From a7b9ba000dff7b1fcc96dbdf4ae743a4552af560 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 6 Nov 2016 15:07:51 +1030 Subject: [PATCH] asort, cdump, htable, list, noerr, strmap, tal/link: fix sign warnings in examples. Many are because argc is 'int' not 'unsigned', others just laziness. Signed-off-by: Rusty Russell --- ccan/asort/_info | 2 +- ccan/cdump/_info | 3 ++- ccan/htable/_info | 4 ++-- ccan/list/_info | 2 +- ccan/noerr/_info | 2 +- ccan/strmap/_info | 2 +- ccan/tal/link/_info | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ccan/asort/_info b/ccan/asort/_info index 28e2faeb..4d59bec1 100644 --- a/ccan/asort/_info +++ b/ccan/asort/_info @@ -31,7 +31,7 @@ * int main(int argc, char *argv[]) * { * bool casefold = false; - * unsigned int i; + * int i; * * if (argc < 2) { * fprintf(stderr, "Usage: %s [-i] ...\n" diff --git a/ccan/cdump/_info b/ccan/cdump/_info index 02ba19b5..c79d013b 100644 --- a/ccan/cdump/_info +++ b/ccan/cdump/_info @@ -29,7 +29,8 @@ * { * char *code, *problems; * struct cdump_definitions *defs; - * int i, j; + * int i; + * size_t j; * * // Read code from stdin. * code = grab_file(NULL, NULL); diff --git a/ccan/htable/_info b/ccan/htable/_info index a55343b4..a3bb76db 100644 --- a/ccan/htable/_info +++ b/ccan/htable/_info @@ -65,7 +65,7 @@ * int main(int argc, char *argv[]) * { * struct htable ht; - * unsigned int i; + * int i; * unsigned long val; * * if (argc < 2) @@ -74,7 +74,7 @@ * * // Create and populate hash table. * htable_init(&ht, rehash, NULL); - * for (i = 0; i < sizeof(map)/sizeof(map[0]); i++) + * for (i = 0; i < (int)(sizeof(map)/sizeof(map[0])); i++) * htable_add(&ht, hash_string(map[i].name), &map[i]); * * // Add any aliases to the hash table. diff --git a/ccan/list/_info b/ccan/list/_info index 60790a99..c4f3e2a0 100644 --- a/ccan/list/_info +++ b/ccan/list/_info @@ -31,7 +31,7 @@ * { * struct parent p; * struct child *c; - * unsigned int i; + * int i; * * if (argc < 2) * errx(1, "Usage: %s parent children...", argv[0]); diff --git a/ccan/noerr/_info b/ccan/noerr/_info index 082c71e6..85f1f6f9 100644 --- a/ccan/noerr/_info +++ b/ccan/noerr/_info @@ -37,7 +37,7 @@ * return false; * } * // A short write means out of space. - * if (ret < strlen(string)) { + * if (ret < (int)strlen(string)) { * unlink(file); * errno = ENOSPC; * return false; diff --git a/ccan/strmap/_info b/ccan/strmap/_info index b8768698..eba8fe44 100644 --- a/ccan/strmap/_info +++ b/ccan/strmap/_info @@ -33,7 +33,7 @@ * STRMAP(size_t) map; * * strmap_init(&map); - * for (i = 1; i < argc; i++) + * for (i = 1; i < (size_t)argc; i++) * // This only adds the first time for this arg. * strmap_add(&map, argv[i], i); * diff --git a/ccan/tal/link/_info b/ccan/tal/link/_info index db2ad614..8e39e781 100644 --- a/ccan/tal/link/_info +++ b/ccan/tal/link/_info @@ -87,7 +87,7 @@ * * int main(int argc, char *argv[]) * { - * unsigned int i; + * int i; * const char **values; * * // Initialize cache. -- 2.39.2