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/Non-IM Contact/src/contactinfo.cpp | 54 +++++------ plugins/Non-IM Contact/src/dialog.cpp | 6 +- plugins/Non-IM Contact/src/files.cpp | 24 ++--- plugins/Non-IM Contact/src/namereplacing.cpp | 136 +++++++++++++-------------- plugins/Non-IM Contact/src/timer.cpp | 2 +- 5 files changed, 111 insertions(+), 111 deletions(-) (limited to 'plugins/Non-IM Contact') diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index eaac4b706b..f6d23ee084 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -275,9 +275,9 @@ char* copyReplaceString(char* oldStr, char* newStr, char* findStr, char* replace int i = 0; while (oldStr[i] != '\0') { // msg(&oldStr[i],""); - if (!strncmp(&oldStr[i], findStr, strlen(findStr))) { + if (!strncmp(&oldStr[i], findStr, mir_strlen(findStr))) { strcat(newStr, replaceWithStr); - i += (int)strlen(findStr); + i += (int)mir_strlen(findStr); } else { strncat(newStr, &oldStr[i], 1); @@ -498,37 +498,37 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) continue; if (!strcmp(line, "[Non-IM Contact]\r\n")) contactDone = 0; - else if (!strncmp(line, "Name=", strlen("Name="))) { - i = (int)strlen("Name="); j = 0; + else if (!strncmp(line, "Name=", mir_strlen("Name="))) { + i = (int)mir_strlen("Name="); j = 0; while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') { name[j] = line[i++]; name[++j] = '\0'; } contactDone = 1; } - else if (!strncmp(line, "ProgramString=", strlen("ProgramString="))) { - i = (int)strlen("ProgramString="); j = 0; + else if (!strncmp(line, "ProgramString=", mir_strlen("ProgramString="))) { + i = (int)mir_strlen("ProgramString="); j = 0; while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') { program[j] = line[i++]; program[++j] = '\0'; } } - else if (!strncmp(line, "ProgramParamString=", strlen("ProgramParamString="))) { - i = (int)strlen("ProgramParamString="); j = 0; + else if (!strncmp(line, "ProgramParamString=", mir_strlen("ProgramParamString="))) { + i = (int)mir_strlen("ProgramParamString="); j = 0; while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') { programparam[j] = line[i++]; programparam[++j] = '\0'; } } - else if (!strncmp(line, "Group=", strlen("Group="))) { - i = (int)strlen("Group="); j = 0; + else if (!strncmp(line, "Group=", mir_strlen("Group="))) { + i = (int)mir_strlen("Group="); j = 0; while (line[i] != '\r' && line[i] != '\n' && line[i] != '\0') { group[j] = line[i++]; group[++j] = '\0'; } } - else if (!strncmp(line, "ToolTip=", strlen("ToolTip="))) { - i = (int)strlen("ToolTip="); + else if (!strncmp(line, "ToolTip=", mir_strlen("ToolTip="))) { + i = (int)mir_strlen("ToolTip="); strcpy(tooltip, &line[i]); fgets(line, 2000, file); while (!strstr(line, "\r\n")) { @@ -538,47 +538,47 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) // the line that has the strncat(tooltip, line, SIZEOF(tooltip) - mir_strlen(tooltip)); } - else if (!strncmp(line, "Icon=", strlen("Icon="))) { - i = (int)strlen("Icon="); + else if (!strncmp(line, "Icon=", mir_strlen("Icon="))) { + i = (int)mir_strlen("Icon="); sscanf(&line[i], "%d", &icon); } - else if (!strncmp(line, "UseTimer=", strlen("UseTimer="))) { - i = (int)strlen("UseTimer="); + else if (!strncmp(line, "UseTimer=", mir_strlen("UseTimer="))) { + i = (int)mir_strlen("UseTimer="); sscanf(&line[i], "%d", &usetimer); } - else if (!strncmp(line, "Timer=", strlen("Timer="))) { - i = (int)strlen("Timer="); + else if (!strncmp(line, "Timer=", mir_strlen("Timer="))) { + i = (int)mir_strlen("Timer="); sscanf(&line[i], "%d", &timer); } - else if (!strncmp(line, "Minutes=", strlen("Minutes="))) { - i = (int)strlen("Minutes="); + else if (!strncmp(line, "Minutes=", mir_strlen("Minutes="))) { + i = (int)mir_strlen("Minutes="); sscanf(&line[i], "%d", &minutes); } else if (contactDone && !strcmp(line, "[/Non-IM Contact]\r\n")) { if (!name) continue; - size_t size = strlen(name) + strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1; + size_t size = mir_strlen(name) + mir_strlen("Do you want to import this Non-IM Contact?\r\n\r\nName: \r\n") + 1; char *msg = (char*)malloc(size); mir_snprintf(msg, size, "Do you want to import this Non-IM Contact?\r\n\r\nName: %s\r\n", name); if (program) { - msg = (char*)realloc(msg, strlen(msg) + strlen(program) + strlen("Program: \r\n") + 1); + msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(program) + mir_strlen("Program: \r\n") + 1); strcat(msg, "Program: "); strcat(msg, program); strcat(msg, "\r\n"); } if (programparam) { - msg = (char*)realloc(msg, strlen(msg) + strlen(programparam) + strlen("Program Parameters: \r\n") + 1); + msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(programparam) + mir_strlen("Program Parameters: \r\n") + 1); strcat(msg, "Program Parameters: "); strcat(msg, programparam); strcat(msg, "\r\n"); } if (tooltip) { - msg = (char*)realloc(msg, strlen(msg) + strlen(tooltip) + strlen("ToolTip: \r\n") + 1); + msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tooltip) + mir_strlen("ToolTip: \r\n") + 1); strcat(msg, "ToolTip: "); strcat(msg, tooltip); strcat(msg, "\r\n"); } if (group) { - msg = (char*)realloc(msg, strlen(msg) + strlen(group) + strlen("Group: \r\n") + 1); + msg = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(group) + mir_strlen("Group: \r\n") + 1); strcat(msg, "Group: "); strcat(msg, group); strcat(msg, "\r\n"); @@ -607,7 +607,7 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) free(msg); continue; } - char *msgtemp = (char*)realloc(msg, strlen(msg) + strlen(tmp) + 1); + char *msgtemp = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tmp) + 1); if (msgtemp) { msg = msgtemp; strcat(msg, tmp); @@ -619,7 +619,7 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) strcpy(tmp2, "Minutes"); else strcpy(tmp2, "Seconds"); mir_snprintf(tmp, SIZEOF(tmp), "UseTimer: Yes\r\nTimer: %d %s", timer, tmp2); - char *msgtemp = (char*)realloc(msg, strlen(msg) + strlen(tmp) + 1); + char *msgtemp = (char*)realloc(msg, mir_strlen(msg) + mir_strlen(tmp) + 1); if (msgtemp) { msg = msgtemp; strcat(msg, tmp); diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index 0702d63a6c..d41cb61fed 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -137,9 +137,9 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP int i = 0, j; if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) { GetDlgItemTextA(hwnd, IDC_STRING, tmp, SIZEOF(tmp)); - if (tmp[strlen(tmp) - 1] == '(') { + if (tmp[mir_strlen(tmp) - 1] == '(') { for (i = 0; i < VARS; i++) { - if (!strcmp(braceList[i].var, &tmp[strlen(tmp) - strlen(braceList[i].var)])) { + if (!strcmp(braceList[i].var, &tmp[mir_strlen(tmp) - mir_strlen(braceList[i].var)])) { for (j = 0; j < MAX_BRACES; j++) { if (!braceOrder[j]) { braceOrder[j] = i; @@ -153,7 +153,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP } } } - else if (tmp[strlen(tmp) - 1] == ')') { + else if (tmp[mir_strlen(tmp) - 1] == ')') { for (j = 0; j < MAX_BRACES; j++) { if (!braceOrder[j]) { EnableWindow(GetDlgItem(hwnd, braceList[braceOrder[j - 1]].idCtrl), 0); diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index 1c183c482d..d91012ab1c 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -110,7 +110,7 @@ void readFile(HWND hwnd) return; } - if (!strncmp("http://", szFileName, strlen("http://")) || !strncmp("https://", szFileName, strlen("https://"))) + if (!strncmp("http://", szFileName, mir_strlen("http://")) || !strncmp("https://", szFileName, mir_strlen("https://"))) mir_snprintf(szFileName, SIZEOF(szFileName), "%s\\plugins\\fn%d.html", getMimDir(temp), fileNumber); FILE *filen = fopen(szFileName, "r"); @@ -122,17 +122,17 @@ void readFile(HWND hwnd) SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_RESETCONTENT, 0, 0); while (lineNumber < (MAXLINES) && (fgets(temp, MAX_STRING_LENGTH, filen))) { if (temp[0] == '\t') temp[0] = ' '; - if (temp[strlen(temp) - 1] == '\n' && temp[strlen(temp) - 2] == '\r') - temp[strlen(temp) - 2] = '\0'; - else if (temp[strlen(temp) - 1] == '\n') - temp[strlen(temp) - 1] = '\0'; - else temp[strlen(temp)] = '\0'; + if (temp[mir_strlen(temp) - 1] == '\n' && temp[mir_strlen(temp) - 2] == '\r') + temp[mir_strlen(temp) - 2] = '\0'; + else if (temp[mir_strlen(temp) - 1] == '\n') + temp[mir_strlen(temp) - 1] = '\0'; + else temp[mir_strlen(temp)] = '\0'; mir_snprintf(temp1, SIZEOF(temp1), Translate("line(%-3d) = | %s"), lineNumber, temp); SendDlgItemMessageA(hwnd, IDC_FILE_CONTENTS, LB_ADDSTRING, 0, (LPARAM)temp1); lineNumber++; fileLength++; - if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5))) - SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)), 0); + if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (mir_strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5))) + SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (mir_strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)), 0); } fclose(filen); } @@ -150,7 +150,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mir_snprintf(fn, SIZEOF(fn), "fn%d", i); SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_RESETCONTENT, 0, 0); if (db_get_static(NULL, MODNAME, fn, string, SIZEOF(string))) { - if ((!strncmp("http://", string, strlen("http://"))) || (!strncmp("https://", string, strlen("https://")))) { + if ((!strncmp("http://", string, mir_strlen("http://"))) || (!strncmp("https://", string, mir_strlen("https://")))) { SetDlgItemTextA(hwnd, IDC_URL, string); mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i); SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10)); @@ -259,7 +259,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SetDlgItemTextA(hwnd, IDC_FN, _itoa(index, fn, 10)); mir_snprintf(fn, SIZEOF(fn), "fn%d", index); if (db_get_static(NULL, MODNAME, fn, tmp, SIZEOF(tmp))) { - if (!strncmp("http://", tmp, strlen("http://")) || !strncmp("https://", tmp, strlen("https://"))) { + if (!strncmp("http://", tmp, mir_strlen("http://")) || !strncmp("https://", tmp, mir_strlen("https://"))) { SetDlgItemTextA(hwnd, IDC_URL, tmp); mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", index); SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10)); @@ -296,7 +296,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) else timer = 60; if (db_get_static(NULL, MODNAME, fn, string, SIZEOF(string))) - if (!strncmp("http://", string, strlen("http://")) || !strncmp("https://", string, strlen("https://"))) { + if (!strncmp("http://", string, mir_strlen("http://")) || !strncmp("https://", string, mir_strlen("https://"))) { mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i); db_set_w(NULL, MODNAME, fn, (WORD)timer); } @@ -318,7 +318,7 @@ char* getMimDir(char* file) *p1 = '\0'; if (file[0] == '\\') - file[strlen(file) - 1] = '\0'; + file[mir_strlen(file) - 1] = '\0'; return file; } diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index e45120f8a7..edfa7dd539 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -24,11 +24,11 @@ int readFileIntoArray(int fileNumber, char *FileContents[]) // free this array before stringReplacer() returns int i; for (i = 0; fgets(temp, MAX_STRING_LENGTH - 1, file); i++) { - if (temp[strlen(temp) - 1] == '\n') - temp[strlen(temp) - 1] = '\0'; - else temp[strlen(temp)] = '\0'; + if (temp[mir_strlen(temp) - 1] == '\n') + temp[mir_strlen(temp) - 1] = '\0'; + else temp[mir_strlen(temp)] = '\0'; - FileContents[i] = (char*)malloc(strlen(temp) + 1); + FileContents[i] = (char*)malloc(mir_strlen(temp) + 1); if (FileContents[i] == NULL) break; strcpy(FileContents[i], temp); } @@ -49,18 +49,18 @@ int findWordInString(const char* line, const char* string, int* lengthOfWord, in strncpy(OpenDivider, "(\"", sizeof(OpenDivider)); strncpy(CloseDivider, "\")", sizeof(CloseDivider)); /* get the word we r looking for */ - if (!strncmp(string, OpenDivider, strlen(OpenDivider))) { - for (i = 2; strncmp(&string[i], CloseDivider, strlen(CloseDivider)); i++) { + if (!strncmp(string, OpenDivider, mir_strlen(OpenDivider))) { + for (i = 2; strncmp(&string[i], CloseDivider, mir_strlen(CloseDivider)); i++) { word[j] = string[i]; word[++j] = '\0'; } } i = 0; - *lengthOfWord = (int)(strlen(word) + strlen(CloseDivider) + strlen(OpenDivider)); + *lengthOfWord = (int)(mir_strlen(word) + mir_strlen(CloseDivider) + mir_strlen(OpenDivider)); /* find the word in the line */ - while (i < (strlen(line) - strlen(word))) { - if (!strncmp(&line[i], word, strlen(word))) { - if (!flag) return i + (int)strlen(word); /* the next char after the word */ + while (i < (mir_strlen(line) - mir_strlen(word))) { + if (!strncmp(&line[i], word, mir_strlen(word))) { + if (!flag) return i + (int)mir_strlen(word); /* the next char after the word */ else return i; /* the char before the word */ } i++; @@ -79,16 +79,16 @@ int findLine(char* FileContents[], const char* string, int linesInFile, int star // check if its a number if (i != -1) { - *positionInOldString += (int)strlen(_itoa(i, tmp, 10)) - 1; + *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)) - 1; return i; } // lastline - if (!strncmp(&string[*positionInOldString], "lastline(", strlen("lastline("))) { - *positionInOldString += (int)strlen("lastline("); + if (!strncmp(&string[*positionInOldString], "lastline(", mir_strlen("lastline("))) { + *positionInOldString += (int)mir_strlen("lastline("); i = getNumber(&string[*positionInOldString]); if (i != -1) { - *positionInOldString += (int)strlen(_itoa(i, tmp, 10)); + *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)); return linesInFile - (i + 1); } @@ -114,14 +114,14 @@ int findLine(char* FileContents[], const char* string, int linesInFile, int star } i = -1; } - *positionInOldString += (int)(strlen(string2Find) + strlen("\"\")")); + *positionInOldString += (int)(mir_strlen(string2Find) + mir_strlen("\"\")")); if (i == -1) return i; // allow for a +- after the word to go up or down lines if (string[*positionInOldString] == '+') { *positionInOldString += 1; j = getNumber(&string[*positionInOldString]); if (j != -1) { - *positionInOldString += (int)strlen(_itoa(j, tmp, 10)) - 2; + *positionInOldString += (int)mir_strlen(_itoa(j, tmp, 10)) - 2; return i + j; } } @@ -129,7 +129,7 @@ int findLine(char* FileContents[], const char* string, int linesInFile, int star *positionInOldString += 1; j = getNumber(&string[*positionInOldString]); if (j != -1) { - *positionInOldString += (int)strlen(_itoa(j, tmp, 10)) - 2; + *positionInOldString += (int)mir_strlen(_itoa(j, tmp, 10)) - 2; return i - j; } } @@ -147,7 +147,7 @@ int findChar(char* FileContents[], const char* string, int linesInFile, int star int i = getNumber(&string[*positionInOldString]); // check if its a number if (i != -1) { - *positionInOldString += (int)strlen(_itoa(i, tmp, 10)) - 1; + *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)) - 1; return i; } @@ -161,22 +161,22 @@ int findChar(char* FileContents[], const char* string, int linesInFile, int star string2Find[++j] = '\0'; } // find the word - for (j = 0; j < strlen(FileContents[startLine]); j++) - if (!strncmp(&FileContents[startLine][j], string2Find, strlen(string2Find))) + for (j = 0; j < mir_strlen(FileContents[startLine]); j++) + if (!strncmp(&FileContents[startLine][j], string2Find, mir_strlen(string2Find))) break; - if (j == strlen(FileContents[startLine])) + if (j == mir_strlen(FileContents[startLine])) return -1; - *positionInOldString += (int)strlen(string2Find) + 1; - return (startEnd) ? j : j + (int)strlen(string2Find); + *positionInOldString += (int)mir_strlen(string2Find) + 1; + return (startEnd) ? j : j + (int)mir_strlen(string2Find); } // csv( - if (!strncmp(&string[*positionInOldString], "csv(", strlen("csv("))) { + if (!strncmp(&string[*positionInOldString], "csv(", mir_strlen("csv("))) { char seperator; int j = 0, k = startChar; - *positionInOldString += (int)strlen("csv("); + *positionInOldString += (int)mir_strlen("csv("); if (!strncmp(&string[*positionInOldString], "tab", 3)) { *positionInOldString += 3; seperator = '\t'; @@ -191,7 +191,7 @@ int findChar(char* FileContents[], const char* string, int linesInFile, int star } i = getNumber(&string[*positionInOldString]); if (i == -1) return -1; - *positionInOldString += (int)strlen(_itoa(i, tmp, 10)); + *positionInOldString += (int)mir_strlen(_itoa(i, tmp, 10)); while (j < i) { if (FileContents[startLine][k] == '\0') break; if (FileContents[startLine][k] == seperator) @@ -207,17 +207,17 @@ int findChar(char* FileContents[], const char* string, int linesInFile, int star void checkStringForcompare(char *str) { if (!strstr(str, "compare(\"")) return; - char *A, *B, *X, *Y, *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str); - unsigned int i, j = 0, s = (int)strlen(str); + char *A, *B, *X, *Y, *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str); + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "compare(\"", strlen("compare(\""))) { - i += (int)strlen("compare(\""); + if (!strncmp(&str[i], "compare(\"", mir_strlen("compare(\""))) { + i += (int)mir_strlen("compare(\""); A = strtok(©OfStr[i], "\",\""); B = strtok(NULL, "\",\""); X = strtok(NULL, "\",\""); Y = strtok(NULL, ",\")"); - j = Y - ©OfStr[i] + (int)strlen(Y) + 1; + j = Y - ©OfStr[i] + (int)mir_strlen(Y) + 1; if (A && B && X && Y) { if (!strcmp(A, B)) strcat(newStr, X); @@ -237,15 +237,15 @@ void checkStringForcompare(char *str) void checkStringForSave(MCONTACT hContact, char* str) { if (!strstr(str, "save(\"")) return; - char *A, *B, *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str); - unsigned int i, j = 0, s = (int)strlen(str); + char *A, *B, *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str); + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "save(\"", strlen("save(\""))) { - i += (int)strlen("save(\""); + if (!strncmp(&str[i], "save(\"", mir_strlen("save(\""))) { + i += (int)mir_strlen("save(\""); A = strtok(©OfStr[i], "\",\""); B = strtok(NULL, ",\")"); - j = B - ©OfStr[i] + (int)strlen(B) + 1; + j = B - ©OfStr[i] + (int)mir_strlen(B) + 1; if (A && B) db_set_s(hContact, MODNAME, A, B); @@ -263,14 +263,14 @@ void checkStringForSave(MCONTACT hContact, char* str) void checkStringForLoad(MCONTACT hContact, char* str) { if (!strstr(str, "load(\"")) return; - char *A, *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str); - unsigned int i, j = 0, s = (int)strlen(str); + char *A, *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str); + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "load(\"", strlen("load(\""))) { - i += (int)strlen("load(\""); + if (!strncmp(&str[i], "load(\"", mir_strlen("load(\""))) { + i += (int)mir_strlen("load(\""); A = strtok(©OfStr[i], "\")"); - j = A - ©OfStr[i] + (int)strlen(A) + 1; + j = A - ©OfStr[i] + (int)mir_strlen(A) + 1; if (A) { DBVARIANT dbv; if (!db_get_s(hContact, MODNAME, A, &dbv)) { @@ -292,17 +292,17 @@ void checkStringForLoad(MCONTACT hContact, char* str) void checkStringForSaveN(char* str) { if (!strstr(str, "saveN(\"")) return; - char *A, *B, *C, *D, *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str); - unsigned int i, j = 0, s = (int)strlen(str); + char *A, *B, *C, *D, *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str); + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "saveN(\"", strlen("saveN(\""))) { - i += (int)strlen("saveN(\""); + if (!strncmp(&str[i], "saveN(\"", mir_strlen("saveN(\""))) { + i += (int)mir_strlen("saveN(\""); A = strtok(©OfStr[i], "\",\""); B = strtok(NULL, ",\""); C = strtok(NULL, ",\""); D = strtok(NULL, ",\")"); - j = D - ©OfStr[i] + (int)strlen(D) + 1; + j = D - ©OfStr[i] + (int)mir_strlen(D) + 1; if (A && B && C && D) { switch (D[0]) { case '0': @@ -337,16 +337,16 @@ void checkStringForSaveN(char* str) void checkStringForLoadN(char* str) { if (!strstr(str, "loadN(\"")) return; - char *newStr = (char*)malloc(strlen(str)), *copyOfStr = _strdup(str), temp[32]; - unsigned int i, j = 0, s = (int)strlen(str); + char *newStr = (char*)malloc(mir_strlen(str)), *copyOfStr = _strdup(str), temp[32]; + unsigned int i, j = 0, s = (int)mir_strlen(str); newStr[0] = '\0'; for (i = 0; i < s; i++) { - if (!strncmp(&str[i], "loadN(\"", strlen("loadN(\""))) { - i += (int)strlen("loadN(\""); + if (!strncmp(&str[i], "loadN(\"", mir_strlen("loadN(\""))) { + i += (int)mir_strlen("loadN(\""); char *A = strtok(©OfStr[i], "\",\""); char *B = strtok(NULL, ",\")"); if (A && B) { - j = B - ©OfStr[i] + (int)strlen(B) + 1; + j = B - ©OfStr[i] + (int)mir_strlen(B) + 1; DBVARIANT dbv; if (!db_get(NULL, A, B, &dbv)) { switch (dbv.type) { @@ -401,7 +401,7 @@ BOOL GetLastWriteTime(HANDLE hFile, LPSTR lpszString) int lastChecked(char *newStr, const char *str) { char *szPattern = "lastchecked(file("; - size_t cbPattern = strlen(szPattern); + size_t cbPattern = mir_strlen(szPattern); if (!strncmp(str, szPattern, cbPattern)) { int file; @@ -427,7 +427,7 @@ int lastChecked(char *newStr, const char *str) CloseHandle(hFile); strcat(newStr, tszFileName); mir_snprintf(tszFileName, SIZEOF(tszFileName), "%s%d))", szPattern, file); - return (int)strlen(tszFileName); + return (int)mir_strlen(tszFileName); } CloseHandle(hFile); } @@ -458,10 +458,10 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) strncpy(newString, "", sizeof(newString)); strncpy(var_file, "file(", sizeof(var_file)); - while ((positionInOldString < (int)strlen(oldString)) && (oldString[positionInOldString] != '\0')) { + while ((positionInOldString < (int)mir_strlen(oldString)) && (oldString[positionInOldString] != '\0')) { // load the file... must be first - if (!strncmp(&oldString[positionInOldString], var_file, strlen(var_file))) { - positionInOldString += (int)strlen(var_file); + if (!strncmp(&oldString[positionInOldString], var_file, mir_strlen(var_file))) { + positionInOldString += (int)mir_strlen(var_file); // check if its a number tempInt = getNumber(&oldString[positionInOldString]); if (tempInt == -1) { @@ -473,11 +473,11 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) linesInFile = readFileIntoArray(tempInt, fileContents); if (linesInFile == 0) return ERROR_NO_FILE; - positionInOldString += (int)strlen(_itoa(tempInt, tempString, 10)) + 1; // +1 for the closing ) + positionInOldString += (int)mir_strlen(_itoa(tempInt, tempString, 10)) + 1; // +1 for the closing ) // wholeline() - if (!strncmp(&oldString[positionInOldString], "wholeline(line(", strlen("wholeline(line("))) { - positionInOldString += (int)strlen("wholeline(line("); + if (!strncmp(&oldString[positionInOldString], "wholeline(line(", mir_strlen("wholeline(line("))) { + positionInOldString += (int)mir_strlen("wholeline(line("); tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString); if (tempInt == -1 || !fileContents[tempInt]) return ERROR_NO_LINE_AFTER_VAR_F; @@ -485,8 +485,8 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) positionInOldString += 3; // add 2 for the )) for wholeline(line()) } - if (!strncmp(&oldString[positionInOldString], "start(", strlen("start("))) { - positionInOldString += (int)strlen("start(line("); + if (!strncmp(&oldString[positionInOldString], "start(", mir_strlen("start("))) { + positionInOldString += (int)mir_strlen("start(line("); tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString); if (tempInt == -1 || !fileContents[tempInt]) return ERROR_NO_LINE_AFTER_VAR_F; @@ -494,7 +494,7 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) positionInOldString += 2; startLine = tempInt; if (!endChar) - endChar = (int)strlen(fileContents[startLine]); + endChar = (int)mir_strlen(fileContents[startLine]); tempInt = findChar(fileContents, oldString, linesInFile, startLine, &positionInOldString, startChar, 0); if (tempInt == -1) return ERROR_NO_LINE_AFTER_VAR_F; @@ -502,8 +502,8 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) } positionInOldString += 2; // add 2 for the )) for start(line()) } - if (!strncmp(&oldString[positionInOldString], "end(", strlen("end("))) { - positionInOldString += (int)strlen("end(line("); + if (!strncmp(&oldString[positionInOldString], "end(", mir_strlen("end("))) { + positionInOldString += (int)mir_strlen("end(line("); tempInt = findLine(fileContents, oldString, linesInFile, startLine, &positionInOldString); if (tempInt == -1 || !fileContents[tempInt]) return ERROR_NO_LINE_AFTER_VAR_F; @@ -539,8 +539,8 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) } } // filename() - else if (!strncmp(&oldString[positionInOldString], "filename(", strlen("filename("))) { - positionInOldString += (int)strlen("filename("); + else if (!strncmp(&oldString[positionInOldString], "filename(", mir_strlen("filename("))) { + positionInOldString += (int)mir_strlen("filename("); tempInt = getNumber(&oldString[positionInOldString]); if (tempInt == -1) { return ERROR_NO_FILE; @@ -550,11 +550,11 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) if (db_get_static(NULL, MODNAME, tempString, tempString, SIZEOF(tempString))) strcat(newString, tempString); else return ERROR_NO_FILE; - positionInOldString += (int)strlen(_itoa(tempInt, tempString, 10)) + 1; + positionInOldString += (int)mir_strlen(_itoa(tempInt, tempString, 10)) + 1; } } // lastchecked(file(X)) - else if (!strncmp(&oldString[positionInOldString], "lastchecked(file(", strlen("lastchecked(file("))) { + else if (!strncmp(&oldString[positionInOldString], "lastchecked(file(", mir_strlen("lastchecked(file("))) { positionInOldString += lastChecked(newString, &oldString[positionInOldString]); } else { diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index 9d81dbd70b..a3195ecad3 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -27,7 +27,7 @@ void timerFunc(void *di) if (!db_get_static(NULL, MODNAME, fn, text, SIZEOF(text))) break; - if (!strncmp("http://", text, strlen("http://")) || !strncmp("https://", text, strlen("https://"))) { + if (!strncmp("http://", text, mir_strlen("http://")) || !strncmp("https://", text, mir_strlen("https://"))) { mir_snprintf(fn, SIZEOF(fn), "fn%d_timer", i); int timer = db_get_w(NULL, MODNAME, fn, 60); if (timer && !(timerCount % timer)) { -- cgit v1.2.3