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. --- protocols/Gadu-Gadu/src/core.cpp | 26 +++++++++++++------------- protocols/Gadu-Gadu/src/dialogs.cpp | 4 ++-- protocols/Gadu-Gadu/src/gg_proto.cpp | 4 ++-- protocols/Gadu-Gadu/src/groupchat.cpp | 4 ++-- protocols/Gadu-Gadu/src/import.cpp | 8 ++++---- protocols/Gadu-Gadu/src/services.cpp | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) (limited to 'protocols/Gadu-Gadu') diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 81416b50c4..22c6198556 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -70,8 +70,8 @@ void GaduProto::disconnect() szMsg = mir_utf8encodeW(modemsg.online); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 6, 1, "modemsg_mutex", 1); if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_ONLINE, "Default"), &dbv, DBVT_WCHAR)) { - if (dbv.ptszVal && *(dbv.ptszVal)) - szMsg = mir_utf8encodeW(dbv.ptszVal); + if (dbv.pwszVal && *(dbv.pwszVal)) + szMsg = mir_utf8encodeW(dbv.pwszVal); db_free(&dbv); } break; @@ -81,8 +81,8 @@ void GaduProto::disconnect() szMsg = mir_utf8encodeW(modemsg.away); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 7, 1, "modemsg_mutex", 1); if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_AWAY, "Default"), &dbv, DBVT_WCHAR)) { - if (dbv.ptszVal && *(dbv.ptszVal)) - szMsg = mir_utf8encodeW(dbv.ptszVal); + if (dbv.pwszVal && *(dbv.pwszVal)) + szMsg = mir_utf8encodeW(dbv.pwszVal); db_free(&dbv); } break; @@ -92,8 +92,8 @@ void GaduProto::disconnect() szMsg = mir_utf8encodeW(modemsg.dnd); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 8, 1, "modemsg_mutex", 1); if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_DND, "Default"), &dbv, DBVT_WCHAR)) { - if (dbv.ptszVal && *(dbv.ptszVal)) - szMsg = mir_utf8encodeW(dbv.ptszVal); + if (dbv.pwszVal && *(dbv.pwszVal)) + szMsg = mir_utf8encodeW(dbv.pwszVal); db_free(&dbv); } break; @@ -103,8 +103,8 @@ void GaduProto::disconnect() szMsg = mir_utf8encodeW(modemsg.freechat); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 9, 1, "modemsg_mutex", 1); if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_WCHAR)) { - if (dbv.ptszVal && *(dbv.ptszVal)) - szMsg = mir_utf8encodeW(dbv.ptszVal); + if (dbv.pwszVal && *(dbv.pwszVal)) + szMsg = mir_utf8encodeW(dbv.pwszVal); db_free(&dbv); } break; @@ -114,8 +114,8 @@ void GaduProto::disconnect() szMsg = mir_utf8encodeW(modemsg.invisible); gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 10, 1, "modemsg_mutex", 1); if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_INVISIBLE, "Default"), &dbv, DBVT_WCHAR)) { - if (dbv.ptszVal && *(dbv.ptszVal)) - szMsg = mir_utf8encodeW(dbv.ptszVal); + if (dbv.pwszVal && *(dbv.pwszVal)) + szMsg = mir_utf8encodeW(dbv.pwszVal); db_free(&dbv); } break; @@ -881,7 +881,7 @@ retry: gce.ptszText = messageT; wchar_t* nickT; if (!getWString(GG_KEY_NICK, &dbv)) { - nickT = mir_wstrdup(dbv.ptszVal); + nickT = mir_wstrdup(dbv.pwszVal); db_free(&dbv); } else @@ -1318,12 +1318,12 @@ int GaduProto::dbsettingchanged(WPARAM hContact, LPARAM lParam) { // Most important... check redundancy (fucking cascading) static int cascade = 0; - if (!cascade && dbv.ptszVal) + if (!cascade && dbv.pwszVal) { debugLogA("dbsettingchanged(): Conference %s was renamed.", dbv.pszVal); // Mark cascading /* FIXME */ cascade = 1; - Chat_ChangeSessionName(m_szModuleName, dbv.ptszVal, ptszVal); + Chat_ChangeSessionName(m_szModuleName, dbv.pwszVal, ptszVal); /* FIXME */ cascade = 0; } db_free(&dbv); diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 64cbbea445..2c622e2551 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -127,8 +127,8 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule mir_snwprintf(str, L"%S", dbv.pszVal); break; case DBVT_WCHAR: - unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0'); - ptstr = dbv.ptszVal; + unspecified = (special == SVS_ZEROISUNSPEC && dbv.pwszVal[0] == '\0'); + ptstr = dbv.pwszVal; break; case DBVT_UTF8: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 46f32e1a94..e839edf429 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -598,8 +598,8 @@ void __cdecl GaduProto::getawaymsgthread(void *arg) debugLogA("getawaymsgthread(): started"); gg_sleep(100, FALSE, "getawaymsgthread", 106, 1); if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_WCHAR)) { - ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); - debugLogW(L"getawaymsgthread(): Reading away msg <%s>.", dbv.ptszVal); + ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.pwszVal); + debugLogW(L"getawaymsgthread(): Reading away msg <%s>.", dbv.pwszVal); db_free(&dbv); } else { diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 44e061dc72..609bc68b9f 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -135,7 +135,7 @@ int GaduProto::gc_event(WPARAM, LPARAM lParam) MCONTACT hNext = db_find_next(hContact); DBVARIANT dbv; if (!getWString(hContact, "ChatRoomID", &dbv)) { - if (dbv.ptszVal && !mir_wstrcmp(gch->ptszID, dbv.ptszVal)) + if (dbv.pwszVal && !mir_wstrcmp(gch->ptszID, dbv.pwszVal)) db_delete_contact(hContact); db_free(&dbv); } @@ -155,7 +155,7 @@ int GaduProto::gc_event(WPARAM, LPARAM lParam) gce.ptszText = gch->ptszText; wchar_t* nickT; if (!getWString(GG_KEY_NICK, &dbv)) { - nickT = mir_wstrdup(dbv.ptszVal); + nickT = mir_wstrdup(dbv.pwszVal); db_free(&dbv); } else diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index e461b82906..80f4bc9a28 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -33,7 +33,7 @@ char *gg_makecontacts(GaduProto *gg, int cr) DBVARIANT dbv; if (!gg->getWString(hContact, GG_KEY_PD_FIRSTNAME, &dbv)) { - char* pszValA = mir_u2a(dbv.ptszVal); + char* pszValA = mir_u2a(dbv.pwszVal); string_append(s, dbv.pszVal); mir_free(pszValA); db_free(&dbv); @@ -42,7 +42,7 @@ char *gg_makecontacts(GaduProto *gg, int cr) // Readup LastName if (!gg->getWString(hContact, GG_KEY_PD_LASTNAME, &dbv)) { - char* pszValA = mir_u2a(dbv.ptszVal); + char* pszValA = mir_u2a(dbv.pwszVal); string_append(s, dbv.pszVal); mir_free(pszValA); db_free(&dbv); @@ -52,11 +52,11 @@ char *gg_makecontacts(GaduProto *gg, int cr) // Readup Nick if (!db_get_ws(hContact, "CList", "MyHandle", &dbv) || !gg->getWString(hContact, GG_KEY_NICK, &dbv)) { - char* dbvA = mir_u2a(dbv.ptszVal); + char* dbvA = mir_u2a(dbv.pwszVal); DBVARIANT dbv2; if (!gg->getWString(hContact, GG_KEY_PD_NICKNAME, &dbv2)) { - char* pszValA = mir_u2a(dbv2.ptszVal); + char* pszValA = mir_u2a(dbv2.pwszVal); string_append(s, pszValA); mir_free(pszValA); db_free(&dbv2); diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index f58bcc2e50..37b148c012 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -192,9 +192,9 @@ INT_PTR GaduProto::getavatarinfo(WPARAM wParam, LPARAM lParam) //directly check if contact has protected user avatar set by AVS, and if yes return it as protocol avatar DBVARIANT dbv; if (!db_get_ws(pai->hContact, "ContactPhoto", "Backup", &dbv)) { - if ((mir_wstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)) { + if ((mir_wstrlen(dbv.pwszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)) { debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS"); - wcscpy_s(pai->filename, _countof(pai->filename), dbv.ptszVal); + wcscpy_s(pai->filename, _countof(pai->filename), dbv.pwszVal); pai->format = ProtoGetAvatarFormat(pai->filename); db_free(&dbv); return GAIR_SUCCESS; -- cgit v1.2.3