Re: [gtkmm] Glib::ustring problems



Am Son, 2002-10-13 um 16.11 schrieb Daniel Elstner:
> Am Son, 2002-10-13 um 16.04 schrieb Daniel Elstner:
> > Am Son, 2002-10-13 um 08.51 schrieb Tapan S. Parikh:
> > > 
> > > cout << t.c_str() << endl
> > > cout << t << endl;
> > 
> > This one I don't fully understand.  If there's really no semicolon after
> > the 1st endl, you're outputting a pointer to the stream...
> 
> Ooops no, that would require another << as well.  So I guess it's just a
> typo.  Hmm, that's really weird then -- the 2nd line does work?

Wait, I suddenly remembered a change in GLib I recently stumbled over
while studying the ChangeLog:

Tue Aug 20 16:01:03 2002  HideToshi Tajima  <hidetoshi tajima sun com>

	* glib/gconvert.c (strdup_len): validate 'len' argument properly
	for the case that input string is not null-terminated. (#91222)

That would explain why a) the weird c_str() + normal output combination
works: c_str() appends the '\0' termination character.  And b) why it
works if the locale charset isn't UTF-8: strdup_len() is only called if
no conversion is necessary (it just copies and validates the input).

So I'm pretty sure this is your problem.  Grab GLib (branch glib-2-0)
from CVS or wait for the next release.  They already bumped the version
number to 2.0.7 in CVS, so it can't be too far off.

Cheers,
--Daniel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]