Skip to content

Instantly share code, notes, and snippets.

@kjk
Last active Jun 3, 2022
Embed
What would you like to do?
cpp check results for sumatra (made with https://codeeval.dev)
src\utils\ScopedWin.h:223:9: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'prevPen' a value by passing the value to the constructor in the initialization list. [useInitializationList]
prevPen = (HPEN)SelectObject(hdc, pen);
^
src\utils\ScopedWin.h:237:9: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'prevBrush' a value by passing the value to the constructor in the initialization list. [useInitializationList]
prevBrush = (HBRUSH)SelectObject(hdc, pen);
^
src\mui\TextRender.h:108:5: warning: Member variable 'TextRenderGdiplus::measureAlgo' is not initialized in the constructor. [uninitMemberVarPrivate]
TextRenderGdiplus() = default;
^
src\ExternalViewers.cpp:23:17: style: struct member 'ExternalViewerInfo::name' is never used. [unusedStructMember]
const char* name; // shown to the user
^
src\MainWindow.cpp:79:5: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'rect' a value by passing the value to the constructor in the initialization list. [useInitializationList]
rect = other.rect;
^
src\MainWindow.cpp:100:5: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'hwndFrame' a value by passing the value to the constructor in the initialization list. [useInitializationList]
hwndFrame = hwnd;
^
src\MemLeakDetect.cpp:72:9: portability: Returning an integer (int/long/etc) in a function with pointer return type is not portable across different platforms and compilers. For example in 32-bit Windows and Linux they are same width, but in 64-bit Windows and Linux they are of different width. In worst case you end up casting 64-bit integer down to 32-bit pointer. The safe way is to always return a pointer. [CastIntegerToAddressAtReturn]
return gRtlAllocateHeapOrig(gHeap, 0, n);
^
src\MemLeakDetect.cpp:75:9: portability: Returning an integer (int/long/etc) in a function with pointer return type is not portable across different platforms and compilers. For example in 32-bit Windows and Linux they are same width, but in 64-bit Windows and Linux they are of different width. In worst case you end up casting 64-bit integer down to 32-bit pointer. The safe way is to always return a pointer. [CastIntegerToAddressAtReturn]
return gHeapAllocOrig(gHeap, 0, n);
^
src\Menu.cpp:1358:9: style: struct member 'Anonymous2::itemId' is never used. [unusedStructMember]
int itemId;
^
src\Menu.cpp:1359:11: style: struct member 'Anonymous2::zoom' is never used. [unusedStructMember]
float zoom;
^
src\MobiDoc.cpp:48:17: style: struct member 'Anonymous0::reserved2' is never used. [unusedStructMember]
u16 reserved2;
^
src\PdfSync.cpp:69:9: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'scanner' a value by passing the value to the constructor in the initialization list. [useInitializationList]
scanner = nullptr;
^
src\PdfSync.cpp:88:5: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'syncFilePath' a value by passing the value to the constructor in the initialization list. [useInitializationList]
syncFilePath = str::Dup(syncFilePathIn);
^
src\Print.cpp:890:11: style: struct member 'PaperSizeDesc::minDx' is never used. [unusedStructMember]
float minDx, maxDx;
^
src\Print.cpp:890:18: style: struct member 'PaperSizeDesc::maxDx' is never used. [unusedStructMember]
float minDx, maxDx;
^
src\Print.cpp:891:11: style: struct member 'PaperSizeDesc::minDy' is never used. [unusedStructMember]
float minDy, maxDy;
^
src\Print.cpp:891:18: style: struct member 'PaperSizeDesc::maxDy' is never used. [unusedStructMember]
float minDy, maxDy;
^
src\Print.cpp:892:17: style: struct member 'PaperSizeDesc::paperFormat' is never used. [unusedStructMember]
PaperFormat paperFormat;
^
src\SearchAndDDE.cpp:239:17: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
wnd = nullptr;
^
src\SearchAndDDE.cpp:324:23: warning: Either the condition 'ftd' is redundant or there is possible null pointer dereference: ftd. [nullPointerRedundantCheck]
MainWindow* win = ftd->win;
^
src\SearchAndDDE.cpp:323:5: note: Assuming that condition 'ftd' is not redundant
CrashIf(!(ftd && ftd->win && ftd->win->ctrl && ftd->win->ctrl->AsFixed()));
^
src\SearchAndDDE.cpp:322:27: note: Assignment to 'ftd=(FindThreadData*)data'
FindThreadData* ftd = (FindThreadData*)data;
^
src\SearchAndDDE.cpp:322:25: note: ftd is assigned '(FindThreadData*)data' here.
FindThreadData* ftd = (FindThreadData*)data;
^
src\SearchAndDDE.cpp:324:23: note: Null pointer dereference
MainWindow* win = ftd->win;
^
src\SearchAndDDE.cpp:328:34: warning: Either the condition 'ftd' is redundant or there is possible null pointer dereference: ftd. [nullPointerRedundantCheck]
dm->textSearch->SetDirection(ftd->direction);
^
src\SearchAndDDE.cpp:323:5: note: Assuming that condition 'ftd' is not redundant
CrashIf(!(ftd && ftd->win && ftd->win->ctrl && ftd->win->ctrl->AsFixed()));
^
src\SearchAndDDE.cpp:322:27: note: Assignment to 'ftd=(FindThreadData*)data'
FindThreadData* ftd = (FindThreadData*)data;
^
src\SearchAndDDE.cpp:322:25: note: ftd is assigned '(FindThreadData*)data' here.
FindThreadData* ftd = (FindThreadData*)data;
^
src\SearchAndDDE.cpp:328:34: note: Null pointer dereference
dm->textSearch->SetDirection(ftd->direction);
^
src\SearchAndDDE.cpp:329:9: warning: Either the condition 'ftd' is redundant or there is possible null pointer dereference: ftd. [nullPointerRedundantCheck]
if (ftd->wasModified || !win->ctrl->ValidPageNo(dm->textSearch->GetCurrentPageNo()) ||
^
src\SearchAndDDE.cpp:323:5: note: Assuming that condition 'ftd' is not redundant
CrashIf(!(ftd && ftd->win && ftd->win->ctrl && ftd->win->ctrl->AsFixed()));
^
src\SearchAndDDE.cpp:322:27: note: Assignment to 'ftd=(FindThreadData*)data'
FindThreadData* ftd = (FindThreadData*)data;
^
src\SearchAndDDE.cpp:322:25: note: ftd is assigned '(FindThreadData*)data' here.
FindThreadData* ftd = (FindThreadData*)data;
^
src\SearchAndDDE.cpp:329:9: note: Null pointer dereference
if (ftd->wasModified || !win->ctrl->ValidPageNo(dm->textSearch->GetCurrentPageNo()) ||
^
src\SumatraStartup.cpp:953:20: style: Variable 'gEnableMemLeak' is reassigned a value before the old one has been used. [redundantAssignment]
gEnableMemLeak = false;
^
src\SumatraStartup.cpp:951:24: note: gEnableMemLeak is assigned
gEnableMemLeak = true;
^
src\SumatraStartup.cpp:953:20: note: gEnableMemLeak is overwritten
gEnableMemLeak = false;
^
src\utils\CssParser.cpp:161:19: warning: Either the condition 'sel.clazz' is redundant or there is overflow in pointer subtraction. [nullPointerArithmeticRedundantCheck]
if (sel.clazz - 1 == sel.s) {
^
src\utils\CssParser.cpp:163:25: note: Assuming that condition 'sel.clazz' is not redundant
} else if (c == (sel.clazz ? sel.clazz - 1 : sEnd) && c == sel.s + 1 && *sel.s == '*') {
^
src\utils\CssParser.cpp:161:19: note: Null pointer subtraction
if (sel.clazz - 1 == sel.s) {
^
src\utils\HtmlPullParser.cpp:379:17: style: Local variable 'start' shadows outer variable [shadowVariable]
const char* start = currPos;
^
src\utils\HtmlPullParser.h:82:17: note: Shadowed declaration
const char* start = nullptr;
^
src\utils\HtmlPullParser.cpp:379:17: note: Shadow variable
const char* start = currPos;
^
src\utils\HtmlWindow.cpp:1910:5: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'refCount' a value by passing the value to the constructor in the initialization list. [useInitializationList]
refCount = 1;
^
src\utils\HtmlWindow.cpp:1919:5: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'ambientLocale' a value by passing the value to the constructor in the initialization list. [useInitializationList]
ambientLocale = 0;
^
src\utils\HtmlWindow.cpp:1920:5: performance: When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'ambientForeColor' a value by passing the value to the constructor in the initialization list. [useInitializationList]
ambientForeColor = ::GetSysColor(COLOR_WINDOWTEXT);
^
src\utils\MinHook.cpp:842:8: style: struct member '_CALL_ABS::opcode0' is never used. [unusedStructMember]
u8 opcode0; // FF15 00000002: CALL [+6]
^
src\utils\MinHook.cpp:843:8: style: struct member '_CALL_ABS::opcode1' is never used. [unusedStructMember]
u8 opcode1;
^
src\utils\MinHook.cpp:845:8: style: struct member '_CALL_ABS::dummy1' is never used. [unusedStructMember]
u8 dummy1; // EB 08: JMP +10
^
src\utils\MinHook.cpp:846:8: style: struct member '_CALL_ABS::dummy2' is never used. [unusedStructMember]
u8 dummy2;
^
src\utils\MinHook.cpp:852:8: style: struct member '_JCC_REL::opcode0' is never used. [unusedStructMember]
u8 opcode0; // 0F8* xxxxxxxx: J** +6+xxxxxxxx
^
src\utils\MinHook.cpp:853:8: style: struct member '_JCC_REL::opcode1' is never used. [unusedStructMember]
u8 opcode1;
^
src\utils\MinHook.cpp:860:8: style: struct member '_JCC_ABS::dummy0' is never used. [unusedStructMember]
u8 dummy0;
^
src\utils\MinHook.cpp:861:8: style: struct member '_JCC_ABS::dummy1' is never used. [unusedStructMember]
u8 dummy1; // FF25 00000000: JMP [+6]
^
src\utils\MinHook.cpp:862:8: style: struct member '_JCC_ABS::dummy2' is never used. [unusedStructMember]
u8 dummy2;
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment