aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/helper/test-bloom.c9
-rw-r--r--t/helper/test-cache-tree.c1
-rw-r--r--t/helper/test-config.c1
-rw-r--r--t/helper/test-csprng.c3
-rw-r--r--t/helper/test-drop-caches.c2
-rw-r--r--t/helper/test-dump-fsmonitor.c3
-rw-r--r--t/helper/test-dump-split-index.c3
-rw-r--r--t/helper/test-dump-untracked-cache.c6
-rw-r--r--t/helper/test-genrandom.c2
-rw-r--r--t/helper/test-genzeros.c2
-rw-r--r--t/helper/test-hash-speed.c5
-rw-r--r--t/helper/test-mergesort.c2
-rw-r--r--t/helper/test-parse-options.c5
-rw-r--r--t/helper/test-path-utils.c1
-rw-r--r--t/helper/test-reach.c3
-rw-r--r--t/helper/test-ref-store.c3
-rw-r--r--t/helper/test-run-command.c2
-rw-r--r--t/helper/test-string-list.c2
-rw-r--r--t/helper/test-tool.c3
-rw-r--r--t/helper/test-trace2.c1
-rw-r--r--t/unit-tests/lib-reftable.c2
-rw-r--r--t/unit-tests/t-example-decorate.c4
-rw-r--r--t/unit-tests/t-prio-queue.c2
-rw-r--r--t/unit-tests/t-reftable-readwrite.c2
-rw-r--r--t/unit-tests/t-reftable-stack.c2
-rw-r--r--t/unit-tests/t-trailer.c2
-rw-r--r--t/unit-tests/test-lib.c2
27 files changed, 43 insertions, 32 deletions
diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c
index 97541daf71..14e075c1a1 100644
--- a/t/helper/test-bloom.c
+++ b/t/helper/test-bloom.c
@@ -11,30 +11,25 @@ static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
static void add_string_to_filter(const char *data, struct bloom_filter *filter) {
struct bloom_key key;
- int i;
fill_bloom_key(data, strlen(data), &key, &settings);
printf("Hashes:");
- for (i = 0; i < settings.num_hashes; i++){
+ for (size_t i = 0; i < settings.num_hashes; i++)
printf("0x%08x|", key.hashes[i]);
- }
printf("\n");
add_key_to_filter(&key, filter, &settings);
clear_bloom_key(&key);
}
static void print_bloom_filter(struct bloom_filter *filter) {
- int i;
-
if (!filter) {
printf("No filter.\n");
return;
}
printf("Filter_Length:%d\n", (int)filter->len);
printf("Filter_Data:");
- for (i = 0; i < filter->len; i++) {
+ for (size_t i = 0; i < filter->len; i++)
printf("%02x|", filter->data[i]);
- }
printf("\n");
}
diff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c
index 5cdef3ebef..3ae45cec3b 100644
--- a/t/helper/test-cache-tree.c
+++ b/t/helper/test-cache-tree.c
@@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
+#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "gettext.h"
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 33247f0e92..75e028ab2a 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
+#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "config.h"
diff --git a/t/helper/test-csprng.c b/t/helper/test-csprng.c
index 65d14973c5..a4a0aca617 100644
--- a/t/helper/test-csprng.c
+++ b/t/helper/test-csprng.c
@@ -1,7 +1,6 @@
#include "test-tool.h"
#include "git-compat-util.h"
-
int cmd__csprng(int argc, const char **argv)
{
unsigned long count;
@@ -12,7 +11,7 @@ int cmd__csprng(int argc, const char **argv)
return 2;
}
- count = (argc == 2) ? strtoul(argv[1], NULL, 0) : -1L;
+ count = (argc == 2) ? strtoul(argv[1], NULL, 0) : ULONG_MAX;
while (count) {
unsigned long chunk = count < sizeof(buf) ? count : sizeof(buf);
diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
index 73e551cfc2..7055d94354 100644
--- a/t/helper/test-drop-caches.c
+++ b/t/helper/test-drop-caches.c
@@ -1,3 +1,5 @@
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-tool.h"
#include "git-compat-util.h"
diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
index 1b7f37a84f..efd017ca35 100644
--- a/t/helper/test-dump-fsmonitor.c
+++ b/t/helper/test-dump-fsmonitor.c
@@ -8,7 +8,6 @@
int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED)
{
struct index_state *istate = the_repository->index;
- int i;
setup_git_directory();
if (do_read_index(istate, the_repository->index_file, 0) < 0)
@@ -19,7 +18,7 @@ int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED)
}
printf("fsmonitor last update %s\n", istate->fsmonitor_last_update);
- for (i = 0; i < istate->cache_nr; i++)
+ for (size_t i = 0; i < istate->cache_nr; i++)
printf((istate->cache[i]->ce_flags & CE_FSMONITOR_VALID) ? "+" : "-");
return 0;
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index a6720faf9c..f855a3862c 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -16,7 +16,6 @@ static void show_bit(size_t pos, void *data UNUSED)
int cmd__dump_split_index(int ac UNUSED, const char **av)
{
struct split_index *si;
- int i;
setup_git_directory();
@@ -28,7 +27,7 @@ int cmd__dump_split_index(int ac UNUSED, const char **av)
return 0;
}
printf("base %s\n", oid_to_hex(&si->base_oid));
- for (i = 0; i < the_repository->index->cache_nr; i++) {
+ for (size_t i = 0; i < the_repository->index->cache_nr; i++) {
struct cache_entry *ce = the_repository->index->cache[i];
printf("%06o %s %d\t%s\n", ce->ce_mode,
oid_to_hex(&ce->oid), ce_stage(ce), ce->name);
diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index b2e70837a9..01a109496b 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -23,7 +23,7 @@ static int compare_dir(const void *a_, const void *b_)
static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
{
- int i, len;
+ int len;
QSORT(ucd->untracked, ucd->untracked_nr, compare_untracked);
QSORT(ucd->dirs, ucd->dirs_nr, compare_dir);
len = base->len;
@@ -37,9 +37,9 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
if (ucd->valid)
fputs(" valid", stdout);
printf("\n");
- for (i = 0; i < ucd->untracked_nr; i++)
+ for (size_t i = 0; i < ucd->untracked_nr; i++)
printf("%s\n", ucd->untracked[i]);
- for (i = 0; i < ucd->dirs_nr; i++)
+ for (size_t i = 0; i < ucd->dirs_nr; i++)
dump(ucd->dirs[i], base);
strbuf_setlen(base, len);
}
diff --git a/t/helper/test-genrandom.c b/t/helper/test-genrandom.c
index 99b8dc1e2d..51b67f2f87 100644
--- a/t/helper/test-genrandom.c
+++ b/t/helper/test-genrandom.c
@@ -22,7 +22,7 @@ int cmd__genrandom(int argc, const char **argv)
next = next * 11 + *c;
} while (*c++);
- count = (argc == 3) ? strtoul(argv[2], NULL, 0) : -1L;
+ count = (argc == 3) ? strtoul(argv[2], NULL, 0) : ULONG_MAX;
while (count--) {
next = next * 1103515245 + 12345;
diff --git a/t/helper/test-genzeros.c b/t/helper/test-genzeros.c
index 47af843b68..b895436a32 100644
--- a/t/helper/test-genzeros.c
+++ b/t/helper/test-genzeros.c
@@ -1,3 +1,5 @@
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-tool.h"
#include "git-compat-util.h"
diff --git a/t/helper/test-hash-speed.c b/t/helper/test-hash-speed.c
index 7de822af51..80df1aae66 100644
--- a/t/helper/test-hash-speed.c
+++ b/t/helper/test-hash-speed.c
@@ -16,12 +16,11 @@ int cmd__hash_speed(int ac, const char **av)
unsigned char hash[GIT_MAX_RAWSZ];
clock_t initial, start, end;
unsigned bufsizes[] = { 64, 256, 1024, 8192, 16384 };
- int i;
void *p;
const struct git_hash_algo *algo = NULL;
if (ac == 2) {
- for (i = 1; i < GIT_HASH_NALGOS; i++) {
+ for (size_t i = 1; i < GIT_HASH_NALGOS; i++) {
if (!strcmp(av[1], hash_algos[i].name)) {
algo = &hash_algos[i];
break;
@@ -36,7 +35,7 @@ int cmd__hash_speed(int ac, const char **av)
printf("algo: %s\n", algo->name);
- for (i = 0; i < ARRAY_SIZE(bufsizes); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(bufsizes); i++) {
unsigned long j, kb;
double kb_per_sec;
p = xcalloc(1, bufsizes[i]);
diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c
index 328bfe2977..791e128793 100644
--- a/t/helper/test-mergesort.c
+++ b/t/helper/test-mergesort.c
@@ -1,3 +1,5 @@
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-tool.h"
#include "mem-pool.h"
#include "mergesort.h"
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 5da359486c..bfe45ec68b 100644
--- a/t/helper/test-parse-options.c
+++ b/t/helper/test-parse-options.c
@@ -174,7 +174,6 @@ int cmd__parse_options(int argc, const char **argv)
OPT_ALIAS('Z', "alias-target", "alias-source"),
OPT_END(),
};
- int i;
int ret = 0;
trace2_cmd_name("_parse_");
@@ -198,10 +197,10 @@ int cmd__parse_options(int argc, const char **argv)
show(&expect, &ret, "dry run: %s", dry_run ? "yes" : "no");
show(&expect, &ret, "file: %s", file ? file : "(not set)");
- for (i = 0; i < list.nr; i++)
+ for (size_t i = 0; i < list.nr; i++)
show(&expect, &ret, "list: %s", list.items[i].string);
- for (i = 0; i < argc; i++)
+ for (int i = 0; i < argc; i++)
show(&expect, &ret, "arg %02d: %s", i, argv[i]);
expect.strdup_strings = 1;
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index 3129aa28fd..72ac8d1b1b 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
+#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "abspath.h"
diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c
index 84deee604a..01cf77ae65 100644
--- a/t/helper/test-reach.c
+++ b/t/helper/test-reach.c
@@ -13,7 +13,6 @@
static void print_sorted_commit_ids(struct commit_list *list)
{
- int i;
struct string_list s = STRING_LIST_INIT_DUP;
while (list) {
@@ -23,7 +22,7 @@ static void print_sorted_commit_ids(struct commit_list *list)
string_list_sort(&s);
- for (i = 0; i < s.nr; i++)
+ for (size_t i = 0; i < s.nr; i++)
printf("%s\n", s.items[i].string);
string_list_clear(&s, 0);
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 240f6fc29d..1cc05f043a 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -24,14 +24,13 @@ struct flag_definition {
static unsigned int parse_flags(const char *str, struct flag_definition *defs)
{
struct string_list masks = STRING_LIST_INIT_DUP;
- int i = 0;
unsigned int result = 0;
if (!strcmp(str, "0"))
return 0;
string_list_split(&masks, str, ',', 64);
- for (; i < masks.nr; i++) {
+ for (size_t i = 0; i < masks.nr; i++) {
const char *name = masks.items[i].string;
struct flag_definition *def = defs;
int found = 0;
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index 61eb1175fe..3719f23cc2 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -8,6 +8,8 @@
* published by the Free Software Foundation.
*/
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-tool.h"
#include "run-command.h"
#include "strvec.h"
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index e2aad611d1..6f10c5a435 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -1,3 +1,5 @@
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-tool.h"
#include "strbuf.h"
#include "string-list.h"
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 1ebb69a5dc..4a7aa993ba 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -101,7 +101,6 @@ static NORETURN void die_usage(void)
int cmd_main(int argc, const char **argv)
{
- int i;
const char *working_directory = NULL;
struct option options[] = {
OPT_STRING('C', NULL, &working_directory, "directory",
@@ -120,7 +119,7 @@ int cmd_main(int argc, const char **argv)
if (working_directory && chdir(working_directory) < 0)
die("Could not cd to '%s'", working_directory);
- for (i = 0; i < ARRAY_SIZE(cmds); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(cmds); i++) {
if (!strcmp(cmds[i].name, argv[1])) {
argv++;
argc--;
diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c
index c588c273ce..415df078c1 100644
--- a/t/helper/test-trace2.c
+++ b/t/helper/test-trace2.c
@@ -1,4 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
+#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "strvec.h"
diff --git a/t/unit-tests/lib-reftable.c b/t/unit-tests/lib-reftable.c
index d795dfb7c9..8a69612266 100644
--- a/t/unit-tests/lib-reftable.c
+++ b/t/unit-tests/lib-reftable.c
@@ -1,3 +1,5 @@
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "lib-reftable.h"
#include "test-lib.h"
#include "reftable/constants.h"
diff --git a/t/unit-tests/t-example-decorate.c b/t/unit-tests/t-example-decorate.c
index 8bf0709c41..bfc776e223 100644
--- a/t/unit-tests/t-example-decorate.c
+++ b/t/unit-tests/t-example-decorate.c
@@ -42,9 +42,9 @@ static void t_lookup(struct test_vars *vars)
static void t_loop(struct test_vars *vars)
{
- int i, objects_noticed = 0;
+ int objects_noticed = 0;
- for (i = 0; i < vars->n.size; i++) {
+ for (size_t i = 0; i < vars->n.size; i++) {
if (vars->n.entries[i].base)
objects_noticed++;
}
diff --git a/t/unit-tests/t-prio-queue.c b/t/unit-tests/t-prio-queue.c
index fe6ae37935..a053635000 100644
--- a/t/unit-tests/t-prio-queue.c
+++ b/t/unit-tests/t-prio-queue.c
@@ -25,7 +25,7 @@ static void test_prio_queue(int *input, size_t input_size,
struct prio_queue pq = { intcmp };
int j = 0;
- for (int i = 0; i < input_size; i++) {
+ for (size_t i = 0; i < input_size; i++) {
void *peek, *get;
switch(input[i]) {
case GET:
diff --git a/t/unit-tests/t-reftable-readwrite.c b/t/unit-tests/t-reftable-readwrite.c
index 8c4161f365..6b75a419b9 100644
--- a/t/unit-tests/t-reftable-readwrite.c
+++ b/t/unit-tests/t-reftable-readwrite.c
@@ -6,6 +6,8 @@ license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-lib.h"
#include "lib-reftable.h"
#include "reftable/basics.h"
diff --git a/t/unit-tests/t-reftable-stack.c b/t/unit-tests/t-reftable-stack.c
index e208e156f0..aeec195b2b 100644
--- a/t/unit-tests/t-reftable-stack.c
+++ b/t/unit-tests/t-reftable-stack.c
@@ -6,6 +6,8 @@ license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-lib.h"
#include "lib-reftable.h"
#include "dir.h"
diff --git a/t/unit-tests/t-trailer.c b/t/unit-tests/t-trailer.c
index e1c6ad7461..184593e73d 100644
--- a/t/unit-tests/t-trailer.c
+++ b/t/unit-tests/t-trailer.c
@@ -1,3 +1,5 @@
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-lib.h"
#include "trailer.h"
diff --git a/t/unit-tests/test-lib.c b/t/unit-tests/test-lib.c
index fa1f95965c..87e1f5c201 100644
--- a/t/unit-tests/test-lib.c
+++ b/t/unit-tests/test-lib.c
@@ -1,3 +1,5 @@
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "test-lib.h"
enum result {