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/DbEditorPP/src/copymodule.cpp | 2 +- plugins/DbEditorPP/src/exportimport.cpp | 8 ++++---- plugins/DbEditorPP/src/headers.h | 2 +- plugins/DbEditorPP/src/main.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins/DbEditorPP/src') diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 1e580ba6a4..c58d9b8cae 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -127,7 +127,7 @@ void copyModuleMenuItem(char* module, MCONTACT hContact) { ModuleAndContact *mac = (ModuleAndContact *)mir_calloc(sizeof(ModuleAndContact)); mac->hContact = hContact; - strncpy(mac->module, module, 255); + mir_strncpy(mac->module, module, 255); CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_COPY_MOD), 0, copyModDlgProc, (LPARAM)mac); } \ No newline at end of file diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 9c07ce46b7..99877ae7ce 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -314,19 +314,19 @@ void importSettings(MCONTACT hContact, char *importstring) p2 = strrchr(&importstring[i], '}*'); if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szUID)) { - strncpy(szUID, p1 + 1, p2 - p1 - 2); + mir_strncpy(szUID, p1 + 1, p2 - p1 - 2); p1 = strrchr(&importstring[i], ')*<'); p2 = strrchr(&importstring[i], '>*{'); if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(uid)) { - strncpy(uid, p1 + 1, p2 - p1 - 3); + mir_strncpy(uid, p1 + 1, p2 - p1 - 3); p1 = strrchr(&importstring[i], ' *('); p2 = strrchr(&importstring[i], ')*<'); if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szProto)) { - strncpy(szProto, p1 + 1, p2 - p1 - 3); + mir_strncpy(szProto, p1 + 1, p2 - p1 - 3); char *protouid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)protouid != CALLSERVICE_NOTFOUND) { @@ -558,7 +558,7 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) if (!mir_tstrcmp(szFileNames, "") == 0) { if ((DWORD)mir_strlen(szFileNames) < offset) { index += offset; - strncpy(szPath, szFileNames, offset); + mir_strncpy(szPath, szFileNames, offset); mir_strcat(szPath, "\\"); } diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 425f14ec61..17f729c89b 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -76,7 +76,7 @@ extern MCONTACT hRestore; #define WM_FINDITEM (WM_USER + 1) // onyl for the main window, wparam is ItemIfno* lparam is 0 #define mir_strlen(ptr) ((ptr == NULL) ? 0 : (int)mir_strlen(ptr)) -#define mir_strncpy(dst, src, len) strncpy(dst, src, len)[len - 1] = 0; +#define mir_strncpy(dst, src, len) mir_strncpy(dst, src, len)[len - 1] = 0; #define mir_strcmp(ptr1, ptr2) ((ptr1 && ptr2) ? mir_strcmp(ptr1, ptr2) : 1) // (ptr1||ptr2) #define ListView_SetItemTextW(hwndLV, i, iSubItem_, pszText_) \ diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index b8b97cec80..25c8a7e647 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -258,7 +258,7 @@ int DBGetContactSettingStringStatic(MCONTACT hContact, char *szModule, char *szS { DBVARIANT dbv; if (!db_get(hContact, szModule, szSetting, &dbv)) { - strncpy(value, dbv.pszVal, maxLength); + mir_strncpy(value, dbv.pszVal, maxLength); db_free(&dbv); return 1; } @@ -313,7 +313,7 @@ int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, cha if (Value && length >= 10 && !GetSetting(hContact, szModule, szSetting, &dbv)) { switch (dbv.type) { case DBVT_ASCIIZ: - strncpy(Value, dbv.pszVal, length); + mir_strncpy(Value, dbv.pszVal, length); break; case DBVT_DWORD: _itoa(dbv.dVal, Value, 10); @@ -330,7 +330,7 @@ int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, cha WCHAR *wc = (WCHAR *)_alloca(len * sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); WideCharToMultiByte(CP_ACP, 0, wc, -1, sz, len, NULL, NULL); - strncpy(Value, sz, length); + mir_strncpy(Value, sz, length); break; } -- cgit v1.2.3