Skip to content

Commit

Permalink
Fix some Cppcheck warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed May 10, 2024
1 parent 60dcd06 commit bee0824
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions metapath/src/metapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -3634,8 +3634,8 @@ void LoadLaunchSetings(void) {
IniSectionParse(pIniSection, pIniSectionBuf);

int iValue = IniSectionGetInt(pIniSection, L"UseTargetApplication", UseTargetApplication_NotSet);
iUseTargetApplication = (UseTargetApplication)iValue;
if (iUseTargetApplication != UseTargetApplication_NotSet) {
if (iValue != UseTargetApplication_NotSet) {
iUseTargetApplication = (UseTargetApplication)iValue;
IniSectionGetString(pIniSection, L"TargetApplicationPath", szTargetApplication, szTargetApplication, COUNTOF(szTargetApplication));
IniSectionGetString(pIniSection, L"TargetApplicationParams", szTargetApplicationParams, szTargetApplicationParams, COUNTOF(szTargetApplicationParams));
iValue = IniSectionGetInt(pIniSection, L"TargetApplicationMode", (int)iTargetApplicationMode);
Expand Down
2 changes: 1 addition & 1 deletion scintilla/lexers/LexCPP.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ void ColouriseCppDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
} else if (iswordchar(s[0]) && (IsASpace(sc.ch) || sc.ch == '[' || sc.ch == ')' || sc.ch == '>'
|| sc.ch == '*' || sc.ch == '&' || sc.ch == ':')) {
bool is_class = false;
Sci_PositionU pos = sc.currentPos;
const int next_char = nextChar;

if (sc.ch == ':' && sc.chNext == ':') { // C++
Expand All @@ -319,6 +318,7 @@ void ColouriseCppDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
if (!IsUpperCase(s[0])) is_class = false;
}
} else if (next_char == ')' || next_char == '>' || next_char == '[' || next_char == '*' || next_char == '&') {
Sci_PositionU pos = sc.currentPos;
while (IsASpace(styler.SafeGetCharAt(pos))) pos++;
pos++;
while (IsASpace(styler.SafeGetCharAt(pos))) pos++;
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ std::string CodePretty(LPCEDITLEXER pLex, const char *styledText, size_t textLen
} else if (ch == '!') {
spaceOption |= SpaceOption_SpaceBefore; // !important
}
} else if (pLex->iLexer == SCLEX_JAVASCRIPT) {
} else {
if (ch == '(') {
braceTop = '(';
spaceOption |= SpaceOption_PushBrace;
Expand Down
2 changes: 1 addition & 1 deletion src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2632,7 +2632,7 @@ static INT_PTR CALLBACK InfoBoxDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR
case IDYES:
case IDNO:
if (IsButtonChecked(hwnd, IDC_INFOBOXCHECK)) {
LPINFOBOX lpib = (LPINFOBOX)GetWindowLongPtr(hwnd, DWLP_USER);
const LPCINFOBOX lpib = (LPCINFOBOX)GetWindowLongPtr(hwnd, DWLP_USER);
IniSetBool(INI_SECTION_NAME_SUPPRESSED_MESSAGES, lpib->lpstrSetting, SuppressMmessage_Suppress);
}
EndDialog(hwnd, LOWORD(wParam));
Expand Down
2 changes: 1 addition & 1 deletion src/Edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,7 @@ void EditURLDecode(void) {
UrlUnescape(pszTextW, pszUnescapedW, &cchUnescapedW, URL_UNESCAPE_AS_UTF8);
if (!IsWin8AndAbove()) {
char *ptr = pszUnescaped;
WCHAR *t = pszUnescapedW;
LPCWSTR t = pszUnescapedW;
WCHAR ch;
while ((ch = *t++) != 0) {
if (ch > 0xff) {
Expand Down
4 changes: 2 additions & 2 deletions src/Styles.c
Original file line number Diff line number Diff line change
Expand Up @@ -3515,15 +3515,15 @@ bool Style_SelectColor(HWND hwnd, LPWSTR lpszStyle, int cchStyle, bool bFore) {
if (StrNotEmpty(szNewStyle)) {
lstrcat(szNewStyle, L"; ");
}
wsprintf(tch, L"fore:#%06X", iRGBResult);
wsprintf(tch, L"fore:#%06X", (unsigned)iRGBResult);
lstrcat(szNewStyle, tch);
Style_StrCopyBack(szNewStyle, lpszStyle, tch);
} else {
Style_StrCopyFore(szNewStyle, lpszStyle, tch);
if (StrNotEmpty(szNewStyle)) {
lstrcat(szNewStyle, L"; ");
}
wsprintf(tch, L"back:#%06X", iRGBResult);
wsprintf(tch, L"back:#%06X", (unsigned)iRGBResult);
lstrcat(szNewStyle, tch);
}

Expand Down

0 comments on commit bee0824

Please sign in to comment.