Skip to content

Commit

Permalink
chore: fix warnings in project WeaselTSF
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed May 11, 2024
1 parent f11b28b commit 3375479
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions WeaselTSF/CandidateList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ STDMETHODIMP CCandidateList::GetDocumentMgr(ITfDocumentMgr** ppdim) {
}

STDMETHODIMP CCandidateList::GetCount(UINT* pCandidateCount) {
*pCandidateCount = _ui->ctx().cinfo.candies.size();
*pCandidateCount = static_cast<UINT>(_ui->ctx().cinfo.candies.size());
return S_OK;
}

Expand All @@ -124,7 +124,7 @@ STDMETHODIMP CCandidateList::GetString(UINT uIndex, BSTR* pbstr) {
return E_INVALIDARG;

auto& str = cinfo.candies[uIndex].str;
*pbstr = SysAllocStringLen(str.c_str(), str.size() + 1);
*pbstr = SysAllocStringLen(str.c_str(), static_cast<UINT>(str.size()) + 1);

return S_OK;
}
Expand Down Expand Up @@ -399,7 +399,7 @@ void WeaselTSF::_HandleMousePageEvent(bool* const nextPage,
int offset = *scrollNextPage ? 1 : -1;
offset = offset * (is_reposition ? -1 : 1);
int index = (int)current_select + offset;
if (index >= 0 && index < cand_count)
if (index >= 0 && index < (int)cand_count)
m_client.HighlightCandidateOnCurrentPage((size_t)index);
else {
KeyEvent ke{0, 0};
Expand Down
8 changes: 4 additions & 4 deletions WeaselTSF/Composition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ STDAPI CGetTextExtentEditSession::DoEditSession(TfEditCookie ec) {
BOOL fClipped;
TF_SELECTION selection;
ULONG nSelection;
LONG cch;

if (FAILED(_pContext->QueryInterface(IID_ITfInsertAtSelection,
(LPVOID*)&pInsertAtSelection)))
Expand Down Expand Up @@ -271,8 +270,8 @@ STDAPI CInlinePreeditEditSession::DoEditSession(TfEditCookie ec) {
if ((_pComposition->GetRange(&pRangeComposition)) != S_OK)
return E_FAIL;

if ((pRangeComposition->SetText(ec, 0, preedit.c_str(), preedit.length())) !=
S_OK)
if ((pRangeComposition->SetText(ec, 0, preedit.c_str(),
static_cast<LONG>(preedit.length()))) != S_OK)
return E_FAIL;

/* TODO: Check the availability and correctness of these values */
Expand Down Expand Up @@ -347,7 +346,8 @@ STDMETHODIMP CInsertTextEditSession::DoEditSession(TfEditCookie ec) {
if (FAILED(_pComposition->GetRange(&pRange)))
return E_FAIL;

if (FAILED(pRange->SetText(ec, 0, _text.c_str(), _text.length())))
if (FAILED(pRange->SetText(ec, 0, _text.c_str(),
static_cast<LONG>(_text.length()))))
return E_FAIL;

/* update the selection to an insertion point just past the inserted text. */
Expand Down
2 changes: 1 addition & 1 deletion WeaselTSF/KeyEventSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void WeaselTSF::_ProcessKeyEvent(WPARAM wParam, LPARAM lParam, BOOL* pfEaten) {
_EnsureServerConnected();
weasel::KeyEvent ke;
GetKeyboardState(_lpbKeyState);
if (!ConvertKeyEvent(wParam, lParam, _lpbKeyState, ke)) {
if (!ConvertKeyEvent(static_cast<UINT>(wParam), lParam, _lpbKeyState, ke)) {
/* Unknown key event */
*pfEaten = FALSE;
} else {
Expand Down

0 comments on commit 3375479

Please sign in to comment.