|
From: Gary K. <gr...@re...> - 2005-01-13 13:16:11
|
On Thu, 2005-01-13 at 13:16 +0000, Zilo wrote: > On 01/13/05 13:50:51, Gary Kramlich wrote: > > On Thu, 2005-01-13 at 12:21 +0000, evew wrote: > > > I found a bug inside bnet_buddy_add() in a wrong use of > > gaim_normalize > > > (): > > > > > > name =3D gaim_normalize(conn->account, buddy->name); > > > > > > Using name for saving our buddy inside the hash table is wrong > > 'cause > > > gaim_normalize() returns a pointer to a own static array... then =20 > > its > >=20 > > > value isn't the same during time :P > > > > > > As a result of this when receiving friends list all buddy are > > > considered new (because not found in conn->buddies) then (re)added > > in > > > the gaim list... resulting in a big increasing of our popolarity in > > a > > > few seconds :) > > > > > > Anyway, I was thinking about the needing of this line... 'cause if > > it's > > > useful, then we can simply g_strdup() name, but we are already =20 > > using > >=20 > > > gaim_utf8_strcasecmp() to compare nicks in the hash table... isn't > > > enough? > > > > > > cya > >=20 > > I thought we were strcmp'n it which would make that legit.. But if > > we're just comparing pointers, than yeah thats going to be a =20 > > problem... >=20 > Uhm... I'm not sure I understand your answer... excuse my english, just =20 > in case :P >=20 > Anyway, we were strcmp'n it... the problem is that the pointer returned =20 > by gaim_normalize() is always the same, and its contents change every =20 > time we call the function. >=20 > I'm not very familiar with gaim code, so I was asking what is the =20 > meaning of using gaim_normalize()... because if we need it only to > strdown our names, well, there's already gaim_utf8_strcasecmp()... >=20 > Well, in others words, I don't know what g_utf8_normalize() is supposed =20 > to do :) >=20 > cya As per the documentation at http://developer.gnome.org/doc/API/2.0/glib/glib-Unicode-Manipulation.html#= g-utf8-normalize Converts a string into canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character. You should generally call g_utf8_normalize() before comparing two Unicode strings. So basically, what I tried to do, but it obviously isn't working, is to store a comparable string in our hash table, so we can test it before adding a new one, and therefore avoid duplicates. --=20 Gary Kramlich <gr...@re...> |