From 5a17c9299e03bebf46169927abdeee34aaf8e854 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 22 May 2015 10:06:32 +0000 Subject: replace strlen to mir_strlen git-svn-id: http://svn.miranda-ng.org/main/trunk@13747 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/addeditsettingsdlg.cpp | 8 ++++---- plugins/DbEditorPP/src/exportimport.cpp | 12 ++++++------ plugins/DbEditorPP/src/findwindow.cpp | 6 +++--- plugins/DbEditorPP/src/headers.h | 2 +- plugins/DbEditorPP/src/main.cpp | 8 ++++---- plugins/DbEditorPP/src/settinglist.cpp | 2 +- plugins/DbEditorPP/src/watchedvars.cpp | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) (limited to 'plugins/DbEditorPP') diff --git a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp index f17a97b740..5eff743b33 100644 --- a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp +++ b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp @@ -52,12 +52,12 @@ BOOL convertSetting(MCONTACT hContact, char* module, char* setting, int toType) case DBVT_ASCIIZ: if (toType == 4) // convert to UNICODE { - int len = (int)strlen(dbv.pszVal) + 1; + int len = (int)mir_strlen(dbv.pszVal) + 1; WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, wc, len); Result = !db_set_ws(hContact, module, setting, wc); } - else if (strlen(dbv.pszVal) < 11 && toType != 3) { + else if (mir_strlen(dbv.pszVal) < 11 && toType != 3) { int val = atoi(dbv.pszVal); if (val == 0 && dbv.pszVal[0] != '0') break; @@ -68,7 +68,7 @@ BOOL convertSetting(MCONTACT hContact, char* module, char* setting, int toType) case DBVT_UTF8: if (toType == 3) { // convert to ANSI - int len = (int)strlen(dbv.pszVal) + 1; + int len = (int)mir_strlen(dbv.pszVal) + 1; char *sz = (char*)_alloca(len * 3); WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); @@ -199,7 +199,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l else { char *tmp = (((struct DBsetting*)lParam)->dbv.pszVal); - int length = (int)strlen(tmp) + 1; + int length = (int)mir_strlen(tmp) + 1; WCHAR *wc = (WCHAR*)_alloca(length*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, tmp, -1, wc, length); SetDlgItemTextW(hwnd, IDC_STRING, wc); diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 3537a3a04e..7f594a4eb5 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -295,16 +295,16 @@ void importSettings(MCONTACT hContact, char *importstring) continue; } - if (!strncmp(&importstring[i], "SETTINGS:", strlen("SETTINGS:"))) { + if (!strncmp(&importstring[i], "SETTINGS:", mir_strlen("SETTINGS:"))) { importstring = strtok(NULL, "\n"); continue; } - if (!strncmp(&importstring[i], "CONTACT:", strlen("CONTACT:"))) { + if (!strncmp(&importstring[i], "CONTACT:", mir_strlen("CONTACT:"))) { hContact = INVALID_CONTACT_ID; - i = i + (int)strlen("CONTACT:"); - int len = (int)strlen(&importstring[i]); + i = i + (int)mir_strlen("CONTACT:"); + int len = (int)mir_strlen(&importstring[i]); if (len > 10) { char uid[256] = "", szUID[256] = "", szProto[512] = ""; @@ -424,7 +424,7 @@ void importSettings(MCONTACT hContact, char *importstring) break; case 'n': case 'N': - WriteBlobFromString(hContact, module, setting, (end + 2), (int)strlen((end + 2))); + WriteBlobFromString(hContact, module, setting, (end + 2), (int)mir_strlen((end + 2))); break; } } @@ -565,7 +565,7 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) while (szFileNames[index]) { strcpy(szFile, szPath); strcat(szFile, &szFileNames[index]); - index += (int)strlen(&szFileNames[index]) + 1; + index += (int)mir_strlen(&szFileNames[index]) + 1; HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hFile != INVALID_HANDLE_VALUE) { diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index d49c185cc8..0762aeec5b 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -234,8 +234,8 @@ char* multiReplace(const char* value, const char *find, const char *replace, int { char *head, *temp, *string; - int len = (int)strlen(find); - int replen = (int)strlen(replace); + int len = (int)mir_strlen(find); + int replen = (int)mir_strlen(replace); // only should be 1 '=' sign there... if (head = (char*)(cs ? strstr(value, find) : StrStrI(value, find))) { @@ -244,7 +244,7 @@ char* multiReplace(const char* value, const char *find, const char *replace, int temp[0] = '\0'; while (head) { - temp = (char*)mir_realloc(temp, strlen(temp) + strlen(string) + replen + 1); + temp = (char*)mir_realloc(temp, mir_strlen(temp) + mir_strlen(string) + replen + 1); if (!temp) mir_tstrdup(value); strncat(temp, string, (head - string)); diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 4e428e0940..6501ff5165 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -75,7 +75,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)strlen(ptr)) +#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_strcmp(ptr1, ptr2) ((ptr1 && ptr2) ? strcmp(ptr1, ptr2) : 1) // (ptr1||ptr2) diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 0d0902f896..78c640a78e 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -325,7 +325,7 @@ int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, cha _itoa(dbv.wVal, Value, 10); break; case DBVT_UTF8: - int len = (int)strlen(dbv.pszVal) + 1; + int len = (int)mir_strlen(dbv.pszVal) + 1; char *sz = (char *)_alloca(len * 3); WCHAR *wc = (WCHAR *)_alloca(len * sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); @@ -355,14 +355,14 @@ int GetValueW(MCONTACT hContact, const char *szModule, const char *szSetting, WC if (Value && length >= 10 && !GetSetting(hContact, szModule, szSetting, &dbv)) { switch (dbv.type) { case DBVT_UTF8: - len = (int)strlen(dbv.pszVal) + 1; + len = (int)mir_strlen(dbv.pszVal) + 1; wc = (WCHAR *)_alloca(length * sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); wcsncpy((WCHAR *)Value, wc, length); break; case DBVT_ASCIIZ: - len = (int)strlen(dbv.pszVal) + 1; + len = (int)mir_strlen(dbv.pszVal) + 1; wc = (WCHAR *)_alloca(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, wc, len); wcsncpy((WCHAR *)Value, wc, length); @@ -478,7 +478,7 @@ WCHAR* GetContactName(MCONTACT hContact, const char *szProto, int unicode) if (unicode) len = (int)wcslen(res); else - len = (int)strlen((char *)res); + len = (int)mir_strlen((char *)res); } else res[0] = 0; diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index ff49c2eb1e..f9f96e426a 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -185,7 +185,7 @@ void additem(HWND hwnd2Settings, MCONTACT hContact, char* module, char* setting, lvi.iImage = 5; ListView_SetItem(hwnd2Settings, &lvi); - int length = (int)strlen(dbv.pszVal) + 1; + int length = (int)mir_strlen(dbv.pszVal) + 1; WCHAR *wc = (WCHAR*)_alloca(length*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, length); ListView_SetItemTextW(hwnd2Settings, index, 1, wc); diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index d5a6ce476a..edcf5f4a30 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -125,7 +125,7 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam) break; case DBVT_UTF8: - int length = (int)strlen(dbv->pszVal) + 1; + int length = (int)mir_strlen(dbv->pszVal) + 1; WCHAR *wc = (WCHAR*)_alloca(length*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv->pszVal, -1, wc, length); ListView_SetItemTextW(hwnd2list, index, 4, wc); -- cgit v1.2.3