{"thread":{"id":"63459","subject":"/: [FirstTimer] Remove DISABLE_SIGN_COMPARE_WARNINGS from file add-interactive.c","startedAt":"2025-05-14T19:18:18Z","lastAt":"2025-05-14T19:18:18Z","messageCount":1,"participants":["Lucas Eiji Uchiyama"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"518066","messageId":"CACbT7NujbVnnktZVREAZUSSz0_X5ybcDR3S8kwbwzV_invDoQw@mail.gmail.com","threadId":"63459","inReplyTo":null,"subject":"/: [FirstTimer] Remove DISABLE_SIGN_COMPARE_WARNINGS from file add-interactive.c","fromName":"Lucas Eiji Uchiyama","fromEmail":"eijiuchiyama@usp.br","sentAt":"2025-05-14T19:18:04Z","receivedAt":"2025-05-14T19:18:18Z","isPatch":false,"sender":{"key":"eijiuchiyama@usp.br","avatar":null},"body":"This is an initial contribution to git, based on the SoC 2025 ideas\nfor microprojects. It removes the DISABLE_SIGN_COMPARE_WARNINGS macro and\nsolves the warnings generated by running make DEVELOPER=1 -j4\n\n\nFrom 4a0dd8c7986bed1eba806c5dce25715ff0d17c13 Mon Sep 17 00:00:00 2001\nFrom: Eiji Uchiyama <eijiuchiyama@github.com>\nDate: Wed, 14 May 2025 15:27:51 -0300\nSubject: [PATCH] /: [FirstTimer] Remove DISABLE_SIGN_COMPARE_WARNINGS from\n file add-interactive.c\n\nThis is an initial contribution to git, based on the SoC 2025 ideas\nfor microprojects. It removes the DISABLE_SIGN_COMPARE_WARNINGS macro and\nsolves the warnings generated by running make DEVELOPER=1 -j4\n\nSigned-off-by: Lucas Eiji Uchiyama <eijiuchiyama@usp.br>\n---\n add-interactive.c | 24 +++++++++++-------------\n 1 file changed, 11 insertions(+), 13 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 97ff35b6f1..3a0c44c47f 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -1,5 +1,3 @@\n-#define DISABLE_SIGN_COMPARE_WARNINGS\n-\n #include \"git-compat-util.h\"\n #include \"add-interactive.h\"\n #include \"color.h\"\n@@ -213,10 +211,10 @@ static ssize_t find_unique(const char *string, struct prefix_item_list *list)\n \telse if (index > 0 &&\n \t\t starts_with(list->sorted.items[index - 1].string, string))\n \t\treturn -1;\n-\telse if (index + 1 < list->sorted.nr &&\n+\telse if (index + 1 < (long int)(list->sorted.nr) &&\n \t\t starts_with(list->sorted.items[index + 1].string, string))\n \t\treturn -1;\n-\telse if (index < list->sorted.nr &&\n+\telse if (index < (long int)(list->sorted.nr) &&\n \t\t starts_with(list->sorted.items[index].string, string))\n \t\titem = list->sorted.items[index].util;\n \telse\n@@ -244,7 +242,7 @@ static void list(struct add_i_state *s, struct string_list *list, int *selected,\n \t\tcolor_fprintf_ln(stdout, s->header_color,\n \t\t\t\t \"%s\", opts->header);\n \n-\tfor (i = 0; i < list->nr; i++) {\n+\tfor (i = 0; i < (long int)(list->nr); i++) {\n \t\topts->print_item(i, selected ? selected[i] : 0, list->items + i,\n \t\t\t\t opts->print_item_data);\n \n@@ -385,7 +383,7 @@ static ssize_t list_and_choose(struct add_i_state *s,\n \t\t\t\t\tto = from + 1;\n \t\t\t}\n \n-\t\t\tif (from < 0 || from >= items->items.nr ||\n+\t\t\tif (from < 0 || from >= (long int)(items->items.nr) ||\n \t\t\t    (singleton && from + 1 != to)) {\n \t\t\t\tcolor_fprintf_ln(stderr, s->error_color,\n \t\t\t\t\t\t _(\"Huh (%s)?\"), p);\n@@ -395,7 +393,7 @@ static ssize_t list_and_choose(struct add_i_state *s,\n \t\t\t\tbreak;\n \t\t\t}\n \n-\t\t\tif (to > items->items.nr)\n+\t\t\tif (to > (long int)(items->items.nr))\n \t\t\t\tto = items->items.nr;\n \n \t\t\tfor (; from < to; from++)\n@@ -859,7 +857,7 @@ static int get_untracked_files(struct repository *r,\n \tadd_pattern_list(&dir, EXC_CMDL, \"--exclude option\");\n \tfill_directory(&dir, r->index, ps);\n \n-\tfor (i = 0; i < dir.nr; i++) {\n+\tfor (i = 0; (long int)(i) < dir.nr; i++) {\n \t\tstruct dir_entry *ent = dir.entries[i];\n \n \t\tif (index_name_is_other(r->index, ent->name, ent->len)) {\n@@ -939,7 +937,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,\n \t\treturn -1;\n \n \tif (unmerged_count || binary_count) {\n-\t\tfor (i = j = 0; i < files->items.nr; i++) {\n+\t\tfor (i = j = 0; i < (long int)(files->items.nr); i++) {\n \t\t\tstruct file_item *item = files->items.items[i].util;\n \n \t\t\tif (item->index.binary || item->worktree.binary) {\n@@ -972,7 +970,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,\n \t\tstruct strvec args = STRVEC_INIT;\n \t\tstruct pathspec ps_selected = { 0 };\n \n-\t\tfor (i = 0; i < files->items.nr; i++)\n+\t\tfor (i = 0; i < (long int)(files->items.nr); i++)\n \t\t\tif (files->selected[i])\n \t\t\t\tstrvec_push(&args,\n \t\t\t\t\t    files->items.items[i].string);\n@@ -1018,7 +1016,7 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,\n \t\t\t     oid_to_hex(!is_initial ? &oid :\n \t\t\t\t\ts->r->hash_algo->empty_tree),\n \t\t\t     \"--\", NULL);\n-\t\tfor (i = 0; i < files->items.nr; i++)\n+\t\tfor (i = 0; i < (long int)(files->items.nr); i++)\n \t\t\tif (files->selected[i])\n \t\t\t\tstrvec_push(&cmd.args,\n \t\t\t\t\t    files->items.items[i].string);\n@@ -1146,7 +1144,7 @@ int run_add_i(struct repository *r, const struct pathspec *ps)\n \tssize_t i;\n \tint res = 0;\n \n-\tfor (i = 0; i < ARRAY_SIZE(command_list); i++) {\n+\tfor (i = 0; i < (long int)(ARRAY_SIZE(command_list)); i++) {\n \t\tstruct command_item *util = xcalloc(1, sizeof(*util));\n \t\tutil->command = command_list[i].command;\n \t\tstring_list_append(&commands.items, command_list[i].string)\n@@ -1183,7 +1181,7 @@ int run_add_i(struct repository *r, const struct pathspec *ps)\n \t\tstruct command_item *util;\n \n \t\ti = list_and_choose(&s, &commands, &main_loop_opts);\n-\t\tif (i < 0 || i >= commands.items.nr)\n+\t\tif (i < 0 || i >= (long int)(commands.items.nr))\n \t\t\tutil = NULL;\n \t\telse\n \t\t\tutil = commands.items.items[i].util;\n-- \n2.34.1\n\n"}]}