Skip to content

fix (WeaselTSF): Use STDMETHODIMP instead of STDAPI for non-static member functions#1835

Open
cqjjjzr wants to merge 1 commit intorime:masterfrom
cqjjjzr:stdmethodimp
Open

fix (WeaselTSF): Use STDMETHODIMP instead of STDAPI for non-static member functions#1835
cqjjjzr wants to merge 1 commit intorime:masterfrom
cqjjjzr:stdmethodimp

Conversation

@cqjjjzr
Copy link
Copy Markdown

@cqjjjzr cqjjjzr commented Apr 9, 2026

Fixes #1834 .

有几个是全局函数,必须是 STDAPI,就没有修改

…mber functions.

Fixes rime#1834 , also silented clang-format errors due to different
interpretation of blocks (commented out `if` keyword) between
clang-format versions
@fxliang
Copy link
Copy Markdown
Contributor

fxliang commented Apr 10, 2026

要分开PR,STDAPI改STDMETHODIMP 集中一个PR来,另外的修改另外PR

@cqjjjzr
Copy link
Copy Markdown
Author

cqjjjzr commented Apr 10, 2026

是分开 PR 的,一个一个 PR 合就会自动 rebase 好

@cqjjjzr
Copy link
Copy Markdown
Author

cqjjjzr commented Apr 10, 2026

顺序是 STDAPI改 -> 图标修 -> 新的语言覆盖参数

@fxliang
Copy link
Copy Markdown
Contributor

fxliang commented Apr 10, 2026

三个不是强相关的话,应该要独立来,这样绑一起了

@cqjjjzr
Copy link
Copy Markdown
Author

cqjjjzr commented Apr 10, 2026

拆开了,幸好这三个可以完全独立应用,不涉及需要来回 rebase 的情况

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses #1834 by replacing STDAPI with STDMETHODIMP for COM non-static member function definitions in WeaselTSF, avoiding extern "C" linkage on member implementations and improving compatibility with C++ tooling.

Changes:

  • Switched COM member function definitions from STDAPI/STDAPI_ to STDMETHODIMP/STDMETHODIMP_ across WeaselTSF implementation files (with exceptions for true global exports).
  • Reflowed some function signatures for readability while applying the macro changes.
  • Minor comment/brace formatting adjustments in setup and service code paths.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
WeaselTSF/WeaselTSF.cpp Converts core COM interface method definitions to STDMETHODIMP / STDMETHODIMP_.
WeaselTSF/ThreadMgrEventSink.cpp Converts thread manager event sink method definitions to STDMETHODIMP.
WeaselTSF/TextEditSink.cpp Converts text edit/layout sink method definitions to STDMETHODIMP.
WeaselTSF/Server.cpp Converts class factory COM method definitions to STDMETHODIMP (global DLL exports remain STDAPI).
WeaselTSF/LanguageBar.cpp Converts language bar COM method definitions to STDMETHODIMP.
WeaselTSF/KeyEventSink.cpp Converts key event sink COM method definitions to STDMETHODIMP.
WeaselTSF/EnumDisplayAttributeInfo.cpp Converts enumerator COM method definitions to STDMETHODIMP.
WeaselTSF/EditSession.cpp Converts ITfEditSession method definition to STDMETHODIMP.
WeaselTSF/DisplayAttributeProvider.cpp Converts display attribute provider method definitions to STDMETHODIMP.
WeaselTSF/DisplayAttributeInfo.cpp Converts display attribute info COM method definitions to STDMETHODIMP.
WeaselTSF/Composition.cpp Converts edit-session and composition sink COM method definitions to STDMETHODIMP.
WeaselTSF/Compartment.cpp Converts compartment event sink COM method definitions to STDMETHODIMP.
WeaselSetup/imesetup.cpp Comment/brace formatting around always-silent registration parameters.
WeaselServer/WeaselService.cpp Comment/brace formatting around always-on RegisterApplicationRestart call.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread WeaselTSF/Compartment.cpp
Comment on lines +10 to +11
STDMETHODIMP CCompartmentEventSink::QueryInterface(REFIID riid,
_Outptr_ void** ppvObj) {
Comment on lines +18 to 20
STDMETHODIMP CEnumDisplayAttributeInfo::QueryInterface(REFIID riid,
_Outptr_ void** ppvObj) {
if (ppvObj == nullptr)
Comment thread WeaselTSF/LanguageBar.cpp
}

STDAPI CLangBarItemButton::QueryInterface(REFIID riid, void** ppvObject) {
STDMETHODIMP CLangBarItemButton::QueryInterface(REFIID riid, void** ppvObject) {
Comment thread WeaselTSF/Server.cpp
};

STDAPI CClassFactory::QueryInterface(REFIID riid, void** ppvObject) {
STDMETHODIMP CClassFactory::QueryInterface(REFIID riid, void** ppvObject) {
Comment thread WeaselTSF/EditSession.cpp
#include "ResponseParser.h"

STDAPI WeaselTSF::DoEditSession(TfEditCookie ec) {
STDMETHODIMP WeaselTSF::DoEditSession(TfEditCookie ec) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

使用 STDMETHODIMP 而非 STDAPI 定义 COM 类成员函数

3 participants