From 6fcfba2c46a456677b5825a899469ba4e8905448 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 23 May 2015 17:49:58 +0000 Subject: replace strncpy to mir_strncpy git-svn-id: http://svn.miranda-ng.org/main/trunk@13785 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tlen/src/tlen.cpp | 2 +- protocols/Tlen/src/tlen_file.cpp | 2 +- protocols/Tlen/src/tlen_p2p_old.cpp | 6 +++--- protocols/Tlen/src/tlen_svc.cpp | 2 +- protocols/Tlen/src/tlen_thread.cpp | 14 +++++++------- protocols/Tlen/src/tlen_util.cpp | 6 +++--- protocols/Tlen/src/tlen_voice.cpp | 4 ++-- protocols/Tlen/src/tlen_xml.cpp | 20 ++++++++++---------- 8 files changed, 28 insertions(+), 28 deletions(-) (limited to 'protocols/Tlen') diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index e87fcac01d..e82ddbc75f 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -214,7 +214,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) if (end == NULL) { end = resp->headers[i].szValue + mir_strlen(resp->headers[i].szValue); } - strncpy(cookie, start, (end - start)); + mir_strncpy(cookie, start, (end - start)); break; } } diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 71ad60185f..fb58de29c0 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -578,7 +578,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) if (numFiles == 1) { if ((p=TlenXmlGetAttrValue(node, "n")) != NULL) { p = TlenTextDecode(p); - strncpy(szFilename, p, sizeof(szFilename)-1); + mir_strncpy(szFilename, p, sizeof(szFilename)-1); mir_free(p); } else { mir_strcpy(szFilename, Translate("1 File")); diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index cb72d33849..51499497f3 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -334,7 +334,7 @@ static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) return NULL; } in.S_un.S_addr = *(PDWORD)(buf+4); - strncpy(sb->szHost, inet_ntoa(in), sizeof(sb->szHost)-1); + mir_strncpy(sb->szHost, inet_ntoa(in), sizeof(sb->szHost)-1); sb->wPort = htons(*(PWORD)(buf+2)); ft->s = s; forkthread((void (__cdecl *)(void*))TlenFileBindSocks4Thread, 0, ft); @@ -463,11 +463,11 @@ HANDLE TlenP2PListen(TLEN_FILE_TRANSFER *ft) if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) { sb.useAuth = TRUE; if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) { - strncpy(sb.szUser, dbv.pszVal, sizeof(sb.szUser)-1); + mir_strncpy(sb.szUser, dbv.pszVal, sizeof(sb.szUser)-1); db_free(&dbv); } if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) { - strncpy(sb.szPassword, dbv.pszVal, sizeof(sb.szPassword)-1); + mir_strncpy(sb.szPassword, dbv.pszVal, sizeof(sb.szPassword)-1); db_free(&dbv); } } diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 705b4ca150..487302c7fd 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -55,7 +55,7 @@ DWORD_PTR TlenProtocol::GetCaps(int type, MCONTACT hContact) INT_PTR TlenProtocol::GetName(WPARAM wParam, LPARAM lParam) { - strncpy((char*)lParam, m_szModuleName, wParam); + mir_strncpy((char*)lParam, m_szModuleName, wParam); return 0; } diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index f614b0a323..c8aef49d25 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -130,7 +130,7 @@ void __cdecl TlenServerThread(ThreadData *info) DBVARIANT dbv; if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) { - strncpy(info->username, dbv.pszVal, sizeof(info->username)); + mir_strncpy(info->username, dbv.pszVal, sizeof(info->username)); info->username[sizeof(info->username)-1] = '\0'; _strlwr(info->username); db_set_s(NULL, info->proto->m_szModuleName, "LoginName", info->username); @@ -143,7 +143,7 @@ void __cdecl TlenServerThread(ThreadData *info) if (loginErr == 0) { if (!db_get(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) { - strncpy(info->server, dbv.pszVal, sizeof(info->server)); + mir_strncpy(info->server, dbv.pszVal, sizeof(info->server)); info->server[sizeof(info->server)-1] = '\0'; _strlwr(info->server); db_set_s(NULL, info->proto->m_szModuleName, "LoginServer", info->server); @@ -168,7 +168,7 @@ void __cdecl TlenServerThread(ThreadData *info) CloseHandle(hEventPasswdDlg); if (onlinePassword[0] != (char) -1) { - strncpy(info->password, onlinePassword, sizeof(info->password)); + mir_strncpy(info->password, onlinePassword, sizeof(info->password)); info->password[sizeof(info->password)-1] = '\0'; } else { @@ -178,7 +178,7 @@ void __cdecl TlenServerThread(ThreadData *info) } else { if (!db_get(NULL, info->proto->m_szModuleName, "Password", &dbv)) { - strncpy(info->password, dbv.pszVal, sizeof(info->password)); + mir_strncpy(info->password, dbv.pszVal, sizeof(info->password)); info->password[sizeof(info->password)-1] = '\0'; db_free(&dbv); } @@ -211,7 +211,7 @@ void __cdecl TlenServerThread(ThreadData *info) db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr); if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) { - strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost)); + mir_strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost)); info->manualHost[sizeof(info->manualHost)-1] = '\0'; db_free(&dbv); } @@ -227,7 +227,7 @@ void __cdecl TlenServerThread(ThreadData *info) if (!db_get(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) { - strncpy(info->proto->threadData->avatarHash, dbv.pszVal, sizeof(info->proto->threadData->avatarHash)-1); + mir_strncpy(info->proto->threadData->avatarHash, dbv.pszVal, sizeof(info->proto->threadData->avatarHash)-1); db_free(&dbv); } info->avatarFormat = db_get_dw(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN); @@ -587,7 +587,7 @@ static void TlenProcessAvatar(XmlNode* node, ThreadData *info) XmlNode *aNode = TlenXmlGetChild(node, "a"); if (tokenNode != NULL) { char *token = tokenNode->text; - strncpy(info->avatarToken, token, sizeof(info->avatarToken)-1); + mir_strncpy(info->avatarToken, token, sizeof(info->avatarToken)-1); } if (aNode != NULL) { if (TlenProcessAvatarNode(info->proto, node, NULL)) { diff --git a/protocols/Tlen/src/tlen_util.cpp b/protocols/Tlen/src/tlen_util.cpp index f315a3e177..61bde3433d 100644 --- a/protocols/Tlen/src/tlen_util.cpp +++ b/protocols/Tlen/src/tlen_util.cpp @@ -85,7 +85,7 @@ char *TlenResourceFromJID(const char *jid2) if (p != NULL && p[1] != '\0') { p++; if ((nick=(char *) mir_alloc(1+mir_strlen(jid)-(p-jid))) != NULL) { - strncpy(nick, p, mir_strlen(jid)-(p-jid)); + mir_strncpy(nick, p, mir_strlen(jid)-(p-jid)); nick[mir_strlen(jid)-(p-jid)] = '\0'; } } @@ -107,7 +107,7 @@ char *TlenNickFromJID(const char *jid2) p = strchr(jid, '/'); if (p != NULL) { if ((nick=(char *) mir_alloc((p-jid)+1)) != NULL) { - strncpy(nick, jid, p-jid); + mir_strncpy(nick, jid, p-jid); nick[p-jid] = '\0'; } } @@ -128,7 +128,7 @@ char *TlenLoginFromJID(const char *jid2) p = strchr(jid, '/'); if (p != NULL) { if ((nick=(char *) mir_alloc((p-jid)+1)) != NULL) { - strncpy(nick, jid, p-jid); + mir_strncpy(nick, jid, p-jid); nick[p-jid] = '\0'; } } diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 70bf723c23..1c4149c8ae 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -1016,7 +1016,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) db_free(&dbv); } else { - strncpy(jid, from, SIZEOF(jid) - 1); + mir_strncpy(jid, from, SIZEOF(jid) - 1); } ignore = !IsAuthorized(proto, jid); ask = true; @@ -1029,7 +1029,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) db_free(&dbv); } else { - strncpy(jid, from, SIZEOF(jid) - 1); + mir_strncpy(jid, from, SIZEOF(jid) - 1); } ask = !IsAuthorized(proto, jid); ignore = false; diff --git a/protocols/Tlen/src/tlen_xml.cpp b/protocols/Tlen/src/tlen_xml.cpp index 408df2ab3a..5939c65d58 100644 --- a/protocols/Tlen/src/tlen_xml.cpp +++ b/protocols/Tlen/src/tlen_xml.cpp @@ -126,18 +126,18 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) } else { if (*(p+1) == '/') { // closing tag - strncpy(tag, p+2, r-(p+2)); + mir_strncpy(tag, p+2, r-(p+2)); tag[r-(p+2)] = '\0'; elemType = ELEM_CLOSE; } else { if (*(r-1) == '/') { // single open/close tag - strncpy(tag, p+1, r-(p+1)-1); + mir_strncpy(tag, p+1, r-(p+1)-1); tag[r-(p+1)-1] = '\0'; elemType = ELEM_OPENCLOSE; } else { - strncpy(tag, p+1, r-(p+1)); + mir_strncpy(tag, p+1, r-(p+1)); tag[r-(p+1)] = '\0'; elemType = ELEM_OPEN; } @@ -147,7 +147,7 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) // TlenLog("ATTR_MAX_LEN too small, ignore current tag"); } else { - strncpy(attr, r, q-r); + mir_strncpy(attr, r, q-r); if ((q-r)>0 && attr[q-r-1] == '/') { attr[q-r-1] = '\0'; elemType = ELEM_OPENCLOSE; @@ -171,7 +171,7 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) for (q=p+1; qname = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); break; @@ -228,7 +228,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) if (*p != '=') { a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); continue; @@ -242,7 +242,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) if (*p == '\0') { a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); break; @@ -263,10 +263,10 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) } a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = (char *) mir_alloc(vlen+1); - strncpy(a->value, vstart, vlen); + mir_strncpy(a->value, vstart, vlen); a->value[vlen] = '\0'; } } -- cgit v1.2.3