Skip to content

Commit 876e7bb

Browse files
committed
Merge branch 'ta/bulk-checkin-signed-compare-false-warning-fix'
Compiler warnings workaround. * ta/bulk-checkin-signed-compare-false-warning-fix: bulk-checkin: fix sign compare warnings
2 parents 9fdf2a0 + 133d065 commit 876e7bb

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

bulk-checkin.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
#define USE_THE_REPOSITORY_VARIABLE
6-
#define DISABLE_SIGN_COMPARE_WARNINGS
76

87
#include "git-compat-util.h"
98
#include "bulk-checkin.h"
@@ -56,7 +55,6 @@ static void flush_bulk_checkin_packfile(struct bulk_checkin_packfile *state)
5655
{
5756
unsigned char hash[GIT_MAX_RAWSZ];
5857
struct strbuf packname = STRBUF_INIT;
59-
int i;
6058

6159
if (!state->f)
6260
return;
@@ -82,7 +80,7 @@ static void flush_bulk_checkin_packfile(struct bulk_checkin_packfile *state)
8280
finish_tmp_packfile(&packname, state->pack_tmp_name,
8381
state->written, state->nr_written,
8482
&state->pack_idx_opts, hash);
85-
for (i = 0; i < state->nr_written; i++)
83+
for (uint32_t i = 0; i < state->nr_written; i++)
8684
free(state->written[i]);
8785

8886
clear_exit:
@@ -131,14 +129,12 @@ static void flush_batch_fsync(void)
131129

132130
static int already_written(struct bulk_checkin_packfile *state, struct object_id *oid)
133131
{
134-
int i;
135-
136132
/* The object may already exist in the repository */
137133
if (repo_has_object_file(the_repository, oid))
138134
return 1;
139135

140136
/* Might want to keep the list sorted */
141-
for (i = 0; i < state->nr_written; i++)
137+
for (uint32_t i = 0; i < state->nr_written; i++)
142138
if (oideq(&state->written[i]->oid, oid))
143139
return 1;
144140

@@ -182,13 +178,13 @@ static int stream_blob_to_pack(struct bulk_checkin_packfile *state,
182178

183179
while (status != Z_STREAM_END) {
184180
if (size && !s.avail_in) {
185-
ssize_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf);
181+
size_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf);
186182
ssize_t read_result = read_in_full(fd, ibuf, rsize);
187183
if (read_result < 0)
188184
die_errno("failed to read from '%s'", path);
189-
if (read_result != rsize)
190-
die("failed to read %d bytes from '%s'",
191-
(int)rsize, path);
185+
if ((size_t)read_result != rsize)
186+
die("failed to read %u bytes from '%s'",
187+
(unsigned)rsize, path);
192188
offset += rsize;
193189
if (*already_hashed_to < offset) {
194190
size_t hsize = offset - *already_hashed_to;

0 commit comments

Comments
 (0)