* /: [FirstTimer] Remove DISABLE_SIGN_COMPARE_WARNINGS from file add-interactive.c
@ 2025-05-14 19:18 Lucas Eiji Uchiyama
0 siblings, 0 replies; only message in thread
From: Lucas Eiji Uchiyama @ 2025-05-14 19:18 UTC (permalink / raw)
To: git; +Cc: Lucas Eiji Uchiyama
[-- Attachment #1.1: Type: text/plain, Size: 204 bytes --]
This is an initial contribution to git, based on the SoC 2025 ideas
for microprojects. It removes the DISABLE_SIGN_COMPARE_WARNINGS macro and
solves the warnings generated by running make DEVELOPER=1 -j4
[-- Attachment #1.2: Type: text/html, Size: 239 bytes --]
[-- Attachment #2: 0001-FirstTimer-Remove-DISABLE_SIGN_COMPARE_WARNINGS-from.patch --]
[-- Type: text/x-patch, Size: 4566 bytes --]
From 4a0dd8c7986bed1eba806c5dce25715ff0d17c13 Mon Sep 17 00:00:00 2001
From: Eiji Uchiyama <eijiuchiyama@github.com>
Date: Wed, 14 May 2025 15:27:51 -0300
Subject: [PATCH] /: [FirstTimer] Remove DISABLE_SIGN_COMPARE_WARNINGS from
file add-interactive.c
This is an initial contribution to git, based on the SoC 2025 ideas
for microprojects. It removes the DISABLE_SIGN_COMPARE_WARNINGS macro and
solves the warnings generated by running make DEVELOPER=1 -j4
Signed-off-by: Lucas Eiji Uchiyama <eijiuchiyama@usp.br>
---
add-interactive.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/add-interactive.c b/add-interactive.c
index 97ff35b6f1..3a0c44c47f 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -1,5 +1,3 @@
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "add-interactive.h"
#include "color.h"
@@ -213,10 +211,10 @@ static ssize_t find_unique(const char *string, struct prefix_item_list *list)
else if (index > 0 &&
starts_with(list->sorted.items[index - 1].string, string))
return -1;
- else if (index + 1 < list->sorted.nr &&
+ else if (index + 1 < (long int)(list->sorted.nr) &&
starts_with(list->sorted.items[index + 1].string, string))
return -1;
- else if (index < list->sorted.nr &&
+ else if (index < (long int)(list->sorted.nr) &&
starts_with(list->sorted.items[index].string, string))
item = list->sorted.items[index].util;
else
@@ -244,7 +242,7 @@ static void list(struct add_i_state *s, struct string_list *list, int *selected,
color_fprintf_ln(stdout, s->header_color,
"%s", opts->header);
- for (i = 0; i < list->nr; i++) {
+ for (i = 0; i < (long int)(list->nr); i++) {
opts->print_item(i, selected ? selected[i] : 0, list->items + i,
opts->print_item_data);
@@ -385,7 +383,7 @@ static ssize_t list_and_choose(struct add_i_state *s,
to = from + 1;
}
- if (from < 0 || from >= items->items.nr ||
+ if (from < 0 || from >= (long int)(items->items.nr) ||
(singleton && from + 1 != to)) {
color_fprintf_ln(stderr, s->error_color,
_("Huh (%s)?"), p);
@@ -395,7 +393,7 @@ static ssize_t list_and_choose(struct add_i_state *s,
break;
}
- if (to > items->items.nr)
+ if (to > (long int)(items->items.nr))
to = items->items.nr;
for (; from < to; from++)
@@ -859,7 +857,7 @@ static int get_untracked_files(struct repository *r,
add_pattern_list(&dir, EXC_CMDL, "--exclude option");
fill_directory(&dir, r->index, ps);
- for (i = 0; i < dir.nr; i++) {
+ for (i = 0; (long int)(i) < dir.nr; i++) {
struct dir_entry *ent = dir.entries[i];
if (index_name_is_other(r->index, ent->name, ent->len)) {
@@ -939,7 +937,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
return -1;
if (unmerged_count || binary_count) {
- for (i = j = 0; i < files->items.nr; i++) {
+ for (i = j = 0; i < (long int)(files->items.nr); i++) {
struct file_item *item = files->items.items[i].util;
if (item->index.binary || item->worktree.binary) {
@@ -972,7 +970,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
struct strvec args = STRVEC_INIT;
struct pathspec ps_selected = { 0 };
- for (i = 0; i < files->items.nr; i++)
+ for (i = 0; i < (long int)(files->items.nr); i++)
if (files->selected[i])
strvec_push(&args,
files->items.items[i].string);
@@ -1018,7 +1016,7 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
oid_to_hex(!is_initial ? &oid :
s->r->hash_algo->empty_tree),
"--", NULL);
- for (i = 0; i < files->items.nr; i++)
+ for (i = 0; i < (long int)(files->items.nr); i++)
if (files->selected[i])
strvec_push(&cmd.args,
files->items.items[i].string);
@@ -1146,7 +1144,7 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
ssize_t i;
int res = 0;
- for (i = 0; i < ARRAY_SIZE(command_list); i++) {
+ for (i = 0; i < (long int)(ARRAY_SIZE(command_list)); i++) {
struct command_item *util = xcalloc(1, sizeof(*util));
util->command = command_list[i].command;
string_list_append(&commands.items, command_list[i].string)
@@ -1183,7 +1181,7 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
struct command_item *util;
i = list_and_choose(&s, &commands, &main_loop_opts);
- if (i < 0 || i >= commands.items.nr)
+ if (i < 0 || i >= (long int)(commands.items.nr))
util = NULL;
else
util = commands.items.items[i].util;
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-14 19:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14 19:18 /: [FirstTimer] Remove DISABLE_SIGN_COMPARE_WARNINGS from file add-interactive.c Lucas Eiji Uchiyama
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).