|
From: evew <ko...@gm...> - 2005-01-13 12:15:13
|
I found a bug inside bnet_buddy_add() in a wrong use of gaim_normalize=20 (): name =3D gaim_normalize(conn->account, buddy->name); Using name for saving our buddy inside the hash table is wrong 'cause =20 gaim_normalize() returns a pointer to a own static array... then its =20 value isn't the same during time :P As a result of this when receiving friends list all buddy are =20 considered new (because not found in conn->buddies) then (re)added in =20 the gaim list... resulting in a big increasing of our popolarity in a =20 few seconds :) Anyway, I was thinking about the needing of this line... 'cause if it's =20 useful, then we can simply g_strdup() name, but we are already using =20 gaim_utf8_strcasecmp() to compare nicks in the hash table... isn't =20 enough? cya |
|
From: Gary K. <gr...@re...> - 2005-01-13 12:49:24
|
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=20 > (): >=20 > name =3D gaim_normalize(conn->account, buddy->name); >=20 > Using name for saving our buddy inside the hash table is wrong 'cause =20 > gaim_normalize() returns a pointer to a own static array... then its =20 > value isn't the same during time :P >=20 > As a result of this when receiving friends list all buddy are =20 > considered new (because not found in conn->buddies) then (re)added in =20 > the gaim list... resulting in a big increasing of our popolarity in a =20 > few seconds :) >=20 > Anyway, I was thinking about the needing of this line... 'cause if it's =20 > useful, then we can simply g_strdup() name, but we are already using =20 > gaim_utf8_strcasecmp() to compare nicks in the hash table... isn't =20 > enough? >=20 > cya 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 problem... --=20 Gary Kramlich <gr...@re...> |
|
From: Zilo <ko...@gm...> - 2005-01-13 13:10:36
|
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... Uhm... I'm not sure I understand your answer... excuse my english, just =20 in case :P 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. 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()... Well, in others words, I don't know what g_utf8_normalize() is supposed =20 to do :) cya |
|
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...> |
|
From: Zilo <ko...@gm...> - 2005-01-13 14:45:18
|
On 01/13/05 14:17:27, Gary Kramlich wrote: > As per the documentation at > http://developer.gnome.org/doc/API/2.0/glib/glib-Unicode-Manipulation.htm= l#g-utf8-normalize >=20 > 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. >=20 > 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 =20 > before adding a new one, and therefore avoid duplicates. Well, I think that lowering case should be enough, anyway I posted a =20 fix to use gaim_normalize() too :P cya |