Skip to content

Commit a07f15f

Browse files
committed
Merge branch 'ps/build-sign-compare' into seen
Start working to make the codebase buildable with -Wsign-compare. * ps/build-sign-compare: t/helper: don't depend on implicit wraparound
2 parents f7193ae + 1c300bd commit a07f15f

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

git.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define USE_THE_REPOSITORY_VARIABLE
2+
#define DISABLE_SIGN_COMPARE_WARNINGS
23

34
#include "builtin.h"
45
#include "config.h"

oss-fuzz/fuzz-parse-attr-line.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define DISABLE_SIGN_COMPARE_WARNINGS
2+
13
#include "git-compat-util.h"
24
#include <stddef.h>
35
#include <stdlib.h>

t/helper/test-csprng.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
#define DISABLE_SIGN_COMPARE_WARNINGS
2-
31
#include "test-tool.h"
42
#include "git-compat-util.h"
53

6-
74
int cmd__csprng(int argc, const char **argv)
85
{
96
unsigned long count;
@@ -14,7 +11,7 @@ int cmd__csprng(int argc, const char **argv)
1411
return 2;
1512
}
1613

17-
count = (argc == 2) ? strtoul(argv[1], NULL, 0) : -1L;
14+
count = (argc == 2) ? strtoul(argv[1], NULL, 0) : ULONG_MAX;
1815

1916
while (count) {
2017
unsigned long chunk = count < sizeof(buf) ? count : sizeof(buf);

t/helper/test-genrandom.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.
55
*/
66

7-
#define DISABLE_SIGN_COMPARE_WARNINGS
8-
97
#include "test-tool.h"
108
#include "git-compat-util.h"
119

@@ -24,7 +22,7 @@ int cmd__genrandom(int argc, const char **argv)
2422
next = next * 11 + *c;
2523
} while (*c++);
2624

27-
count = (argc == 3) ? strtoul(argv[2], NULL, 0) : -1L;
25+
count = (argc == 3) ? strtoul(argv[2], NULL, 0) : ULONG_MAX;
2826

2927
while (count--) {
3028
next = next * 1103515245 + 12345;

0 commit comments

Comments
 (0)