From 6ba2363bdbde5debcd23568ea723cdef8f2c6a60 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Sat, 5 Jul 2025 21:05:15 +0900 Subject: [PATCH] [CICERO][MSCTF] ITfContext: Follow-up of #8224 (#8231) Follow-up of #8224. JIRA issue: CORE-19361 - Add cicIsNullPtr function in Cicero . - Reordering of CMakeLists.txt items. - Minor refactoring. --- base/ctf/cicero/cicbase.h | 5 +++++ base/ctf/msctf/CMakeLists.txt | 2 +- base/ctf/msctf/compartmentmgr.cpp | 5 ----- base/ctf/msctf/context.cpp | 23 ++++++++++------------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/base/ctf/cicero/cicbase.h b/base/ctf/cicero/cicbase.h index 36a143fc9b9..73515c49490 100644 --- a/base/ctf/cicero/cicbase.h +++ b/base/ctf/cicero/cicbase.h @@ -30,6 +30,11 @@ static inline void cicMemFree(LPVOID ptr) LocalFree(ptr); } +static inline bool cicIsNullPtr(LPCVOID ptr) +{ + return !ptr; +} + struct CicNoThrow { }; #define cicNoThrow CicNoThrow{} diff --git a/base/ctf/msctf/CMakeLists.txt b/base/ctf/msctf/CMakeLists.txt index 82c0266ff56..4a55a2f5c31 100644 --- a/base/ctf/msctf/CMakeLists.txt +++ b/base/ctf/msctf/CMakeLists.txt @@ -13,8 +13,8 @@ list(APPEND SOURCE list(APPEND PCH_SKIP_SOURCE categorymgr.cpp - context.cpp compartmentmgr.cpp + context.cpp displayattributemgr.cpp documentmgr.cpp langbarmgr.cpp diff --git a/base/ctf/msctf/compartmentmgr.cpp b/base/ctf/msctf/compartmentmgr.cpp index a43a4d5661a..3abd8b20b33 100644 --- a/base/ctf/msctf/compartmentmgr.cpp +++ b/base/ctf/msctf/compartmentmgr.cpp @@ -26,11 +26,6 @@ #include WINE_DEFAULT_DEBUG_CHANNEL(msctf); -static inline bool cicIsNullPtr(LPCVOID ptr) -{ - return !ptr; -} - //////////////////////////////////////////////////////////////////////////// typedef struct tagCompartmentValue diff --git a/base/ctf/msctf/context.cpp b/base/ctf/msctf/context.cpp index 9f2ea2350e8..383894acdcb 100644 --- a/base/ctf/msctf/context.cpp +++ b/base/ctf/msctf/context.cpp @@ -26,18 +26,17 @@ #include WINE_DEFAULT_DEBUG_CHANNEL(msctf); -static inline bool cicIsNullPtr(LPCVOID ptr) -{ - return !ptr; -} - //////////////////////////////////////////////////////////////////////////// class CContext : public ITfContext , public ITfSource + // , public ITfContextComposition , public ITfContextOwnerCompositionServices + // , public ITfContextOwnerServices , public ITfInsertAtSelection + // , public ITfMouseTracker + // , public ITfQueryEmbedded , public ITfSourceSingle , public ITextStoreACPSink , public ITextStoreACPServices @@ -412,15 +411,13 @@ STDMETHODIMP CContext::GetSelection( hr = m_pITextStoreACP->GetSelection(ulIndex + i, 1, &acps, &fetched); if (hr == TS_E_NOLOCK) return TF_E_NOLOCK; - else if (SUCCEEDED(hr)) - { - pSelection[totalFetched].style.ase = (TfActiveSelEnd)acps.style.ase; - pSelection[totalFetched].style.fInterimChar = acps.style.fInterimChar; - Range_Constructor(this, m_pITextStoreACP, cookie->lockType, acps.acpStart, acps.acpEnd, &pSelection[totalFetched].range); - totalFetched++; - } - else + else if (FAILED(hr)) break; + + pSelection[totalFetched].style.ase = (TfActiveSelEnd)acps.style.ase; + pSelection[totalFetched].style.fInterimChar = acps.style.fInterimChar; + Range_Constructor(this, m_pITextStoreACP, cookie->lockType, acps.acpStart, acps.acpEnd, &pSelection[totalFetched].range); + totalFetched++; } *pcFetched = totalFetched;