asort, cdump, htable, list, noerr, strmap, tal/link: fix sign warnings in examples.
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 6 Nov 2016 04:37:51 +0000 (15:07 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 6 Nov 2016 05:24:05 +0000 (15:54 +1030)
Many are because argc is 'int' not 'unsigned', others just laziness.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/asort/_info
ccan/cdump/_info
ccan/htable/_info
ccan/list/_info
ccan/noerr/_info
ccan/strmap/_info
ccan/tal/link/_info

index 28e2faebecb3edfcc8e3eff487b99c59cc219401..4d59bec1a7a58d05af0fe4ca8c28f018207a2615 100644 (file)
@@ -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] <list>...\n"
index 02ba19b5b3fb0d0b9d4ebe8a009195c6895e930e..c79d013b2c8a08ebb7bb826bd8c40ad2f64e4591 100644 (file)
@@ -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);
index a55343b465282db60d7592c965f7b8186632ebfd..a3bb76db6bf0395562bfbc96c02e0f9e98e04391 100644 (file)
@@ -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.
index 60790a9903f084eb0492436a95dd097eefe67416..c4f3e2a0acf21b32097cf5b3a9194361831d0a4b 100644 (file)
@@ -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]);
index 082c71e601e451cf77ef022555d25d102f054de2..85f1f6f9c3906496969eba2b234fe11146b92749 100644 (file)
@@ -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;
index b8768698bf87a40de3a9bbc7163488206a02b281..eba8fe444ae78e1119e03644ab0f55d29d1d4d23 100644 (file)
@@ -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);
  *
index db2ad61454687f4f9ba3a4b885df4ff2e77f75cc..8e39e781d8569978517854646c21d87cdf2fa68a 100644 (file)
@@ -87,7 +87,7 @@
  *
  *     int main(int argc, char *argv[])
  *     {
- *             unsigned int i;
+ *             int i;
  *             const char **values;
  *
  *             // Initialize cache.