From babf7873a3fe373d60ef22b1b671d98e014d8819 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 22 May 2015 19:52:29 +0000 Subject: replace strcpy to mir_strcpy git-svn-id: http://svn.miranda-ng.org/main/trunk@13763 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HTTPServer/src/FileShareNode.cpp | 6 +++--- plugins/HTTPServer/src/GuiElements.cpp | 10 +++++----- plugins/HTTPServer/src/HttpUser.cpp | 6 +++--- plugins/HTTPServer/src/IndexHTML.cpp | 8 ++++---- plugins/HTTPServer/src/IndexXML.cpp | 8 ++++---- plugins/HTTPServer/src/MimeHandling.cpp | 6 +++--- plugins/HTTPServer/src/main.cpp | 10 +++++----- 7 files changed, 27 insertions(+), 27 deletions(-) (limited to 'plugins/HTTPServer/src') diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp index a9675f49cf..a0307cad11 100644 --- a/plugins/HTTPServer/src/FileShareNode.cpp +++ b/plugins/HTTPServer/src/FileShareNode.cpp @@ -209,7 +209,7 @@ bool CLFileShareNode::bSetPaths(char * pszSrvPath, char * pszRealPath) { st.dwMaxSrvPath = (int)mir_strlen(pszSrvPath) + 1; st.pszSrvPath = new char[ st.dwMaxSrvPath ]; - strcpy(st.pszSrvPath, pszSrvPath); + mir_strcpy(st.pszSrvPath, pszSrvPath); int nRealLen = (int)mir_strlen(pszRealPath); if (nRealLen <= 2 || !(pszRealPath[1] == ':' || @@ -218,14 +218,14 @@ bool CLFileShareNode::bSetPaths(char * pszSrvPath, char * pszRealPath) { // we will prepend plugin path to avoid problems st.dwMaxRealPath = nPluginPathLen + nRealLen + 1; st.pszRealPath = new char[ st.dwMaxRealPath ]; - strcpy(st.pszRealPath, szPluginPath); + mir_strcpy(st.pszRealPath, szPluginPath); pszOrigRealPath = &st.pszRealPath[nPluginPathLen]; } else { st.dwMaxRealPath = nRealLen + 1; st.pszRealPath = new char[ st.dwMaxRealPath ]; pszOrigRealPath = st.pszRealPath; } - strcpy(pszOrigRealPath, pszRealPath); + mir_strcpy(pszOrigRealPath, pszRealPath); return true; } diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 0af77ce591..d936a59018 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -300,7 +300,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( } else { // a directory was selected pNotify->lpOFN->Flags &= ~OFN_FILEMUSTEXIST; - strcpy(pNotify->lpOFN->lpstrFile, pszShareDirStr); + mir_strcpy(pNotify->lpOFN->lpstrFile, pszShareDirStr); CommDlg_OpenSave_SetControlText(hWndFileDlg, edt1, pszShareDirStr); EnableWindow(hFileName, FALSE); EnableWindow(GetDlgItem(hDlg, IDC_MAX_DOWNLOADS), FALSE); @@ -341,7 +341,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( SetDlgItemText(hDlg, IDC_SHARE_NAME, szSelection); } - strcpy(pstShare->pszSrvPath, szSelection); + mir_strcpy(pstShare->pszSrvPath, szSelection); return false; } @@ -444,7 +444,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { char szInitialDir[MAX_PATH]; if (ofn.lpstrFile[mir_strlen(ofn.lpstrFile)-1] == '\\') { ofn.lpstrInitialDir = szInitialDir; - strcpy(szInitialDir, ofn.lpstrFile); + mir_strcpy(szInitialDir, ofn.lpstrFile); *ofn.lpstrFile = '\0'; } @@ -602,7 +602,7 @@ void UpdateStatisticView(HWND hwndDlg, bool bRefressUsersOnly = false) { if (pclCurUser->dwTotalSize) { mir_snprintf(szTmp, SIZEOF(szTmp), "%d %%", (pclCurUser->dwCurrentDL * 100) / pclCurUser->dwTotalSize); } else { - strcpy(szTmp, "? %%"); + mir_strcpy(szTmp, "? %%"); } sItem.iSubItem = 3; sItem.pszText = szTmp; @@ -918,7 +918,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, sLink.size() + 1); // Lock the handle and copy the text to the buffer. char * lptstrCopy = (char *)GlobalLock(hglbCopy); - strcpy(lptstrCopy, sLink.c_str()); + mir_strcpy(lptstrCopy, sLink.c_str()); GlobalUnlock(hglbCopy); // Place the handle on the clipboard. diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index c8f111d5c2..e1398215bc 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -472,14 +472,14 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { hFile = CreateFile(szTempfile, GENERIC_READ , FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - strcpy(szRealPath, "a.xml"); // restore .xml for mime type + mir_strcpy(szRealPath, "a.xml"); // restore .xml for mime type } else if ((indexCreationMode == INDEX_CREATION_HTML || indexCreationMode == INDEX_CREATION_DETECT) && bCreateIndexHTML(pszRealPath, szTempfile, pszSrvPath, dwRemoteIP)) { hFile = CreateFile(szTempfile, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - strcpy(szRealPath, "a.html"); // restore .html for mime type + mir_strcpy(szRealPath, "a.html"); // restore .html for mime type } else { continue; } @@ -504,7 +504,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { } } - strcpy(this->szCurrentDLSrvPath, pszSrvPath); + mir_strcpy(this->szCurrentDLSrvPath, pszSrvPath); DWORD nDataSize = GetFileSize(hFile, NULL); dwTotalSize = nDataSize; diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp index a37ef808db..222e1bca5c 100644 --- a/plugins/HTTPServer/src/IndexHTML.cpp +++ b/plugins/HTTPServer/src/IndexHTML.cpp @@ -234,7 +234,7 @@ bool LoadIndexHTMLTemplate() { //LogEvent("Template", szDestBuf); szIndexHTMLTemplate = new char[mir_strlen(szDestBuf)+1]; - strcpy(szIndexHTMLTemplate, szDestBuf); + mir_strcpy(szIndexHTMLTemplate, szDestBuf); } CloseHandle(hFile); @@ -329,7 +329,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, strncpy(szName, pszTemp + 1, SIZEOF(szName)-1); if (szName[0] == '\0') - strcpy(szName, "my Miranda Webserver"); + mir_strcpy(szName, "my Miranda Webserver"); do { switch (*pszPos) { @@ -369,8 +369,8 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, } if (hFind) { - strcpy(szName, fdFindFileData.cFileName); - strcpy(szURL, fdFindFileData.cFileName); + mir_strcpy(szName, fdFindFileData.cFileName); + mir_strcpy(szURL, fdFindFileData.cFileName); /*char* pszTmp = szURL; while(pszTmp = strchr(pszTmp, ' ')) *pszTmp = '+';*/ diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index 11ee766135..782cb289e2 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -35,8 +35,8 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, strncpy(szBuffer, pszSrc, SIZEOF(szBuffer)-1); do { - strcpy(szBuffer + (pszSign - pszSrc), pszNew); - strcpy(szBuffer + (pszSign - pszSrc) + mir_strlen(pszNew), pszSign + 1); + mir_strcpy(szBuffer + (pszSign - pszSrc), pszNew); + mir_strcpy(szBuffer + (pszSign - pszSrc) + mir_strlen(pszNew), pszSign + 1); *pszSign = ' '; } while (pszSign = strchr(pszSrc, pszReplace)); @@ -133,7 +133,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, (mir_strcmp(fdFindFileData.cFileName, "..") || mir_strcmp(pszSrvPath, "/"))) { // hide .. in root pszBuffer = szBuffer; - strcpy(szFileName, fdFindFileData.cFileName); + mir_strcpy(szFileName, fdFindFileData.cFileName); ReplaceSign(szFileName, MAX_PATH, '&', "&"); if (fdFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { @@ -185,7 +185,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, !strncmp(pclCur->st.pszSrvPath, pszSrvPath, mir_strlen(pszSrvPath))) { pszBuffer = szBuffer; - strcpy(szFileName, &pclCur->st.pszSrvPath[mir_strlen(pszSrvPath)]); + mir_strcpy(szFileName, &pclCur->st.pszSrvPath[mir_strlen(pszSrvPath)]); ReplaceSign(szFileName, MAX_PATH, '&', "&"); if (pclCur->bIsDirectory()) { diff --git a/plugins/HTTPServer/src/MimeHandling.cpp b/plugins/HTTPServer/src/MimeHandling.cpp index 45fead8013..12a45f1946 100644 --- a/plugins/HTTPServer/src/MimeHandling.cpp +++ b/plugins/HTTPServer/src/MimeHandling.cpp @@ -15,7 +15,7 @@ int bInitMimeHandling() { ExtensionListCell *pExtCell = NULL; char szBuf[10000]; - strcpy(szBuf, szPluginPath); + mir_strcpy(szBuf, szPluginPath); strcat(szBuf, szMimeTypeConfigFile); mimeDB = fopen(szBuf, "r"); @@ -40,7 +40,7 @@ int bInitMimeHandling() { /*create and fill a cell*/ pDBCell = (ContentType*)malloc(sizeof(ContentType)); pDBCell->mimeType = (char*)malloc(mir_strlen(tok) + 1); - strcpy(pDBCell->mimeType, tok); + mir_strcpy(pDBCell->mimeType, tok); pDBCell->extList = NULL; pDBCell->next = NULL; /* looking for extensions */ @@ -49,7 +49,7 @@ int bInitMimeHandling() { /*create and fill a cell*/ pExtCell = (ExtensionListCell*)malloc(sizeof(ExtensionListCell)); pExtCell->ext = (char*)malloc(mir_strlen(tok) + 1); - strcpy(pExtCell->ext, tok); + mir_strcpy(pExtCell->ext, tok); pExtCell->next = NULL; /*link*/ if (pDBCell->extList == NULL) { diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index d63307f5f4..5923287f17 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -229,7 +229,7 @@ bool bReadConfigurationFile() { CLFileShareNode * pclLastNode = NULL; char szBuf[1000]; - strcpy(szBuf, szPluginPath); + mir_strcpy(szBuf, szPluginPath); strcat(szBuf, szConfigFile); HANDLE hFile = CreateFile(szBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); @@ -329,7 +329,7 @@ bool bReadConfigurationFile() { bool bWriteConfigurationFile() { CLFileShareListAccess clCritSection; char szBuf[1000]; - strcpy(szBuf, szPluginPath); + mir_strcpy(szBuf, szPluginPath); strcat(szBuf, szConfigFile); HANDLE hFile = CreateFile(szBuf, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { @@ -489,7 +489,7 @@ static INT_PTR nGetShare(WPARAM /*wParam*/, LPARAM lParam) { if (mir_strcmp(pclCur->st.pszSrvPath, pclShare->pszSrvPath) == 0) { if (pclShare->dwMaxRealPath <= mir_strlen(pclCur->st.pszRealPath) + 1) return 1003; - strcpy(pclShare->pszRealPath, pclCur->st.pszRealPath); + mir_strcpy(pclShare->pszRealPath, pclCur->st.pszRealPath); pclShare->dwAllowedIP = pclCur->st.dwAllowedIP; pclShare->dwAllowedMask = pclCur->st.dwAllowedMask; pclShare->nMaxDownloads = pclCur->st.nMaxDownloads; @@ -728,11 +728,11 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) { share.pszRealPath = szRealPath; share.dwMaxRealPath = sizeof(szRealPath); - strcpy(share.pszRealPath, p[0]); + mir_strcpy(share.pszRealPath, p[0]); share.pszSrvPath = szSrvPath; share.dwMaxSrvPath = sizeof(szSrvPath); - strcpy(share.pszSrvPath, p[1]); + mir_strcpy(share.pszSrvPath, p[1]); if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&share)) break; -- cgit v1.2.3