[Mono-list] [patch] Environment.cs

2004-07-22 Thread Malcolm Parsons

This patch moves the Hashtable tbl initialisation outside the loop in
ExpandEnvironmentVariables() so that GetEnvironmentVariablesNoCase() is
only called once.

It looks like this is what the author intended.

-- 
Malcolm Parsons
Index: Environment.cs
===
RCS file: /mono/mcs/class/corlib/System/Environment.cs,v
retrieving revision 1.79
diff -u -p -r1.79 Environment.cs
--- Environment.cs  22 Jul 2004 08:20:11 -  1.79
+++ Environment.cs  22 Jul 2004 19:55:23 -
@@ -294,8 +294,8 @@ namespace System
PlatformID platform = Platform;
StringBuilder result = new StringBuilder ();
result.Append (name, 0, off1);
+   Hashtable tbl = null;
do {
-   Hashtable tbl = null;
string var = name.Substring (off1 + 1, off2 - off1 - 
1);
string value = GetEnvironmentVariable (var);
if (value == null && (int) platform != 128) {


Re: [Mono-list] [Q] cross-platform paths.

2004-07-23 Thread Malcolm Parsons
On Fri, Jul 23, 2004 at 01:36:45PM -0400, Daniel Carrera wrote:
>  * To specify a full path I need to identify the OS.  Something like:
>if (WINDOWS)
>{
>   path = "C:\\temp\myfile";
>}
>elsif (LINUX || UNIX)
>{
>   path = "/tmp/myfile";
>}

Why not use GetTempPath() or GetTempFileName() from System.IO.Path?

-- 
Malcolm Parsons
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list



Re: [Mono-list] NET_1_1 & Co.

2004-07-24 Thread Malcolm Parsons
On Fri, Jul 23, 2004 at 03:40:12PM +0200, Jochen Wezel wrote:
> While reviewing code, I've seen in System.Environment:
> 
>   #if NET_1_1
>   static
>   #endif
> 
> I would write
> 
>   #if not NET_1_0
> 
> since I expect that in 2.x this "static" won't change. But if I reason correctly, 
> this "static" item would get "unstatic" with this current grammar in DotNet 2.x.
> 

In mcs/class/README it says:

* Supporting .NET 1.2, .NET 1.1 and .NET 1.0 builds

The defines NET_1_1 and NET_2_0 are used to include
features.   When NET_2_0 is defined, it also implies that the
NET_1_1 is defined.

To have code which is only available in an old version, use ONLY_1_0,
ONLY_1_1


The code you quoted is therefore correct.

-- 
Malcolm Parsons
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] typeof and sizeof pointer types

2004-07-26 Thread Malcolm Parsons
On Sun, Jul 25, 2004 at 08:14:20PM +, Alan Jenkins wrote:
> typeof (float) == typeof (float*)
> sizeof (float) == sizeof (float*)
> 
> Is this really the correct behaviour?  I can see there are problems with 
> unique types for pointers, because there is an infinite number - float, 
> float*, float**, etc - but I would have thought it would be important to get 
> sizeof right.

sizeof is correct.

both a float and a pointer to a float use 4 bytes ( on a 32 bit cpu ).

typeof is incorrect.

typeof( float) is System.Single
typeof( float *  ) should be System.Single*, but isn't in mono.
typeof( float [] ) is System.Single[]

-- 
Malcolm Parsons
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] directory path separator

2004-09-16 Thread Malcolm Parsons
On Thu, 16 Sep 2004 07:50:56 -0600, Kevin White <[EMAIL PROTECTED]> wrote:

> I'd like my code to be portable between windows and linux using .Net
> and mono.I take one of the "special" folders from
> Environment.GetFolder(), and append some directory structure to that
> to do some work.  How do I know what folder separator to use?

System.IO.Path.DirectorySeparatorChar

-- 
Malcolm Parsons
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] ToTitleCase

2004-10-14 Thread Malcolm Parsons
On Thu, 14 Oct 2004 16:56:46 +1300, Rob Brown-Bayliss
<[EMAIL PROTECTED]> wrote:

> Here is the code I am using, is this a bug in the mono implementation or the
> correct behaviour and a bug in my understanding?

It's a bug in mono.

-- 
Malcolm Parsons
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list