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/TipperYM/src/options.cpp | 16 ++++++++-------- plugins/TipperYM/src/subst.cpp | 8 ++++---- plugins/TipperYM/src/translations.cpp | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins/TipperYM/src') diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index b2060654d7..8b0c73ba99 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -37,7 +37,7 @@ extern int IsTrayProto(const wchar_t *swzProto, BOOL bExtendedTip) DBVARIANT dbv; int result = 1; if (!db_get_ws(NULL, MODULENAME, szSetting, &dbv)) { - result = wcsstr(dbv.ptszVal, swzProto) ? 1 : 0; + result = wcsstr(dbv.pwszVal, swzProto) ? 1 : 0; db_free(&dbv); } @@ -100,7 +100,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index) if (db_get_ws(0, MODULE_ITEMS, setting, &dbv)) return false; - wcsncpy(ds->swzName, dbv.ptszVal, _countof(ds->swzName)); + wcsncpy(ds->swzName, dbv.pwszVal, _countof(ds->swzName)); ds->swzName[_countof(ds->swzName) - 1] = 0; db_free(&dbv); @@ -109,7 +109,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index) mir_snprintf(setting, "Module%d", index); ds->szModuleName[0] = 0; - if (!db_get(0, MODULE_ITEMS, setting, &dbv)) { + if (!db_get_s(0, MODULE_ITEMS, setting, &dbv)) { strncpy(ds->szModuleName, dbv.pszVal, MODULE_NAME_LEN); ds->szModuleName[MODULE_NAME_LEN - 1] = 0; db_free(&dbv); @@ -117,7 +117,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index) mir_snprintf(setting, "Setting%d", index); ds->szSettingName[0] = 0; - if (!db_get(0, MODULE_ITEMS, setting, &dbv)) { + if (!db_get_s(0, MODULE_ITEMS, setting, &dbv)) { strncpy(ds->szSettingName, dbv.pszVal, SETTING_NAME_LEN); ds->szSettingName[SETTING_NAME_LEN - 1] = 0; db_free(&dbv); @@ -161,14 +161,14 @@ bool LoadDI(DISPLAYITEM *di, int index) if (db_get_ws(0, MODULE_ITEMS, setting, &dbv)) return false; - wcsncpy(di->swzLabel, dbv.ptszVal, _countof(di->swzLabel)); + wcsncpy(di->swzLabel, dbv.pwszVal, _countof(di->swzLabel)); di->swzLabel[_countof(di->swzLabel) - 1] = 0; db_free(&dbv); mir_snprintf(setting, "DIValue%d", index); di->swzValue[0] = 0; if (!db_get_ws(0, MODULE_ITEMS, setting, &dbv)) { - wcsncpy(di->swzValue, dbv.ptszVal, _countof(di->swzValue)); + wcsncpy(di->swzValue, dbv.pwszVal, _countof(di->swzValue)); di->swzValue[_countof(di->swzValue) - 1] = 0; db_free(&dbv); } @@ -308,7 +308,7 @@ void LoadObsoleteSkinSetting() opt.transfMode[i] = (TransformationMode)db_get_b(0, MODULENAME, setting, 0); mir_snprintf(setting, "SImgFile%d", i); if (!db_get_ws(NULL, MODULENAME, setting, &dbv)) { - opt.szImgFile[i] = mir_wstrdup(dbv.ptszVal); + opt.szImgFile[i] = mir_wstrdup(dbv.pwszVal); db_free(&dbv); } @@ -514,7 +514,7 @@ void LoadOptions() } else if (opt.skinMode == SM_IMAGE) { if (!db_get_ws(NULL, MODULENAME, "SkinName", &dbv)) { - wcsncpy(opt.szSkinName, dbv.ptszVal, _countof(opt.szSkinName) - 1); + wcsncpy(opt.szSkinName, dbv.pwszVal, _countof(opt.szSkinName) - 1); db_free(&dbv); } } diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 2e6fd15826..34a7bde2cb 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -221,8 +221,8 @@ wchar_t* GetStatusMessageText(MCONTACT hContact) return nullptr; if (!db_get_ws(hContact, MODULENAME, "TempStatusMsg", &dbv)) { - if (mir_wstrlen(dbv.ptszVal) != 0) - swzMsg = mir_wstrdup(dbv.ptszVal); + if (mir_wstrlen(dbv.pwszVal) != 0) + swzMsg = mir_wstrdup(dbv.pwszVal); db_free(&dbv); } } @@ -233,8 +233,8 @@ wchar_t* GetStatusMessageText(MCONTACT hContact) return nullptr; if (!db_get_ws(hContact, "CList", "StatusMsg", &dbv)) { - if (mir_wstrlen(dbv.ptszVal) != 0) - swzMsg = mir_wstrdup(dbv.ptszVal); + if (mir_wstrlen(dbv.pwszVal) != 0) + swzMsg = mir_wstrdup(dbv.pwszVal); db_free(&dbv); } } diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index 8a487fd6a2..999585bd3e 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -523,7 +523,7 @@ wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, if (ProtoServiceExists(szModuleName, "/SendXML")) // jabber protocol? { if (!db_get_ws(hContact, szModuleName, szSettingName, &dbv)) { - wcsncpy(buff, TranslateW(dbv.ptszVal), bufflen); + wcsncpy(buff, TranslateW(dbv.pwszVal), bufflen); buff[bufflen - 1] = 0; return buff; } -- cgit v1.2.3