diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-29 21:34:40 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-29 21:34:40 +0000 |
commit | 33d765917eabeb4b664c1b0681d52185920def72 (patch) | |
tree | 2c9e2a65aca18a034daada72599fc6531adae7e1 /protocols/Gadu-Gadu/src/gg_proto.cpp | |
parent | a66281d8453edde56145e032e8d38db91580ba08 (diff) |
no more mir_strncat in GG
git-svn-id: http://svn.miranda-ng.org/main/trunk@13901 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/gg_proto.cpp')
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 979b77de51..a61ec36c60 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -303,10 +303,6 @@ HANDLE GGPROTO::SearchBasic(const PROTOCHAR *id) HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName, const PROTOCHAR *lastName)
{
- gg_pubdir50_t req;
- unsigned long crc;
- char data[512] = "\0";
-
// Check if connected and if there's a search data
if (!isonline())
return 0;
@@ -314,8 +310,8 @@ HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName, if (!nick && !firstName && !lastName)
return 0;
- if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)))
- {
+ gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH);
+ if (req == NULL) {
#ifdef DEBUGMODE
debugLogA("SearchByName(): ForkThread 12 GGPROTO::searchthread");
#endif
@@ -324,33 +320,33 @@ HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName, }
// Add nick,firstName,lastName and search it
+ CMStringA szQuery;
if (nick)
{
T2Utf nick_utf8(nick);
gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nick_utf8);
- mir_strncat(data, nick_utf8, sizeof(data) - mir_strlen(data));
+ szQuery.Append(nick_utf8);
}
- mir_strncat(data, ".", sizeof(data) - mir_strlen(data));
+ szQuery.AppendChar('.');
if (firstName)
{
T2Utf firstName_utf8(firstName);
gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8);
- mir_strncat(data, firstName_utf8, sizeof(data) - mir_strlen(data));
+ szQuery.Append(firstName_utf8);
}
- mir_strncat(data, ".", sizeof(data) - mir_strlen(data));
+ szQuery.AppendChar('.');
if (lastName)
{
T2Utf lastName_utf8(lastName);
gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8);
- mir_strncat(data, lastName_utf8, sizeof(data) - mir_strlen(data));
+ szQuery.Append(lastName_utf8);
}
- mir_strncat(data, ".", sizeof(data) - mir_strlen(data));
+ szQuery.AppendChar('.');
// Count crc & check if the data was equal if yes do same search with shift
- crc = crc_get(data);
-
+ unsigned long crc = crc_get(szQuery.GetBuffer());
if (crc == last_crc && next_uin)
gg_pubdir50_add(req, GG_PUBDIR50_START, ditoa(next_uin));
else
|