Add wuffs_base__io_{reader,writer} bounds field

This commit is contained in:
Nigel Tao committed 2018-04-28 09:11:05 +10:00
1 parent a2cf739e52
commit f5ef70b2fc
14 files changed
+28 -1

No files matched your search

+2
View File
@@ -565,6 +565,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -575,6 +576,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2 -1
View File
@@ -50,7 +50,8 @@ const baseHeader = "" +
"in_inclusive_x, s.min_inclusive_x);\n r.min_inclusive_y =\n wuffs_base__u32__min(r.min_inclusive_y, s.min_inclusive_y);\n r.max_exclusive_x =\n wuffs_base__u32__max(r.max_exclusive_x, s.max_exclusive_x);\n r.max_exclusive_y =\n wuffs_base__u32__max(r.max_exclusive_y, s.max_exclusive_y);\n return r;\n}\n\nstatic inline uint32_t wuffs_base__rect_ie_u32__width(\n wuffs_base__rect_ie_u32 r) {\n return wuffs_base__u32__sat_sub(r.max_exclusive_x, r.min_inclusive_x);\n}\n\nstatic inline uint32_t wuffs_base__rect_ie_u32__height(\n wuffs_base__rect_ie_u32 r) {\n return wuffs_base__u32__sat_sub(r.max_exclusive_y, r.min_inclusive_y);\n}\n\n" +
"" +
"// ---------------- I/O\n\n// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and length), plus\n// additional indexes into that buffer, plus an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n} wuffs_base__io_buffer;\n\n// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:\n// its first N bytes. That N can be greater than a buffer's current read or\n// write capacity. N decreases naturally over time as bytes are read from or\n// written to the stream.\n//\n// A value with all fields NULL or zero is a valid, unlimited view.\ntypedef struct wuffs_base__io_limit {\n uint64_t* ptr_to_len; // Pointer to N.\n struct wuffs_base__io_limit* next; // Linked list of limits.\n} wuffs_base__io_limit;\n\ntypedef" +
" struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__io_buffer* buf;\n wuffs_base__io_limit limit;\n uint8_t* mark;\n } private_impl;\n} wuffs_base__io_reader;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__io_buffer* buf;\n wuffs_base__io_limit limit;\n uint8_t* mark;\n } private_impl;\n} wuffs_base__io_writer;\n\nstatic inline wuffs_base__io_reader wuffs_base__io_buffer__reader(\n wuffs_base__io_buffer* buf) {\n wuffs_base__io_reader ret = ((wuffs_base__io_reader){});\n if (buf) {\n ret.private_impl.buf = buf;\n }\n return ret;\n}\n\nstatic inline wuffs_base__io_writer wuffs_base__io_buffer__writer(\n wuffs_base__io_buffer* buf) {\n wuffs_base__io_writer ret = ((wuffs_base__io_writer){});\n if (buf) {\n ret.private_impl.buf = buf;\n }\n return ret;\n}\n\n" +
" struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__io_buffer* buf;\n uint8_t* bounds[2];\n wuffs_base__io_limit limit;\n uint8_t* mark;\n } private_impl;\n} wuffs_base__io_reader;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__io_buffer* buf;\n uint8_t* bounds[2];\n wuffs_base__io_limit limit;\n uint8_t* mark;\n } private_impl;\n} wuffs_base__io_writer;\n\nstatic inline wuffs_base__io_reader wuffs_base__io_buffer__reader(\n wuffs_base__io_buffer* buf) {\n wuffs_base__io_reader ret = ((wuffs_base__io_reader){});\n if (buf) {\n ret.private_impl.buf = buf;\n }\n return ret;\n}\n\nstatic inline wuffs_base__io_writer wuffs_base__io_buffer__writer(\n wuffs_base__io_buffer* buf) {\n wuffs_base__io_writer ret = ((wuffs_base__io_writer){});\n if (buf) {\n ret.private_im" +
"pl.buf = buf;\n }\n return ret;\n}\n\n" +
"" +
"// ---------------- Images\n\n// wuffs_base__pixel_format encodes the format of the bytes that constitute an\n// image frame's pixel data. Its bits:\n// - bit 31 is reserved.\n// - bits 30 .. 28 encodes color (and channel order, in terms of memory).\n// - bits 27 .. 26 are reserved.\n// - bits 25 .. 24 encodes transparency.\n// - bit 23 indicates big-endian/MSB-first (as opposed to little/LSB).\n// - bit 22 indicates floating point (as opposed to integer).\n// - bits 21 .. 20 are the number of planes, minus 1. Zero means packed.\n// - bits 19 .. 16 encodes the number of bits (depth) in an index value.\n// Zero means direct, not palette-indexed.\n// - bits 15 .. 12 encodes the number of bits (depth) in the 3rd channel.\n// - bits 11 .. 8 encodes the number of bits (depth) in the 2nd channel.\n// - bits 7 .. 4 encodes the number of bits (depth) in the 1st channel.\n// - bits 3 .. 0 encodes the number of bits (depth) in the 0th channel.\n//\n// The bit fields of a wuffs_base" +
"__pixel_format are not independent. For\n// example, the number of planes should not be greater than the number of\n// channels. Similarly, bits 15..4 are unused (and should be zero) if bits\n// 31..24 (color and transparency) together imply only 1 channel (gray, no\n// alpha) and floating point samples should mean a bit depth of 16, 32 or 64.\n//\n// Formats hold between 1 and 4 channels. For example: Y (1 channel: gray), YA\n// (2 channels: gray and alpha), BGR (3 channels: blue, green, red) or CMYK (4\n// channels: cyan, magenta, yellow, black).\n//\n// For direct formats with N > 1 channels, those channels can be laid out in\n// either 1 (packed) or N (planar) planes. For example, RGBA data is usually\n// packed, but YUV data is usually planar, due to chroma subsampling (for\n// details, see the wuffs_base__pixel_subsampling type). For indexed formats,\n// the palette (always 256 × 4 bytes) holds up to 4 packed bytes of color data\n// per index value, and there is only 1 plane (for the index). The distance\n// between s" +
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
+2
View File
@@ -568,6 +568,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;
@@ -578,6 +579,7 @@ typedef struct {
// compatibility or safety guarantee if you do so.
struct {
wuffs_base__io_buffer* buf;
uint8_t* bounds[2];
wuffs_base__io_limit limit;
uint8_t* mark;
} private_impl;