Skip to content

Commit f24b622

Browse files
committed
desktop: textarea: Unsigned difference expression compared to zero
Squash CodeQL `cpp/unsigned-difference-expression-compared-zero` issue. This rule finds relational comparisons between the result of an unsigned subtraction and the value `0`. Such comparisons are likely to be wrong as the value of an unsigned subtraction can never be negative. So the relational comparison ends up checking whether the result of the subtraction is equal to 0. This is probably not what the programmer intended.
1 parent 6b74da9 commit f24b622

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

desktop/textarea.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ static bool textarea_reflow_multiline(struct textarea *ta,
10871087

10881088
continue;
10891089

1090-
} else if (len - b_off > 0) {
1090+
} else if (b_off < len) {
10911091
/* soft wrapped, find last space (if any) */
10921092
for (space = text + b_off; space > text;
10931093
space--) {

0 commit comments

Comments
 (0)