commit 16aeacf7088dcd3cd5e654af46a3015cecf41426 from: Stefan Sperling date: Thu Nov 26 12:54:19 2020 UTC use size_t for loop indices to avoid signedness warnings; from emaste@freebsd commit - e99e2d157170987cd8665508a0adcbec58d040b6 commit + 16aeacf7088dcd3cd5e654af46a3015cecf41426 blob - 0526cfdab94262bbc3d44a427af97d56d5deb7b8 blob + 861cb6f29586892ef12113a5db50c7e4329eb9e0 --- lib/diff3.c +++ lib/diff3.c @@ -264,9 +264,8 @@ got_merge_diff3(int *overlapcnt, int outfd, const char char *dp13, *dp23, *path1, *path2, *path3; BUF *b1, *b2, *b3, *d1, *d2, *diffb; u_char *data, *patch; - size_t dlen, plen; + size_t dlen, plen, i; struct diff3_state *d3s; - int i; *overlapcnt = 0; blob - 92ce7a5fda79f0688485a4cd32be5ec5fd2dfa64 blob + 6cbb7ca6b8a72218dbc5725fed24856910329b8f --- lib/error.c +++ lib/error.c @@ -40,7 +40,7 @@ const struct got_error * got_error(int code) { - int i; + size_t i; for (i = 0; i < nitems(got_errors); i++) { if (code == got_errors[i].code) @@ -54,7 +54,7 @@ const struct got_error * got_error_msg(int code, const char *msg) { static struct got_error err; - int i; + size_t i; for (i = 0; i < nitems(got_errors); i++) { if (code == got_errors[i].code) { @@ -178,7 +178,7 @@ got_error_path(const char *path, int code) { static struct got_error err; static char msg[PATH_MAX + 128]; - int i; + size_t i; for (i = 0; i < nitems(got_errors); i++) { if (code == got_errors[i].code) { blob - 718d9571c10a58194bf79eb95828d68e66053da6 blob + 91dc86ae797191eff2211c2555318120b1dcbbff --- lib/fetch.c +++ lib/fetch.c @@ -359,9 +359,10 @@ got_fetch_pack(struct got_object_id **pack_hash, struc int fetchfd, struct got_repository *repo, got_fetch_progress_cb progress_cb, void *progress_arg) { + size_t i; int imsg_fetchfds[2], imsg_idxfds[2]; int packfd = -1, npackfd = -1, idxfd = -1, nidxfd = -1, nfetchfd = -1; - int tmpfds[3], i; + int tmpfds[3]; int fetchstatus, idxstatus, done = 0; const struct got_error *err; struct imsgbuf fetchibuf, idxibuf; blob - 69956c3e9633b8b589dac03f893ff441190025d1 blob + c4d930baadc3304783bc427af25900e6765fd933 --- lib/gitconfig.c +++ lib/gitconfig.c @@ -309,7 +309,7 @@ conf_parse(struct got_gitconfig *conf, int trans, char const struct got_error * got_gitconfig_open(struct got_gitconfig **conf, int fd) { - unsigned int i; + size_t i; *conf = calloc(1, sizeof(**conf)); if (*conf == NULL) @@ -325,7 +325,7 @@ static void conf_clear(struct got_gitconfig *conf) { struct got_gitconfig_binding *cb; - int i; + size_t i; if (conf->addr) { for (i = 0; i < nitems(conf->bindings); i++) @@ -502,7 +502,7 @@ got_gitconfig_get_section_list(struct got_gitconfig_li struct got_gitconfig_list *list = NULL; struct got_gitconfig_list_node *node = 0; struct got_gitconfig_binding *cb; - int i; + size_t i; *sections = NULL; blob - 2428cdcd39afb48683eba7e9096828a0245b75ca blob + 87a2ed47fc53ce199f828d6f49ba4cd304e3b52f --- lib/object_parse.c +++ lib/object_parse.c @@ -167,7 +167,7 @@ got_object_parse_header(struct got_object **obj, char }; int type = 0; size_t size = 0, hdrlen = 0; - int i; + size_t i; *obj = NULL; blob - 55eb3a41d0b6ef47b2e286aa578da8cb73c0e2f7 blob + a17a8788d58b000507ac5d3d079dfaba0fe6ac2d --- lib/privsep.c +++ lib/privsep.c @@ -2265,7 +2265,7 @@ got_privsep_unveil_exec_helpers(void) GOT_PATH_PROG_FETCH_PACK, GOT_PATH_PROG_INDEX_PACK, }; - int i; + size_t i; for (i = 0; i < nitems(helpers); i++) { if (unveil(helpers[i], "x") == 0) blob - 6df30b62bbfe8cebeb316e89734855cc1cedd6dc blob + ef042bcbd8a8763b42a65397975a53c336f74544 --- lib/reference.c +++ lib/reference.c @@ -264,7 +264,7 @@ is_valid_ref_name(const char *name) const char *forbidden_seq[] = { "//", "..", "@{" }; const char *lfs = GOT_LOCKFILE_SUFFIX; const size_t lfs_len = sizeof(GOT_LOCKFILE_SUFFIX) - 1; - int i; + size_t i; if (name[0] == '@' && name[1] == '\0') return 0; @@ -439,7 +439,8 @@ got_ref_open(struct got_reference **ref, struct got_re const char *subdirs[] = { GOT_REF_HEADS, GOT_REF_TAGS, GOT_REF_REMOTES }; - int i, well_known = is_well_known_ref(refname); + size_t i; + int well_known = is_well_known_ref(refname); struct got_lockfile *lf = NULL; *ref = NULL; blob - dfc1bf52869052e48db54b0fa8404e5c7f6b873d blob + d5c352fa14553107e5f6733cdfc9eba3f79b7baf --- lib/repository.c +++ lib/repository.c @@ -590,7 +590,7 @@ got_repo_open(struct got_repository **repop, const cha struct got_repository *repo = NULL; const struct got_error *err = NULL; char *abspath, *repo_path = NULL; - int i; + size_t i; *repop = NULL; @@ -692,7 +692,7 @@ const struct got_error * got_repo_close(struct got_repository *repo) { const struct got_error *err = NULL, *child_err; - int i; + size_t i; for (i = 0; i < nitems(repo->packidx_cache); i++) { if (repo->packidx_cache[i] == NULL) @@ -875,7 +875,7 @@ cache_packidx(struct got_repository *repo, struct got_ const char *path_packidx) { const struct got_error *err = NULL; - int i; + size_t i; for (i = 0; i < nitems(repo->packidx_cache); i++) { if (repo->packidx_cache[i] == NULL) @@ -928,7 +928,7 @@ got_repo_search_packidx(struct got_packidx **packidx, DIR *packdir; struct dirent *dent; char *path_packidx; - int i; + size_t i; /* Search pack index cache. */ for (i = 0; i < nitems(repo->packidx_cache); i++) { @@ -1066,7 +1066,7 @@ got_repo_cache_pack(struct got_pack **packp, struct go const struct got_error *err = NULL; struct got_pack *pack = NULL; struct stat sb; - int i; + size_t i; if (packp) *packp = NULL; @@ -1134,7 +1134,7 @@ struct got_pack * got_repo_get_cached_pack(struct got_repository *repo, const char *path_packfile) { struct got_pack *pack = NULL; - int i; + size_t i; for (i = 0; i < nitems(repo->packs); i++) { pack = &repo->packs[i]; @@ -1164,7 +1164,7 @@ got_repo_init(const char *repo_path) "\tfilemode = true\n" "\tbare = true\n"; char *path; - int i; + size_t i; if (!got_path_dir_is_empty(repo_path)) return got_error(GOT_ERR_DIR_NOT_EMPTY);