Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade lengths of RichString to size_t & many related changes. #1592

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
233c953
Fix potential out of bound access in PCPProcessTable_updateCmdline()
Explorer09 Jan 15, 2025
160c066
Minor code style adjustment in matchCmdlinePrefixWithExeSuffix()
Explorer09 Jan 16, 2025
f83ab04
Improve process cmdline basename matching with procExe path
Explorer09 Jan 16, 2025
56654dd
Improve "comm" string highlighting in Process_makeCommandStr()
Explorer09 Jan 16, 2025
9a395cb
Process: Use size_t for "cmdline" and "procExe" offsets
Explorer09 Jan 16, 2025
9eb2343
Simplify an expression in Process_updateExe()
Explorer09 Jan 16, 2025
473c847
Simplify findCommInCmdline() logic in Process.c
Explorer09 Jan 16, 2025
7ff906c
RichString_setLen() minor logic fix
Explorer09 Jan 18, 2025
bd27b7e
Prevent length wraparound in RichString_rewind()
Explorer09 Jan 18, 2025
1715ad0
Replace unnecessary RichString_appendnAscii() calls with appendAscii()
Explorer09 Jan 18, 2025
4ef38cb
Use RichString_appendnAscii() for CPU frequency text
Explorer09 Jan 18, 2025
fd54355
Add an assertion to Row_printLeftAlignedField()
Explorer09 Jan 18, 2025
39c14cd
Add bound checks when changing Panel.cursorX value
Explorer09 Jan 18, 2025
521e563
Remove redundant length clamping in Panel_draw()
Explorer09 Jan 18, 2025
78184a1
Panel.scrollH value clamp logic improvement
Explorer09 Jan 18, 2025
e101339
Use size_t for Panel.scrollH and Panel.selectedLen
Explorer09 Jan 18, 2025
9af21a7
Upgrade all length parameters of RichString class to size_t
Explorer09 Jan 18, 2025
4b32769
Add size limit checks to RichString methods
Explorer09 Jan 20, 2025
5d61426
Improve BarMeterMode_draw() limit check after data type changes
Explorer09 Jan 18, 2025
22deed3
Improve LEDMeterMode_draw() limit check after data type changes
Explorer09 Jan 18, 2025
1b8f1ab
Fix mbstowcs_nonfatal() that might convert string shorter than desired
Explorer09 Jan 18, 2025
005c9b6
Introduce RichString_append{,n}FormatAscii functions
Explorer09 Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RichString.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void RichString_setLen(RichString* this, int len) {
}

void RichString_rewind(RichString* this, int count) {
RichString_setLen(this, this->chlen - count);
RichString_setLen(this, this->chlen > count ? this->chlen - count : 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Once the types of RichString.chlen and count are changed to unsigned, we can change this expression to a saturatingSub() call to make the expression more concise to read. However, I found missed optimizations with this: In GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118679) and in Clang
(llvm/llvm-project#124714)

}

#ifdef HAVE_LIBNCURSESW
Expand Down