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/HTTPServer/src/FileShareNode.cpp | 4 ++-- plugins/HTTPServer/src/GuiElements.cpp | 22 +++++++++++----------- plugins/HTTPServer/src/HttpUser.cpp | 6 +++--- plugins/HTTPServer/src/IndexHTML.cpp | 2 +- plugins/HTTPServer/src/IndexXML.cpp | 14 +++++++------- plugins/HTTPServer/src/MimeHandling.cpp | 6 +++--- plugins/HTTPServer/src/main.cpp | 10 +++++----- 7 files changed, 32 insertions(+), 32 deletions(-) (limited to 'plugins/HTTPServer') diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp index 5751dd60e2..3f344a35cf 100644 --- a/plugins/HTTPServer/src/FileShareNode.cpp +++ b/plugins/HTTPServer/src/FileShareNode.cpp @@ -207,11 +207,11 @@ bool CLFileShareNode::bSetPaths(char * pszSrvPath, char * pszRealPath) { delete [] st.pszSrvPath; delete [] st.pszRealPath; - st.dwMaxSrvPath = (int)strlen(pszSrvPath) + 1; + st.dwMaxSrvPath = (int)mir_strlen(pszSrvPath) + 1; st.pszSrvPath = new char[ st.dwMaxSrvPath ]; strcpy(st.pszSrvPath, pszSrvPath); - int nRealLen = (int)strlen(pszRealPath); + int nRealLen = (int)mir_strlen(pszRealPath); if (nRealLen <= 2 || !(pszRealPath[1] == ':' || (pszRealPath[0] == '\\' && pszRealPath[1] == '\\'))) { // Relative path diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 593b5aa0fd..f4ccb99546 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -63,7 +63,7 @@ string sPageKeyword = szDefaultPageKeyword; void ReplaceAll(string &sSrc, const char * pszReplace, const string &sNew) { string::size_type nCur = 0; - int nRepalceLen = (int)strlen(pszReplace); + int nRepalceLen = (int)mir_strlen(pszReplace); while ((nCur = sSrc.find(pszReplace, nCur)) != sSrc.npos) { sSrc.replace(nCur, nRepalceLen, sNew); nCur += sNew.size(); @@ -164,7 +164,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) { if (pszIp == NULL) pszIp = nlreply->pData; else - pszIp += strlen(szPattern); + pszIp += mir_strlen(szPattern); while ((*pszIp < '0' || *pszIp > '9') && *pszIp) pszIp++; @@ -291,7 +291,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( // a file was selected // only reenable windows / set default values when a folder was selected before - if (pstShare->pszSrvPath[strlen(pstShare->pszSrvPath)-1] == '/') { + if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath)-1] == '/') { pNotify->lpOFN->Flags |= OFN_FILEMUSTEXIST; EnableWindow(hFileName, TRUE); EnableWindow(GetDlgItem(hDlg, IDC_MAX_DOWNLOADS), TRUE); @@ -319,9 +319,9 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( if (pszTmp != NULL) *pszTmp = '\0'; - memmove(&szSelection[1], pszFolder, strlen(pszFolder) + 1); + memmove(&szSelection[1], pszFolder, mir_strlen(pszFolder) + 1); szSelection[0] = '/'; - if (szSelection[strlen(szSelection)-1] != '/') + if (szSelection[mir_strlen(szSelection)-1] != '/') strcat(szSelection, "/"); // only write to IDC_SHARE_NAME when a file / other folder was selected before @@ -352,11 +352,11 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( char* pszTmp = strstr(pstShare->pszRealPath, pszShareDirStr); if (pszTmp) { *pszTmp = '\0'; - if (pstShare->pszSrvPath[strlen(pstShare->pszSrvPath)-1] != '/') + if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath)-1] != '/') strcat(pstShare->pszSrvPath, "/"); } else { - if (pstShare->pszSrvPath[strlen(pstShare->pszSrvPath)-1] == '/') - pstShare->pszSrvPath[strlen(pstShare->pszSrvPath)-1] = '\0'; + if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath)-1] == '/') + pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath)-1] = '\0'; } BOOL bTranslated = false; @@ -369,7 +369,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( //if( ! (pstShare->dwAllowedIP & pstShare->dwAllowedMask) - if (!bTranslated || (strlen(pstShare->pszSrvPath) <= 0)) { + if (!bTranslated || (mir_strlen(pstShare->pszSrvPath) <= 0)) { SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 1); return true; } @@ -442,7 +442,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { ofn.nMaxFile = pstNewShare->dwMaxRealPath; char szInitialDir[MAX_PATH]; - if (ofn.lpstrFile[strlen(ofn.lpstrFile)-1] == '\\') { + if (ofn.lpstrFile[mir_strlen(ofn.lpstrFile)-1] == '\\') { ofn.lpstrInitialDir = szInitialDir; strcpy(szInitialDir, ofn.lpstrFile); *ofn.lpstrFile = '\0'; @@ -476,7 +476,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { // terminate it with \0 append to realpath and add the share char* pszFileNamePos = pstNewShare->pszSrvPath; char* szRealDirectoryEnd = - &pstNewShare->pszRealPath[strlen(pstNewShare->pszRealPath)]; + &pstNewShare->pszRealPath[mir_strlen(pstNewShare->pszRealPath)]; *szRealDirectoryEnd = '\\'; szRealDirectoryEnd++; diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index 6acffb37ff..03e6b50c53 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -183,7 +183,7 @@ bool CLHttpUser::bReadGetParameters(char * pszRequest) { pszRequest[0] = 0; pszRequest++; for (int nCur = 0; nCur < eLastParam ; nCur++) { - int nLen = (int)strlen(szParmStr[nCur]); + int nLen = (int)mir_strlen(szParmStr[nCur]); if (strncmp(pszRequest, szParmStr[nCur], nLen) == 0) { if (apszParam[nCur]) { bRet = false; @@ -429,7 +429,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - if (pszSrvPath[strlen(pszSrvPath)-1] != '/') { + if (pszSrvPath[mir_strlen(pszSrvPath)-1] != '/') { strmcat(pszRealPath, "\\", MAX_PATH); strmcat(pszSrvPath, "/", MAX_PATH); } @@ -457,7 +457,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { while (pszTmp = strchr(pszTmp, '/')) * pszTmp = '~'; } - pszRealPath[strlen(pszRealPath) - 10] = '\0'; + pszRealPath[mir_strlen(pszRealPath) - 10] = '\0'; // detecting browser function removed // every browser should support it by now diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp index fed678827d..222e24b332 100644 --- a/plugins/HTTPServer/src/IndexHTML.cpp +++ b/plugins/HTTPServer/src/IndexHTML.cpp @@ -233,7 +233,7 @@ bool LoadIndexHTMLTemplate() { //LogEvent("Template", szDestBuf); - szIndexHTMLTemplate = new char[strlen(szDestBuf)+1]; + szIndexHTMLTemplate = new char[mir_strlen(szDestBuf)+1]; strcpy(szIndexHTMLTemplate, szDestBuf); } diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index 0e98cd8cca..99526c5d79 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -36,7 +36,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, do { strcpy(szBuffer + (pszSign - pszSrc), pszNew); - strcpy(szBuffer + (pszSign - pszSrc) + strlen(pszNew), pszSign + 1); + strcpy(szBuffer + (pszSign - pszSrc) + mir_strlen(pszNew), pszSign + 1); *pszSign = ' '; } while (pszSign = strchr(pszSrc, pszReplace)); @@ -116,7 +116,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, strncpy(szBuffer, "index.xsl", BUFFER_SIZE); } - WriteFile(hFile, szBuffer, (DWORD)strlen(szBuffer), &dwBytesWritten, NULL); + WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, NULL); WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, NULL); @@ -180,16 +180,16 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, // Add other shared files & directories for (CLFileShareNode * pclCur = pclFirstNode; pclCur ; pclCur = pclCur->pclNext) { if (!((pclCur->st.dwAllowedIP ^ dwRemoteIP) & pclCur->st.dwAllowedMask) && // hide inaccessible shares - (size_t)(pclCur->nGetSrvPathLen()) > strlen(pszSrvPath) && + (size_t)(pclCur->nGetSrvPathLen()) > mir_strlen(pszSrvPath) && !strstr(pclCur->st.pszRealPath, "\\@") && - !strncmp(pclCur->st.pszSrvPath, pszSrvPath, strlen(pszSrvPath))) { + !strncmp(pclCur->st.pszSrvPath, pszSrvPath, mir_strlen(pszSrvPath))) { pszBuffer = szBuffer; - strcpy(szFileName, &pclCur->st.pszSrvPath[strlen(pszSrvPath)]); + strcpy(szFileName, &pclCur->st.pszSrvPath[mir_strlen(pszSrvPath)]); ReplaceSign(szFileName, MAX_PATH, '&', "&"); if (pclCur->bIsDirectory()) { - szFileName[strlen(szFileName)-1] = '\0'; + szFileName[mir_strlen(szFileName)-1] = '\0'; if (!strchr(szFileName, '/')) { // only one level deeper pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer), " \r\n", szFileName); @@ -199,7 +199,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, } } else { if (!strchr(szFileName, '/') && // only one level deeper - strncmp(pszRealPath, pclCur->st.pszRealPath, strlen(pszRealPath))) { // no duplicates + strncmp(pszRealPath, pclCur->st.pszRealPath, mir_strlen(pszRealPath))) { // no duplicates pszExt = strrchr(szFileName, '.'); if (pszExt != NULL) { diff --git a/plugins/HTTPServer/src/MimeHandling.cpp b/plugins/HTTPServer/src/MimeHandling.cpp index 9656753056..45fead8013 100644 --- a/plugins/HTTPServer/src/MimeHandling.cpp +++ b/plugins/HTTPServer/src/MimeHandling.cpp @@ -31,7 +31,7 @@ int bInitMimeHandling() { *tok = '\0'; } /* remove trailing \n */ - int lenght = (int)strlen(line); + int lenght = (int)mir_strlen(line); if (lenght > 0 && line[lenght - 1] == '\n') line[lenght - 1] = '\0'; @@ -39,7 +39,7 @@ int bInitMimeHandling() { tok = (char*)strtok(line, " \t"); /*create and fill a cell*/ pDBCell = (ContentType*)malloc(sizeof(ContentType)); - pDBCell->mimeType = (char*)malloc(strlen(tok) + 1); + pDBCell->mimeType = (char*)malloc(mir_strlen(tok) + 1); strcpy(pDBCell->mimeType, tok); pDBCell->extList = NULL; pDBCell->next = NULL; @@ -48,7 +48,7 @@ int bInitMimeHandling() { while (tok != NULL) { /*create and fill a cell*/ pExtCell = (ExtensionListCell*)malloc(sizeof(ExtensionListCell)); - pExtCell->ext = (char*)malloc(strlen(tok) + 1); + pExtCell->ext = (char*)malloc(mir_strlen(tok) + 1); strcpy(pExtCell->ext, tok); pExtCell->next = NULL; /*link*/ diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 0dab60b744..029bc234ba 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -129,7 +129,7 @@ bool bOpenLogFile() { bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) { if (nLen < 0) - nLen = (int)strlen(pszSrc); + nLen = (int)mir_strlen(pszSrc); DWORD dwBytesWritten; return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, NULL) && (dwBytesWritten == (DWORD)nLen); } @@ -166,7 +166,7 @@ void LogEvent(const TCHAR * pszTitle, const char * pszLog) { time(&now); int nLen = (int)strftime(szTmp, sizeof(szTmp), "%d-%m-%Y %H:%M:%S -- ", localtime(&now)); - int nLogLen = (int)strlen(pszLog); + int nLogLen = (int)mir_strlen(pszLog); while (nLogLen > 0 && (pszLog[nLogLen-1] == '\r' || pszLog[nLogLen-1] == '\n')) nLogLen--; @@ -406,7 +406,7 @@ static INT_PTR nAddChangeRemoveShare(WPARAM wParam, LPARAM lParam) { return 1002; CLFileShareListAccess clCritSection; - bool bIsDirectory = (pclNew->pszSrvPath[strlen(pclNew->pszSrvPath)-1] == '/'); + bool bIsDirectory = (pclNew->pszSrvPath[mir_strlen(pclNew->pszSrvPath)-1] == '/'); CLFileShareNode **pclPrev = &pclFirstNode; CLFileShareNode * pclCur = pclFirstNode; @@ -487,7 +487,7 @@ static INT_PTR nGetShare(WPARAM /*wParam*/, LPARAM lParam) { CLFileShareNode * pclCur = pclFirstNode; while (pclCur) { if (strcmp(pclCur->st.pszSrvPath, pclShare->pszSrvPath) == 0) { - if (pclShare->dwMaxRealPath <= strlen(pclCur->st.pszRealPath) + 1) + if (pclShare->dwMaxRealPath <= mir_strlen(pclCur->st.pszRealPath) + 1) return 1003; strcpy(pclShare->pszRealPath, pclCur->st.pszRealPath); pclShare->dwAllowedIP = pclCur->st.dwAllowedIP; @@ -908,7 +908,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { return 1; } - nPluginPathLen = (int)strlen(szPluginPath); + nPluginPathLen = (int)mir_strlen(szPluginPath); sLogFilePath = szPluginPath; sLogFilePath += "HTTPServer.log"; -- cgit v1.2.3