From b572f4308e640ea46e9381ff642bed2950ffa888 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 15 Mar 2018 15:34:59 +0300 Subject: warning fixes --- .../src/ex_import/classExImContactXML.cpp | 16 ++--- plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 80 ++++++++++------------ plugins/YAMN/src/services.cpp | 2 +- src/mir_core/src/http.cpp | 2 +- 4 files changed, 47 insertions(+), 53 deletions(-) diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index c6fa31e5ff..5c90624aaa 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -532,9 +532,6 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) LPCSTR pUID = xContact->Attribute("uidv"); if (pUID != nullptr) { - size_t valLen; - PBYTE pbVal = nullptr; - switch (*(pUID++)) { case 'b': uid((BYTE)atoi(pUID)); @@ -553,9 +550,12 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) uidu(pUID); break; case 'n': - pbVal = (PBYTE)mir_base64_decode(pUID, &valLen); - if (pbVal != nullptr) - uidn(pbVal, valLen); + size_t valLen; + { + PBYTE pbVal = (PBYTE)mir_base64_decode(pUID, &valLen); + if (pbVal != nullptr) + uidn(pbVal, (DWORD)valLen); + } break; default: uidu((LPCSTR)nullptr); @@ -888,7 +888,7 @@ int CExImContactXML::ImportSetting(LPCSTR pszModule, TiXmlElement *xmlEntry) dbv.type = DBVT_BLOB; dbv.pbVal = (PBYTE)mir_base64_decode(value + 1, &baselen); if (dbv.pbVal != nullptr) - dbv.cpbVal = baselen; + dbv.cpbVal = (WORD)baselen; else { mir_free(dbv.pbVal); return ERROR_NOT_ADDED; @@ -952,7 +952,7 @@ int CExImContactXML::ImportEvent(LPCSTR pszModule, TiXmlElement *xmlEvent) if (tmpVal != NULL) { // event owning module dbei.pBlob = tmpVal; - dbei.cbBlob = baselen; + dbei.cbBlob = (WORD)baselen; dbei.szModule = (LPSTR)pszModule; xmlEvent->Attribute("type", (LPINT)&dbei.eventType); diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index 8c55ff4aae..1b7b7b3a76 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -39,61 +39,55 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ static void ExportModule(MCONTACT hContact, LPCSTR pszModule, FILE* file) { - DB::CEnumList Settings; - - if (!Settings.EnumSettings(hContact, pszModule)) - { - DBVARIANT dbv; - LPSTR here; - WORD j; - int i; - //char tmp[32]; + DB::CEnumList Settings; + if (!Settings.EnumSettings(hContact, pszModule)) { // print the module header.. fprintf(file, "\n[%s]\n", pszModule); for (auto &it : Settings) { + DBVARIANT dbv; if (!DB::Setting::GetAsIs(hContact, pszModule, it, &dbv)) { switch (dbv.type) { - case DBVT_BYTE: - fprintf(file, "%s=b%u\n", it, dbv.bVal); - break; + case DBVT_BYTE: + fprintf(file, "%s=b%u\n", it, dbv.bVal); + break; - case DBVT_WORD: - fprintf(file, "%s=w%u\n", it, dbv.wVal); - break; + case DBVT_WORD: + fprintf(file, "%s=w%u\n", it, dbv.wVal); + break; - case DBVT_DWORD: - fprintf(file, "%s=d%u\n", it, dbv.dVal); - break; + case DBVT_DWORD: + fprintf(file, "%s=d%u\n", it, dbv.dVal); + break; - case DBVT_ASCIIZ: - case DBVT_UTF8: - for (here = dbv.pszVal; here && *here; here++) - { - switch (*here) { - // convert \r to STX - case '\r': - *here = 2; - break; - - // convert \n to ETX - case '\n': - *here = 3; - } + case DBVT_ASCIIZ: + case DBVT_UTF8: + for (LPSTR here = dbv.pszVal; here && *here; here++) { + switch (*here) { + // convert \r to STX + case '\r': + *here = 2; + break; + + // convert \n to ETX + case '\n': + *here = 3; } - if (dbv.type == DBVT_UTF8) - fprintf(file, "%s=u%s\n", it, dbv.pszVal); - else - fprintf(file, "%s=s%s\n", it, dbv.pszVal); - break; + } + + if (dbv.type == DBVT_UTF8) + fprintf(file, "%s=u%s\n", it, dbv.pszVal); + else + fprintf(file, "%s=s%s\n", it, dbv.pszVal); + break; - case DBVT_BLOB: - fprintf(file, "%s=n", it); - for (j = 0; j < dbv.cpbVal; j++) - fprintf(file, "%02X ", (BYTE)dbv.pbVal[j]); - fputc('\n', file); - break; + case DBVT_BLOB: + fprintf(file, "%s=n", it); + for (WORD j = 0; j < dbv.cpbVal; j++) + fprintf(file, "%02X ", (BYTE)dbv.pbVal[j]); + fputc('\n', file); + break; } db_free(&dbv); } diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index 56c7477213..c667d3df4a 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -148,7 +148,7 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam) DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read enter\n"); #endif if ((ActualAccount->Flags & YAMN_ACC_ENA) && ActualAccount->Plugin->Fcn->SynchroFcnPtr) { - struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, lParam?YAMN_FORCECHECK:YAMN_NORMALCHECK, nullptr, nullptr}; + CheckParam ParamToPlugin = { YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, lParam ? YAMN_FORCECHECK : YAMN_NORMALCHECK, nullptr, nullptr }; ActualAccount->TimeLeft = ActualAccount->Interval; DWORD tid; diff --git a/src/mir_core/src/http.cpp b/src/mir_core/src/http.cpp index ff7644362a..ae5a9f3ff4 100755 --- a/src/mir_core/src/http.cpp +++ b/src/mir_core/src/http.cpp @@ -66,7 +66,7 @@ MIR_CORE_DLL(char*) mir_base64_encode(const void *input, size_t inputLen) if (input == nullptr) return nullptr; - unsigned outputLen = mir_base64_encode_bufsize(inputLen); + size_t outputLen = mir_base64_encode_bufsize(inputLen); char *output = (char*)mir_alloc(outputLen); if (output == nullptr) return nullptr; -- cgit v1.2.3