diff --git a/doc/changelog.md b/doc/changelog.md index 8afddbcd..a0dc9320 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -3,6 +3,7 @@ ## Work In Progress +- Renamed warnings to notes. - Made `wuffs_base__status` a struct. diff --git a/doc/note/statuses.md b/doc/note/statuses.md index eb4dbbd4..252c787d 100644 --- a/doc/note/statuses.md +++ b/doc/note/statuses.md @@ -5,7 +5,7 @@ involving [I/O](/doc/note/io-input-output.md) - return a status value. There are four categories: - OK: the request was completed, successfully. -- Warnings: the request was completed, unsuccessfully. +- Notes: the request was completed, unsuccessfully. - Suspensions: the request was not completed, but can be re-tried. - Errors: the request was not completed, permanently. @@ -18,12 +18,12 @@ When a method returns a suspension, the suspended again. However, calling any other public coroutine method, while already suspended, will lead to an `"#interleaved coroutine calls"` error. -Otherwise, the call was complete. 'Warning' or 'unsuccessful' doesn't +Otherwise, the call was complete. 'Unsuccessful' (i.e. a note) doesn't necessarily mean 'bad' or something to avoid, only that something occurred other than the typical outcome. For example, when decoding an animated image, without knowing the number of frames beforehand, a call to "decode the next -frame" could return OK, if there was a next frame, or an `"@end of data"` -warning, if there wasn't. +frame" could return OK, if there was a next frame, or an `"@end of data"` note, +if there wasn't. ## Statuses are Strings @@ -60,7 +60,7 @@ information such as a source filename. The first byte of the string message gives the category. For example, `"#bad receiver"` is an error and `"$short read"` is a suspension: -- `'@'` means a warning. +- `'@'` means a note. - `'$'` means a suspension. - `'#'` means an error. diff --git a/doc/std/image-decoders.md b/doc/std/image-decoders.md index c8baeb5b..da01ef40 100644 --- a/doc/std/image-decoders.md +++ b/doc/std/image-decoders.md @@ -31,7 +31,7 @@ wuffs_base__pixel_buffer pb = etc; while (true) { wuffs_base__frame_config fc; status = wuffs_gif__decoder__decode_frame_config(dec, &fc, &src); - if (status == wuffs_base__warning__end_of_data) { + if (status == wuffs_base__note__end_of_data) { break; } // Ditto re error checking. diff --git a/example/gifplayer/gifplayer.c b/example/gifplayer/gifplayer.c index d9cb3dc4..8658bf35 100644 --- a/example/gifplayer/gifplayer.c +++ b/example/gifplayer/gifplayer.c @@ -347,7 +347,7 @@ const char* play() { wuffs_base__status status = wuffs_gif__decoder__decode_frame_config(&dec, &fc, &src); if (!wuffs_base__status__is_ok(&status)) { - if (status.repr == wuffs_base__warning__end_of_data) { + if (status.repr == wuffs_base__note__end_of_data) { break; } return wuffs_base__status__message(&status); @@ -372,7 +372,7 @@ const char* play() { wuffs_base__status decode_frame_status = wuffs_gif__decoder__decode_frame(&dec, &pb, &src, workbuf, NULL); - if (decode_frame_status.repr == wuffs_base__warning__end_of_data) { + if (decode_frame_status.repr == wuffs_base__note__end_of_data) { break; } diff --git a/fuzz/c/std/gif_fuzzer.c b/fuzz/c/std/gif_fuzzer.c index 5e083fa9..3dbc2e24 100644 --- a/fuzz/c/std/gif_fuzzer.c +++ b/fuzz/c/std/gif_fuzzer.c @@ -117,7 +117,7 @@ const char* fuzz(wuffs_base__io_buffer* src, uint32_t hash) { wuffs_base__frame_config fc = ((wuffs_base__frame_config){}); status = wuffs_gif__decoder__decode_frame_config(&dec, &fc, src); if (!wuffs_base__status__is_ok(&status)) { - if ((status.repr != wuffs_base__warning__end_of_data) || !seen_ok) { + if ((status.repr != wuffs_base__note__end_of_data) || !seen_ok) { ret = wuffs_base__status__message(&status); } goto exit; @@ -135,7 +135,7 @@ const char* fuzz(wuffs_base__io_buffer* src, uint32_t hash) { } if (!wuffs_base__status__is_ok(&status)) { - if ((status.repr != wuffs_base__warning__end_of_data) || !seen_ok) { + if ((status.repr != wuffs_base__note__end_of_data) || !seen_ok) { ret = wuffs_base__status__message(&status); } goto exit; diff --git a/internal/cgen/base/core-public.h b/internal/cgen/base/core-public.h index b4544c27..c8230990 100644 --- a/internal/cgen/base/core-public.h +++ b/internal/cgen/base/core-public.h @@ -141,9 +141,9 @@ typedef struct { #ifdef __cplusplus inline bool is_complete() const; inline bool is_error() const; + inline bool is_note() const; inline bool is_ok() const; inline bool is_suspension() const; - inline bool is_warning() const; inline const char* message() const; #endif // __cplusplus @@ -168,6 +168,11 @@ wuffs_base__status__is_error(const wuffs_base__status* z) { return z->repr && (*z->repr == '#'); } +static inline bool // +wuffs_base__status__is_note(const wuffs_base__status* z) { + return z->repr && (*z->repr != '$') && (*z->repr != '#'); +} + static inline bool // wuffs_base__status__is_ok(const wuffs_base__status* z) { return z->repr == NULL; @@ -178,11 +183,6 @@ wuffs_base__status__is_suspension(const wuffs_base__status* z) { return z->repr && (*z->repr == '$'); } -static inline bool // -wuffs_base__status__is_warning(const wuffs_base__status* z) { - return z->repr && (*z->repr != '$') && (*z->repr != '#'); -} - // wuffs_base__status__message strips the leading '$', '#' or '@'. static inline const char* // wuffs_base__status__message(const wuffs_base__status* z) { @@ -206,6 +206,11 @@ wuffs_base__status::is_error() const { return wuffs_base__status__is_error(this); } +inline bool // +wuffs_base__status::is_note() const { + return wuffs_base__status__is_note(this); +} + inline bool // wuffs_base__status::is_ok() const { return wuffs_base__status__is_ok(this); @@ -216,11 +221,6 @@ wuffs_base__status::is_suspension() const { return wuffs_base__status__is_suspension(this); } -inline bool // -wuffs_base__status::is_warning() const { - return wuffs_base__status__is_warning(this); -} - inline const char* // wuffs_base__status::message() const { return wuffs_base__status__message(this); diff --git a/internal/cgen/cgen.go b/internal/cgen/cgen.go index 8c26db6c..dbc87dd6 100644 --- a/internal/cgen/cgen.go +++ b/internal/cgen/cgen.go @@ -127,7 +127,7 @@ func Do(args []string) error { if msg == "" { continue } - pre := "warning" + pre := "note" if msg[0] == '$' { pre = "suspension" } else if msg[0] == '#' { @@ -195,12 +195,12 @@ func statusMsgIsError(msg string) bool { return (len(msg) != 0) && (msg[0] == '#') } -func statusMsgIsSuspension(msg string) bool { - return (len(msg) != 0) && (msg[0] == '$') +func statusMsgIsNote(msg string) bool { + return (len(msg) == 0) || (msg[0] != '$' && msg[0] != '#') } -func statusMsgIsWarning(msg string) bool { - return (len(msg) == 0) || (msg[0] != '$' && msg[0] != '#') +func statusMsgIsSuspension(msg string) bool { + return (len(msg) != 0) && (msg[0] == '$') } type buffer []byte @@ -284,7 +284,7 @@ func insertBaseAllPublicH(buf *buffer) error { if msg == "" { return fmt.Errorf("bad built-in status %q", z) } - pre := "warning" + pre := "note" if statusMsgIsError(msg) { pre = "error" } else if statusMsgIsSuspension(msg) { @@ -688,7 +688,7 @@ func (g *gen) gatherStatuses(b *buffer, n *a.Status) error { } func (g *gen) addStatus(qid t.QID, msg string, public bool) error { - category := "warning__" + category := "note__" if msg[0] == '$' { category = "suspension__" } else if msg[0] == '#' { diff --git a/internal/cgen/data.go b/internal/cgen/data.go index 6310ec80..61762045 100644 --- a/internal/cgen/data.go +++ b/internal/cgen/data.go @@ -69,9 +69,9 @@ const baseCorePublicH = "" + "// --------\n\n// wuffs_base__empty_struct is used when a Wuffs function returns an empty\n// struct. In C, if a function f returns void, you can't say \"x = f()\", but in\n// Wuffs, if a function g returns empty, you can say \"y = g()\".\ntypedef struct {\n // private_impl is a placeholder field. It isn't explicitly used, except that\n // without it, the sizeof a struct with no fields can differ across C/C++\n // compilers, and it is undefined behavior in C99. For example, gcc says that\n // the sizeof an empty struct is 0, and g++ says that it is 1. This leads to\n // ABI incompatibility if a Wuffs .c file is processed by one compiler and\n // its .h file with another compiler.\n //\n // Instead, we explicitly insert an otherwise unused field, so that the\n // sizeof this struct is always 1.\n uint8_t private_impl;\n} wuffs_base__empty_struct;\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__make_empty_struct() {\n wuffs_base__empty_struct ret;\n ret.private_impl = 0;\n return ret;\n}\n\n// wuffs_base__utility is" + " a placeholder receiver type. It enables what Java\n// calls static methods, as opposed to regular methods.\ntypedef struct {\n // private_impl is a placeholder field. It isn't explicitly used, except that\n // without it, the sizeof a struct with no fields can differ across C/C++\n // compilers, and it is undefined behavior in C99. For example, gcc says that\n // the sizeof an empty struct is 0, and g++ says that it is 1. This leads to\n // ABI incompatibility if a Wuffs .c file is processed by one compiler and\n // its .h file with another compiler.\n //\n // Instead, we explicitly insert an otherwise unused field, so that the\n // sizeof this struct is always 1.\n uint8_t private_impl;\n} wuffs_base__utility;\n\n" + "" + - "// --------\n\n// See https://github.com/google/wuffs/blob/master/doc/note/statuses.md\ntypedef struct {\n const char* repr;\n\n#ifdef __cplusplus\n inline bool is_complete() const;\n inline bool is_error() const;\n inline bool is_ok() const;\n inline bool is_suspension() const;\n inline bool is_warning() const;\n inline const char* message() const;\n#endif // __cplusplus\n\n} wuffs_base__status;\n\n// !! INSERT wuffs_base__status names.\n\nstatic inline wuffs_base__status //\nwuffs_base__make_status(const char* repr) {\n wuffs_base__status z;\n z.repr = repr;\n return z;\n}\n\nstatic inline bool //\nwuffs_base__status__is_complete(const wuffs_base__status* z) {\n return (z->repr == NULL) || ((*z->repr != '$') && (*z->repr != '#'));\n}\n\nstatic inline bool //\nwuffs_base__status__is_error(const wuffs_base__status* z) {\n return z->repr && (*z->repr == '#');\n}\n\nstatic inline bool //\nwuffs_base__status__is_ok(const wuffs_base__status* z) {\n return z->repr == NULL;\n}\n\nstatic inline bool //\nwuffs_base__status__is_suspension(c" + - "onst wuffs_base__status* z) {\n return z->repr && (*z->repr == '$');\n}\n\nstatic inline bool //\nwuffs_base__status__is_warning(const wuffs_base__status* z) {\n return z->repr && (*z->repr != '$') && (*z->repr != '#');\n}\n\n// wuffs_base__status__message strips the leading '$', '#' or '@'.\nstatic inline const char* //\nwuffs_base__status__message(const wuffs_base__status* z) {\n if (z->repr) {\n if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) {\n return z->repr + 1;\n }\n }\n return z->repr;\n}\n\n#ifdef __cplusplus\n\ninline bool //\nwuffs_base__status::is_complete() const {\n return wuffs_base__status__is_complete(this);\n}\n\ninline bool //\nwuffs_base__status::is_error() const {\n return wuffs_base__status__is_error(this);\n}\n\ninline bool //\nwuffs_base__status::is_ok() const {\n return wuffs_base__status__is_ok(this);\n}\n\ninline bool //\nwuffs_base__status::is_suspension() const {\n return wuffs_base__status__is_suspension(this);\n}\n\ninline bool //\nwuffs_base__status::is_warning() const {\n re" + - "turn wuffs_base__status__is_warning(this);\n}\n\ninline const char* //\nwuffs_base__status::message() const {\n return wuffs_base__status__message(this);\n}\n\n#endif // __cplusplus\n\n" + + "// --------\n\n// See https://github.com/google/wuffs/blob/master/doc/note/statuses.md\ntypedef struct {\n const char* repr;\n\n#ifdef __cplusplus\n inline bool is_complete() const;\n inline bool is_error() const;\n inline bool is_note() const;\n inline bool is_ok() const;\n inline bool is_suspension() const;\n inline const char* message() const;\n#endif // __cplusplus\n\n} wuffs_base__status;\n\n// !! INSERT wuffs_base__status names.\n\nstatic inline wuffs_base__status //\nwuffs_base__make_status(const char* repr) {\n wuffs_base__status z;\n z.repr = repr;\n return z;\n}\n\nstatic inline bool //\nwuffs_base__status__is_complete(const wuffs_base__status* z) {\n return (z->repr == NULL) || ((*z->repr != '$') && (*z->repr != '#'));\n}\n\nstatic inline bool //\nwuffs_base__status__is_error(const wuffs_base__status* z) {\n return z->repr && (*z->repr == '#');\n}\n\nstatic inline bool //\nwuffs_base__status__is_note(const wuffs_base__status* z) {\n return z->repr && (*z->repr != '$') && (*z->repr != '#');\n}\n\nstatic inline bool //\nwu" + + "ffs_base__status__is_ok(const wuffs_base__status* z) {\n return z->repr == NULL;\n}\n\nstatic inline bool //\nwuffs_base__status__is_suspension(const wuffs_base__status* z) {\n return z->repr && (*z->repr == '$');\n}\n\n// wuffs_base__status__message strips the leading '$', '#' or '@'.\nstatic inline const char* //\nwuffs_base__status__message(const wuffs_base__status* z) {\n if (z->repr) {\n if ((*z->repr == '$') || (*z->repr == '#') || (*z->repr == '@')) {\n return z->repr + 1;\n }\n }\n return z->repr;\n}\n\n#ifdef __cplusplus\n\ninline bool //\nwuffs_base__status::is_complete() const {\n return wuffs_base__status__is_complete(this);\n}\n\ninline bool //\nwuffs_base__status::is_error() const {\n return wuffs_base__status__is_error(this);\n}\n\ninline bool //\nwuffs_base__status::is_note() const {\n return wuffs_base__status__is_note(this);\n}\n\ninline bool //\nwuffs_base__status::is_ok() const {\n return wuffs_base__status__is_ok(this);\n}\n\ninline bool //\nwuffs_base__status::is_suspension() const {\n return wuffs_base" + + "__status__is_suspension(this);\n}\n\ninline const char* //\nwuffs_base__status::message() const {\n return wuffs_base__status__message(this);\n}\n\n#endif // __cplusplus\n\n" + "" + "// --------\n\n// FourCC constants.\n\n// !! INSERT FourCCs.\n\n" + "" + diff --git a/internal/cgen/statement.go b/internal/cgen/statement.go index ff2472d1..d1c4ff60 100644 --- a/internal/cgen/statement.go +++ b/internal/cgen/statement.go @@ -435,15 +435,15 @@ func (g *gen) writeStatementRet(b *buffer, n *a.Ret, depth uint32) error { if g.currFunk.astFunc.Effect().Coroutine() || (g.currFunk.returnsStatus && (len(g.currFunk.derivedVars) > 0)) { - isOK := false + isComplete := false b.writes("status = ") if retExpr.Operator() == 0 && retExpr.Ident() == t.IDOk { b.writes("wuffs_base__make_status(NULL)") - isOK = true + isComplete = true } else { if retExpr.Ident().IsStrLiteral(g.tm) { msg, _ := t.Unescape(retExpr.Ident().Str(g.tm)) - isOK = statusMsgIsWarning(msg) + isComplete = statusMsgIsNote(msg) } if err := g.writeExpr( b, retExpr, depth); err != nil { @@ -458,7 +458,7 @@ func (g *gen) writeStatementRet(b *buffer, n *a.Ret, depth uint32) error { if n.RetsError() { b.writes("goto exit;") - } else if isOK { + } else if isComplete { g.currFunk.hasGotoOK = true b.writes("goto ok;") } else { diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index e3c4d62d..d3bbe9d8 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go @@ -25,7 +25,7 @@ var FourCCs = [...][2]string{ } var Statuses = [...]string{ - // Warnings. + // Notes. `"@end of data"`, `"@metadata reported"`, @@ -295,9 +295,9 @@ var Funcs = []string{ // TODO: should we add is_complete? "status.is_error() bool", + "status.is_note() bool", "status.is_ok() bool", "status.is_suspension() bool", - "status.is_warning() bool", // ---- frame_config // Duration's upper bound is the maximum possible i64 value. diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 6a3228c7..86180b31 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -163,16 +163,16 @@ typedef struct { #ifdef __cplusplus inline bool is_complete() const; inline bool is_error() const; + inline bool is_note() const; inline bool is_ok() const; inline bool is_suspension() const; - inline bool is_warning() const; inline const char* message() const; #endif // __cplusplus } wuffs_base__status; -extern const char* wuffs_base__warning__end_of_data; -extern const char* wuffs_base__warning__metadata_reported; +extern const char* wuffs_base__note__end_of_data; +extern const char* wuffs_base__note__metadata_reported; extern const char* wuffs_base__suspension__short_read; extern const char* wuffs_base__suspension__short_write; extern const char* wuffs_base__error__bad_i_o_position; @@ -210,6 +210,11 @@ wuffs_base__status__is_error(const wuffs_base__status* z) { return z->repr && (*z->repr == '#'); } +static inline bool // +wuffs_base__status__is_note(const wuffs_base__status* z) { + return z->repr && (*z->repr != '$') && (*z->repr != '#'); +} + static inline bool // wuffs_base__status__is_ok(const wuffs_base__status* z) { return z->repr == NULL; @@ -220,11 +225,6 @@ wuffs_base__status__is_suspension(const wuffs_base__status* z) { return z->repr && (*z->repr == '$'); } -static inline bool // -wuffs_base__status__is_warning(const wuffs_base__status* z) { - return z->repr && (*z->repr != '$') && (*z->repr != '#'); -} - // wuffs_base__status__message strips the leading '$', '#' or '@'. static inline const char* // wuffs_base__status__message(const wuffs_base__status* z) { @@ -248,6 +248,11 @@ wuffs_base__status::is_error() const { return wuffs_base__status__is_error(this); } +inline bool // +wuffs_base__status::is_note() const { + return wuffs_base__status__is_note(this); +} + inline bool // wuffs_base__status::is_ok() const { return wuffs_base__status__is_ok(this); @@ -258,11 +263,6 @@ wuffs_base__status::is_suspension() const { return wuffs_base__status__is_suspension(this); } -inline bool // -wuffs_base__status::is_warning() const { - return wuffs_base__status__is_warning(this); -} - inline const char* // wuffs_base__status::message() const { return wuffs_base__status__message(this); @@ -3637,7 +3637,7 @@ extern "C" { // ---------------- Status Codes -extern const char* wuffs_zlib__warning__dictionary_required; +extern const char* wuffs_zlib__note__dictionary_required; extern const char* wuffs_zlib__error__bad_checksum; extern const char* wuffs_zlib__error__bad_compression_method; extern const char* wuffs_zlib__error__bad_compression_window_size; @@ -4534,8 +4534,8 @@ const uint64_t wuffs_base__low_bits_mask__u64[65] = { 0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, }; -const char* wuffs_base__warning__end_of_data = "@base: end of data"; -const char* wuffs_base__warning__metadata_reported = "@base: metadata reported"; +const char* wuffs_base__note__end_of_data = "@base: end of data"; +const char* wuffs_base__note__metadata_reported = "@base: metadata reported"; const char* wuffs_base__suspension__short_read = "$base: short read"; const char* wuffs_base__suspension__short_write = "$base: short write"; const char* wuffs_base__error__bad_i_o_position = "#base: bad I/O position"; @@ -8814,8 +8814,7 @@ wuffs_gif__decoder__ack_metadata_chunk(wuffs_gif__decoder* self, wuffs_base__u64__sat_add(a_src->meta.pos, ((uint64_t)(iop_a_src - io0_a_src))), self->private_impl.f_metadata_chunk_length_value); - status = - wuffs_base__make_status(wuffs_base__warning__metadata_reported); + status = wuffs_base__make_status(wuffs_base__note__metadata_reported); goto ok; } (iop_a_src += 1, wuffs_base__make_empty_struct()); @@ -9090,7 +9089,7 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self, } } if (self->private_impl.f_end_of_data) { - status = wuffs_base__make_status(wuffs_base__warning__end_of_data); + status = wuffs_base__make_status(wuffs_base__note__end_of_data); goto ok; } v_blend = 0; @@ -10132,8 +10131,7 @@ wuffs_gif__decoder__decode_ae(wuffs_gif__decoder* self, ((uint64_t)(iop_a_src - io0_a_src))), self->private_impl.f_metadata_chunk_length_value); self->private_impl.f_call_sequence = 1; - status = - wuffs_base__make_status(wuffs_base__warning__metadata_reported); + status = wuffs_base__make_status(wuffs_base__note__metadata_reported); goto ok; } else if (v_is_xmp && self->private_impl.f_report_metadata_xmp) { while (((uint64_t)(io2_a_src - iop_a_src)) <= 0) { @@ -10153,8 +10151,7 @@ wuffs_gif__decoder__decode_ae(wuffs_gif__decoder* self, ((uint64_t)(iop_a_src - io0_a_src))), self->private_impl.f_metadata_chunk_length_value); self->private_impl.f_call_sequence = 1; - status = - wuffs_base__make_status(wuffs_base__warning__metadata_reported); + status = wuffs_base__make_status(wuffs_base__note__metadata_reported); goto ok; } goto label_0_break; @@ -11602,7 +11599,7 @@ exit: // ---------------- Status Codes Implementations -const char* wuffs_zlib__warning__dictionary_required = +const char* wuffs_zlib__note__dictionary_required = "@zlib: dictionary required"; const char* wuffs_zlib__error__bad_checksum = "#zlib: bad checksum"; const char* wuffs_zlib__error__bad_compression_method = @@ -11914,8 +11911,7 @@ wuffs_zlib__decoder__decode_io_writer(wuffs_zlib__decoder* self, } self->private_impl.f_dict_id_want = t_1; } - status = - wuffs_base__make_status(wuffs_zlib__warning__dictionary_required); + status = wuffs_base__make_status(wuffs_zlib__note__dictionary_required); goto ok; } else if (self->private_impl.f_got_dictionary) { status = @@ -11929,8 +11925,7 @@ wuffs_zlib__decoder__decode_io_writer(wuffs_zlib__decoder* self, wuffs_base__make_status(wuffs_zlib__error__incorrect_dictionary); goto exit; } - status = - wuffs_base__make_status(wuffs_zlib__warning__dictionary_required); + status = wuffs_base__make_status(wuffs_zlib__note__dictionary_required); goto ok; } self->private_impl.f_header_complete = true; diff --git a/test/c/std/gif.c b/test/c/std/gif.c index c664e0d0..24733fc9 100644 --- a/test/c/std/gif.c +++ b/test/c/std/gif.c @@ -221,7 +221,7 @@ const char* wuffs_gif_decode(wuffs_base__io_buffer* dst, while (true) { wuffs_base__status status = wuffs_gif__decoder__decode_frame_config(&dec, &fc, src); - if (status.repr == wuffs_base__warning__end_of_data) { + if (status.repr == wuffs_base__note__end_of_data) { break; } CHECK_STATUS("decode_frame_config", status); @@ -443,9 +443,9 @@ const char* do_test_wuffs_gif_decode(const char* filename, } wuffs_base__status status = wuffs_gif__decoder__decode_frame( &dec, &pb, &src, global_work_slice, NULL); - if (status.repr != wuffs_base__warning__end_of_data) { + if (status.repr != wuffs_base__note__end_of_data) { RETURN_FAIL("decode_frame: got \"%s\", want \"%s\"", status.repr, - wuffs_base__warning__end_of_data); + wuffs_base__note__end_of_data); } if (src.meta.ri != src.meta.wi) { RETURN_FAIL( @@ -631,9 +631,9 @@ const char* do_test_wuffs_gif_decode_animated( for (i = 0; i < 3; i++) { wuffs_base__status status = wuffs_gif__decoder__decode_frame( &dec, &pb, &src, global_work_slice, NULL); - if (status.repr != wuffs_base__warning__end_of_data) { + if (status.repr != wuffs_base__note__end_of_data) { RETURN_FAIL("decode_frame: got \"%s\", want \"%s\"", status.repr, - wuffs_base__warning__end_of_data); + wuffs_base__note__end_of_data); } } @@ -942,10 +942,10 @@ const char* test_wuffs_gif_decode_frame_out_of_bounds() { { status = wuffs_gif__decoder__decode_frame_config(&dec, &fc, &src); if (i == WUFFS_TESTLIB_ARRAY_SIZE(want_frame_config_bounds)) { - if (status.repr != wuffs_base__warning__end_of_data) { + if (status.repr != wuffs_base__note__end_of_data) { RETURN_FAIL("q=%d: decode_frame_config #%" PRIu32 ": got \"%s\", want \"%s\"", - q, i, status.repr, wuffs_base__warning__end_of_data); + q, i, status.repr, wuffs_base__note__end_of_data); } break; } @@ -1286,10 +1286,10 @@ const char* do_test_wuffs_gif_decode_metadata(bool full) { wuffs_gif__decoder__decode_image_config(&dec, &ic, &src); if (wuffs_base__status__is_ok(&status)) { break; - } else if (status.repr != wuffs_base__warning__metadata_reported) { + } else if (status.repr != wuffs_base__note__metadata_reported) { RETURN_FAIL( "decode_image_config (iccp=%d, xmp=%d): got \"%s\", want \"%s\"", - iccp, xmp, status.repr, wuffs_base__warning__metadata_reported); + iccp, xmp, status.repr, wuffs_base__note__metadata_reported); } const char* want = ""; @@ -1335,10 +1335,10 @@ const char* do_test_wuffs_gif_decode_metadata(bool full) { wuffs_gif__decoder__ack_metadata_chunk(&dec, &src); if (wuffs_base__status__is_ok(&status)) { break; - } else if (status.repr != wuffs_base__warning__metadata_reported) { + } else if (status.repr != wuffs_base__note__metadata_reported) { RETURN_FAIL( "ack_metadata_chunk (iccp=%d, xmp=%d): got \"%s\", want \"%s\"", - iccp, xmp, status.repr, wuffs_base__warning__metadata_reported); + iccp, xmp, status.repr, wuffs_base__note__metadata_reported); } } @@ -1485,10 +1485,10 @@ const char* test_wuffs_gif_decode_multiple_loop_counts() { wuffs_base__status status = wuffs_gif__decoder__decode_frame_config(&dec, NULL, &src); if (i == WUFFS_TESTLIB_ARRAY_SIZE(want_num_animation_loops)) { - if (status.repr != wuffs_base__warning__end_of_data) { + if (status.repr != wuffs_base__note__end_of_data) { RETURN_FAIL("decode_frame_config #%" PRIu32 ": got \"%s\", want \"%s\"", - i, status.repr, wuffs_base__warning__end_of_data); + i, status.repr, wuffs_base__note__end_of_data); } break; } @@ -1668,11 +1668,11 @@ const char* do_test_wuffs_gif_num_decoded(bool frame_config) { if (wuffs_base__status__is_ok(&status)) { want++; - } else if (status.repr == wuffs_base__warning__end_of_data) { + } else if (status.repr == wuffs_base__note__end_of_data) { end_of_data = true; } else { RETURN_FAIL("%s: got \"%s\", want \"%s\"", method, status.repr, - wuffs_base__warning__end_of_data); + wuffs_base__note__end_of_data); } } @@ -1789,9 +1789,9 @@ const char* do_test_wuffs_gif_io_position(bool chunked) { wuffs_base__status status = wuffs_gif__decoder__decode_frame_config(&dec, NULL, &src); - if (status.repr != wuffs_base__warning__end_of_data) { + if (status.repr != wuffs_base__note__end_of_data) { RETURN_FAIL("decode_frame_config EOD: got \"%s\", want \"%s\"", status.repr, - wuffs_base__warning__end_of_data); + wuffs_base__note__end_of_data); } // If we're chunked, we've discarded some source bytes due to an earlier @@ -1834,9 +1834,9 @@ const char* do_test_wuffs_gif_io_position(bool chunked) { } status = wuffs_gif__decoder__decode_frame_config(&dec, NULL, &src); - if (status.repr != wuffs_base__warning__end_of_data) { + if (status.repr != wuffs_base__note__end_of_data) { RETURN_FAIL("decode_frame_config #%d: got \"%s\", want \"%s\"", i, - status.repr, wuffs_base__warning__end_of_data); + status.repr, wuffs_base__note__end_of_data); } } diff --git a/test/c/std/zlib.c b/test/c/std/zlib.c index 334fc88d..236bc9c5 100644 --- a/test/c/std/zlib.c +++ b/test/c/std/zlib.c @@ -238,9 +238,9 @@ const char* test_wuffs_zlib_decode_sheep() { wuffs_base__status status = wuffs_zlib__decoder__decode_io_writer( &dec, &got, &src, global_work_slice); - if (status.repr != wuffs_zlib__warning__dictionary_required) { + if (status.repr != wuffs_zlib__note__dictionary_required) { RETURN_FAIL("decode_io_writer (before dict): got \"%s\", want \"%s\"", - status.repr, wuffs_zlib__warning__dictionary_required); + status.repr, wuffs_zlib__note__dictionary_required); } uint32_t dict_id_got = wuffs_zlib__decoder__dictionary_id(&dec);