On Wed, 2006-02-22 at 07:59, Christian Neumair wrote:
> Am Mittwoch, den 22.02.2006, 07:09 -0800 schrieb Alan M. Evans:
> > On Tue, 2006-02-21 at 16:25, Tor Lillqvist wrote:
> > >  > Also, I don't think the string returned from g_utf8_casefold() is
> > >  > guaranteed to be the same length as the original, so my calculation
> > >  > for string length is incorrect.
> > > 
> > > Umm, no? You look at the casefolded string and calculate the length of
> > > the part up to the '.' of that?
> > 
> > Yes, that's what I'm doing. No, I don't think it's correct.
> 
> You can perfectly do pointer arithmetic with UTF-8 encoded strings.

I don't have a problem with pointer arithmetic. My problem is that I'm
doing arithmetic on one string (the case-folded version) and applying
that math to another string (the original version). This can only be
correct if the two strings are the same length in bytes. I don't believe
that's a sure thing with UTF-8.

> For the sake of readability, I'd rather use the following code:
> 
> char **str;
> 
> /* str[0]: basename
>    str[1]: extension */
> str = g_strsplit (filename, ".", 2);
> 
> g_strfreev(str)

Surely that won't work if there is more than one dot in the name!


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to