From e982a1066515dcbb884d0ac7263254bf2ca21ddd Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 7 Nov 2014 11:05:48 -0800 Subject: [PATCH] More nested data refinement. --- dump.c | 43 ++++++++++--------------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/dump.c b/dump.c index 55efec4b73..ff06d66747 100644 --- a/dump.c +++ b/dump.c @@ -208,14 +208,19 @@ get_string(const char *where) #define get_string() get_string(WHERE) static void -dump_empty_nested(void) +dump_nested_string(void) { + match_byte_assert (0); + match_byte_assert (0); int outer_end = pos + get_u32(); int inner_end = pos + get_u32(); if (pos != inner_end) { match_u32_assert(0); - match_byte_assert(0x58); + if (match_byte(0x31)) + get_string(); + else + match_byte_assert(0x58); if (pos != inner_end) { fprintf(stderr, "inner end discrepancy\n"); @@ -279,31 +284,7 @@ dump_value_31(void) else if (match_u32 (1)) { printf("(footnote %d) ", get_u32()); - match_byte_assert (0); - match_byte_assert (0); - - int outer_end = pos + get_u32(); - int inner_end = pos + get_u32(); - if (pos != inner_end) - { - match_u32_assert(0); - if (match_byte(0x31)) - get_string(); - else - match_byte_assert(0x58); - if (pos != inner_end) - { - fprintf(stderr, "inner end discrepancy\n"); - exit(1); - } - } - match_byte_assert(0x58); - match_byte_assert(0x58); - if (pos != outer_end) - { - fprintf(stderr, "outer end discrepancy\n"); - exit(1); - } + dump_nested_string(); } else if (match_u32 (2)) { @@ -312,9 +293,7 @@ dump_value_31(void) match_byte_assert(0); if (!match_u32 (2)) match_u32_assert(1); - match_byte_assert(0); - match_byte_assert(0); - dump_empty_nested(); + dump_nested_string(); /* Our corpus doesn't contain any examples with strings though. */ } else { @@ -325,9 +304,7 @@ dump_value_31(void) match_byte_assert(1); match_byte_assert(0); match_u32_assert(2); - match_byte_assert(0); - match_byte_assert(0); - dump_empty_nested(); + dump_nested_string(); /* Our corpus doesn't contain any examples with strings though. */ } } else -- 2.30.2