From 4c814798c7bc7f6a0f92c21b027b26290622aa2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 19:35:42 +0000 Subject: SIZEOF replaced with more secure analog - _countof git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FileAsMessage/src/dialog.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'plugins/FileAsMessage/src/dialog.cpp') diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index c958e08dcc..1edaf90842 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -193,7 +193,7 @@ void FILEECHO::setState(DWORD state) iState = state; int indx; - for (indx = 0; indx < SIZEOF(controlEnabled); indx++) + for (indx = 0; indx < _countof(controlEnabled); indx++) { EnableWindow(GetDlgItem(hDlg, controlEnabled[indx][0]), (iState & controlEnabled[indx][1]) != 0); } @@ -243,9 +243,9 @@ void FILEECHO::updateTitle() contactName = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0); if (iState == STATE_OPERATE && chunkCount != 0) - mir_snprintf(newtitle, SIZEOF(newtitle), "%d%% - %s: %s", chunkSent * 100 / chunkCount, Translate(szFEMode[inSend]), contactName); + mir_snprintf(newtitle, _countof(newtitle), "%d%% - %s: %s", chunkSent * 100 / chunkCount, Translate(szFEMode[inSend]), contactName); else - mir_snprintf(newtitle, SIZEOF(newtitle), "%s: %s", Translate(szFEMode[inSend]), contactName); + mir_snprintf(newtitle, _countof(newtitle), "%s: %s", Translate(szFEMode[inSend]), contactName); SetWindowText(hDlg, newtitle); } @@ -412,9 +412,9 @@ void FILEECHO::sendReq() if (*p == '\\') mir_strcpy(filename, p + 1); - mir_snprintf(sendbuf, SIZEOF(sendbuf), Translate("Size: %d bytes"), fileSize); + mir_snprintf(sendbuf, _countof(sendbuf), Translate("Size: %d bytes"), fileSize); SetDlgItemText(hDlg, IDC_FILESIZE, sendbuf); - mir_snprintf(sendbuf, SIZEOF(sendbuf), "?%c%c%d:%d \n" NOPLUGIN_MESSAGE, asBinary + '0', codeSymb, chunkCount, fileSize); + mir_snprintf(sendbuf, _countof(sendbuf), "?%c%c%d:%d \n" NOPLUGIN_MESSAGE, asBinary + '0', codeSymb, chunkCount, fileSize); sendCmd(0, CMD_REQ, sendbuf, filename); SetDlgItemText(hDlg, IDC_STATUS, Translate("Request sent. Awaiting of acceptance..")); @@ -429,7 +429,7 @@ void FILEECHO::incomeRequest(char *param) char *p = strchr(param, '?'); if (p == NULL) return; *p++ = 0; CallService(MS_FILE_GETRECEIVEDFILESFOLDER, hContact, (LPARAM)buf); - mir_strncat(buf, param, SIZEOF(buf) - mir_strlen(buf)); + mir_strncat(buf, param, _countof(buf) - mir_strlen(buf)); free(filename); filename = mir_strdup(buf); // p == &c @@ -618,7 +618,7 @@ void FILEECHO::onSendTimer() } char prefix[128]; - mir_snprintf(prefix, SIZEOF(prefix), "%X,%X,%X>", chunkIndx + 1, chunkPos[chunkIndx], chksum); + mir_snprintf(prefix, _countof(prefix), "%X,%X,%X>", chunkIndx + 1, chunkPos[chunkIndx], chksum); #ifdef DEBUG overhead += mir_tstrlen((char*)buffer); #endif @@ -869,7 +869,7 @@ void CreateDirectoryTree(char *szDir) DWORD dwAttributes; char *pszLastBackslash, szTestDir[MAX_PATH]; - mir_strncpy(szTestDir, szDir, SIZEOF(szTestDir)); + mir_strncpy(szTestDir, szDir, _countof(szTestDir)); if ((dwAttributes = GetFileAttributes(szTestDir)) != 0xffffffff && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) return; pszLastBackslash = strrchr(szTestDir, '\\'); @@ -1151,7 +1151,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) memset(&ofn, 0, sizeof(ofn)); *str = 0; - GetDlgItemText(hDlg, IDC_FILENAME, str, SIZEOF(str)); + GetDlgItemText(hDlg, IDC_FILENAME, str, _countof(str)); //ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hDlg; @@ -1159,7 +1159,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) ofn.lpstrFile = str; ofn.Flags = dat->inSend ? OFN_FILEMUSTEXIST : 0; ofn.lpstrTitle = dat->inSend ? Translate("Select a file") : Translate("Save as"); - ofn.nMaxFile = SIZEOF(str); + ofn.nMaxFile = _countof(str); ofn.nMaxFileTitle = MAX_PATH; if (!GetOpenFileName(&ofn)) break; if (!dat->inSend && dat->iState == STATE_FINISHED) break; @@ -1169,7 +1169,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (size != -1) mir_snprintf(str, Translate("Size: %d bytes"), size); else - mir_strncpy(str, Translate("Can't get a file size"), SIZEOF(str)); + mir_strncpy(str, Translate("Can't get a file size"), _countof(str)); SetDlgItemText(hDlg, IDC_FILESIZE, str); break; -- cgit v1.2.3