[Mono-dev] [Mono-patches] r153961 - trunk/mono/mono/metadata

Andreas Färber andreas.faerber at web.de
Sun Mar 21 18:54:16 EDT 2010


Hi Gonzalo,

Am 21.03.2010 um 23:30 schrieb Gonzalo Paniagua Javier:

> I would just #ifdef out the entire case statement so if that  
> protocol is
> used by any program and is not supported, the program will get the
> appropriate exception.

family is assigned the default value of -1. This will happen either way.
The difference is that this way this happens silently, while  
#ifdef'ing out the whole case will jump into the default section and  
print a g_warning about an "unknown" value.

A better option might be to put the #ifdef around the whole case, like  
you suggested, plus add a new #ifndef'ed case above so that the  
g_warning for "unsupported" values is triggered instead.

If you'd like me to do that, I'll gladly cook up a patch!

Andreas

> -Gonzalo
>
> On Sun, 2010-03-21 at 14:55 -0400, Andreas Färber
> (andreas.faerber at web.de) wrote:
>> Author: afaerber
>> Date: 2010-03-21 14:55:50 -0400 (Sun, 21 Mar 2010)
>> New Revision: 153961
>>
>> Modified:
>>   trunk/mono/mono/metadata/ChangeLog
>>   trunk/mono/mono/metadata/socket-io.c
>> Log:
>> Handle absence of socket constants
>>
>> AF_SNA, AF_DECnet and SOCK_RDM are not part of POSIX, and Haiku  
>> does not
>> supply them.
>> Check for their presence before using them, as already done for  
>> AF_IPX.
>>
>> 2010-03-21  Andreas Faerber  <andreas.faerber at web.de>
>>
>> 	* socket-io.c: Don't depend on AF_SNA, AF_DECnet,
>> 	SOCK_RDM.
>>
>> This commit is licensed under the MIT X11 license.
>>
>> Modified: trunk/mono/mono/metadata/ChangeLog
>> ===================================================================
>> --- trunk/mono/mono/metadata/ChangeLog	2010-03-21 18:06:56 UTC (rev  
>> 153960)
>> +++ trunk/mono/mono/metadata/ChangeLog	2010-03-21 18:55:50 UTC (rev  
>> 153961)
>> @@ -1,3 +1,10 @@
>> +2010-03-21  Andreas Färber  <andreas.faerber at web.de>
>> +
>> +	* socket-io.c: Don't depend on AF_SNA, AF_DECnet,
>> +	SOCK_RDM.
>> +	
>> +	Code is contributed under MIT/X11 license.
>> +
>> 2010-03-20  Sanjoy Das <sanjoy at playingwithpointers.com>
>>
>> 	* sgen-gc.c (mono_gc_get_write_barrier): Handle non-aligned
>>
>> Modified: trunk/mono/mono/metadata/socket-io.c
>> ===================================================================
>> --- trunk/mono/mono/metadata/socket-io.c	2010-03-21 18:06:56 UTC  
>> (rev 153960)
>> +++ trunk/mono/mono/metadata/socket-io.c	2010-03-21 18:55:50 UTC  
>> (rev 153961)
>> @@ -141,11 +141,15 @@
>> 		break;
>> 		
>> 	case AddressFamily_Sna:
>> +#ifdef AF_SNA
>> 		family=AF_SNA;
>> +#endif
>> 		break;
>> 		
>> 	case AddressFamily_DecNet:
>> +#ifdef AF_DECnet
>> 		family=AF_DECnet;
>> +#endif
>> 		break;
>> 		
>> 	case AddressFamily_AppleTalk:
>> @@ -192,13 +196,17 @@
>> 		break;
>> #endif
>> 		
>> +#ifdef AF_SNA
>> 	case AF_SNA:
>> 		family=AddressFamily_Sna;
>> 		break;
>> +#endif
>> 		
>> +#ifdef AF_DECnet
>> 	case AF_DECnet:
>> 		family=AddressFamily_DecNet;
>> 		break;
>> +#endif
>> 		
>> 	case AF_APPLETALK:
>> 		family=AddressFamily_AppleTalk;
>> @@ -240,7 +248,9 @@
>> 		break;
>>
>> 	case SocketType_Rdm:
>> +#ifdef SOCK_RDM
>> 		type=SOCK_RDM;
>> +#endif
>> 		break;
>>
>> 	case SocketType_Seqpacket:
>>
>> _______________________________________________
>> Mono-patches maillist  -  Mono-patches at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-patches
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list