Skip to content

Commit

Permalink
Minor code refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Dec 24, 2023
1 parent e8db1a1 commit 1f3f202
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Checks: >
misc-*,
-clang-analyzer-security.insecureAPI.strcpy,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-analyzer-optin.core.EnumCastOutOfRange,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-narrowing-conversions,
Expand Down
4 changes: 1 addition & 3 deletions src/Helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -2582,8 +2582,7 @@ HBITMAP BitmapCache_Get(BitmapCache *cache, LPCWSTR path) {
cache->used |= 1U << index;
HBITMAP hbmp = cache->items[index];
if (hbmp == NULL) {
HDC hDC = GetDC(NULL);
HDC bitmapDC = CreateCompatibleDC(hDC);
HDC bitmapDC = CreateCompatibleDC(NULL);
int width = 0;
int height = 0;
ImageList_GetIconSize(imageList, &width, &height);
Expand All @@ -2593,7 +2592,6 @@ HBITMAP BitmapCache_Get(BitmapCache *cache, LPCWSTR path) {
ImageList_Draw(imageList, iIcon, bitmapDC, 0, 0, ILD_TRANSPARENT);
SelectBitmap(bitmapDC, oldBitmap);
DeleteDC(bitmapDC);
ReleaseDC(NULL, hDC);
cache->items[index] = hbmp;
}

Expand Down
4 changes: 4 additions & 0 deletions src/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ NP2_inline bool IsASpaceOrTab(int ch) {
return ch == ' ' || ch == '\t';
}

NP2_inline bool IsADigit(int ch) {
return ch >= '0' && ch <= '9';
}

NP2_inline bool IsOctalDigit(int ch) {
return ch >= '0' && ch <= '7';
}
Expand Down

0 comments on commit 1f3f202

Please sign in to comment.