Commit a7b9ba00 authored by Rusty Russell's avatar Rusty Russell

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: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 7307b7ef
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* int main(int argc, char *argv[]) * int main(int argc, char *argv[])
* { * {
* bool casefold = false; * bool casefold = false;
* unsigned int i; * int i;
* *
* if (argc < 2) { * if (argc < 2) {
* fprintf(stderr, "Usage: %s [-i] <list>...\n" * fprintf(stderr, "Usage: %s [-i] <list>...\n"
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
* { * {
* char *code, *problems; * char *code, *problems;
* struct cdump_definitions *defs; * struct cdump_definitions *defs;
* int i, j; * int i;
* size_t j;
* *
* // Read code from stdin. * // Read code from stdin.
* code = grab_file(NULL, NULL); * code = grab_file(NULL, NULL);
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
* int main(int argc, char *argv[]) * int main(int argc, char *argv[])
* { * {
* struct htable ht; * struct htable ht;
* unsigned int i; * int i;
* unsigned long val; * unsigned long val;
* *
* if (argc < 2) * if (argc < 2)
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
* *
* // Create and populate hash table. * // Create and populate hash table.
* htable_init(&ht, rehash, NULL); * 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]); * htable_add(&ht, hash_string(map[i].name), &map[i]);
* *
* // Add any aliases to the hash table. * // Add any aliases to the hash table.
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* { * {
* struct parent p; * struct parent p;
* struct child *c; * struct child *c;
* unsigned int i; * int i;
* *
* if (argc < 2) * if (argc < 2)
* errx(1, "Usage: %s parent children...", argv[0]); * errx(1, "Usage: %s parent children...", argv[0]);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* return false; * return false;
* } * }
* // A short write means out of space. * // A short write means out of space.
* if (ret < strlen(string)) { * if (ret < (int)strlen(string)) {
* unlink(file); * unlink(file);
* errno = ENOSPC; * errno = ENOSPC;
* return false; * return false;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* STRMAP(size_t) map; * STRMAP(size_t) map;
* *
* strmap_init(&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. * // This only adds the first time for this arg.
* strmap_add(&map, argv[i], i); * strmap_add(&map, argv[i], i);
* *
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
* *
* int main(int argc, char *argv[]) * int main(int argc, char *argv[])
* { * {
* unsigned int i; * int i;
* const char **values; * const char **values;
* *
* // Initialize cache. * // Initialize cache.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment