1 |
commit: bf111d7d5464f8a6b3a251d3d12fe9e39357bc6e |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 23 13:16:31 2018 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 23 13:16:31 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=bf111d7d |
7 |
|
8 |
fix signedness warnings |
9 |
|
10 |
main.c | 8 +++++--- |
11 |
qcheck.c | 2 +- |
12 |
qdepends.c | 2 +- |
13 |
qgrep.c | 5 +++-- |
14 |
qlop.c | 7 ++++--- |
15 |
qsearch.c | 2 +- |
16 |
qsize.c | 2 +- |
17 |
qxpak.c | 8 +++++--- |
18 |
8 files changed, 21 insertions(+), 15 deletions(-) |
19 |
|
20 |
diff --git a/main.c b/main.c |
21 |
index b11fe83..44226db 100644 |
22 |
--- a/main.c |
23 |
+++ b/main.c |
24 |
@@ -1420,9 +1420,11 @@ get_vdb_atoms(int fullcpv) |
25 |
if ((dfd = scandirat(ctx->vdb_fd, cat[j]->d_name, &pf, q_vdb_filter_pkg, alphasort)) < 0) |
26 |
continue; |
27 |
for (i = 0; i < dfd; i++) { |
28 |
- int blen = snprintf(buf, sizeof(buf), "%s/%s/SLOT", cat[j]->d_name, pf[i]->d_name); |
29 |
- if (blen >= sizeof(buf)) { |
30 |
- warnf("unable to parse long package: %s/%s", cat[j]->d_name, pf[i]->d_name); |
31 |
+ int blen = snprintf(buf, sizeof(buf), "%s/%s/SLOT", |
32 |
+ cat[j]->d_name, pf[i]->d_name); |
33 |
+ if (blen < 0 || (size_t)blen >= sizeof(buf)) { |
34 |
+ warnf("unable to parse long package: %s/%s", |
35 |
+ cat[j]->d_name, pf[i]->d_name); |
36 |
continue; |
37 |
} |
38 |
|
39 |
|
40 |
diff --git a/qcheck.c b/qcheck.c |
41 |
index 26b820e..66589a3 100644 |
42 |
--- a/qcheck.c |
43 |
+++ b/qcheck.c |
44 |
@@ -375,7 +375,7 @@ int qcheck_main(int argc, char **argv) |
45 |
|
46 |
argc -= optind; |
47 |
argv += optind; |
48 |
- for (i = 0; i < argc; ++i) { |
49 |
+ for (i = 0; i < (size_t)argc; ++i) { |
50 |
atom = atom_explode(argv[i]); |
51 |
if (!atom) |
52 |
warn("invalid atom: %s", argv[i]); |
53 |
|
54 |
diff --git a/qdepends.c b/qdepends.c |
55 |
index a614704..e8b2190 100644 |
56 |
--- a/qdepends.c |
57 |
+++ b/qdepends.c |
58 |
@@ -579,7 +579,7 @@ int qdepends_main(int argc, char **argv) |
59 |
else { |
60 |
cb = qdepends_main_vdb_cb; |
61 |
|
62 |
- for (i = 0; i < argc; ++i) { |
63 |
+ for (i = 0; i < (size_t)argc; ++i) { |
64 |
atom = atom_explode(argv[i]); |
65 |
if (!atom) |
66 |
warn("invalid atom: %s", argv[i]); |
67 |
|
68 |
diff --git a/qgrep.c b/qgrep.c |
69 |
index 0680035..fe53ea2 100644 |
70 |
--- a/qgrep.c |
71 |
+++ b/qgrep.c |
72 |
@@ -153,9 +153,10 @@ qgrep_print_line(qgrep_buf_t *current, const char *label, |
73 |
int regexec_flags = 0; |
74 |
while ((*p != '\0') && !regexec(preg, p, 1, &match, regexec_flags)) { |
75 |
if (match.rm_so > 0) |
76 |
- printf("%.*s", match.rm_so, p); |
77 |
+ printf("%.*s", (int)match.rm_so, p); |
78 |
if (match.rm_eo > match.rm_so) { |
79 |
- printf("%s%.*s%s", RED, match.rm_eo - match.rm_so, p + match.rm_so, NORM); |
80 |
+ printf("%s%.*s%s", RED, (int)(match.rm_eo - match.rm_so), |
81 |
+ p + match.rm_so, NORM); |
82 |
p += match.rm_eo; |
83 |
} else { |
84 |
p += match.rm_eo; |
85 |
|
86 |
diff --git a/qlop.c b/qlop.c |
87 |
index 5be2ddd..410a94b 100644 |
88 |
--- a/qlop.c |
89 |
+++ b/qlop.c |
90 |
@@ -580,7 +580,8 @@ void show_current_emerge(void) |
91 |
raip = realloc(ip, sizeof(struct kinfo_proc) * size); |
92 |
if (raip == NULL) { |
93 |
free(ip); |
94 |
- warnp("Could not extend allocated block to %d bytes for process information", |
95 |
+ warnp("Could not extend allocated block to " |
96 |
+ "%zd bytes for process information", |
97 |
sizeof(struct kinfo_proc) * size); |
98 |
return; |
99 |
} |
100 |
@@ -798,7 +799,7 @@ int qlop_main(int argc, char **argv) |
101 |
|
102 |
argc -= optind; |
103 |
argv += optind; |
104 |
- for (i = 0; i < argc; ++i) { |
105 |
+ for (i = 0; i < (size_t)argc; ++i) { |
106 |
atom = atom_explode(argv[i]); |
107 |
if (!atom) |
108 |
warn("invalid atom: %s", argv[i]); |
109 |
@@ -820,7 +821,7 @@ int qlop_main(int argc, char **argv) |
110 |
show_sync_history(logfile, start_time, end_time); |
111 |
|
112 |
if (do_time) { |
113 |
- for (i = 0; i < argc; ++i) |
114 |
+ for (i = 0; i < (size_t)argc; ++i) |
115 |
show_merge_times(argv[i], logfile, average, do_human_readable, |
116 |
start_time, end_time); |
117 |
} |
118 |
|
119 |
diff --git a/qsearch.c b/qsearch.c |
120 |
index c2b2ebe..a620f95 100644 |
121 |
--- a/qsearch.c |
122 |
+++ b/qsearch.c |
123 |
@@ -104,7 +104,7 @@ qsearch_ebuild_ebuild(int overlay_fd, const char *ebuild, const char *search_me, |
124 |
int linelen; |
125 |
size_t buflen; |
126 |
while ((linelen = getline(&buf, &buflen, ebuildfp)) >= 0) { |
127 |
- if (linelen <= search_len) |
128 |
+ if ((size_t)linelen <= search_len) |
129 |
continue; |
130 |
if (strncmp(buf, search_var, search_len) != 0) |
131 |
continue; |
132 |
|
133 |
diff --git a/qsize.c b/qsize.c |
134 |
index b92f533..acf74bf 100644 |
135 |
--- a/qsize.c |
136 |
+++ b/qsize.c |
137 |
@@ -176,7 +176,7 @@ int qsize_main(int argc, char **argv) |
138 |
|
139 |
argc -= optind; |
140 |
argv += optind; |
141 |
- for (i = 0; i < argc; ++i) { |
142 |
+ for (i = 0; i < (size_t)argc; ++i) { |
143 |
atom = atom_explode(argv[i]); |
144 |
if (!atom) |
145 |
warn("invalid atom: %s", argv[i]); |
146 |
|
147 |
diff --git a/qxpak.c b/qxpak.c |
148 |
index 95fb779..ada9767 100644 |
149 |
--- a/qxpak.c |
150 |
+++ b/qxpak.c |
151 |
@@ -341,9 +341,11 @@ xpak_create(int dir_fd, const char *file, int argc, char **argv) |
152 |
if ((numfiles = scandir(argv[i], &dir, filter_hidden, alphasort)) < 0) |
153 |
warn("Directory '%s' is empty; skipping", argv[i]); |
154 |
for (fidx = 0; fidx < numfiles; ++fidx) { |
155 |
- int ret = snprintf(path, sizeof(path), "%s/%s", argv[i], dir[fidx]->d_name); |
156 |
- if (ret >= sizeof(path)) { |
157 |
- warn("skipping path too long: %s/%s", argv[i], dir[fidx]->d_name); |
158 |
+ int ret = snprintf(path, sizeof(path), "%s/%s", |
159 |
+ argv[i], dir[fidx]->d_name); |
160 |
+ if (ret < 0 || (size_t)ret >= sizeof(path)) { |
161 |
+ warn("skipping path too long: %s/%s", |
162 |
+ argv[i], dir[fidx]->d_name); |
163 |
continue; |
164 |
} |
165 |
if (stat(path, &st) < 0) { |