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 --- plugins/SecureIM/src/commonheaders.cpp | 4 ++-- plugins/SecureIM/src/crypt_lists.cpp | 2 +- plugins/SecureIM/src/main.cpp | 8 ++++---- plugins/SecureIM/src/options.cpp | 8 ++++---- plugins/SecureIM/src/svcs_proto.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'plugins/SecureIM/src') diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index eca5257814..6a5044482a 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -28,7 +28,7 @@ LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *s if (!val) return NULL; size_t len = mir_strlen(val) + 64; char *buf = (LPSTR)mir_alloc(len); - strncpy(buf, val, len); mir_free(val); + mir_strncpy(buf, val, len); mir_free(val); return buf; } @@ -36,7 +36,7 @@ int myDBWriteStringEncode(MCONTACT hContact, const char *szModule, const char *s { int len = (int)mir_strlen(val) + 64; char *buf = (LPSTR)alloca(len); - strncpy(buf, val, len); + mir_strncpy(buf, val, len); int ret = db_set_s(hContact, szModule, szSetting, buf); return ret; } diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 28557fd1af..29db82daed 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -30,7 +30,7 @@ void loadSupportedProtocols() SupPro *p = (SupPro*)mir_calloc(sizeof(SupPro)); p->name = mir_strdup(protos[i]->szModuleName); if (szNames && p->name) { - char tmp[128]; strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", SIZEOF(tmp) - mir_strlen(tmp)); + char tmp[128]; mir_strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", SIZEOF(tmp) - mir_strlen(tmp)); LPSTR szName = strstr(szNames, tmp); if (szName) { szName = strchr(szName, ':'); diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 6d3362a52a..a3b37f6819 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -130,11 +130,11 @@ static int onModulesLoaded(WPARAM, LPARAM) else { LPSTR tmp = db_get_sa(0, MODULENAME, "pgpPubRing"); if (tmp) { - strncpy(PubRingPath, tmp, sizeof(PubRingPath)); + mir_strncpy(PubRingPath, tmp, sizeof(PubRingPath)); mir_free(tmp); } if (tmp = db_get_sa(0, MODULENAME, "pgpSecRing")) { - strncpy(SecRingPath, tmp, sizeof(SecRingPath)); + mir_strncpy(SecRingPath, tmp, sizeof(SecRingPath)); mir_free(tmp); } if (PubRingPath[0] && SecRingPath[0]) { @@ -163,11 +163,11 @@ static int onModulesLoaded(WPARAM, LPARAM) LPSTR tmp = db_get_sa(0, MODULENAME, "gpgExec"); if (tmp) { - strncpy(gpgexec, tmp, sizeof(gpgexec)-1); + mir_strncpy(gpgexec, tmp, sizeof(gpgexec)-1); mir_free(tmp); } if (tmp = db_get_sa(0, MODULENAME, "gpgHome")) { - strncpy(gpghome, tmp, sizeof(gpghome)-1); + mir_strncpy(gpghome, tmp, sizeof(gpghome)-1); mir_free(tmp); } diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 157ac96f8d..5f95f66817 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1400,14 +1400,14 @@ void setListViewIcon(HWND hLV, UINT iItem, pUinKey ptr) void setListViewMode(HWND hLV, UINT iItem, UINT iMode) { char tmp[256]; - strncpy(tmp, Translate(sim231[iMode]), sizeof(tmp)-1); + mir_strncpy(tmp, Translate(sim231[iMode]), sizeof(tmp)-1); LV_SetItemTextA(hLV, iItem, 2, tmp); } void setListViewStatus(HWND hLV, UINT iItem, UINT iStatus) { char tmp[128]; - strncpy(tmp, Translate(sim232[iStatus]), sizeof(tmp)-1); + mir_strncpy(tmp, Translate(sim232[iStatus]), sizeof(tmp)-1); LV_SetItemTextA(hLV, iItem, 3, tmp); } @@ -1421,7 +1421,7 @@ UINT getListViewPSK(HWND hLV, UINT iItem) void setListViewPSK(HWND hLV, UINT iItem, UINT iStatus) { char str[128]; - strncpy(str, (iStatus) ? Translate(sim206) : "-", sizeof(str)-1); + mir_strncpy(str, (iStatus) ? Translate(sim206) : "-", sizeof(str)-1); LV_SetItemTextA(hLV, iItem, 4, str); } @@ -1435,7 +1435,7 @@ UINT getListViewPUB(HWND hLV, UINT iItem) void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) { char str[128]; - strncpy(str, (iStatus) ? Translate(sim233) : "-", sizeof(str)-1); + mir_strncpy(str, (iStatus) ? Translate(sim233) : "-", sizeof(str)-1); LV_SetItemTextA(hLV, iItem, 4, str); LPSTR sha = NULL; diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index e254f7b81e..bdfe43dfcd 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -865,7 +865,7 @@ int __cdecl onProtoAck(WPARAM wParam, LPARAM lParam) LPSTR p = strrchr(file_out, '.'); LPSTR x = strrchr(file_out, '\\'); if (p > x) { - strncpy(buf, p, sizeof(buf)-1); + mir_strncpy(buf, p, sizeof(buf)-1); pos = p; } for (int i = 1; i < 10000; i++) { -- cgit v1.2.3