From d296f9f99daf102b9af5d56690e2bd00d61c1267 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 24 Jul 2018 11:11:26 +0300 Subject: database: - senseless fiels ptszVal removed from DBVARIANT, pwszVal is used instead; - if you want db_get to return a string, you need to use db_get_s. --- plugins/IEView/src/ChatHTMLBuilder.cpp | 2 +- plugins/IEView/src/HistoryHTMLBuilder.cpp | 2 +- plugins/IEView/src/MUCCHTMLBuilder.cpp | 2 +- plugins/IEView/src/Options.cpp | 18 +++++++++--------- plugins/IEView/src/ScriverHTMLBuilder.cpp | 2 +- plugins/IEView/src/TabSRMMHTMLBuilder.cpp | 2 +- plugins/IEView/src/TemplateHTMLBuilder.cpp | 12 ++++++------ 7 files changed, 20 insertions(+), 20 deletions(-) (limited to 'plugins/IEView/src') diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index b956a740c7..8c14599e6c 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -73,7 +73,7 @@ void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; mir_snprintf(str, "Font%d", i); - if (db_get(NULL, CHATFONTMOD, str, &dbv)) + if (db_get_s(NULL, CHATFONTMOD, str, &dbv)) strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE); else { strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE); diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index cf343e9651..8cb6fc1b9e 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -123,7 +123,7 @@ void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA * lf, CO lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; mir_snprintf(str, "Font.%s.Name", dbSetting); - if (db_get(NULL, HPPMOD, str, &dbv)) + if (db_get_s(NULL, HPPMOD, str, &dbv)) strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE); else { strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE); diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index bbcdd90c3e..b787a1017e 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -69,7 +69,7 @@ void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; mir_snprintf(str, "Font%dFace", i); - if (db_get(NULL, MUCCMOD, str, &dbv)) + if (db_get_s(NULL, MUCCMOD, str, &dbv)) strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE); else { strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE); diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index 3fb64021ee..2a21e47e5b 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -1504,7 +1504,7 @@ void Options::init() mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS); proto->setSRMMFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128)); mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_BACKGROUND); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); if (strncmp(tmpPath, "http://", 7)) PathToAbsolute(dbv.pszVal, tmpPath); @@ -1513,7 +1513,7 @@ void Options::init() db_free(&dbv); } mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_CSS); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); if (strncmp(tmpPath, "http://", 7)) PathToAbsolute(dbv.pszVal, tmpPath); @@ -1522,7 +1522,7 @@ void Options::init() db_free(&dbv); } mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_SRMM_TEMPLATE); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); PathToAbsolute(dbv.pszVal, tmpPath); proto->setSRMMTemplateFilename(tmpPath); @@ -1537,7 +1537,7 @@ void Options::init() mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS); proto->setChatFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128)); mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_BACKGROUND); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); if (strncmp(tmpPath, "http://", 7)) PathToAbsolute(dbv.pszVal, tmpPath); @@ -1546,7 +1546,7 @@ void Options::init() db_free(&dbv); } mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_CSS); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); if (strncmp(tmpPath, "http://", 7)) PathToAbsolute(dbv.pszVal, tmpPath); @@ -1555,7 +1555,7 @@ void Options::init() db_free(&dbv); } mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_CHAT_TEMPLATE); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); PathToAbsolute(dbv.pszVal, tmpPath); proto->setChatTemplateFilename(tmpPath); @@ -1570,7 +1570,7 @@ void Options::init() mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS); proto->setHistoryFlags(db_get_dw(NULL, ieviewModuleName, dbsName, 16128)); mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_BACKGROUND); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); if (strncmp(tmpPath, "http://", 7)) PathToAbsolute(dbv.pszVal, tmpPath); @@ -1579,7 +1579,7 @@ void Options::init() db_free(&dbv); } mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_CSS); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); if (strncmp(tmpPath, "http://", 7)) PathToAbsolute(dbv.pszVal, tmpPath); @@ -1588,7 +1588,7 @@ void Options::init() db_free(&dbv); } mir_snprintf(dbsName, "%s.%s", proto->getProtocolName(), DBS_HISTORY_TEMPLATE); - if (!db_get(NULL, ieviewModuleName, dbsName, &dbv)) { + if (!db_get_s(NULL, ieviewModuleName, dbsName, &dbv)) { strncpy_s(tmpPath, dbv.pszVal, _TRUNCATE); PathToAbsolute(dbv.pszVal, tmpPath); proto->setHistoryTemplateFilename(tmpPath); diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index c0e569cca7..c910643352 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -111,7 +111,7 @@ void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; mir_snprintf(str, "SRMFont%d", i); - if (db_get(NULL, SRMMMOD, str, &dbv)) + if (db_get_s(NULL, SRMMMOD, str, &dbv)) strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE); else { strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE); diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index 01e63bdc89..fbd8771138 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -142,7 +142,7 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; mir_snprintf(str, "Font%d", i); - if (db_get(NULL, TABSRMM_FONTMODULE, str, &dbv)) + if (db_get_s(NULL, TABSRMM_FONTMODULE, str, &dbv)) strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE); else { strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE); diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index bdf5882c08..1440221bc8 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -49,13 +49,13 @@ char* TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char *szProto) result = ace->szFilename; } if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { - if (mir_wstrlen(dbv.ptszVal) > 0) { - //wchar_t *ext = wcsrchr(dbv.ptszVal, '.'); + if (mir_wstrlen(dbv.pwszVal) > 0) { + //wchar_t *ext = wcsrchr(dbv.pwszVal, '.'); if (result == nullptr) { /* relative -> absolute */ - wcsncpy_s(tmpPath, dbv.ptszVal, _TRUNCATE); + wcsncpy_s(tmpPath, dbv.pwszVal, _TRUNCATE); if (wcsncmp(tmpPath, L"http://", 7)) - PathToAbsoluteW(dbv.ptszVal, tmpPath); + PathToAbsoluteW(dbv.pwszVal, tmpPath); result = tmpPath; } } @@ -168,7 +168,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr if (szAvatarOut == nullptr) szAvatarOut = mir_strdup(szNoAvatar); - if (!db_get(event->hContact, "CList", "StatusMsg", &dbv)) { + if (!db_get_s(event->hContact, "CList", "StatusMsg", &dbv)) { if (mir_strlen(dbv.pszVal) > 0) szStatusMsg = mir_utf8encode(dbv.pszVal); db_free(&dbv); @@ -341,7 +341,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, szAvatarOut = mir_strdup(szNoAvatar); if (event->hContact != NULL) { - if (!db_get(event->hContact, "CList", "StatusMsg", &dbv)) { + if (!db_get_s(event->hContact, "CList", "StatusMsg", &dbv)) { if (mir_strlen(dbv.pszVal) > 0) szStatusMsg = mir_utf8encode(dbv.pszVal); db_free(&dbv); -- cgit v1.2.3