Git fork

diff.h: fix index used to loop through unsigned integer

The `struct diff_flags` structure is essentially an array of flags, all
of which have the same type. We can thus use `sizeof()` to iterate
through all of the flags, which we do in `diff_flags_or()`. But while
the statement returns an unsigned integer, we used a signed integer to
iterate through the flags, which generates a warning.

Fix this by using `size_t` for the index instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
47d72a74 4f9264b0

+1 -23
-1
builtin/am.c
··· 5 5 */ 6 6 7 7 #define USE_THE_REPOSITORY_VARIABLE 8 - #define DISABLE_SIGN_COMPARE_WARNINGS 9 8 10 9 #include "builtin.h" 11 10 #include "abspath.h"
-1
builtin/diff-tree.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "builtin.h" 5 4 #include "config.h"
-1
builtin/merge-ours.c
··· 9 9 */ 10 10 11 11 #define USE_THE_REPOSITORY_VARIABLE 12 - #define DISABLE_SIGN_COMPARE_WARNINGS 13 12 14 13 #include "git-compat-util.h" 15 14 #include "builtin.h"
-1
builtin/pack-refs.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "builtin.h" 5 4 #include "config.h"
-1
builtin/range-diff.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "builtin.h" 5 4 #include "gettext.h"
-1
builtin/reflog.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "builtin.h" 5 4 #include "config.h"
-1
builtin/reset.c
··· 9 9 */ 10 10 11 11 #define USE_THE_REPOSITORY_VARIABLE 12 - #define DISABLE_SIGN_COMPARE_WARNINGS 13 12 14 13 #include "builtin.h" 15 14 #include "advice.h"
-1
builtin/revert.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" 5 4 #include "builtin.h"
-1
builtin/shortlog.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "builtin.h" 5 4 #include "config.h"
-2
diff-merges.c
··· 1 - #define DISABLE_SIGN_COMPARE_WARNINGS 2 - 3 1 #include "git-compat-util.h" 4 2 #include "diff-merges.h" 5 3
+1 -2
diff.h
··· 205 205 { 206 206 char *tmp_a = (char *)a; 207 207 const char *tmp_b = (const char *)b; 208 - int i; 209 208 210 - for (i = 0; i < sizeof(struct diff_flags); i++) 209 + for (size_t i = 0; i < sizeof(struct diff_flags); i++) 211 210 tmp_a[i] |= tmp_b[i]; 212 211 } 213 212
-2
diffcore-order.c
··· 2 2 * Copyright (C) 2005 Junio C Hamano 3 3 */ 4 4 5 - #define DISABLE_SIGN_COMPARE_WARNINGS 6 - 7 5 #include "git-compat-util.h" 8 6 #include "gettext.h" 9 7 #include "diff.h"
-2
diffcore-rotate.c
··· 3 3 * Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano 4 4 */ 5 5 6 - #define DISABLE_SIGN_COMPARE_WARNINGS 7 - 8 6 #include "git-compat-util.h" 9 7 #include "gettext.h" 10 8 #include "diff.h"
-1
list-objects-filter.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" 5 4 #include "dir.h"
-2
patch-ids.c
··· 1 - #define DISABLE_SIGN_COMPARE_WARNINGS 2 - 3 1 #include "git-compat-util.h" 4 2 #include "diff.h" 5 3 #include "commit.h"
-1
reachable.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" 5 4 #include "gettext.h"
-1
reflog-walk.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 - #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" 5 4 #include "commit.h"
-1
t/helper/test-revision-walking.c
··· 9 9 */ 10 10 11 11 #define USE_THE_REPOSITORY_VARIABLE 12 - #define DISABLE_SIGN_COMPARE_WARNINGS 13 12 14 13 #include "test-tool.h" 15 14 #include "commit.h"