Skip to content

Commit

Permalink
fix: fix defects according to Coverity Scan
Browse files Browse the repository at this point in the history
  • Loading branch information
Prcuvu committed Apr 5, 2018
1 parent c8c64ff commit 526a91d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion RimeWithWeasel/RimeWithWeasel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ bool RimeWithWeaselHandler::_Respond(UINT session_id, EatLine eat)
RimeFreeCommit(&commit);
}

bool is_composing;
bool is_composing = false;
RIME_STRUCT(RimeStatus, status);
if (RimeGetStatus(session_id, &status))
{
Expand Down
1 change: 1 addition & 0 deletions WeaselDeployer/Configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ int Configurator::SyncUserData() {
if (!rime->sync_user_data())
{
LOG(ERROR) << "Error synching user data.";
CloseHandle(hMutex);
return 1;
}
rime->join_maintenance_thread();
Expand Down
4 changes: 3 additions & 1 deletion WeaselDeployer/SwitcherSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ LRESULT SwitcherSettingsDialog::OnOK(WORD, WORD code, HWND, BOOL&) {
}
}
if (count == 0) {
MessageBox(L"至少要選用一項吧。", L"小狼毫不是這般用法", MB_OK | MB_ICONEXCLAMATION);
MessageBox(_T("至少要選用一項吧。"), _T("小狼毫不是這般用法"), MB_OK | MB_ICONEXCLAMATION);
delete selection;
return 0;
}
api_->select_schemas(settings_, selection, count);
delete selection;
}
EndDialog(code);
return 0;
Expand Down
4 changes: 4 additions & 0 deletions WeaselServer/WeaselService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ WeaselService::WeaselService(

WeaselService::~WeaselService()
{
if (_stoppedEvent != NULL)
{
CloseHandle(_stoppedEvent);
}
}

BOOL WeaselService::Run(WeaselService &serv)
Expand Down
9 changes: 6 additions & 3 deletions WeaselSetup/imesetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,14 @@ int register_ime(const wpath& ime_path, bool register_ime, bool is_wow64, bool h
DWORD len = sizeof(imeFile);
DWORD type = 0;
ret = RegQueryValueEx(hSubKey, L"Ime File", NULL, &type, (LPBYTE)imeFile, &len);
RegCloseKey(hSubKey);
if (_wcsicmp(imeFile, L"weasel.ime") == 0)
if (ret = ERROR_SUCCESS)
{
hKL = (HKL)k; // already there
if (_wcsicmp(imeFile, L"weasel.ime") == 0)
{
hKL = (HKL)k; // already there
}
}
RegCloseKey(hSubKey);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion include/WeaselCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace weasel

struct TextAttribute
{
TextAttribute() {}
TextAttribute() : type(NONE) {}
TextAttribute(int _start, int _end, TextAttributeType _type) : range(_start, _end), type(_type) {}
TextRange range;
TextAttributeType type;
Expand Down

0 comments on commit 526a91d

Please sign in to comment.