Bill Pringlemeir wrote:

>> [props.c 1.39: line 1394] 
>> - while ((c = (guchar) *s) != '\0' && isascii(c) && isblank(c)) 
>> + while ((c = (guchar) *s) != '\0' && isblank(c)) 
>>         s++;

>> If c is "blank", it is also ascii?  Isn't that right?  I don't
>> think there are UTF type blanks.
 
On Mon, 24 May 2004, [EMAIL PROTECTED] wrote:

> Actually, I don't know whether there are additional UTF blanks. I
> thought there might be. However, the "problem" is that I'm not
> really sure which locale is effective when the code is
> executed. There should be only two acceptable encodings for the
> configuration file UTF-8 or ASCII, IMO. The original code considered
> only certain ASCII blanks, I didn't want to expand this set
> arbitrarily.

Everything looks ok when it is explained.  Maybe if anyone revisits
the file they could consider,

   void prop_load_from_file(
           prop_set_t *ps, const gchar *dir, const gchar *filename)
...
       char * saved_local = setlocale(LC_CTYPE, NULL);
       setlocale(LC_CTYPE,"C");

       /* Parse the file.... */
...

       setlocale(LC_CTYPE, saved_local);

       /* Set the property */

I have no experience with "setlocale()"; maybe it takes a long time to
execute?

The man page for "isblank()" seems to say that only space and tab is
checked.  Of course, it doesn't say what a space or tab is.  In
Unicode, there are half-space characters.  These might exist in a
shift-JIS or GB type locale.

Pre-scanning the string for 7-bit only before parsing might also look
a little cleaner.  But this would be slower.

Maybe a macro incorporating "isascii()" would help.  It looks like
"isascii()" was just used with all "isXXXX()" functions to prevent any
sort of locale mischief; but it is a little confusing if you didn't
write it.  Although I think the "isXXXX()" are a step forward.

Regards,
Bill Pringlemeir.



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Gtk-gnutella-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to