From bb952e431866d131bae95c08e579ec8a00f00343 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 8 Jul 2013 22:10:14 +0000 Subject: core protocol helpers for creating protocol evengs, services & threads git-svn-id: http://svn.miranda-ng.org/main/trunk@5286 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AssocMgr/src/reg.cpp | 2 +- plugins/HTTPServer/src/IndexXML.cpp | 2 +- plugins/HTTPServer/src/MimeHandling.cpp | 7 +++---- plugins/HTTPServer/src/main.cpp | 10 +++++----- plugins/New_GPG/src/utilities.h | 10 +++++----- plugins/TabSRMM/src/chat/services.cpp | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) (limited to 'plugins') diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index d792a69566..fc5803d7e1 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -346,7 +346,7 @@ static void WriteDbBackupData(const char *pszSetting,DWORD dwType,BYTE *pData,DW if (buf) { *(DWORD*)buf = dwType; CopyMemory(buf+sizeof(DWORD), pData, cbData); - db_set_blob(NULL, "AssocMgr", pszSetting, buf, cbLen); + db_set_blob(NULL, "AssocMgr", pszSetting, buf, (unsigned)cbLen); mir_free(buf); } } diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index 15c86c5c40..0297a1f038 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -116,7 +116,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, strcpy(szBuffer, "index.xsl"); } - WriteFile(hFile, szBuffer, strlen(szBuffer), &dwBytesWritten, NULL); + WriteFile(hFile, szBuffer, (DWORD)strlen(szBuffer), &dwBytesWritten, NULL); WriteFile(hFile, szXmlHeader2, sizeof(szXmlHeader2) - 1, &dwBytesWritten, NULL); diff --git a/plugins/HTTPServer/src/MimeHandling.cpp b/plugins/HTTPServer/src/MimeHandling.cpp index 42964bfeb3..9656753056 100644 --- a/plugins/HTTPServer/src/MimeHandling.cpp +++ b/plugins/HTTPServer/src/MimeHandling.cpp @@ -9,7 +9,6 @@ int bInitMimeHandling() { FILE *mimeDB; char line[LINE_MAX_SIZE]; char *tok = NULL; - int lenght; ContentType *pDBCell = NULL; ContentTypeDB pDB = NULL; ExtensionList extListCur = NULL; @@ -32,10 +31,10 @@ int bInitMimeHandling() { *tok = '\0'; } /* remove trailing \n */ - lenght = strlen(line); - if (lenght > 0 && line[lenght - 1] == '\n') { + int lenght = (int)strlen(line); + if (lenght > 0 && line[lenght - 1] == '\n') line[lenght - 1] = '\0'; - } + /* first token = mime type */ tok = (char*)strtok(line, " \t"); /*create and fill a cell*/ diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index f6bd92563a..b59587737e 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -127,7 +127,7 @@ bool bOpenLogFile() { bool bWriteToFile(HANDLE hFile, const char * pszSrc, int nLen = -1) { if (nLen < 0) - nLen = strlen(pszSrc); + nLen = (int)strlen(pszSrc); DWORD dwBytesWritten; return WriteFile(hFile, pszSrc, nLen, &dwBytesWritten, NULL) && (dwBytesWritten == (DWORD)nLen); } @@ -162,9 +162,9 @@ void LogEvent(const TCHAR * pszTitle, const char * pszLog) { char szTmp[128]; time_t now; time(&now); - int nLen = strftime(szTmp, sizeof(szTmp), "%d-%m-%Y %H:%M:%S -- ", localtime(&now)); + int nLen = (int)strftime(szTmp, sizeof(szTmp), "%d-%m-%Y %H:%M:%S -- ", localtime(&now)); - int nLogLen = strlen(pszLog); + int nLogLen = (int)strlen(pszLog); while (nLogLen > 0 && (pszLog[nLogLen-1] == '\r' || pszLog[nLogLen-1] == '\n')) nLogLen--; @@ -242,7 +242,7 @@ bool bReadConfigurationFile() { // move rest of buffer to front if (pszCurPos && pszCurPos != szBuf) { - dwBytesInBuffer = sizeof(szBuf) - (pszCurPos - szBuf); + dwBytesInBuffer = DWORD(sizeof(szBuf) - (pszCurPos - szBuf)); memmove(szBuf, pszCurPos, dwBytesInBuffer); } @@ -915,7 +915,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { return 1; } - nPluginPathLen = strlen(szPluginPath); + nPluginPathLen = (int)strlen(szPluginPath); sLogFilePath = szPluginPath; sLogFilePath += "HTTPServer.log"; diff --git a/plugins/New_GPG/src/utilities.h b/plugins/New_GPG/src/utilities.h index eaa7ef71b5..ef3fbced23 100644 --- a/plugins/New_GPG/src/utilities.h +++ b/plugins/New_GPG/src/utilities.h @@ -46,12 +46,12 @@ public: timestamp = time(0); szModule = 0; cbSize = 0; - cbBlob = strlen(msg)+1; + cbBlob = DWORD(strlen(msg)+1); pBlob = (PBYTE)msg; } db_event(char* msg, DWORD time) { - cbBlob = strlen(msg)+1; + cbBlob = DWORD(strlen(msg)+1); pBlob = (PBYTE)msg; eventType = EVENTTYPE_MESSAGE; flags = 0; @@ -61,7 +61,7 @@ public: } db_event(char* msg, DWORD time, int type) { - cbBlob = strlen(msg)+1; + cbBlob = DWORD(strlen(msg)+1); pBlob = (PBYTE)msg; if(type) eventType = type; @@ -74,7 +74,7 @@ public: } db_event(char* msg, int type) { - cbBlob = strlen(msg)+1; + cbBlob = DWORD(strlen(msg)+1); pBlob = (PBYTE)msg; flags = 0; if(type) @@ -87,7 +87,7 @@ public: } db_event(char* msg, DWORD time, int type, DWORD _flags) { - cbBlob = strlen(msg)+1; + cbBlob = DWORD(strlen(msg)+1); pBlob = (PBYTE)msg; if(type) eventType = type; diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index e421518e24..231f466da9 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -159,7 +159,7 @@ INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) mi = MM_AddModule(gcr->pszModule); if (mi) { mi->ptszModDispName = a2tf( gcr->ptszModuleDispName, gcr->dwFlags); - mi->bBold = gcr->dwFlags & GC_BOLD; + mi->bBold = (gcr->dwFlags & GC_BOLD) != 0; mi->bUnderline = (gcr->dwFlags & GC_UNDERLINE) != 0; mi->bItalics = (gcr->dwFlags & GC_ITALICS) != 0; mi->bColor = (gcr->dwFlags & GC_COLOR) != 0; -- cgit v1.2.3