Have convert-to-nia output valid NIA on bad frames
diff --git a/example/convert-to-nia/convert-to-nia.c b/example/convert-to-nia/convert-to-nia.c
index 8ff6699..d9c45a7 100644
--- a/example/convert-to-nia/convert-to-nia.c
+++ b/example/convert-to-nia/convert-to-nia.c
@@ -525,9 +525,6 @@
return "main: animation frame duration overflow";
}
total_duration += duration;
- if (!g_flags.first_frame_only) {
- print_nia_duration(total_duration);
- }
if (wuffs_base__frame_config__index(&g_frame_config) == 0) {
fill_rectangle(
@@ -561,14 +558,19 @@
TRY(read_more_src());
}
+ if (!g_flags.first_frame_only) {
+ print_nia_duration(total_duration);
+ }
print_nie_frame();
+ if (!g_flags.first_frame_only) {
+ print_nia_padding();
+ }
if (df_status.repr != NULL) {
return wuffs_base__status__message(&df_status);
} else if (g_flags.first_frame_only) {
return NULL;
}
- print_nia_padding();
switch (wuffs_base__frame_config__disposal(&g_frame_config)) {
case WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND: {
@@ -605,11 +607,11 @@
if (!g_flags.first_frame_only) {
print_nix_header(0x41AFC36E); // "nïA" as a u32le.
}
- TRY(convert_frames());
+ const char* ret = convert_frames();
if (!g_flags.first_frame_only) {
print_nia_footer();
}
- return NULL;
+ return ret;
}
int //
diff --git a/test/nia-checksums-of-data.txt b/test/nia-checksums-of-data.txt
index e041d65..c13225b 100644
--- a/test/nia-checksums-of-data.txt
+++ b/test/nia-checksums-of-data.txt
@@ -14,13 +14,13 @@
a1a9b56d test/data/artificial-gif/multiple-graphic-controls.gif
47c877fd test/data/artificial-gif/multiple-loop-counts.gif
ba6e48f8 test/data/artificial-gif/no-frames.gif
-6ec818c3 test/data/artificial-gif/pixel-data-none.gif
-5e57adb2 test/data/artificial-gif/pixel-data-not-enough.gif
-3e29f88a test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif
-3e29f88a test/data/artificial-gif/pixel-data-too-much-good-lzw.gif
+f33b9bc1 test/data/artificial-gif/pixel-data-none.gif
+ac9d76d8 test/data/artificial-gif/pixel-data-not-enough.gif
+2342e3fc test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif
+2342e3fc test/data/artificial-gif/pixel-data-too-much-good-lzw.gif
39a71dce test/data/artificial-gif/small-frame-interlaced.gif
beaec397 test/data/artificial-gif/transparent-index.gif
-6ec818c3 test/data/artificial-gif/zero-width-frame.gif
+f33b9bc1 test/data/artificial-gif/zero-width-frame.gif
0564b364 test/data/artificial-png/apng-skip-idat.png
e08a7cc8 test/data/artificial-png/key-value-pairs.png
076cb375 test/data/bricks-color.bmp
@@ -57,7 +57,7 @@
dcbb225a test/data/hippopotamus.bmp
ed4b78fc test/data/hippopotamus.interlaced.gif
dcbb225a test/data/hippopotamus.interlaced.png
-a80781a1 test/data/hippopotamus.interlaced.truncated.gif
+45bf0281 test/data/hippopotamus.interlaced.truncated.gif
d3bbed27 test/data/hippopotamus.masked-with-muybridge.gif
7e6acf01 test/data/hippopotamus.masked-with-muybridge.png
dcbb225a test/data/hippopotamus.nie