Rename warnings to notes

This commit is contained in:
Nigel Tao committed 2020-01-05 13:15:00 +11:00
1 parent 0319777cce
commit 0fa32bd09f
13 files changed
+82 -86

No files matched your search

+1
View File
@@ -3,6 +3,7 @@
## Work In Progress ## Work In Progress
- Renamed warnings to notes.
- Made `wuffs_base__status` a struct. - Made `wuffs_base__status` a struct.
+5 -5
View File
@@ -5,7 +5,7 @@ involving [I/O](/doc/note/io-input-output.md) - return a status value. There
are four categories: are four categories:
- OK: the request was completed, successfully. - 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. - Suspensions: the request was not completed, but can be re-tried.
- Errors: the request was not completed, permanently. - 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 again. However, calling any other public coroutine method, while already
suspended, will lead to an `"#interleaved coroutine calls"` error. 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 necessarily mean 'bad' or something to avoid, only that something occurred
other than the typical outcome. For example, when decoding an animated image, 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 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"` frame" could return OK, if there was a next frame, or an `"@end of data"` note,
warning, if there wasn't. if there wasn't.
## Statuses are Strings ## 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 The first byte of the string message gives the category. For example, `"#bad
receiver"` is an error and `"$short read"` is a suspension: receiver"` is an error and `"$short read"` is a suspension:
- `'@'` means a warning. - `'@'` means a note.
- `'$'` means a suspension. - `'$'` means a suspension.
- `'#'` means an error. - `'#'` means an error.
+1 -1
View File
@@ -31,7 +31,7 @@ wuffs_base__pixel_buffer pb = etc;
while (true) { while (true) {
wuffs_base__frame_config fc; wuffs_base__frame_config fc;
status = wuffs_gif__decoder__decode_frame_config(dec, &fc, &src); 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; break;
} }
// Ditto re error checking. // Ditto re error checking.
+2 -2
View File
@@ -347,7 +347,7 @@ const char* play() {
wuffs_base__status status = wuffs_base__status status =
wuffs_gif__decoder__decode_frame_config(&dec, &fc, &src); wuffs_gif__decoder__decode_frame_config(&dec, &fc, &src);
if (!wuffs_base__status__is_ok(&status)) { 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; break;
} }
return wuffs_base__status__message(&status); return wuffs_base__status__message(&status);
@@ -372,7 +372,7 @@ const char* play() {
wuffs_base__status decode_frame_status = wuffs_base__status decode_frame_status =
wuffs_gif__decoder__decode_frame(&dec, &pb, &src, workbuf, NULL); 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; break;
} }
+2 -2
View File
@@ -117,7 +117,7 @@ const char* fuzz(wuffs_base__io_buffer* src, uint32_t hash) {
wuffs_base__frame_config fc = ((wuffs_base__frame_config){}); wuffs_base__frame_config fc = ((wuffs_base__frame_config){});
status = wuffs_gif__decoder__decode_frame_config(&dec, &fc, src); status = wuffs_gif__decoder__decode_frame_config(&dec, &fc, src);
if (!wuffs_base__status__is_ok(&status)) { 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); ret = wuffs_base__status__message(&status);
} }
goto exit; 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 (!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); ret = wuffs_base__status__message(&status);
} }
goto exit; goto exit;
+11 -11
View File
@@ -141,9 +141,9 @@ typedef struct {
#ifdef __cplusplus #ifdef __cplusplus
inline bool is_complete() const; inline bool is_complete() const;
inline bool is_error() const; inline bool is_error() const;
inline bool is_note() const;
inline bool is_ok() const; inline bool is_ok() const;
inline bool is_suspension() const; inline bool is_suspension() const;
inline bool is_warning() const;
inline const char* message() const; inline const char* message() const;
#endif // __cplusplus #endif // __cplusplus
@@ -168,6 +168,11 @@ wuffs_base__status__is_error(const wuffs_base__status* z) {
return z->repr && (*z->repr == '#'); 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 // static inline bool //
wuffs_base__status__is_ok(const wuffs_base__status* z) { wuffs_base__status__is_ok(const wuffs_base__status* z) {
return z->repr == NULL; return z->repr == NULL;
@@ -178,11 +183,6 @@ wuffs_base__status__is_suspension(const wuffs_base__status* z) {
return z->repr && (*z->repr == '$'); 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 '@'. // wuffs_base__status__message strips the leading '$', '#' or '@'.
static inline const char* // static inline const char* //
wuffs_base__status__message(const wuffs_base__status* z) { 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); return wuffs_base__status__is_error(this);
} }
inline bool //
wuffs_base__status::is_note() const {
return wuffs_base__status__is_note(this);
}
inline bool // inline bool //
wuffs_base__status::is_ok() const { wuffs_base__status::is_ok() const {
return wuffs_base__status__is_ok(this); return wuffs_base__status__is_ok(this);
@@ -216,11 +221,6 @@ wuffs_base__status::is_suspension() const {
return wuffs_base__status__is_suspension(this); 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* // inline const char* //
wuffs_base__status::message() const { wuffs_base__status::message() const {
return wuffs_base__status__message(this); return wuffs_base__status__message(this);
+7 -7
View File
@@ -127,7 +127,7 @@ func Do(args []string) error {
if msg == "" { if msg == "" {
continue continue
} }
pre := "warning" pre := "note"
if msg[0] == '$' { if msg[0] == '$' {
pre = "suspension" pre = "suspension"
} else if msg[0] == '#' { } else if msg[0] == '#' {
@@ -195,12 +195,12 @@ func statusMsgIsError(msg string) bool {
return (len(msg) != 0) && (msg[0] == '#') return (len(msg) != 0) && (msg[0] == '#')
} }
func statusMsgIsSuspension(msg string) bool { func statusMsgIsNote(msg string) bool {
return (len(msg) != 0) && (msg[0] == '$') return (len(msg) == 0) || (msg[0] != '$' && msg[0] != '#')
} }
func statusMsgIsWarning(msg string) bool { func statusMsgIsSuspension(msg string) bool {
return (len(msg) == 0) || (msg[0] != '$' && msg[0] != '#') return (len(msg) != 0) && (msg[0] == '$')
} }
type buffer []byte type buffer []byte
@@ -284,7 +284,7 @@ func insertBaseAllPublicH(buf *buffer) error {
if msg == "" { if msg == "" {
return fmt.Errorf("bad built-in status %q", z) return fmt.Errorf("bad built-in status %q", z)
} }
pre := "warning" pre := "note"
if statusMsgIsError(msg) { if statusMsgIsError(msg) {
pre = "error" pre = "error"
} else if statusMsgIsSuspension(msg) { } 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 { func (g *gen) addStatus(qid t.QID, msg string, public bool) error {
category := "warning__" category := "note__"
if msg[0] == '$' { if msg[0] == '$' {
category = "suspension__" category = "suspension__"
} else if msg[0] == '#' { } else if msg[0] == '#' {
+3 -3
View File
@@ -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" + "// --------\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" + " 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" + "// --------\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" +
"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" + "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" +
"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" + "__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" + "// --------\n\n// FourCC constants.\n\n// !! INSERT FourCCs.\n\n" +
"" + "" +
+4 -4
View File
@@ -435,15 +435,15 @@ func (g *gen) writeStatementRet(b *buffer, n *a.Ret, depth uint32) error {
if g.currFunk.astFunc.Effect().Coroutine() || if g.currFunk.astFunc.Effect().Coroutine() ||
(g.currFunk.returnsStatus && (len(g.currFunk.derivedVars) > 0)) { (g.currFunk.returnsStatus && (len(g.currFunk.derivedVars) > 0)) {
isOK := false isComplete := false
b.writes("status = ") b.writes("status = ")
if retExpr.Operator() == 0 && retExpr.Ident() == t.IDOk { if retExpr.Operator() == 0 && retExpr.Ident() == t.IDOk {
b.writes("wuffs_base__make_status(NULL)") b.writes("wuffs_base__make_status(NULL)")
isOK = true isComplete = true
} else { } else {
if retExpr.Ident().IsStrLiteral(g.tm) { if retExpr.Ident().IsStrLiteral(g.tm) {
msg, _ := t.Unescape(retExpr.Ident().Str(g.tm)) msg, _ := t.Unescape(retExpr.Ident().Str(g.tm))
isOK = statusMsgIsWarning(msg) isComplete = statusMsgIsNote(msg)
} }
if err := g.writeExpr( if err := g.writeExpr(
b, retExpr, depth); err != nil { b, retExpr, depth); err != nil {
@@ -458,7 +458,7 @@ func (g *gen) writeStatementRet(b *buffer, n *a.Ret, depth uint32) error {
if n.RetsError() { if n.RetsError() {
b.writes("goto exit;") b.writes("goto exit;")
} else if isOK { } else if isComplete {
g.currFunk.hasGotoOK = true g.currFunk.hasGotoOK = true
b.writes("goto ok;") b.writes("goto ok;")
} else { } else {
+2 -2
View File
@@ -25,7 +25,7 @@ var FourCCs = [...][2]string{
} }
var Statuses = [...]string{ var Statuses = [...]string{
// Warnings. // Notes.
`"@end of data"`, `"@end of data"`,
`"@metadata reported"`, `"@metadata reported"`,
@@ -295,9 +295,9 @@ var Funcs = []string{
// TODO: should we add is_complete? // TODO: should we add is_complete?
"status.is_error() bool", "status.is_error() bool",
"status.is_note() bool",
"status.is_ok() bool", "status.is_ok() bool",
"status.is_suspension() bool", "status.is_suspension() bool",
"status.is_warning() bool",
// ---- frame_config // ---- frame_config
// Duration's upper bound is the maximum possible i64 value. // Duration's upper bound is the maximum possible i64 value.
+23 -28
View File
@@ -163,16 +163,16 @@ typedef struct {
#ifdef __cplusplus #ifdef __cplusplus
inline bool is_complete() const; inline bool is_complete() const;
inline bool is_error() const; inline bool is_error() const;
inline bool is_note() const;
inline bool is_ok() const; inline bool is_ok() const;
inline bool is_suspension() const; inline bool is_suspension() const;
inline bool is_warning() const;
inline const char* message() const; inline const char* message() const;
#endif // __cplusplus #endif // __cplusplus
} wuffs_base__status; } wuffs_base__status;
extern const char* wuffs_base__warning__end_of_data; extern const char* wuffs_base__note__end_of_data;
extern const char* wuffs_base__warning__metadata_reported; extern const char* wuffs_base__note__metadata_reported;
extern const char* wuffs_base__suspension__short_read; extern const char* wuffs_base__suspension__short_read;
extern const char* wuffs_base__suspension__short_write; extern const char* wuffs_base__suspension__short_write;
extern const char* wuffs_base__error__bad_i_o_position; 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 == '#'); 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 // static inline bool //
wuffs_base__status__is_ok(const wuffs_base__status* z) { wuffs_base__status__is_ok(const wuffs_base__status* z) {
return z->repr == NULL; return z->repr == NULL;
@@ -220,11 +225,6 @@ wuffs_base__status__is_suspension(const wuffs_base__status* z) {
return z->repr && (*z->repr == '$'); 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 '@'. // wuffs_base__status__message strips the leading '$', '#' or '@'.
static inline const char* // static inline const char* //
wuffs_base__status__message(const wuffs_base__status* z) { 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); return wuffs_base__status__is_error(this);
} }
inline bool //
wuffs_base__status::is_note() const {
return wuffs_base__status__is_note(this);
}
inline bool // inline bool //
wuffs_base__status::is_ok() const { wuffs_base__status::is_ok() const {
return wuffs_base__status__is_ok(this); return wuffs_base__status__is_ok(this);
@@ -258,11 +263,6 @@ wuffs_base__status::is_suspension() const {
return wuffs_base__status__is_suspension(this); 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* // inline const char* //
wuffs_base__status::message() const { wuffs_base__status::message() const {
return wuffs_base__status__message(this); return wuffs_base__status__message(this);
@@ -3637,7 +3637,7 @@ extern "C" {
// ---------------- Status Codes // ---------------- 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_checksum;
extern const char* wuffs_zlib__error__bad_compression_method; extern const char* wuffs_zlib__error__bad_compression_method;
extern const char* wuffs_zlib__error__bad_compression_window_size; 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, 0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
}; };
const char* wuffs_base__warning__end_of_data = "@base: end of data"; const char* wuffs_base__note__end_of_data = "@base: end of data";
const char* wuffs_base__warning__metadata_reported = "@base: metadata reported"; 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_read = "$base: short read";
const char* wuffs_base__suspension__short_write = "$base: short write"; const char* wuffs_base__suspension__short_write = "$base: short write";
const char* wuffs_base__error__bad_i_o_position = "#base: bad I/O position"; 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, wuffs_base__u64__sat_add(a_src->meta.pos,
((uint64_t)(iop_a_src - io0_a_src))), ((uint64_t)(iop_a_src - io0_a_src))),
self->private_impl.f_metadata_chunk_length_value); self->private_impl.f_metadata_chunk_length_value);
status = status = wuffs_base__make_status(wuffs_base__note__metadata_reported);
wuffs_base__make_status(wuffs_base__warning__metadata_reported);
goto ok; goto ok;
} }
(iop_a_src += 1, wuffs_base__make_empty_struct()); (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) { 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; goto ok;
} }
v_blend = 0; v_blend = 0;
@@ -10132,8 +10131,7 @@ wuffs_gif__decoder__decode_ae(wuffs_gif__decoder* self,
((uint64_t)(iop_a_src - io0_a_src))), ((uint64_t)(iop_a_src - io0_a_src))),
self->private_impl.f_metadata_chunk_length_value); self->private_impl.f_metadata_chunk_length_value);
self->private_impl.f_call_sequence = 1; self->private_impl.f_call_sequence = 1;
status = status = wuffs_base__make_status(wuffs_base__note__metadata_reported);
wuffs_base__make_status(wuffs_base__warning__metadata_reported);
goto ok; goto ok;
} else if (v_is_xmp && self->private_impl.f_report_metadata_xmp) { } else if (v_is_xmp && self->private_impl.f_report_metadata_xmp) {
while (((uint64_t)(io2_a_src - iop_a_src)) <= 0) { 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))), ((uint64_t)(iop_a_src - io0_a_src))),
self->private_impl.f_metadata_chunk_length_value); self->private_impl.f_metadata_chunk_length_value);
self->private_impl.f_call_sequence = 1; self->private_impl.f_call_sequence = 1;
status = status = wuffs_base__make_status(wuffs_base__note__metadata_reported);
wuffs_base__make_status(wuffs_base__warning__metadata_reported);
goto ok; goto ok;
} }
goto label_0_break; goto label_0_break;
@@ -11602,7 +11599,7 @@ exit:
// ---------------- Status Codes Implementations // ---------------- Status Codes Implementations
const char* wuffs_zlib__warning__dictionary_required = const char* wuffs_zlib__note__dictionary_required =
"@zlib: dictionary required"; "@zlib: dictionary required";
const char* wuffs_zlib__error__bad_checksum = "#zlib: bad checksum"; const char* wuffs_zlib__error__bad_checksum = "#zlib: bad checksum";
const char* wuffs_zlib__error__bad_compression_method = 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; self->private_impl.f_dict_id_want = t_1;
} }
status = status = wuffs_base__make_status(wuffs_zlib__note__dictionary_required);
wuffs_base__make_status(wuffs_zlib__warning__dictionary_required);
goto ok; goto ok;
} else if (self->private_impl.f_got_dictionary) { } else if (self->private_impl.f_got_dictionary) {
status = status =
@@ -11929,8 +11925,7 @@ wuffs_zlib__decoder__decode_io_writer(wuffs_zlib__decoder* self,
wuffs_base__make_status(wuffs_zlib__error__incorrect_dictionary); wuffs_base__make_status(wuffs_zlib__error__incorrect_dictionary);
goto exit; goto exit;
} }
status = status = wuffs_base__make_status(wuffs_zlib__note__dictionary_required);
wuffs_base__make_status(wuffs_zlib__warning__dictionary_required);
goto ok; goto ok;
} }
self->private_impl.f_header_complete = true; self->private_impl.f_header_complete = true;
+19 -19
View File
@@ -221,7 +221,7 @@ const char* wuffs_gif_decode(wuffs_base__io_buffer* dst,
while (true) { while (true) {
wuffs_base__status status = wuffs_base__status status =
wuffs_gif__decoder__decode_frame_config(&dec, &fc, src); 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; break;
} }
CHECK_STATUS("decode_frame_config", status); 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( wuffs_base__status status = wuffs_gif__decoder__decode_frame(
&dec, &pb, &src, global_work_slice, NULL); &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, 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) { if (src.meta.ri != src.meta.wi) {
RETURN_FAIL( RETURN_FAIL(
@@ -631,9 +631,9 @@ const char* do_test_wuffs_gif_decode_animated(
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
wuffs_base__status status = wuffs_gif__decoder__decode_frame( wuffs_base__status status = wuffs_gif__decoder__decode_frame(
&dec, &pb, &src, global_work_slice, NULL); &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, 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); status = wuffs_gif__decoder__decode_frame_config(&dec, &fc, &src);
if (i == WUFFS_TESTLIB_ARRAY_SIZE(want_frame_config_bounds)) { 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 RETURN_FAIL("q=%d: decode_frame_config #%" PRIu32
": got \"%s\", want \"%s\"", ": 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; break;
} }
@@ -1286,10 +1286,10 @@ const char* do_test_wuffs_gif_decode_metadata(bool full) {
wuffs_gif__decoder__decode_image_config(&dec, &ic, &src); wuffs_gif__decoder__decode_image_config(&dec, &ic, &src);
if (wuffs_base__status__is_ok(&status)) { if (wuffs_base__status__is_ok(&status)) {
break; break;
} else if (status.repr != wuffs_base__warning__metadata_reported) { } else if (status.repr != wuffs_base__note__metadata_reported) {
RETURN_FAIL( RETURN_FAIL(
"decode_image_config (iccp=%d, xmp=%d): got \"%s\", want \"%s\"", "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 = ""; 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); wuffs_gif__decoder__ack_metadata_chunk(&dec, &src);
if (wuffs_base__status__is_ok(&status)) { if (wuffs_base__status__is_ok(&status)) {
break; break;
} else if (status.repr != wuffs_base__warning__metadata_reported) { } else if (status.repr != wuffs_base__note__metadata_reported) {
RETURN_FAIL( RETURN_FAIL(
"ack_metadata_chunk (iccp=%d, xmp=%d): got \"%s\", want \"%s\"", "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_base__status status =
wuffs_gif__decoder__decode_frame_config(&dec, NULL, &src); wuffs_gif__decoder__decode_frame_config(&dec, NULL, &src);
if (i == WUFFS_TESTLIB_ARRAY_SIZE(want_num_animation_loops)) { 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 RETURN_FAIL("decode_frame_config #%" PRIu32
": got \"%s\", want \"%s\"", ": got \"%s\", want \"%s\"",
i, status.repr, wuffs_base__warning__end_of_data); i, status.repr, wuffs_base__note__end_of_data);
} }
break; break;
} }
@@ -1668,11 +1668,11 @@ const char* do_test_wuffs_gif_num_decoded(bool frame_config) {
if (wuffs_base__status__is_ok(&status)) { if (wuffs_base__status__is_ok(&status)) {
want++; 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; end_of_data = true;
} else { } else {
RETURN_FAIL("%s: got \"%s\", want \"%s\"", method, status.repr, 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_base__status status =
wuffs_gif__decoder__decode_frame_config(&dec, NULL, &src); 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, 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 // 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); 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, 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);
} }
} }
+2 -2
View File
@@ -238,9 +238,9 @@ const char* test_wuffs_zlib_decode_sheep() {
wuffs_base__status status = wuffs_zlib__decoder__decode_io_writer( wuffs_base__status status = wuffs_zlib__decoder__decode_io_writer(
&dec, &got, &src, global_work_slice); &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\"", 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); uint32_t dict_id_got = wuffs_zlib__decoder__dictionary_id(&dec);