diff options
author | George Hazan <ghazan@miranda.im> | 2018-07-24 11:11:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-07-24 11:11:26 +0300 |
commit | d296f9f99daf102b9af5d56690e2bd00d61c1267 (patch) | |
tree | 39311caaf80abf0b47ecb78cf94dc8157b193575 /src/core | |
parent | ffc521e5d5e9bd66feb65afe0046b3fc7e073356 (diff) |
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.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdaway/src/sendmsg.cpp | 26 | ||||
-rw-r--r-- | src/core/stdfile/src/fileopts.cpp | 2 | ||||
-rw-r--r-- | src/core/stdfile/src/filerecvdlg.cpp | 4 | ||||
-rw-r--r-- | src/core/stdfile/src/filexferdlg.cpp | 8 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_options.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 4 | ||||
-rw-r--r-- | src/core/stduserinfo/src/contactinfo.cpp | 22 | ||||
-rw-r--r-- | src/core/stduserinfo/src/stdinfo.cpp | 4 | ||||
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 2 |
9 files changed, 37 insertions, 37 deletions
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index 377f9e5200..b9a0a492e1 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -89,18 +89,18 @@ static wchar_t* GetAwayMessage(int statusMode, char *szProto) DBVARIANT dbv;
if (GetStatusModeByte(statusMode, "UsePrev")) {
if (db_get_ws(NULL, MODULENAME, StatusModeToDbSetting(statusMode, "Msg"), &dbv))
- dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusMode));
+ dbv.pwszVal = mir_wstrdup(GetDefaultMessage(statusMode));
}
else {
if (db_get_ws(NULL, MODULENAME, StatusModeToDbSetting(statusMode, "Default"), &dbv))
- dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusMode));
+ dbv.pwszVal = mir_wstrdup(GetDefaultMessage(statusMode));
- for (int i = 0; dbv.ptszVal[i]; i++) {
- if (dbv.ptszVal[i] != '%')
+ for (int i = 0; dbv.pwszVal[i]; i++) {
+ if (dbv.pwszVal[i] != '%')
continue;
wchar_t substituteStr[128];
- if (!wcsnicmp(dbv.ptszVal + i, L"%time%", 6)) {
+ if (!wcsnicmp(dbv.pwszVal + i, L"%time%", 6)) {
MIRANDA_IDLE_INFO mii;
Idle_GetInfo(mii);
@@ -116,17 +116,17 @@ static wchar_t* GetAwayMessage(int statusMode, char *szProto) }
else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, _countof(substituteStr));
}
- else if (!wcsnicmp(dbv.ptszVal + i, L"%date%", 6))
+ else if (!wcsnicmp(dbv.pwszVal + i, L"%date%", 6))
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, _countof(substituteStr));
else continue;
if (mir_wstrlen(substituteStr) > 6)
- dbv.ptszVal = (wchar_t*)mir_realloc(dbv.ptszVal, (mir_wstrlen(dbv.ptszVal) + 1 + mir_wstrlen(substituteStr) - 6) * sizeof(wchar_t));
- memmove(dbv.ptszVal + i + mir_wstrlen(substituteStr), dbv.ptszVal + i + 6, (mir_wstrlen(dbv.ptszVal) - i - 5) * sizeof(wchar_t));
- memcpy(dbv.ptszVal + i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
+ dbv.pwszVal = (wchar_t*)mir_realloc(dbv.pwszVal, (mir_wstrlen(dbv.pwszVal) + 1 + mir_wstrlen(substituteStr) - 6) * sizeof(wchar_t));
+ memmove(dbv.pwszVal + i + mir_wstrlen(substituteStr), dbv.pwszVal + i + 6, (mir_wstrlen(dbv.pwszVal) - i - 5) * sizeof(wchar_t));
+ memcpy(dbv.pwszVal + i, substituteStr, mir_wstrlen(substituteStr) * sizeof(wchar_t));
}
}
- return dbv.ptszVal;
+ return dbv.pwszVal;
}
static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -390,9 +390,9 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam DBVARIANT dbv;
if (db_get_ws(NULL, MODULENAME, StatusModeToDbSetting(it, "Default"), &dbv))
if (db_get_ws(NULL, MODULENAME, StatusModeToDbSetting(it, "Msg"), &dbv))
- dbv.ptszVal = mir_wstrdup(GetDefaultMessage(it));
- mir_wstrcpy(dat->info[j].msg, dbv.ptszVal);
- mir_free(dbv.ptszVal);
+ dbv.pwszVal = mir_wstrdup(GetDefaultMessage(it));
+ mir_wstrcpy(dat->info[j].msg, dbv.pwszVal);
+ mir_free(dbv.pwszVal);
}
if (hLst)
SendDlgItemMessage(hwndDlg, IDC_LST_STATUS, LB_SETCURSEL, 0, 0);
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index 6e98fb682c..41d8717635 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -91,7 +91,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DBVARIANT dbv;
if (db_get_ws(NULL, MODULENAME, "ScanCmdLine", &dbv) == 0) {
- SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, dbv.ptszVal);
+ SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, dbv.pwszVal);
db_free(&dbv);
}
else if (SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0)) {
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 3db0e42786..e975d01fe8 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l DBVARIANT dbv;
if (db_get_ws(NULL, MODULENAME, idstr, &dbv))
break;
- SendDlgItemMessage(hwndDlg, IDC_FILEDIR, CB_ADDSTRING, 0, (LPARAM)dbv.ptszVal);
+ SendDlgItemMessage(hwndDlg, IDC_FILEDIR, CB_ADDSTRING, 0, (LPARAM)dbv.pwszVal);
db_free(&dbv);
}
@@ -315,7 +315,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l mir_snprintf(idstr, "MruDir%d", i);
if (db_get_ws(NULL, MODULENAME, idstr, &dbv)) continue;
mir_snprintf(idstr, "MruDir%d", i+1);
- db_set_ws(NULL, MODULENAME, idstr, dbv.ptszVal);
+ db_set_ws(NULL, MODULENAME, idstr, dbv.pwszVal);
db_free(&dbv);
}
db_set_ws(NULL, MODULENAME, idstr, szRecvDir);
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 841d2d0c2c..35d6884ad0 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -95,18 +95,18 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) { DBVARIANT dbv; if (!db_get_ws(NULL, MODULENAME, "ScanCmdLine", &dbv)) { - if (dbv.ptszVal[0]) { + if (dbv.pwszVal[0]) { STARTUPINFO si = { 0 }; si.cb = sizeof(si); - wchar_t *pszReplace = wcsstr(dbv.ptszVal, L"%f"); + wchar_t *pszReplace = wcsstr(dbv.pwszVal, L"%f"); wchar_t szCmdLine[768]; if (pszReplace) { if (info->szFile[mir_wstrlen(info->szFile) - 1] == '\\') info->szFile[mir_wstrlen(info->szFile) - 1] = '\0'; *pszReplace = 0; - mir_snwprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2); + mir_snwprintf(szCmdLine, L"%s\"%s\"%s", dbv.pwszVal, info->szFile, pszReplace + 2); } else - wcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE); + wcsncpy_s(szCmdLine, dbv.pwszVal, _TRUNCATE); PROCESS_INFORMATION pi; if (CreateProcess(nullptr, szCmdLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) { diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index fc7258ce76..932ca3f07b 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -204,7 +204,7 @@ static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefau { DBVARIANT dbv; if (!db_get_ws(0, CHAT_MODULE, pszSetting, &dbv)) { - replaceStrW(*ppPointer, dbv.ptszVal); + replaceStrW(*ppPointer, dbv.pwszVal); db_free(&dbv); } else replaceStrW(*ppPointer, pszDefault); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index cfb4c8d556..57711e2228 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -219,8 +219,8 @@ bool CSrmmWindow::OnInitDialog() if (m_hContact) {
DBVARIANT dbv;
if (!db_get_ws(m_hContact, SRMSGMOD, DBSAVEDMSG, &dbv)) {
- if (dbv.ptszVal[0]) {
- m_message.SetText(dbv.ptszVal);
+ if (dbv.pwszVal[0]) {
+ m_message.SetText(dbv.pwszVal);
m_btnOk.Enable(true);
UpdateReadChars();
PostMessage(m_message.GetHwnd(), EM_SETSEL, -1, -1);
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index bd99b262d7..d6373e2fba 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -293,7 +293,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP mir_snwprintf(idstr2, L"%d", i + 2);
}
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.pwszVal);
db_free(&dbv);
lvi.iItem++;
}
@@ -306,7 +306,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.pszText = idstr2;
mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.pwszVal);
db_free(&dbv);
lvi.iItem++;
}
@@ -322,14 +322,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!db_get_ws(hContact, szProto, "Phone", &dbv)) {
lvi.pszText = TranslateT("Primary");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.pwszVal);
db_free(&dbv);
lvi.iItem++;
}
if (!db_get_ws(hContact, szProto, "Fax", &dbv)) {
lvi.pszText = TranslateT("Fax");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.pwszVal);
db_free(&dbv);
lvi.iItem++;
}
@@ -338,23 +338,23 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
if (mir_strlen(dbv.pszVal) > 4 && !mir_strcmp(dbv.pszVal + mir_strlen(dbv.pszVal) - 4, " SMS")) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, L"y");
- dbv.ptszVal[mir_wstrlen(dbv.ptszVal) - 4] = '\0';
+ dbv.pwszVal[mir_wstrlen(dbv.pwszVal) - 4] = '\0';
}
- ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.pwszVal);
db_free(&dbv);
lvi.iItem++;
}
if (!db_get_ws(hContact, szProto, "CompanyPhone", &dbv)) {
lvi.pszText = TranslateT("Work phone");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.pwszVal);
db_free(&dbv);
lvi.iItem++;
}
if (!db_get_ws(hContact, szProto, "CompanyFax", &dbv)) {
lvi.pszText = TranslateT("Work fax");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.pwszVal);
db_free(&dbv);
lvi.iItem++;
}
@@ -367,11 +367,11 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.pszText = idstr2;
mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- if (mir_wstrlen(dbv.ptszVal) > 4 && !mir_wstrcmp(dbv.ptszVal + mir_wstrlen(dbv.ptszVal) - 4, L" SMS")) {
+ if (mir_wstrlen(dbv.pwszVal) > 4 && !mir_wstrcmp(dbv.pwszVal + mir_wstrlen(dbv.pwszVal) - 4, L" SMS")) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, L"y");
- dbv.ptszVal[mir_wstrlen(dbv.ptszVal) - 4] = '\0';
+ dbv.pwszVal[mir_wstrlen(dbv.pwszVal) - 4] = '\0';
}
- ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.pwszVal);
db_free(&dbv);
lvi.iItem++;
}
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 338007fb4f..7983a0f6ff 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -55,7 +55,7 @@ static wchar_t* Proto_GetContactInfoSettingStr(bool proto_service, MCONTACT hCon if (CallProtoService(szModule, PS_GETINFOSETTING, hContact, (LPARAM)&cgs))
return nullptr;
- return dbv.ptszVal;
+ return dbv.pwszVal;
}
static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special)
@@ -152,7 +152,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule char szSettingName[100];
mir_snprintf(szSettingName, "%sName", szSetting);
if (!db_get_ws(hContact, szModule, szSettingName, &dbv)) {
- ptstr = dbv.ptszVal;
+ ptstr = dbv.pwszVal;
unspecified = false;
break;
}
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 5f43ae35a7..4a1385545b 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -266,7 +266,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP LPTSTR ptszLastTab;
DBVARIANT dbv;
if (!db_get_ws(NULL, MODULENAME, "LastTab", &dbv)) {
- ptszLastTab = NEWWSTR_ALLOCA(dbv.ptszVal);
+ ptszLastTab = NEWWSTR_ALLOCA(dbv.pwszVal);
db_free(&dbv);
}
else ptszLastTab = nullptr;
|