Commit d2fc293
rm: fix sign comparison warnings
There are multiple places in loops, where a signed and an
unsigned data type are compared. Git uses a mix of signed and unsigned
types to store lengths of arrays. This sometimes leads to using a signed
index for an array whose length is stored in an unsigned variable or
vice versa.
get_ours_cache_pos is a special case where i, though derived from a
signed variable is never negative. Move this part to the caller side
and make i an unsigned argument of the function. Rename i to
pos to make it descriptive, now that it is a function argument.
Replace signed data types with unsigned data types and vice versa
wherever necessary. Where both signed and unsigned data types have been
used, define a new variable in the scope of the for loop for use as the
iterator. Remove #define DISABLE_SIGN_COMPARE_WARNINGS.
Signed-off-by: Arnav Bhate <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 683c54c commit d2fc293
1 file changed
+9
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
| 42 | + | |
44 | 43 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
51 | 48 | | |
52 | 49 | | |
53 | 50 | | |
| |||
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
61 | | - | |
| 58 | + | |
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
| |||
83 | 80 | | |
84 | 81 | | |
85 | 82 | | |
86 | | - | |
| 83 | + | |
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
| |||
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
134 | | - | |
| 131 | + | |
135 | 132 | | |
136 | 133 | | |
137 | 134 | | |
| |||
314 | 311 | | |
315 | 312 | | |
316 | 313 | | |
317 | | - | |
| 314 | + | |
318 | 315 | | |
319 | 316 | | |
320 | 317 | | |
| |||
0 commit comments