Add wuffs_aux::FooArgBar types for optional args

Prior to this commit, with a "wuffs_aux::Foo(x, y, 0, 0, 4, 5)" call,
with arguments after "y" optional, it was not a compile-time error to
give the wrong number of "0"s or to transpose "4" and "5".
This commit is contained in:
Nigel Tao committed 2021-10-18 00:25:13 +11:00
1 parent 0460bfcd7a
commit ca33506c01
10 files changed
+354 -51

No files matched your search

+4 -2
View File
@@ -133,8 +133,10 @@ load_image(const char* filename) {
callbacks, input,
// Use PIXEL_BLEND__SRC_OVER, not the default PIXEL_BLEND__SRC, because
// we also pass a background color.
WUFFS_BASE__PIXEL_BLEND__SRC_OVER,
g_background_colors[g_background_color_index], MAX_INCL_DIMENSION);
wuffs_aux::DecodeImageArgPixelBlend(WUFFS_BASE__PIXEL_BLEND__SRC_OVER),
wuffs_aux::DecodeImageArgBackgroundColor(
g_background_colors[g_background_color_index]),
wuffs_aux::DecodeImageArgMaxInclDimension(MAX_INCL_DIMENSION));
if (filename) {
fclose(file);
}
+1 -1
View File
@@ -359,7 +359,7 @@ main1(int argc, char** argv) {
wuffs_aux::sync_io::FileInput input(in);
return wuffs_aux::DecodeJson(
callbacks, input,
wuffs_base__make_slice_u32(g_quirks.data(), g_quirks.size()))
wuffs_aux::DecodeJsonArgQuirks(g_quirks.data(), g_quirks.size()))
.error_message;
}
+3 -2
View File
@@ -568,8 +568,9 @@ main1(int argc, char** argv) {
wuffs_aux::sync_io::FileInput input(in);
return wuffs_aux::DecodeJson(
callbacks, input,
wuffs_base__make_slice_u32(g_quirks.data(), g_quirks.size()),
(g_flags.query_c_string ? g_flags.query_c_string : ""))
wuffs_aux::DecodeJsonArgQuirks(g_quirks.data(), g_quirks.size()),
wuffs_aux::DecodeJsonArgJsonPointer(
g_flags.query_c_string ? g_flags.query_c_string : ""))
.error_message;
}