Skip to content

Fix -Wsign-compare warnings in builtin/bisect.c by ensuring type consistency #1868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions builtin/bisect.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS


#include "builtin.h"
#include "copy.h"
Expand Down Expand Up @@ -694,9 +694,10 @@ static enum bisect_error bisect_auto_next(struct bisect_terms *terms, const char
static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
const char **argv)
{
int i;
int no_checkout = 0;
int first_parent_only = 0;
int i, has_double_dash = 0, must_write_terms = 0, bad_seen = 0;
int has_double_dash = 0, must_write_terms = 0, bad_seen = 0;
int flags, pathspec_pos;
enum bisect_error res = BISECT_OK;
struct string_list revs = STRING_LIST_INIT_DUP;
Expand Down Expand Up @@ -775,7 +776,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
*/
if (revs.nr)
must_write_terms = 1;
for (i = 0; i < revs.nr; i++) {
for (i = 0; i < (int)revs.nr; i++) {
if (bad_seen) {
string_list_append(&states, terms->term_good);
} else {
Expand Down Expand Up @@ -858,7 +859,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
sq_quote_argv(&bisect_names, argv + pathspec_pos);
write_file(git_path_bisect_names(), "%s\n", bisect_names.buf);

for (i = 0; i < states.nr; i++)
for (i = 0; i < (int)states.nr; i++)
if (bisect_write(states.items[i].string,
revs.items[i].string, terms, 1)) {
res = BISECT_FAILED;
Expand Down Expand Up @@ -924,8 +925,9 @@ static int bisect_autostart(struct bisect_terms *terms)
static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
const char **argv)
{
int i;
const char *state;
int i, verify_expected = 1;
int verify_expected = 1;
struct object_id oid, expected;
struct oid_array revs = OID_ARRAY_INIT;

Expand Down Expand Up @@ -984,7 +986,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
if (refs_read_ref(get_main_ref_store(the_repository), "BISECT_EXPECTED_REV", &expected))
verify_expected = 0; /* Ignore invalid file contents */

for (i = 0; i < revs.nr; i++) {
for (i = 0; i < (int)revs.nr; i++) {
if (bisect_write(state, oid_to_hex(&revs.oid[i]), terms, 0)) {
oid_array_clear(&revs);
return BISECT_FAILED;
Expand Down
Loading