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/SecureIM/src/commonheaders.cpp | 4 ++-- plugins/SecureIM/src/crypt_dll.cpp | 10 +++++----- plugins/SecureIM/src/dbevent.cpp | 2 +- plugins/SecureIM/src/main.cpp | 2 +- plugins/SecureIM/src/mmi.cpp | 12 ++++++------ plugins/SecureIM/src/options.cpp | 10 +++++----- plugins/SecureIM/src/splitmsg.cpp | 10 +++++----- plugins/SecureIM/src/svcs_proto.cpp | 6 +++--- plugins/SecureIM/src/svcs_rsa.cpp | 2 +- 9 files changed, 29 insertions(+), 29 deletions(-) (limited to 'plugins/SecureIM/src') diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index da32c4b8d6..eca5257814 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -26,7 +26,7 @@ LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *s { char *val = db_get_sa(hContact, szModule, szSetting); if (!val) return NULL; - size_t len = strlen(val) + 64; + size_t len = mir_strlen(val) + 64; char *buf = (LPSTR)mir_alloc(len); strncpy(buf, val, len); mir_free(val); return buf; @@ -34,7 +34,7 @@ LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *s int myDBWriteStringEncode(MCONTACT hContact, const char *szModule, const char *szSetting, const char *val) { - int len = (int)strlen(val) + 64; + int len = (int)mir_strlen(val) + 64; char *buf = (LPSTR)alloca(len); strncpy(buf, val, len); int ret = db_set_s(hContact, szModule, szSetting, buf); diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index a40b6c4974..162b6090ab 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -28,8 +28,8 @@ LPSTR InitKeyA(pUinKey ptr, int features) else keysig = (LPSTR)SIG_KEY3; - int slen = (int)strlen(keysig); - int tlen = (int)strlen(pub_text); + int slen = (int)mir_strlen(keysig); + int tlen = (int)mir_strlen(pub_text); LPSTR keyToSend = (LPSTR)mir_alloc(slen + tlen + 1); @@ -106,8 +106,8 @@ LPSTR encrypt(pUinKey ptr, LPCSTR szEncMsg) { LPSTR szSig = (LPSTR)(ptr->offlineKey ? SIG_ENOF : SIG_ENON); - int slen = (int)strlen(szSig); - int clen = (int)strlen(szEncMsg); + int slen = (int)mir_strlen(szSig); + int clen = (int)mir_strlen(szEncMsg); LPSTR szMsg = (LPSTR)mir_alloc(clen + slen + 1); memcpy(szMsg, szSig, slen); @@ -151,7 +151,7 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) } else { ptr->decoded = true; - int olen = (int)strlen(szOldMsg) + 1; + int olen = (int)mir_strlen(szOldMsg) + 1; szNewMsg = (LPSTR)mir_alloc(olen); memcpy(szNewMsg, szOldMsg, olen); } diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp index ae51a29c6a..1d561307e4 100644 --- a/plugins/SecureIM/src/dbevent.cpp +++ b/plugins/SecureIM/src/dbevent.cpp @@ -7,7 +7,7 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText) dbei.flags = DBEF_SENT | DBEF_READ; dbei.timestamp = time(NULL); dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (int)strlen(szText) + 1; + dbei.cbBlob = (int)mir_strlen(szText) + 1; dbei.pBlob = (PBYTE)szText; db_event_add(0, &dbei); } diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 470ffa12de..6d3362a52a 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -311,7 +311,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) char temp[MAX_PATH]; GetTempPath(sizeof(temp), temp); GetLongPathName(temp, TEMP, sizeof(TEMP)); - TEMP_SIZE = (int)strlen(TEMP); + TEMP_SIZE = (int)mir_strlen(TEMP); if (TEMP[TEMP_SIZE - 1] == '\\') { TEMP_SIZE--; TEMP[TEMP_SIZE] = '\0'; diff --git a/plugins/SecureIM/src/mmi.cpp b/plugins/SecureIM/src/mmi.cpp index e75a076472..90b44148ed 100644 --- a/plugins/SecureIM/src/mmi.cpp +++ b/plugins/SecureIM/src/mmi.cpp @@ -23,8 +23,8 @@ void operator delete[](void *p) // ANSIzUCS2z + ANSIzUCS2z = ANSIzUCS2z char* m_wwstrcat(LPCSTR strA, LPCSTR strB) { - int lenA = (int)strlen(strA); - int lenB = (int)strlen(strB); + int lenA = (int)mir_strlen(strA); + int lenB = (int)mir_strlen(strB); LPSTR str = (LPSTR)mir_alloc((lenA + lenB + 1)*(sizeof(WCHAR) + 1)); memcpy(str, strA, lenA); memcpy(str + lenA, strB, lenB + 1); @@ -36,7 +36,7 @@ char* m_wwstrcat(LPCSTR strA, LPCSTR strB) // ANSIz + ANSIzUCS2z = ANSIzUCS2z char* m_awstrcat(LPCSTR strA, LPCSTR strB) { - int lenA = (int)strlen(strA); + int lenA = (int)mir_strlen(strA); LPSTR tmpA = (LPSTR)mir_alloc((lenA + 1)*(sizeof(WCHAR) + 1)); strcpy(tmpA, strA); MultiByteToWideChar(CP_ACP, 0, strA, -1, (LPWSTR)(tmpA + lenA + 1), (lenA + 1)*sizeof(WCHAR)); @@ -48,8 +48,8 @@ char* m_awstrcat(LPCSTR strA, LPCSTR strB) // ANSIz + ANSIz = ANSIzUCS2z char* m_aastrcat(LPCSTR strA, LPCSTR strB) { - int lenA = (int)strlen(strA); - int lenB = (int)strlen(strB); + int lenA = (int)mir_strlen(strA); + int lenB = (int)mir_strlen(strB); LPSTR str = (LPSTR)mir_alloc((lenA + lenB + 1)*(sizeof(WCHAR) + 1)); strcpy(str, strA); strcat(str, strB); @@ -63,7 +63,7 @@ LPSTR m_string = NULL; char* m_ustrcat(LPCSTR strA, LPCSTR strB) { SAFE_FREE(m_string); - m_string = (LPSTR)mir_alloc(strlen(strA) + strlen(strB) + 1); + m_string = (LPSTR)mir_alloc(mir_strlen(strA) + mir_strlen(strB) + 1); strcpy(m_string, strA); strcat(m_string, strB); return m_string; } diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 8e98b92d8b..9db60844c2 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1606,14 +1606,14 @@ LPSTR LoadKeys(LPCSTR file, BOOL priv) LPSTR keys = (LPSTR)mir_alloc(flen + 1); int i = 0; BOOL b = false; while (fgets(keys + i, 128, f)) { - if (!b && strncmp(keys + i, beg, strlen(beg)) == 0) + if (!b && strncmp(keys + i, beg, mir_strlen(beg)) == 0) b = true; - else if (b && strncmp(keys + i, end, strlen(end)) == 0) { - i += (int)strlen(keys + i); + else if (b && strncmp(keys + i, end, mir_strlen(end)) == 0) { + i += (int)mir_strlen(keys + i); b = false; } if (b) - i += (int)strlen(keys + i); + i += (int)mir_strlen(keys + i); } *(keys + i) = '\0'; fclose(f); @@ -1642,7 +1642,7 @@ BOOL SaveExportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv) FILE *f = _tfopen(szFile, _T("wb")); if (!f) return FALSE; - fwrite(key, strlen(key), 1, f); + fwrite(key, mir_strlen(key), 1, f); fclose(f); return TRUE; diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index 64e1577ad9..c58cfab9e3 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -5,7 +5,7 @@ LPSTR splitMsg(LPSTR szMsg, int iLen) { Sent_NetLog("split: msg: -----\n%s\n-----\n", szMsg); - size_t len = strlen(szMsg); + size_t len = mir_strlen(szMsg); LPSTR out = (LPSTR)mir_alloc(len * 2); LPSTR buf = out; @@ -58,7 +58,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) pm->message = new LPSTR[part_all]; memset(pm->message, 0, sizeof(LPSTR)*part_all); } - pm->message[part_num] = new char[strlen(szMsg)]; + pm->message[part_num] = new char[mir_strlen(szMsg)]; strcpy(pm->message[part_num], szMsg + 8); Sent_NetLog("combine: save part: %s", pm->message[part_num]); @@ -66,7 +66,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) int len = 0, i; for (i = 0; i < part_all; i++) { if (pm->message[i] == NULL) break; - len += (int)strlen(pm->message[i]); + len += (int)mir_strlen(pm->message[i]); } if (i == part_all) { // combine message SAFE_FREE(ptr->tmp); @@ -93,14 +93,14 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) // отправляет сообщение, если надо то разбивает на части int splitMessageSend(pUinKey ptr, LPSTR szMsg) { - int len = (int)strlen(szMsg); + int len = (int)mir_strlen(szMsg); int par = (getContactStatus(ptr->hContact) == ID_STATUS_OFFLINE) ? ptr->proto->split_off : ptr->proto->split_on; if (par && len > par) { int ret; LPSTR msg = splitMsg(szMsg, par); LPSTR buf = msg; while (*buf) { - len = (int)strlen(buf); + len = (int)mir_strlen(buf); LPSTR tmp = mir_strdup(buf); ret = CallContactService(ptr->hContact, PSS_MESSAGE, (WPARAM)PREF_METANODB, (LPARAM)tmp); mir_free(tmp); diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index fb39f770d2..756a2dbf0f 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -110,7 +110,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) if (ssig == SiG_NONE && ptr->msgSplitted) { Sent_NetLog("onRecvMsg: combine untagged splitted message"); - LPSTR tmp = (LPSTR)mir_alloc(strlen(ptr->msgSplitted) + strlen(szEncMsg) + 1); + LPSTR tmp = (LPSTR)mir_alloc(mir_strlen(ptr->msgSplitted) + mir_strlen(szEncMsg) + 1); strcpy(tmp, ptr->msgSplitted); strcat(tmp, szEncMsg); mir_free(ptr->msgSplitted); @@ -224,7 +224,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) // reinit key exchange user has send an encrypted message and i have no key cpp_reset_context(ptr->cntx); - ptrA reSend((LPSTR)mir_alloc(strlen(szEncMsg) + LEN_RSND)); + ptrA reSend((LPSTR)mir_alloc(mir_strlen(szEncMsg) + LEN_RSND)); strcpy(reSend, SIG_RSND); // copy resend sig strcat(reSend, szEncMsg); // add mess @@ -772,7 +772,7 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) if (!name) name = file[i]; else name++; - int size = TEMP_SIZE + (int)strlen(name) + 20; + int size = TEMP_SIZE + (int)mir_strlen(name) + 20; char *file_out = (char *)mir_alloc(size); mir_snprintf(file_out, size, "%s\\%s.AESHELL(%d)", TEMP, name, file_idx++); diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index b4ca73fb1f..9f59e6d3ba 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -16,7 +16,7 @@ int __cdecl rsa_inject(HANDLE context, LPCSTR msg) Sent_NetLog("rsa_inject: '%s'", msg); - int len = (int)strlen(msg) + 1; + int len = (int)mir_strlen(msg) + 1; LPSTR buf = (LPSTR)mir_alloc(LEN_SECU + len); memcpy(buf, SIG_SECU, LEN_SECU); memcpy(buf + LEN_SECU, msg, len); -- cgit v1.2.3