From 0f9e1002ec21154bc476fbfeab0d21f796515823 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Dec 2023 14:58:56 +0300 Subject: DbEvent_GetTextW: useless second parameter removed --- src/core/stdmsg/src/msglog.cpp | 4 ++-- src/core/stduihist/src/history.cpp | 4 ++-- src/mir_app/src/chat_log.cpp | 2 +- src/mir_app/src/chat_tools.cpp | 2 +- src/mir_app/src/db_events.cpp | 12 ++++-------- src/mir_app/src/srmm_base.cpp | 4 ++-- 6 files changed, 12 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 55cac4d02f..0c2c8b4d85 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -364,7 +364,7 @@ public: AppendToBufferWithRTF(buf, szName); AppendToBufferWithRTF(buf, L" "); - msg = DbEvent_GetTextW(&dbei, CP_ACP); + msg = DbEvent_GetTextW(&dbei); if (msg) { AppendToBufferWithRTF(buf, msg); mir_free(msg); @@ -394,7 +394,7 @@ public: case EVENTTYPE_MESSAGE: default: - msg = DbEvent_GetTextW(&dbei, CP_ACP); + msg = DbEvent_GetTextW(&dbei); SetToStyle((dbei.eventType == EVENTTYPE_MESSAGE) ? ((dbei.flags & DBEF_SENT) ? MSGFONTID_MYMSG : MSGFONTID_YOURMSG) : MSGFONTID_NOTICE, buf); AppendToBufferWithRTF(buf, msg); mir_free(msg); diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index c886b4f341..e335167a67 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -274,7 +274,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP DB::EventInfo dbei(hDbEvent); if (dbei) { - ptrW wszDescr(DbEvent_GetTextW(&dbei, CP_ACP)); + ptrW wszDescr(DbEvent_GetTextW(&dbei)); if (wszDescr) SetDlgItemText(hwndDlg, IDC_EDIT, wszDescr); } @@ -309,7 +309,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP dbei.cbBlob = oldBlobSize; db_event_get(hDbEvent, &dbei); - ptrW wszDescr(DbEvent_GetTextW(&dbei, CP_ACP)); + ptrW wszDescr(DbEvent_GetTextW(&dbei)); if (wszDescr) { CharUpperW(wszDescr); if (wcsstr(wszDescr, (const wchar_t *)lParam) != nullptr) { diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index 830430b0d5..6ff849e8b0 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -330,7 +330,7 @@ void CRtfLogWindow::CreateChatRtfMessage(RtfChatLogStreamData *streamData, const return; } } - lin.write(streamData, false, buf, ptrW(DbEvent_GetTextW(&dbei, CP_UTF8))); + lin.write(streamData, false, buf, ptrW(DbEvent_GetTextW(&dbei))); return; } } diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 2692678a69..ec5eefaa74 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -735,7 +735,7 @@ void Chat_EventToGC(SESSION_INFO *si, MEVENT hDbEvent) return; Utf2T wszUserId(dbei.szUserId); - CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei, CP_UTF8))); + CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei))); wszText.Replace(L"%", L"%%"); GCEVENT gce = { si, GC_EVENT_MESSAGE }; diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 1fb1a25a12..de410800ee 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -185,12 +185,8 @@ static INT_PTR DbEventGetTextWorker(const DB::EventInfo *dbei, int codepage, int memcpy(str, dbei->pBlob, dbei->cbBlob); str[dbei->cbBlob] = 0; - if (dbei->flags & DBEF_UTF) { - wchar_t *msg = nullptr; - mir_utf8decodecp(str, codepage, &msg); - if (msg) - return (INT_PTR)msg; - } + if (dbei->flags & DBEF_UTF) + return (INT_PTR)mir_utf8decodeW(str); return (INT_PTR)mir_a2u_cp(str, codepage); } @@ -210,9 +206,9 @@ MIR_APP_DLL(char*) DbEvent_GetTextA(const DBEVENTINFO *dbei, int codepage) return (char*)DbEventGetTextWorker((DB::EventInfo *)dbei, codepage, DBVT_ASCIIZ); } -MIR_APP_DLL(wchar_t*) DbEvent_GetTextW(const DBEVENTINFO *dbei, int codepage) +MIR_APP_DLL(wchar_t*) DbEvent_GetTextW(const DBEVENTINFO *dbei) { - return (wchar_t*)DbEventGetTextWorker((DB::EventInfo *)dbei, codepage, DBVT_WCHAR); + return (wchar_t*)DbEventGetTextWorker((DB::EventInfo *)dbei, CP_ACP, DBVT_WCHAR); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index a744a3e9e3..af0a3bcba8 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -731,7 +731,7 @@ void CSrmmBaseDialog::UpdateChatLog() continue; Utf2T wszUserId(dbei.szUserId); - CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei, CP_ACP))); + CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei))); wszText.Replace(L"%", L"%%"); GCEVENT gce = { m_si, GC_EVENT_MESSAGE }; @@ -1091,7 +1091,7 @@ void CSrmmBaseDialog::SetQuoteEvent(MEVENT hEvent) if (dbei) { CMStringW wszText(TranslateT("In reply to")); wszText += L": "; - wszText += ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)).get(); + wszText += ptrW(DbEvent_GetTextW(&dbei)).get(); m_Quote.SetText(wszText); m_hQuoteEvent = hEvent; -- cgit v1.2.3