Skip to content

Commit 63d555a

Browse files
committed
Merge branch 'mh/connect-sign-compare'
The code in connect.c has been updated to work around complaints from -Wsign-compare. * mh/connect-sign-compare: connect: address -Wsign-compare warnings
2 parents 8d33546 + 49b2992 commit 63d555a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

connect.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#define USE_THE_REPOSITORY_VARIABLE
2-
#define DISABLE_SIGN_COMPARE_WARNINGS
32

43
#include "git-compat-util.h"
54
#include "config.h"
@@ -77,7 +76,7 @@ static NORETURN void die_initial_contact(int unexpected)
7776
/* Checks if the server supports the capability 'c' */
7877
int server_supports_v2(const char *c)
7978
{
80-
int i;
79+
size_t i;
8180

8281
for (i = 0; i < server_capabilities_v2.nr; i++) {
8382
const char *out;
@@ -96,7 +95,7 @@ void ensure_server_supports_v2(const char *c)
9695

9796
int server_feature_v2(const char *c, const char **v)
9897
{
99-
int i;
98+
size_t i;
10099

101100
for (i = 0; i < server_capabilities_v2.nr; i++) {
102101
const char *out;
@@ -112,7 +111,7 @@ int server_feature_v2(const char *c, const char **v)
112111
int server_supports_feature(const char *c, const char *feature,
113112
int die_on_error)
114113
{
115-
int i;
114+
size_t i;
116115

117116
for (i = 0; i < server_capabilities_v2.nr; i++) {
118117
const char *out;
@@ -232,12 +231,12 @@ static void annotate_refs_with_symref_info(struct ref *ref)
232231
string_list_clear(&symref, 0);
233232
}
234233

235-
static void process_capabilities(struct packet_reader *reader, int *linelen)
234+
static void process_capabilities(struct packet_reader *reader, size_t *linelen)
236235
{
237236
const char *feat_val;
238237
size_t feat_len;
239238
const char *line = reader->line;
240-
int nul_location = strlen(line);
239+
size_t nul_location = strlen(line);
241240
if (nul_location == *linelen)
242241
return;
243242
server_capabilities_v1 = xstrdup(line + nul_location + 1);
@@ -271,14 +270,14 @@ static int process_dummy_ref(const struct packet_reader *reader)
271270
!strcmp(name, "capabilities^{}");
272271
}
273272

274-
static void check_no_capabilities(const char *line, int len)
273+
static void check_no_capabilities(const char *line, size_t len)
275274
{
276275
if (strlen(line) != len)
277276
warning(_("ignoring capabilities after first line '%s'"),
278277
line + strlen(line));
279278
}
280279

281-
static int process_ref(const struct packet_reader *reader, int len,
280+
static int process_ref(const struct packet_reader *reader, size_t len,
282281
struct ref ***list, unsigned int flags,
283282
struct oid_array *extra_have)
284283
{
@@ -306,7 +305,7 @@ static int process_ref(const struct packet_reader *reader, int len,
306305
return 1;
307306
}
308307

309-
static int process_shallow(const struct packet_reader *reader, int len,
308+
static int process_shallow(const struct packet_reader *reader, size_t len,
310309
struct oid_array *shallow_points)
311310
{
312311
const char *line = reader->line;
@@ -341,7 +340,7 @@ struct ref **get_remote_heads(struct packet_reader *reader,
341340
struct oid_array *shallow_points)
342341
{
343342
struct ref **orig_list = list;
344-
int len = 0;
343+
size_t len = 0;
345344
enum get_remote_heads_state state = EXPECTING_FIRST_REF;
346345

347346
*list = NULL;
@@ -394,7 +393,7 @@ static int process_ref_v2(struct packet_reader *reader, struct ref ***list,
394393
const char **unborn_head_target)
395394
{
396395
int ret = 1;
397-
int i = 0;
396+
size_t i = 0;
398397
struct object_id old_oid;
399398
struct ref *ref;
400399
struct string_list line_sections = STRING_LIST_INIT_DUP;
@@ -552,7 +551,7 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
552551
const struct string_list *server_options,
553552
int stateless_rpc)
554553
{
555-
int i;
554+
size_t i;
556555
struct strvec *ref_prefixes = transport_options ?
557556
&transport_options->ref_prefixes : NULL;
558557
const char **unborn_head_target = transport_options ?

0 commit comments

Comments
 (0)