]> andersk Git - libyaml.git/commitdiff
Fix -Wformat compilation errors in tests
authorIan Cordasco <graffatcolmingov@gmail.com>
Thu, 8 Dec 2016 01:55:20 +0000 (19:55 -0600)
committerIngy döt Net <ingy@ingy.net>
Sat, 17 Dec 2016 21:27:18 +0000 (13:27 -0800)
There were several warnings generated by formatting errors in the tests,
this corrects the format strings and silences the warnings.

tests/example-deconstructor-alt.c
tests/example-deconstructor.c
tests/example-reformatter-alt.c
tests/example-reformatter.c
tests/run-dumper.c
tests/run-emitter.c
tests/test-reader.c
tests/test-version.c

index 7da194a659d050106a38995aa84d27bf0754a48c..c5412cc5b89ba2ac7ae8f0d5684f9065eb62e6be 100644 (file)
@@ -703,25 +703,25 @@ parser_error:
 
         case YAML_READER_ERROR:
             if (parser.problem_value != -1) {
-                fprintf(stderr, "Reader error: %s: #%X at %d\n", parser.problem,
+                fprintf(stderr, "Reader error: %s: #%X at %zd\n", parser.problem,
                         parser.problem_value, parser.problem_offset);
             }
             else {
-                fprintf(stderr, "Reader error: %s at %d\n", parser.problem,
+                fprintf(stderr, "Reader error: %s at %zd\n", parser.problem,
                         parser.problem_offset);
             }
             break;
 
         case YAML_SCANNER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Scanner error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Scanner error: %s at line %d, column %d\n",
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
@@ -729,14 +729,14 @@ parser_error:
 
         case YAML_PARSER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Parser error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Parser error: %s at line %d, column %d\n",
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
index 3ad99c10c13ce3ab5e1876b6f8debbf808c04660..f8bb5aa4d3ba0057f371b0ae01a2b0a2d49f545c 100644 (file)
@@ -1033,25 +1033,25 @@ parser_error:
 
         case YAML_READER_ERROR:
             if (parser.problem_value != -1) {
-                fprintf(stderr, "Reader error: %s: #%X at %d\n", parser.problem,
+                fprintf(stderr, "Reader error: %s: #%X at %zu\n", parser.problem,
                         parser.problem_value, parser.problem_offset);
             }
             else {
-                fprintf(stderr, "Reader error: %s at %d\n", parser.problem,
+                fprintf(stderr, "Reader error: %s at %zu\n", parser.problem,
                         parser.problem_offset);
             }
             break;
 
         case YAML_SCANNER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Scanner error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Scanner error: %s at line %d, column %d\n",
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
@@ -1059,14 +1059,14 @@ parser_error:
 
         case YAML_PARSER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Parser error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Parser error: %s at line %d, column %d\n",
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
index 550e06cb787bce51f327a36f4190fe4c07ff82d6..e7d006e4a64a73eafb779a887d67834d2b74645e 100644 (file)
@@ -120,25 +120,25 @@ parser_error:
 
         case YAML_READER_ERROR:
             if (parser.problem_value != -1) {
-                fprintf(stderr, "Reader error: %s: #%X at %d\n", parser.problem,
+                fprintf(stderr, "Reader error: %s: #%X at %zd\n", parser.problem,
                         parser.problem_value, parser.problem_offset);
             }
             else {
-                fprintf(stderr, "Reader error: %s at %d\n", parser.problem,
+                fprintf(stderr, "Reader error: %s at %lu\n", parser.problem,
                         parser.problem_offset);
             }
             break;
 
         case YAML_SCANNER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Scanner error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Scanner error: %s at line %d, column %d\n",
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
@@ -146,14 +146,14 @@ parser_error:
 
         case YAML_PARSER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Parser error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Parser error: %s at line %d, column %d\n",
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
@@ -161,14 +161,14 @@ parser_error:
 
         case YAML_COMPOSER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Composer error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Composer error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Composer error: %s at line %d, column %d\n",
+                fprintf(stderr, "Composer error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
index 946d55619afc6ca0b08cac94ca68d607d4901ed1..306c74292fc00502fdfdf5e1a43f05fb237f94c0 100644 (file)
@@ -120,25 +120,25 @@ parser_error:
 
         case YAML_READER_ERROR:
             if (parser.problem_value != -1) {
-                fprintf(stderr, "Reader error: %s: #%X at %d\n", parser.problem,
+                fprintf(stderr, "Reader error: %s: #%X at %zd\n", parser.problem,
                         parser.problem_value, parser.problem_offset);
             }
             else {
-                fprintf(stderr, "Reader error: %s at %d\n", parser.problem,
+                fprintf(stderr, "Reader error: %s at %zd\n", parser.problem,
                         parser.problem_offset);
             }
             break;
 
         case YAML_SCANNER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Scanner error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Scanner error: %s at line %d, column %d\n",
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
@@ -146,14 +146,14 @@ parser_error:
 
         case YAML_PARSER_ERROR:
             if (parser.context) {
-                fprintf(stderr, "Parser error: %s at line %d, column %d\n"
-                        "%s at line %d, column %d\n", parser.context,
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n"
+                        "%s at line %lu, column %lu\n", parser.context,
                         parser.context_mark.line+1, parser.context_mark.column+1,
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
             else {
-                fprintf(stderr, "Parser error: %s at line %d, column %d\n",
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n",
                         parser.problem, parser.problem_mark.line+1,
                         parser.problem_mark.column+1);
             }
index 390d982a3c8c5c413d88502ddd5a8680f8358dfc..6236ee1eaa7f95ebce60a56a2f858de0da10a8b0 100644 (file)
@@ -180,8 +180,8 @@ int print_output(char *name, unsigned char *buffer, size_t size, int count)
         if (feof(file)) break;
     }
     fclose(file);
-    printf("#### (length: %d)\n", total_size);
-    printf("OUTPUT:\n%s#### (length: %d)\n", buffer, size);
+    printf("#### (length: %zd)\n", total_size);
+    printf("OUTPUT:\n%s#### (length: %zd)\n", buffer, size);
     return 0;
 }
 
@@ -304,7 +304,7 @@ main(int argc, char *argv[])
             yaml_document_delete(documents+k);
         }
 
-        printf("PASSED (length: %d)\n", written);
+        printf("PASSED (length: %zd)\n", written);
         print_output(argv[number], buffer, written, -1);
     }
 
index 73ae9a5f79932f1ec0147d5d0c8652e848523a67..fee292252e9ddca59fd53bdec16abef43fb2a3b0 100644 (file)
@@ -205,8 +205,8 @@ int print_output(char *name, unsigned char *buffer, size_t size, int count)
         if (feof(file)) break;
     }
     fclose(file);
-    printf("#### (length: %d)\n", total_size);
-    printf("OUTPUT:\n%s#### (length: %d)\n", buffer, size);
+    printf("#### (length: %zd)\n", total_size);
+    printf("OUTPUT:\n%s#### (length: %zd)\n", buffer, size);
     return 0;
 }
 
@@ -319,7 +319,7 @@ main(int argc, char *argv[])
             yaml_event_delete(events+k);
         }
 
-        printf("PASSED (length: %d)\n", written);
+        printf("PASSED (length: %zd)\n", written);
         print_output(argv[number], buffer, written, -1);
     }
 
index c6f84cd0d6e46627e549ee49495a9eef0c48e8b4..2ecb292d687253a0978483796203ba2232edb0fe 100644 (file)
@@ -144,11 +144,11 @@ int check_utf8_sequences(void)
             }
             else if (parser.error == YAML_READER_ERROR) {
                 if (parser.problem_value != -1) {
-                    printf("(reader error: %s: #%X at %d)\n",
+                    printf("(reader error: %s: #%X at %zu)\n",
                             parser.problem, parser.problem_value, parser.problem_offset);
                 }
                 else {
-                    printf("(reader error: %s at %d)\n",
+                    printf("(reader error: %s at %zu)\n",
                             parser.problem, parser.problem_offset);
                 }
             }
@@ -180,12 +180,12 @@ int check_boms(void)
         yaml_parser_set_input_string(&parser, (unsigned char *)start, end-start);
         result = yaml_parser_update_buffer(&parser, end-start);
         if (!result) {
-            printf("- (reader error: %s at %d)\n", parser.problem, parser.problem_offset);
+            printf("- (reader error: %s at %zu)\n", parser.problem, parser.problem_offset);
             failed++;
         }
         else {
             if (parser.unread != check) {
-                printf("- (length=%d while expected length=%d)\n", parser.unread, check);
+                printf("- (length=%zu while expected length=%d)\n", parser.unread, check);
                 failed++;
             }
             else if (memcmp(parser.buffer.start, bom_original, check) != 0) {
@@ -232,7 +232,7 @@ int check_long_utf8(void)
     for (k = 0; k < LONG; k++) {
         if (!parser.unread) {
             if (!yaml_parser_update_buffer(&parser, 1)) {
-                printf("\treader error: %s at %d\n", parser.problem, parser.problem_offset);
+                printf("\treader error: %s at %zu\n", parser.problem, parser.problem_offset);
                 failed = 1;
                 break;
             }
@@ -262,11 +262,11 @@ int check_long_utf8(void)
     }
     if (!failed) {
         if (!yaml_parser_update_buffer(&parser, 1)) {
-            printf("\treader error: %s at %d\n", parser.problem, parser.problem_offset);
+            printf("\treader error: %s at %zu\n", parser.problem, parser.problem_offset);
             failed = 1;
         }
         else if (parser.buffer.pointer[0] != '\0') {
-            printf("\texpected NUL, found %X (eof=%d, unread=%d)\n", (int)parser.buffer.pointer[0], parser.eof, parser.unread);
+            printf("\texpected NUL, found %X (eof=%d, unread=%zu)\n", (int)parser.buffer.pointer[0], parser.eof, parser.unread);
             failed = 1;
         }
     }
@@ -303,7 +303,7 @@ int check_long_utf16(void)
     for (k = 0; k < LONG; k++) {
         if (!parser.unread) {
             if (!yaml_parser_update_buffer(&parser, 1)) {
-                printf("\treader error: %s at %d\n", parser.problem, parser.problem_offset);
+                printf("\treader error: %s at %zu\n", parser.problem, parser.problem_offset);
                 failed = 1;
                 break;
             }
@@ -333,11 +333,11 @@ int check_long_utf16(void)
     }
     if (!failed) {
         if (!yaml_parser_update_buffer(&parser, 1)) {
-            printf("\treader error: %s at %d\n", parser.problem, parser.problem_offset);
+            printf("\treader error: %s at %zu\n", parser.problem, parser.problem_offset);
             failed = 1;
         }
         else if (parser.buffer.pointer[0] != '\0') {
-            printf("\texpected NUL, found %X (eof=%d, unread=%d)\n", (int)parser.buffer.pointer[0], parser.eof, parser.unread);
+            printf("\texpected NUL, found %X (eof=%d, unread=%zu)\n", (int)parser.buffer.pointer[0], parser.eof, parser.unread);
             failed = 1;
         }
     }
index e3e4a1623b3aa43b158902c3bf5c2155fb61d79e..69ae5bb3828a750b1537cf725b18a274a7a6dae3 100644 (file)
@@ -21,9 +21,9 @@ main(void)
     assert(strcmp(buf, yaml_get_version_string()) == 0);
 
     /* Print structure sizes. */
-    printf("sizeof(token) = %d\n", sizeof(yaml_token_t));
-    printf("sizeof(event) = %d\n", sizeof(yaml_event_t));
-    printf("sizeof(parser) = %d\n", sizeof(yaml_parser_t));
+    printf("sizeof(token) = %lu\n", sizeof(yaml_token_t));
+    printf("sizeof(event) = %lu\n", sizeof(yaml_event_t));
+    printf("sizeof(parser) = %lu\n", sizeof(yaml_parser_t));
 
     return 0;
 }
This page took 0.096704 seconds and 5 git commands to generate.