]> andersk Git - libyaml.git/blobdiff - tests/example-deconstructor.c
Fix -Wformat compilation errors in tests
[libyaml.git] / tests / example-deconstructor.c
index d41b5ae0ccc2f6d7583812ea5fdb6dbeda281675..f8bb5aa4d3ba0057f371b0ae01a2b0a2d49f545c 100644 (file)
@@ -336,67 +336,67 @@ main(int argc, char *argv[])
                             tag != input_event.data.document_start.tag_directives.end;
                             tag ++)
                     {
-                            /* Write '{'. */
-
-                            if (!yaml_mapping_start_event_initialize(&output_event,
-                                        NULL, "tag:yaml.org,2002:map", 1,
-                                        YAML_FLOW_MAPPING_STYLE))
-                                goto event_error;
-                            if (!yaml_emitter_emit(&emitter, &output_event))
-                                goto emitter_error;
-
-                            /* Write 'handle'. */
-
-                            if (!yaml_scalar_event_initialize(&output_event,
-                                        NULL, "tag:yaml.org,2002:str", "handle", -1,
-                                        1, 1, YAML_PLAIN_SCALAR_STYLE))
-                                goto event_error;
-                            if (!yaml_emitter_emit(&emitter, &output_event))
-                                goto emitter_error;
-
-                            /* Write the tag directive handle. */
-
-                            if (!yaml_scalar_event_initialize(&output_event,
-                                        NULL, "tag:yaml.org,2002:str",
-                                        tag->handle, -1,
-                                        0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE))
-                                goto event_error;
-                            if (!yaml_emitter_emit(&emitter, &output_event))
-                                goto emitter_error;
-
-                            /* Write 'prefix'. */
-
-                            if (!yaml_scalar_event_initialize(&output_event,
-                                        NULL, "tag:yaml.org,2002:str", "prefix", -1,
-                                        1, 1, YAML_PLAIN_SCALAR_STYLE))
-                                goto event_error;
-                            if (!yaml_emitter_emit(&emitter, &output_event))
-                                goto emitter_error;
-
-                            /* Write the tag directive prefix. */
-
-                            if (!yaml_scalar_event_initialize(&output_event,
-                                        NULL, "tag:yaml.org,2002:str",
-                                        tag->prefix, -1,
-                                        0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE))
-                                goto event_error;
-                            if (!yaml_emitter_emit(&emitter, &output_event))
-                                goto emitter_error;
-
-                            /* Write '}'. */
-
-                            if (!yaml_mapping_end_event_initialize(&output_event))
-                                goto event_error;
-                            if (!yaml_emitter_emit(&emitter, &output_event))
-                                goto emitter_error;
-                        }
-
-                        /* End a block sequence. */
-
-                        if (!yaml_sequence_end_event_initialize(&output_event))
+                        /* Write '{'. */
+
+                        if (!yaml_mapping_start_event_initialize(&output_event,
+                                    NULL, "tag:yaml.org,2002:map", 1,
+                                    YAML_FLOW_MAPPING_STYLE))
+                            goto event_error;
+                        if (!yaml_emitter_emit(&emitter, &output_event))
+                            goto emitter_error;
+
+                        /* Write 'handle'. */
+
+                        if (!yaml_scalar_event_initialize(&output_event,
+                                    NULL, "tag:yaml.org,2002:str", "handle", -1,
+                                    1, 1, YAML_PLAIN_SCALAR_STYLE))
+                            goto event_error;
+                        if (!yaml_emitter_emit(&emitter, &output_event))
+                            goto emitter_error;
+
+                        /* Write the tag directive handle. */
+
+                        if (!yaml_scalar_event_initialize(&output_event,
+                                    NULL, "tag:yaml.org,2002:str",
+                                    tag->handle, -1,
+                                    0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE))
+                            goto event_error;
+                        if (!yaml_emitter_emit(&emitter, &output_event))
+                            goto emitter_error;
+
+                        /* Write 'prefix'. */
+
+                        if (!yaml_scalar_event_initialize(&output_event,
+                                    NULL, "tag:yaml.org,2002:str", "prefix", -1,
+                                    1, 1, YAML_PLAIN_SCALAR_STYLE))
                             goto event_error;
                         if (!yaml_emitter_emit(&emitter, &output_event))
                             goto emitter_error;
+
+                        /* Write the tag directive prefix. */
+
+                        if (!yaml_scalar_event_initialize(&output_event,
+                                    NULL, "tag:yaml.org,2002:str",
+                                    tag->prefix, -1,
+                                    0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE))
+                            goto event_error;
+                        if (!yaml_emitter_emit(&emitter, &output_event))
+                            goto emitter_error;
+
+                        /* Write '}'. */
+
+                        if (!yaml_mapping_end_event_initialize(&output_event))
+                            goto event_error;
+                        if (!yaml_emitter_emit(&emitter, &output_event))
+                            goto emitter_error;
+                    }
+
+                    /* End a block sequence. */
+
+                    if (!yaml_sequence_end_event_initialize(&output_event))
+                        goto event_error;
+                    if (!yaml_emitter_emit(&emitter, &output_event))
+                        goto emitter_error;
                 }
 
                 /* Write 'implicit'. */
@@ -1033,42 +1033,42 @@ 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,
-                        parser.context_mark.line, parser.context_mark.column,
-                        parser.problem, parser.problem_mark.line,
-                        parser.problem_mark.column);
+                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",
-                        parser.problem, parser.problem_mark.line,
-                        parser.problem_mark.column);
+                fprintf(stderr, "Scanner error: %s at line %lu, column %lu\n",
+                        parser.problem, parser.problem_mark.line+1,
+                        parser.problem_mark.column+1);
             }
             break;
 
         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,
-                        parser.context_mark.line, parser.context_mark.column,
-                        parser.problem, parser.problem_mark.line,
-                        parser.problem_mark.column);
+                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",
-                        parser.problem, parser.problem_mark.line,
-                        parser.problem_mark.column);
+                fprintf(stderr, "Parser error: %s at line %lu, column %lu\n",
+                        parser.problem, parser.problem_mark.line+1,
+                        parser.problem_mark.column+1);
             }
             break;
 
@@ -1079,7 +1079,6 @@ parser_error:
     }
 
     yaml_event_delete(&input_event);
-    yaml_event_delete(&output_event);
     yaml_parser_delete(&parser);
     yaml_emitter_delete(&emitter);
 
@@ -1110,7 +1109,6 @@ emitter_error:
     }
 
     yaml_event_delete(&input_event);
-    yaml_event_delete(&output_event);
     yaml_parser_delete(&parser);
     yaml_emitter_delete(&emitter);
 
@@ -1121,7 +1119,6 @@ event_error:
     fprintf(stderr, "Memory error: Not enough memory for creating an event\n");
 
     yaml_event_delete(&input_event);
-    yaml_event_delete(&output_event);
     yaml_parser_delete(&parser);
     yaml_emitter_delete(&emitter);
 
This page took 1.931571 seconds and 4 git commands to generate.