mirror of
https://github.com/git/git.git
synced 2025-02-06 09:44:30 +00:00
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>
This commit is contained in:
parent
4f9264b0cd
commit
47d72a74a7
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "abspath.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "builtin.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "gettext.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "advice.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "builtin.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
|
@ -1,5 +1,3 @@
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "diff-merges.h"
|
||||
|
||||
|
3
diff.h
3
diff.h
@ -205,9 +205,8 @@ static inline void diff_flags_or(struct diff_flags *a,
|
||||
{
|
||||
char *tmp_a = (char *)a;
|
||||
const char *tmp_b = (const char *)b;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(struct diff_flags); i++)
|
||||
for (size_t i = 0; i < sizeof(struct diff_flags); i++)
|
||||
tmp_a[i] |= tmp_b[i];
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
* Copyright (C) 2005 Junio C Hamano
|
||||
*/
|
||||
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "gettext.h"
|
||||
#include "diff.h"
|
||||
|
@ -3,8 +3,6 @@
|
||||
* Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano
|
||||
*/
|
||||
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "gettext.h"
|
||||
#include "diff.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "dir.h"
|
||||
|
@ -1,5 +1,3 @@
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "diff.h"
|
||||
#include "commit.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "gettext.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "commit.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "test-tool.h"
|
||||
#include "commit.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user