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 --- src/modules/clist/contacts.cpp | 4 ++-- src/modules/database/dbini.cpp | 2 +- src/modules/database/dbutils.cpp | 2 +- src/modules/database/mdatabasecache.cpp | 4 ++-- src/modules/langpack/lpservices.cpp | 2 +- src/modules/metacontacts/meta_services.cpp | 2 +- src/modules/netlib/netlibautoproxy.cpp | 8 ++++---- src/modules/netlib/netlibhttp.cpp | 6 +++--- src/modules/netlib/netliblog.cpp | 2 +- src/modules/netlib/netlibopenconn.cpp | 4 ++-- src/modules/netlib/netlibsecurity.cpp | 4 ++-- src/modules/netlib/netlibupnp.cpp | 10 +++++----- src/modules/protocols/protochains.cpp | 2 +- src/modules/protocols/protocols.cpp | 2 +- src/modules/protocols/protodir.cpp | 2 +- src/modules/skin/hotkeys.cpp | 2 +- src/modules/skin/skinicons.cpp | 4 ++-- src/modules/utils/path.cpp | 2 +- src/modules/xml/xmlParser.cpp | 4 ++-- 19 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src/modules') diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index 98e2669fe0..7bb91e1cd7 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -191,7 +191,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) ci->pszVal = (TCHAR*)buf; } else { - size_t len = strlen(dbv.pszVal) + strlen(dbv2.pszVal) + 2; + size_t len = mir_strlen(dbv.pszVal) + mir_strlen(dbv2.pszVal) + 2; char* buf = (char*)mir_alloc(len); if (buf != NULL) strcat(strcat(strcpy(buf, dbv.pszVal), " "), dbv2.pszVal); @@ -316,7 +316,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) ci->pszVal = (TCHAR*)buf; } else { - size_t len = strlen(dbv.pszVal) + strlen(dbv2.pszVal) + 2; + size_t len = mir_strlen(dbv.pszVal) + mir_strlen(dbv2.pszVal) + 2; char* buf = (char*)mir_alloc(len); if (buf != NULL) strcat(strcat(strcpy(buf, dbv.pszVal), " "), dbv2.pszVal); diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index 4bd9c42f96..be17cf1416 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -211,7 +211,7 @@ static void ConvertBackslashes(char *str, UINT fileCp) case 'r': *pstr = '\r'; break; default: *pstr = pstr[1]; break; } - memmove(pstr + 1, pstr + 2, strlen(pstr + 2) + 1); + memmove(pstr + 1, pstr + 2, mir_strlen(pstr + 2) + 1); } } } diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index b073fbcb49..425cc5d7b4 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -86,7 +86,7 @@ static INT_PTR DbEventTypeGet(WPARAM wParam, LPARAM lParam) static TCHAR* getEventString(DBEVENTINFO *dbei, LPSTR &buf) { LPSTR in = buf; - buf += strlen(buf) + 1; + buf += mir_strlen(buf) + 1; return (dbei->flags & DBEF_UTF) ? Utf8DecodeT(in) : mir_a2t(in); } diff --git a/src/modules/database/mdatabasecache.cpp b/src/modules/database/mdatabasecache.cpp index c864394261..f0638b147d 100644 --- a/src/modules/database/mdatabasecache.cpp +++ b/src/modules/database/mdatabasecache.cpp @@ -157,9 +157,9 @@ void MDatabaseCache::SetCachedVariant(DBVARIANT* s /* new */, DBVARIANT* d /* ca memcpy(d, s, sizeof(DBVARIANT)); if ((s->type == DBVT_UTF8 || s->type == DBVT_ASCIIZ) && s->pszVal != NULL) { if (szSave != NULL) - d->pszVal = (char*)HeapReAlloc(m_hCacheHeap, 0, szSave, strlen(s->pszVal) + 1); + d->pszVal = (char*)HeapReAlloc(m_hCacheHeap, 0, szSave, mir_strlen(s->pszVal) + 1); else - d->pszVal = (char*)HeapAlloc(m_hCacheHeap, 0, strlen(s->pszVal) + 1); + d->pszVal = (char*)HeapAlloc(m_hCacheHeap, 0, mir_strlen(s->pszVal) + 1); strcpy(d->pszVal, s->pszVal); } else if (szSave != NULL) diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index 7649492722..5bb898b709 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -73,7 +73,7 @@ static INT_PTR srvPcharToTchar(WPARAM wParam, LPARAM lParam) if (pszStr == NULL) return NULL; - int len = (int)strlen(pszStr); + int len = (int)mir_strlen(pszStr); TCHAR *result = (TCHAR*)alloca((len+1)*sizeof(TCHAR)); MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pszStr, -1, result, len); result[len] = 0; diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index 9d3a0c89a0..d3fec41eb0 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -82,7 +82,7 @@ INT_PTR Meta_GetCaps(WPARAM wParam, LPARAM lParam) INT_PTR Meta_GetName(WPARAM wParam, LPARAM lParam) { char *name = (char *)Translate(META_PROTO); - size_t size = min(strlen(name), wParam - 1); // copy only the first size bytes. + size_t size = min(mir_strlen(name), wParam - 1); // copy only the first size bytes. if (strncpy((char *)lParam, name, size) == NULL) return 1; ((char *)lParam)[size] = '\0'; diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp index 2de498752e..df46abd73b 100644 --- a/src/modules/netlib/netlibautoproxy.cpp +++ b/src/modules/netlib/netlibautoproxy.cpp @@ -299,8 +299,8 @@ static void NetlibIeProxyThread(void *arg) char *proxy = proxyBuffer; DWORD dwProxyLen = sizeof(proxyBuffer); - if (pInternetGetProxyInfo(param->szUrl, (DWORD)strlen(param->szUrl), - param->szHost, (DWORD)strlen(param->szHost), &proxy, &dwProxyLen)) + if (pInternetGetProxyInfo(param->szUrl, (DWORD)mir_strlen(param->szUrl), + param->szHost, (DWORD)mir_strlen(param->szHost), &proxy, &dwProxyLen)) param->szProxy = mir_strdup(lrtrim(proxy)); NetlibLogf(NULL, "Autoproxy got response %s, Param: %s %s", param->szProxy, param->szUrl, param->szHost); @@ -341,7 +341,7 @@ char* NetlibGetIeProxy(char *szUrl) if (ind < 0 || !szProxyHost[ind]) return NULL; - size_t len = strlen(szHost) + 20; + size_t len = mir_strlen(szHost) + 20; res = (char*)mir_alloc(len); mir_snprintf(res, len, "%s %s", ind == 2 ? "SOCKS" : "PROXY", szProxyHost[ind]); return res; @@ -408,7 +408,7 @@ void NetlibLoadIeProxy(void) szProxyHost[ind] = mir_strdup(szProxy); else { - size_t len = strlen(szProxy) + 10; + size_t len = mir_strlen(szProxy) + 10; szProxyHost[ind] = (char*)mir_alloc(len); mir_snprintf(szProxyHost[ind], len, "%s:%u", szProxy, ind == 2 ? 1080 : 8080); } diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index 7d6734ce8f..0fa5d91f42 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -324,7 +324,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime, if ((peol = strchr(buffer, '\n')) != NULL) break; - if ((int)strlen(buffer) < bytesPeeked) { + if ((int)mir_strlen(buffer) < bytesPeeked) { SetLastError(ERROR_BAD_FORMAT); return 0; } @@ -578,10 +578,10 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) phost = strstr(pszFullUrl, "://"); phost = phost ? phost + 3 : pszFullUrl; ppath = strchr(phost, '/'); - rlen = ppath ? ppath - pszFullUrl : strlen(pszFullUrl); + rlen = ppath ? ppath - pszFullUrl : mir_strlen(pszFullUrl); } - nlc->szNewUrl = (char*)mir_realloc(nlc->szNewUrl, rlen + strlen(tmpUrl) * 3 + 1); + nlc->szNewUrl = (char*)mir_realloc(nlc->szNewUrl, rlen + mir_strlen(tmpUrl) * 3 + 1); strncpy(nlc->szNewUrl, pszFullUrl, rlen); strcpy(nlc->szNewUrl + rlen, tmpUrl); diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 5590d2305c..e673ae8561 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -337,7 +337,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) } if (logOptions.toFile && !logOptions.tszFile.IsEmpty()) { - size_t len = strlen(pszMsg); + size_t len = mir_strlen(pszMsg); mir_writeLogA(hLogger, "%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n"); } diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index c7daa9dea2..0e40641eec 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -115,8 +115,8 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE // http://www.socks.nec.com/protocol/socks4.protocol and http://www.socks.nec.com/protocol/socks4a.protocol if (!nloc || !nloc->szHost || !nloc->szHost[0]) return 0; - size_t nHostLen = strlen(nloc->szHost) + 1; - size_t nUserLen = nlu->settings.szProxyAuthUser ? strlen(nlu->settings.szProxyAuthUser) + 1 : 1; + size_t nHostLen = mir_strlen(nloc->szHost) + 1; + size_t nUserLen = nlu->settings.szProxyAuthUser ? mir_strlen(nlu->settings.szProxyAuthUser) + 1 : 1; size_t len = 8 + nUserLen; char* pInit = (char*)alloca(len + nHostLen); diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 4f47cbf2d8..0e4151d1ad 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -383,7 +383,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, char *szLogin = mir_t2a(login); char *szPassw = mir_t2a(psw); - size_t authLen = strlen(szLogin) + strlen(szPassw) + 5; + size_t authLen = mir_strlen(szLogin) + mir_strlen(szPassw) + 5; char *szAuth = (char*)alloca(authLen); int len = mir_snprintf(szAuth, authLen, "%s:%s", szLogin, szPassw); @@ -401,7 +401,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, return szOutputToken; ptrA szProvider(mir_t2a(hNtlm->szProvider)); - size_t resLen = strlen(szOutputToken) + strlen(szProvider) + 10; + size_t resLen = mir_strlen(szOutputToken) + mir_strlen(szProvider) + 10; char *result = (char*)mir_alloc(resLen); mir_snprintf(result, resLen, "%s %s", szProvider, szOutputToken); mir_free(szOutputToken); diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 513aafaa55..c97a24050f 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -139,7 +139,7 @@ static bool txtParseParam(char* szData, char* presearch, cp = strstr(cp1, start); if (cp == NULL) return false; - cp += strlen(start); + cp += mir_strlen(start); while (*cp == ' ') ++cp; cp1 = strstr(cp, finish); @@ -163,7 +163,7 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath) else phost += 3; ppath = strchr(phost, '/'); - if (ppath == NULL) ppath = phost + strlen(phost); + if (ppath == NULL) ppath = phost + mir_strlen(phost); pport = strchr(phost, ':'); if (pport == NULL) pport = ppath; @@ -452,7 +452,7 @@ retry: acksz += chunkBytes; peol2++; - memmove(data, peol2, strlen(peol2) + 1); + memmove(data, peol2, mir_strlen(peol2) + 1); sz -= peol2 - data; // Last chunk, all data received @@ -535,10 +535,10 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl) rpth = rpth ? rpth + 2 : szCtlUrl; rpth = strchr(rpth, '/'); - if (rpth == NULL) rpth = szCtlUrl + strlen(szCtlUrl); + if (rpth == NULL) rpth = szCtlUrl + mir_strlen(szCtlUrl); } else { // relative URI rel_path - size_t ctlCLen = strlen(szCtlUrl); + size_t ctlCLen = mir_strlen(szCtlUrl); rpth = szCtlUrl + ctlCLen; if (ctlCLen != 0 && *(rpth - 1) != '/') strncpy(rpth++, "/", sizeof(szCtlUrl) - ctlCLen); diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index 187a463e77..bc94b9cc25 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -49,7 +49,7 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen) if (cc == NULL) cc = currDb->m_cache->AddContactToCache(hContact); - cc->szProto = currDb->m_cache->GetCachedSetting(NULL, szBuf, 0, (int)strlen(szBuf)); + cc->szProto = currDb->m_cache->GetCachedSetting(NULL, szBuf, 0, (int)mir_strlen(szBuf)); } return res; } diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 3787696bd9..526b767328 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -130,7 +130,7 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) dbei.szModule = GetContactProto(ccs->hContact); dbei.timestamp = pre->timestamp; dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1; + dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1; dbei.pBlob = (PBYTE)pre->szMessage; if (pre->cbCustomDataSize != 0) { diff --git a/src/modules/protocols/protodir.cpp b/src/modules/protocols/protodir.cpp index 27626880ad..96f442dfc8 100644 --- a/src/modules/protocols/protodir.cpp +++ b/src/modules/protocols/protodir.cpp @@ -107,7 +107,7 @@ char * contactDir_Proto_Add(contactDir * cd, char * proto) mir_cslock lck(cd->csLock); if ( List_GetIndex(&cd->protoNameCache, proto, &index) ) szCache = cd->protoNameCache.items[index]; else { - szCache = HeapAlloc(hCacheHeap, HEAP_NO_SERIALIZE, strlen(proto)+1); + szCache = HeapAlloc(hCacheHeap, HEAP_NO_SERIALIZE, mir_strlen(proto)+1); strcpy(szCache, proto); List_Insert(&cd->protoNameCache, szCache, index); } diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index e2795ae92e..13dfc09ad0 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -218,7 +218,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam) char pszNamePrefix[MAXMODULELABELLENGTH]; size_t cbNamePrefix; mir_snprintf(pszNamePrefix, SIZEOF(pszNamePrefix), "%s$", pszName); - cbNamePrefix = strlen(pszNamePrefix); + cbNamePrefix = mir_strlen(pszNamePrefix); for (i=0; i < hotkeys.getCount(); i++) { diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index d7c2884f14..2382da9976 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -383,8 +383,8 @@ HICON LoadSkinIcon(int idx, bool big) static void convertOneProtocol(char *moduleName, char *iconName) { - char *pm = moduleName + strlen(moduleName); - char *pi = iconName + strlen(iconName); + char *pm = moduleName + mir_strlen(moduleName); + char *pi = iconName + mir_strlen(iconName); for (int i=0; i < SIZEOF(statusIcons); i++) { _itoa(statusIcons[i].id, pm, 10); diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index a7ac429900..f1fa55ea5c 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -107,7 +107,7 @@ TCHAR *GetContactID(MCONTACT hContact) static __forceinline int _xcscmp(const char *s1, const char *s2) { return strcmp(s1, s2); } static __forceinline int _xcsncmp(const char *s1, const char *s2, size_t n) { return strncmp(s1, s2, n); } -static __forceinline size_t _xcslen(const char *s1) { return strlen(s1); } +static __forceinline size_t _xcslen(const char *s1) { return mir_strlen(s1); } static __forceinline char *_xcscpy(char *s1, const char *s2) { return strcpy(s1, s2); } static __forceinline char *_xcsncpy(char *s1, const char *s2, size_t n) { return strncpy(s1, s2, n); } static __forceinline char *_xstrselect(char *, char *s1, TCHAR *s2) { return s1; } diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index 67d65089c7..ab9db2f58e 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -236,7 +236,7 @@ char *myWideCharToMultiByte(const wchar_t *s) return d; } static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { return fopen(filename, mode); } -static inline size_t xstrlen(XMLCSTR c) { return strlen(c); } +static inline size_t xstrlen(XMLCSTR c) { return mir_strlen(c); } #ifdef __BORLANDC__ static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strnicmp(c1, c2, l);} static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return stricmp(c1, c2); } @@ -325,7 +325,7 @@ static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) } #else static inline FILE *xfopen(XMLCSTR filename, XMLCSTR mode) { return fopen(filename, mode); } -static inline int xstrlen(XMLCSTR c) { return strlen(c); } +static inline int xstrlen(XMLCSTR c) { return mir_strlen(c); } static inline int xstrnicmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncasecmp(c1, c2, l);} static inline int xstrncmp(XMLCSTR c1, XMLCSTR c2, int l) { return strncmp(c1, c2, l);} static inline int xstricmp(XMLCSTR c1, XMLCSTR c2) { return strcasecmp(c1, c2); } -- cgit v1.2.3