From 6fcfba2c46a456677b5825a899469ba4e8905448 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 23 May 2015 17:49:58 +0000 Subject: replace strncpy to mir_strncpy git-svn-id: http://svn.miranda-ng.org/main/trunk@13785 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/WebView/src/webview_alerts.cpp | 6 +++--- plugins/WebView/src/webview_cleanup.cpp | 34 ++++++++++++++++----------------- plugins/WebView/src/webview_datawnd.cpp | 2 +- plugins/WebView/src/webview_getdata.cpp | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'plugins/WebView') diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index feffb27c1f..ed6169c3d9 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -272,7 +272,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn memset(&tempraw, 0, sizeof(tempraw)); memset(&raw, 0, sizeof(raw)); - strncpy(tempraw, truncated, SIZEOF(tempraw)); + mir_strncpy(tempraw, truncated, SIZEOF(tempraw)); memset(&alertstring, 0, sizeof(alertstring)); memset(&Alerttempstring, 0, sizeof(Alerttempstring)); @@ -562,7 +562,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn disalertpos = 0; //write selected data to string - strncpy(raw, &tempraw[statalertpos], (statalertposend - statalertpos)); + mir_strncpy(raw, &tempraw[statalertpos], (statalertposend - statalertpos)); raw[(statalertposend - statalertpos)] = '\0'; } } // end putting data into string @@ -760,7 +760,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn } } } - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); return wasAlert; } diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp index 67a4ee5a1d..b645cb5e5d 100644 --- a/plugins/WebView/src/webview_cleanup.cpp +++ b/plugins/WebView/src/webview_cleanup.cpp @@ -386,7 +386,7 @@ void CodetoSymbol(char *truncated) } truncated[(position + counter) - 1] = Characters[n]; - strncpy(&truncated[position], &truncated[position + mir_strlen(CharacterCodes[n])] - 1, mir_strlen(&truncated[position]) - 1); + mir_strncpy(&truncated[position], &truncated[position + mir_strlen(CharacterCodes[n])] - 1, mir_strlen(&truncated[position]) - 1); } // end does character code exist? if (recpos == position) @@ -407,7 +407,7 @@ void EraseBlock(char *truncated) char* tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); // /////////////////////////// @@ -584,7 +584,7 @@ void EraseBlock(char *truncated) positionStart = 0; positionEnd = 0; - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -597,7 +597,7 @@ void EraseSymbols(char *truncated) char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); // ////// while (true) { @@ -625,7 +625,7 @@ void EraseSymbols(char *truncated) recpos = position; } - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -640,7 +640,7 @@ void NumSymbols(char *truncated) char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); while (true) { Sleep(1); // avoid 100% CPU @@ -678,7 +678,7 @@ void NumSymbols(char *truncated) recpos = position; } - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -687,7 +687,7 @@ void FastTagFilter(char *truncated) { char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); for (int counter = 0; counter < mir_strlen(tempraw); counter++) { if (tempraw[counter] == '<') { @@ -703,7 +703,7 @@ void FastTagFilter(char *truncated) } } - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -715,7 +715,7 @@ void RemoveInvis(char *truncated, int AmountWspcRem) char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); switch (AmountWspcRem) { case 1: @@ -745,7 +745,7 @@ void RemoveInvis(char *truncated, int AmountWspcRem) tempraw[counter] = ' '; } // end for - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -754,13 +754,13 @@ void RemoveTabs(char *truncated) { char *tempraw = (char*)malloc(MAXSIZE1); if (truncated) - strncpy(tempraw, truncated, MAXSIZE1); + mir_strncpy(tempraw, truncated, MAXSIZE1); for (int counter = 0; counter < mir_strlen(tempraw); counter++) if (tempraw[counter] == '\t') tempraw[counter] = ' '; - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); free(tempraw); } @@ -779,7 +779,7 @@ void Removewhitespace(char *truncated) counter2++; pos2 = counter2; - strncpy(&truncated[pos1], &truncated[pos2], mir_strlen(&truncated[pos1]) - 1); + mir_strncpy(&truncated[pos1], &truncated[pos2], mir_strlen(&truncated[pos1]) - 1); } // end if } // end for } @@ -788,11 +788,11 @@ void Removewhitespace(char *truncated) void Filter(char *truncated) { char tempraw[MAXSIZE1]; - strncpy(tempraw, truncated, SIZEOF(tempraw)); + mir_strncpy(tempraw, truncated, SIZEOF(tempraw)); for (int counter = 0; counter < mir_strlen(tempraw); counter++) if ((tempraw[counter] == '\n') || (tempraw[counter] == '\r') || (tempraw[counter] == '\t')) - strncpy(&tempraw[counter], &tempraw[counter + 1], mir_strlen(&tempraw[counter]) - 1); + mir_strncpy(&tempraw[counter], &tempraw[counter + 1], mir_strlen(&tempraw[counter]) - 1); - strncpy(truncated, tempraw, mir_strlen(truncated)); + mir_strncpy(truncated, tempraw, mir_strlen(truncated)); } diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 8857e78d1a..eaa1728cc3 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -58,7 +58,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara char *tempbuffer = (char*)malloc(len + 2); GetDlgItemTextA(ParentHwnd, IDC_DATA, tempbuffer, len); - strncpy(buff, tempbuffer, SIZEOF(buff)); + mir_strncpy(buff, tempbuffer, SIZEOF(buff)); free(tempbuffer); Filter(buff); diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index a542e21c0a..3c01680add 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -225,7 +225,7 @@ void GetData(void *param) } dispos = 0; - strncpy(raw, &truncated2[statpos], MallocSize); + mir_strncpy(raw, &truncated2[statpos], MallocSize); raw[MallocSize] = '\0'; trunccount = 0; @@ -334,7 +334,7 @@ void GetData(void *param) eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0); if (eventIndex == 2) { - strncpy(buff, truncated, SIZEOF(buff)); + mir_strncpy(buff, truncated, SIZEOF(buff)); Filter(buff); if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &dbv)) { -- cgit v1.2.3