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 --- protocols/Tlen/src/tlen.cpp | 8 ++++---- protocols/Tlen/src/tlen_avatar.cpp | 16 ++++++++-------- protocols/Tlen/src/tlen_file.cpp | 4 ++-- protocols/Tlen/src/tlen_iqid.cpp | 2 +- protocols/Tlen/src/tlen_list.cpp | 6 +++--- protocols/Tlen/src/tlen_misc.cpp | 6 +++--- protocols/Tlen/src/tlen_p2p_old.cpp | 6 +++--- protocols/Tlen/src/tlen_presence.cpp | 6 +++--- protocols/Tlen/src/tlen_svc.cpp | 18 +++++++++--------- protocols/Tlen/src/tlen_thread.cpp | 8 ++++---- protocols/Tlen/src/tlen_util.cpp | 18 +++++++++--------- protocols/Tlen/src/tlen_xml.cpp | 8 ++++---- 12 files changed, 53 insertions(+), 53 deletions(-) (limited to 'protocols/Tlen/src') diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 32dbe61ffa..f824620131 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -184,7 +184,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) if (db_get_b(NULL, m_szModuleName, "SavePassword", TRUE) == TRUE) password = db_get_sa(NULL, m_szModuleName, "Password"); - else if (threadData != NULL && strlen(threadData->password) > 0) + else if (threadData != NULL && mir_strlen(threadData->password) > 0) password = mir_strdup(threadData->password); memset(&cookie, 0, sizeof(cookie)); @@ -199,7 +199,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) req.headersCount = 1; req.headers = headers; req.pData = form; - req.dataLength = (int)strlen(form); + req.dataLength = (int)mir_strlen(form); req.szUrl = "http://poczta.o2.pl/login.html"; resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req); if (resp != NULL) { @@ -212,7 +212,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) char *end = strstr(resp->headers[i].szValue, ";"); start = start + 5; if (end == NULL) { - end = resp->headers[i].szValue + strlen(resp->headers[i].szValue); + end = resp->headers[i].szValue + mir_strlen(resp->headers[i].szValue); } strncpy(cookie, start, (end - start)); break; @@ -261,7 +261,7 @@ void TlenProtocol::initMenuItems() { char text[_MAX_PATH]; strncpy_s(text, sizeof(text), m_szModuleName, _TRUNCATE); - char *pSvcName = text + strlen(text); + char *pSvcName = text + mir_strlen(text); CLISTMENUITEM mi = { sizeof(mi) }, clmi = { sizeof(clmi) }; clmi.flags = CMIM_FLAGS | CMIF_GRAYED; diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index ba336d2660..bfa27646e0 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -173,17 +173,17 @@ void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, TLEN_LIST_ITE static char *replaceTokens(const char *base, const char *uri, const char *login, const char* token, int type, int access) { char *result; int i, l, size; - l = (int)strlen(uri); - size = (int)strlen(base); + l = (int)mir_strlen(uri); + size = (int)mir_strlen(base); for (i = 0; i < l; ) { if (!strncmp(uri + i, "^login^", 7)) { - size += (int)strlen(login); + size += (int)mir_strlen(login); i += 7; } else if (!strncmp(uri + i, "^type^", 6)) { size++; i += 6; } else if (!strncmp(uri + i, "^token^", 7)) { - size += (int)strlen(token); + size += (int)mir_strlen(token); i += 7; } else if (!strncmp(uri + i, "^access^", 8)) { size++; @@ -195,18 +195,18 @@ static char *replaceTokens(const char *base, const char *uri, const char *login, } result = (char *)mir_alloc(size +1); strcpy(result, base); - size = (int)strlen(base); + size = (int)mir_strlen(base); for (i = 0; i < l; ) { if (!strncmp(uri + i, "^login^", 7)) { strcpy(result + size, login); - size += (int)strlen(login); + size += (int)mir_strlen(login); i += 7; } else if (!strncmp(uri + i, "^type^", 6)) { result[size++] = '0' + type; i += 6; } else if (!strncmp(uri + i, "^token^", 7)) { strcpy(result + size, token); - size += (int)strlen(token); + size += (int)mir_strlen(token); i += 7; } else if (!strncmp(uri + i, "^access^", 8)) { result[size++] = '0' + access; @@ -400,7 +400,7 @@ void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int if (proto->threadData != NULL && dataLen > 0 && data != NULL) { char *mpartHead = "--AaB03x\r\nContent-Disposition: form-data; name=\"filename\"; filename=\"plik.png\"\r\nContent-Type: image/png\r\n\r\n"; char *mpartTail = "\r\n--AaB03x--\r\n"; - int size, sizeHead = (int)strlen(mpartHead), sizeTail = (int)strlen(mpartTail); + int size, sizeHead = (int)mir_strlen(mpartHead), sizeTail = (int)mir_strlen(mpartTail); char *request = replaceTokens(proto->threadData->tlenConfig.mailBase, proto->threadData->tlenConfig.avatarUpload, "", proto->threadData->avatarToken, 0, access); TLENUPLOADAVATARTHREADDATA *threadData = (TLENUPLOADAVATARTHREADDATA *)mir_alloc(sizeof(TLENUPLOADAVATARTHREADDATA)); threadData->proto = proto; diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 830c828cf4..9d05fef08f 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -79,9 +79,9 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) TlenP2PPacketSend(ft->s, packet); TlenP2PPacketFree(packet); - fullFileName = (char *) mir_alloc(strlen(ft->szSavePath) + strlen(ft->files[ft->currentFile]) + 2); + fullFileName = (char *) mir_alloc(mir_strlen(ft->szSavePath) + mir_strlen(ft->files[ft->currentFile]) + 2); strcpy(fullFileName, ft->szSavePath); - if (fullFileName[strlen(fullFileName)-1] != '\\') + if (fullFileName[mir_strlen(fullFileName)-1] != '\\') strcat(fullFileName, "\\"); strcat(fullFileName, ft->files[ft->currentFile]); ft->fileId = _open(fullFileName, _O_BINARY|_O_WRONLY|_O_CREAT|_O_TRUNC, _S_IREAD|_S_IWRITE); diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 7c5368822f..837a24d81b 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -407,7 +407,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) char *str = TlenXmlGetAttrValue(iqNode, "id"); if (str == NULL) return; - int id = atoi(str+strlen(TLEN_IQID)); + int id = atoi(str+mir_strlen(TLEN_IQID)); if (!strcmp(type, "result")) { if ((queryNode=TlenXmlGetChild(iqNode, "query")) == NULL) return; diff --git a/protocols/Tlen/src/tlen_list.cpp b/protocols/Tlen/src/tlen_list.cpp index ddd31b3340..5827fad64f 100644 --- a/protocols/Tlen/src/tlen_list.cpp +++ b/protocols/Tlen/src/tlen_list.cpp @@ -111,13 +111,13 @@ int TlenListExist(TlenProtocol *proto, TLEN_LIST list, const char *jid) size_t len; char *s, *p; s = GetItemId(list, jid); - len = strlen(s); + len = mir_strlen(s); mir_cslock lck(proto->csLists); for (i=0; ilistsCount; i++) if (proto->lists[i].list == list) { p = proto->lists[i].jid; - if (p && strlen(p) >= len && (p[(int)len] == '\0' || p[(int)len] == '/') && !strncmp(p, s, len)) { + if (p && mir_strlen(p) >= len && (p[(int)len] == '\0' || p[(int)len] == '/') && !strncmp(p, s, len)) { mir_free(s); return i+1; } @@ -265,7 +265,7 @@ TLEN_LIST_ITEM *TlenListFindItemPtrById2(TlenProtocol *proto, TLEN_LIST list, co size_t len; char *p; - len = strlen(id); + len = mir_strlen(id); mir_cslock lck(proto->csLists); for (i=0; ilistsCount; i++) { diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index c7205a31cd..e3b4fe6c1e 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -60,14 +60,14 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) proto->debugLogA("auth request: %s, %s", jid, nick); //blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) //blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ) - cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)strlen(nick) + (int)strlen(jid) + 5; + cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)mir_strlen(nick) + (int)mir_strlen(jid) + 5; pBlob = pCurBlob = (PBYTE) mir_alloc(cbBlob); *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD); *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD); - strcpy((char *) pCurBlob, nick); pCurBlob += strlen(nick)+1; + strcpy((char *) pCurBlob, nick); pCurBlob += mir_strlen(nick)+1; *pCurBlob = '\0'; pCurBlob++; //firstName *pCurBlob = '\0'; pCurBlob++; //lastName - strcpy((char *) pCurBlob, jid); pCurBlob += strlen(jid)+1; + strcpy((char *) pCurBlob, jid); pCurBlob += mir_strlen(jid)+1; *pCurBlob = '\0'; //reason TlenDBAddEvent(proto, NULL, EVENTTYPE_AUTHREQUEST, 0, pBlob, cbBlob); } diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index 3d3668b42d..dee4b8831a 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -309,7 +309,7 @@ static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) *(PDWORD)(buf+4) = INADDR_ANY; if (sb->useAuth) { strcpy((char*)buf+8, sb->szUser); - len = (int)strlen(sb->szUser); + len = (int)mir_strlen(sb->szUser); } else { buf[8] = 0; len = 0; @@ -374,8 +374,8 @@ static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) int nUserLen, nPassLen; PBYTE pAuthBuf; - nUserLen = (int)strlen(sb->szUser); - nPassLen = (int)strlen(sb->szPassword); + nUserLen = (int)mir_strlen(sb->szUser); + nPassLen = (int)mir_strlen(sb->szPassword); pAuthBuf = (PBYTE)mir_alloc(3+nUserLen+nPassLen); pAuthBuf[0] = 1; //auth version pAuthBuf[1] = nUserLen; diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp index e9e4b11fe7..a3920281b7 100644 --- a/protocols/Tlen/src/tlen_presence.cpp +++ b/protocols/Tlen/src/tlen_presence.cpp @@ -281,9 +281,9 @@ static void TlenSendPresenceTo(TlenProtocol *proto, int status, char *to) else if (!_strnicmp(ptr+i,"%date%",6)) GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,NULL,NULL,substituteStr,sizeof(substituteStr)); else continue; - if (strlen(substituteStr)>6) ptr=(char*)mir_realloc(ptr,strlen(ptr)+1+strlen(substituteStr)-6); - memmove(ptr+i+strlen(substituteStr),ptr+i+6,strlen(ptr)-i-5); - memcpy(ptr+i,substituteStr,strlen(substituteStr)); + if (mir_strlen(substituteStr)>6) ptr=(char*)mir_realloc(ptr,mir_strlen(ptr)+1+mir_strlen(substituteStr)-6); + memmove(ptr+i+mir_strlen(substituteStr),ptr+i+6,mir_strlen(ptr)-i-5); + memcpy(ptr+i,substituteStr,mir_strlen(substituteStr)); } } } diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 9481729dd8..b578bf6e6b 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -251,9 +251,9 @@ MCONTACT TlenProtocol::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent } char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2; - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; MCONTACT hContact = (MCONTACT) AddToListByJID(this, jid, flags); mir_free(dbei.pBlob); @@ -284,9 +284,9 @@ int TlenProtocol::Authorize(MEVENT hDbEvent) } char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2; - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; TlenSend(this, "", jid); @@ -333,9 +333,9 @@ int TlenProtocol::AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason) } char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2; - char *firstName = nick + strlen(nick) + 1; - char *lastName = firstName + strlen(firstName) + 1; - char *jid = lastName + strlen(lastName) + 1; + char *firstName = nick + mir_strlen(nick) + 1; + char *lastName = firstName + mir_strlen(firstName) + 1; + char *jid = lastName + mir_strlen(lastName) + 1; TlenSend(this, "", jid); TlenSend(this, "", jid); diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 6d93071a28..2b6af296c1 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -635,7 +635,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) if ((bodyNode=TlenXmlGetChild(node, "body")) != NULL) { if (bodyNode->text != NULL) { if ((subjectNode=TlenXmlGetChild(node, "subject")) != NULL && subjectNode->text != NULL && subjectNode->text[0] != '\0') { - size_t size = strlen(subjectNode->text)+strlen(bodyNode->text)+5; + size_t size = mir_strlen(subjectNode->text)+mir_strlen(bodyNode->text)+5; p = (char *)mir_alloc(size); mir_snprintf(p, size, "%s\r\n%s", subjectNode->text, bodyNode->text); localMessage = TlenTextDecode(p); @@ -744,8 +744,8 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) id = -1; if ((idStr=TlenXmlGetAttrValue(node, "id")) != NULL) { - if (!strncmp(idStr, TLEN_IQID, strlen(TLEN_IQID))) - id = atoi(idStr+strlen(TLEN_IQID)); + if (!strncmp(idStr, TLEN_IQID, mir_strlen(TLEN_IQID))) + id = atoi(idStr+mir_strlen(TLEN_IQID)); } queryNode = TlenXmlGetChild(node, "query"); @@ -1130,7 +1130,7 @@ static void TlenProcessP(XmlNode *node, ThreadData *info) iNode = TlenXmlGetChild(xNode, "i"); if (iNode != NULL) { iStr = TlenXmlGetAttrValue(iNode, "i"); - temp = (char*)mir_alloc(strlen(f)+strlen(iStr)+2); + temp = (char*)mir_alloc(mir_strlen(f)+mir_strlen(iStr)+2); strcpy(temp, f); strcat(temp, "/"); strcat(temp, iStr); diff --git a/protocols/Tlen/src/tlen_util.cpp b/protocols/Tlen/src/tlen_util.cpp index 228f8dae8e..55420658cd 100644 --- a/protocols/Tlen/src/tlen_util.cpp +++ b/protocols/Tlen/src/tlen_util.cpp @@ -62,7 +62,7 @@ int TlenSend(TlenProtocol *proto, const char *fmt, ...) va_end(vararg); proto->debugLogA("SEND:%s", str); - size = (int)strlen(str); + size = (int)mir_strlen(str); if (proto->threadData != NULL) { if (proto->threadData->useAES) { result = TlenWsSendAES(proto, str, size, &proto->threadData->aes_out_context, proto->threadData->aes_out_iv); @@ -84,9 +84,9 @@ char *TlenResourceFromJID(const char *jid2) p=strchr(jid, '/'); if (p != NULL && p[1] != '\0') { p++; - if ((nick=(char *) mir_alloc(1+strlen(jid)-(p-jid))) != NULL) { - strncpy(nick, p, strlen(jid)-(p-jid)); - nick[strlen(jid)-(p-jid)] = '\0'; + if ((nick=(char *) mir_alloc(1+mir_strlen(jid)-(p-jid))) != NULL) { + strncpy(nick, p, mir_strlen(jid)-(p-jid)); + nick[mir_strlen(jid)-(p-jid)] = '\0'; } } else { @@ -161,7 +161,7 @@ char *TlenSha1(char *str) return NULL; mir_sha1_init( &sha ); - mir_sha1_append( &sha, (BYTE* )str, (int)strlen( str )); + mir_sha1_append( &sha, (BYTE* )str, (int)mir_strlen( str )); mir_sha1_finish( &sha, (BYTE* )digest ); if ((result=(char *)mir_alloc(41)) == NULL) return NULL; @@ -215,7 +215,7 @@ char *TlenUrlEncode(const char *str) unsigned char c; if (str == NULL) return NULL; - res = (char *) mir_alloc(3*strlen(str) + 1); + res = (char *) mir_alloc(3*mir_strlen(str) + 1); for (p=(char *)str,q=res; *p != '\0'; p++,q++) { if (*p == ' ') { *q = '+'; @@ -406,8 +406,8 @@ void TlenStringAppend(char **str, int *sizeAlloced, const char *fmt, ...) len = 0; } else { - len = (int)strlen(*str); - size = *sizeAlloced - (int)strlen(*str); + len = (int)mir_strlen(*str); + size = *sizeAlloced - (int)mir_strlen(*str); } p = *str + len; @@ -433,7 +433,7 @@ BOOL IsAuthorized(TlenProtocol *proto, const char *jid) void TlenLogMessage(TlenProtocol *proto, MCONTACT hContact, DWORD flags, const char *message) { - int size = (int)strlen(message) + 2; + int size = (int)mir_strlen(message) + 2; char *localMessage = (char *)mir_alloc(size); strcpy(localMessage, message); localMessage[size - 1] = '\0'; diff --git a/protocols/Tlen/src/tlen_xml.cpp b/protocols/Tlen/src/tlen_xml.cpp index 87fdd52211..04e6aa79a3 100644 --- a/protocols/Tlen/src/tlen_xml.cpp +++ b/protocols/Tlen/src/tlen_xml.cpp @@ -193,7 +193,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) char *p; XmlAttr *a; - if (node == NULL || text == NULL || strlen(text) <= 0) + if (node == NULL || text == NULL || mir_strlen(text) <= 0) return; for (p=text;;) { @@ -387,7 +387,7 @@ char *TlenXmlGetAttrValue(XmlNode *node, char *key) { int i; - if (node == NULL || node->numAttr <= 0 || key == NULL || strlen(key) <= 0) + if (node == NULL || node->numAttr <= 0 || key == NULL || mir_strlen(key) <= 0) return NULL; for (i=0; inumAttr; i++) { if (node->attr[i]->name && !strcmp(key, node->attr[i]->name)) @@ -405,7 +405,7 @@ XmlNode *TlenXmlGetNthChild(XmlNode *node, char *tag, int nth) { int i, num; - if (node == NULL || node->numChild <= 0 || tag == NULL || strlen(tag) <= 0 || nth < 1) + if (node == NULL || node->numChild <= 0 || tag == NULL || mir_strlen(tag) <= 0 || nth < 1) return NULL; num = 1; for (i=0; inumChild; i++) { @@ -424,7 +424,7 @@ XmlNode *TlenXmlGetChildWithGivenAttrValue(XmlNode *node, char *tag, char *attrK int i; char *str; - if (node == NULL || node->numChild <= 0 || tag == NULL || strlen(tag) <= 0 || attrKey == NULL || strlen(attrKey) <= 0 || attrValue == NULL || strlen(attrValue) <= 0) + if (node == NULL || node->numChild <= 0 || tag == NULL || mir_strlen(tag) <= 0 || attrKey == NULL || mir_strlen(attrKey) <= 0 || attrValue == NULL || mir_strlen(attrValue) <= 0) return NULL; for (i=0; inumChild; i++) { if (node->child[i]->name && !strcmp(tag, node->child[i]->name)) { -- cgit v1.2.3