Compile C++ example with -Wall -Werror

This commit is contained in:
Nigel Tao committed 2018-06-30 10:56:04 +10:00
1 parent 6183aba9d7
commit 60a7b48745
11 files changed
+50 -50

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ for f in example/*; do
echo Building $f
if [ "$f" = "example/crc32" ]; then
# example/crc32 is unusual in that it's C++, not C.
g++ $f/*.cc -o $f/a.out
g++ -Wall -Werror $f/*.cc -o $f/a.out
elif [ "$f" = "example/library" ]; then
# example/library is unusual in that it uses separately compiled libraries
# instead of directly #include'ing Wuffs' .c files.
@@ -468,11 +468,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -489,7 +489,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -509,7 +509,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -523,7 +523,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});
+4 -4
View File
@@ -119,10 +119,10 @@ const basePrivateH = "" +
"// ---------------- I/O\n\nstatic inline bool wuffs_base__io_buffer__is_valid(wuffs_base__io_buffer buf) {\n return (buf.ptr || (buf.len == 0)) && (buf.len >= buf.wi) &&\n (buf.wi >= buf.ri);\n}\n\nstatic inline bool wuffs_base__io_reader__is_eof(wuffs_base__io_reader o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n return buf && buf->closed && (buf->ptr + buf->wi == o.private_impl.bounds[1]);\n}\n\nstatic inline bool wuffs_base__io_reader__is_valid(wuffs_base__io_reader o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n // Note: if making this function public (i.e. moving it to base-header.h), it\n // also needs to allow NULL (i.e. implicit, callee-calculated) bounds.\n return buf ? ((buf->ptr <= o.private_impl.bounds[0]) &&\n (o.private_impl.bounds[0] <= o.private_impl.bounds[1]) &&\n (o.private_impl.bounds[1] <= buf->ptr + buf->len))\n : ((o.private_impl.bounds[0] == NULL) &&\n (o.private_impl.bounds[1] == NULL));\n}\n\nstatic inline bool wuf" +
"fs_base__io_writer__is_valid(wuffs_base__io_writer o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n // Note: if making this function public (i.e. moving it to base-header.h), it\n // also needs to allow NULL (i.e. implicit, callee-calculated) bounds.\n return buf ? ((buf->ptr <= o.private_impl.bounds[0]) &&\n (o.private_impl.bounds[0] <= o.private_impl.bounds[1]) &&\n (o.private_impl.bounds[1] <= buf->ptr + buf->len))\n : ((o.private_impl.bounds[0] == NULL) &&\n (o.private_impl.bounds[1] == NULL));\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_history32(\n uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t distance,\n uint32_t length) {\n if (!distance) {\n return 0;\n }\n uint8_t* ptr = *ptr_ptr;\n if ((size_t)(ptr - start) < (size_t)(distance)) {\n return 0;\n }\n start = ptr - distance;\n size_t n = end - ptr;\n if ((size_t)(length) > n) {\n length = n;\n } else {\n n = length;\n }\n // TODO: unrolling" +
" by 3 seems best for the std/deflate benchmarks, but that\n // is mostly because 3 is the minimum length for the deflate format. This\n // function implementation shouldn't overfit to that one format. Perhaps the\n // copy_from_history32 Wuffs method should also take an unroll hint argument,\n // and the cgen can look if that argument is the constant expression '3'.\n //\n // See also wuffs_base__io_writer__copy_from_history32__bco below.\n //\n // Alternatively, or additionally, have a sloppy_copy_from_history32 method\n // that copies 8 bytes at a time, possibly writing more than length bytes?\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\n// wuffs_base__io_writer__copy_from_history32__bco is a Bounds Check Optimized\n// version of the wuffs_base__io_writer__copy_from_history32 function above.\n// The caller needs to prove that:\n// - distance > 0\n// - distance <= (*ptr_pt" +
"r - start)\n// - length <= (end - *ptr_ptr)\nstatic inline uint32_t wuffs_base__io_writer__copy_from_history32__bco(\n uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t distance,\n uint32_t length) {\n uint8_t* ptr = *ptr_ptr;\n start = ptr - distance;\n uint32_t n = length;\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_reader32(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n uint8_t** ptr_ioptr_r,\n uint8_t* iobounds1_r,\n uint32_t length) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = length;\n if (n > iobounds1_w - ioptr_w) {\n n = iobounds1_w - ioptr_w;\n }\n uint8_t* ioptr_r = *ptr_ioptr_r;\n if (n > iobounds1_r - ioptr_r) {\n n = iobounds1_r - ioptr_r;\n }\n if (n > 0) {\n memmove(ioptr_w, ioptr_r, n);\n *ptr_ioptr_w += n;\n *ptr_ioptr_r += n;\n }\n return " +
"n;\n}\n\nstatic inline uint64_t wuffs_base__io_writer__copy_from_slice(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n wuffs_base__slice_u8 src) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > iobounds1_w - ioptr_w) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_slice32(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n wuffs_base__slice_u8 src,\n uint32_t length) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > length) {\n n = length;\n }\n if (n > iobounds1_w - ioptr_w) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(\n wuffs_base__io_reader* o,\n uint8_t* ioptr_r,\n uint64_t limit) {\n if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {\n o->private" +
"_impl.bounds[1] = ioptr_r + limit;\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_mark(\n wuffs_base__io_reader* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set(\n wuffs_base__io_writer* o,\n wuffs_base__io_buffer* b,\n uint8_t** ioptr1_ptr,\n uint8_t** ioptr2_ptr,\n wuffs_base__slice_u8 s) {\n b->ptr = s.ptr;\n b->len = s.len;\n b->wi = 0;\n b->ri = 0;\n b->closed = false;\n o->private_impl.buf = b;\n o->private_impl.bounds[0] = s.ptr;\n o->private_impl.bounds[1] = s.ptr + s.len;\n *ioptr1_ptr = s.ptr;\n *ioptr2_ptr = s.ptr + s.len;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(\n wuffs_base__io_writer* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\n#ifdef __cplusplus\n} // extern \"C\"\n" +
"#endif\n\n#endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n" +
"r - start)\n// - length <= (end - *ptr_ptr)\nstatic inline uint32_t wuffs_base__io_writer__copy_from_history32__bco(\n uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t distance,\n uint32_t length) {\n uint8_t* ptr = *ptr_ptr;\n start = ptr - distance;\n uint32_t n = length;\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_reader32(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n uint8_t** ptr_ioptr_r,\n uint8_t* iobounds1_r,\n uint32_t length) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = length;\n if (n > ((size_t)(iobounds1_w - ioptr_w))) {\n n = iobounds1_w - ioptr_w;\n }\n uint8_t* ioptr_r = *ptr_ioptr_r;\n if (n > ((size_t)(iobounds1_r - ioptr_r))) {\n n = iobounds1_r - ioptr_r;\n }\n if (n > 0) {\n memmove(ioptr_w, ioptr_r, n);\n *ptr_ioptr_w += n;\n *ptr_iop" +
"tr_r += n;\n }\n return n;\n}\n\nstatic inline uint64_t wuffs_base__io_writer__copy_from_slice(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n wuffs_base__slice_u8 src) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > ((size_t)(iobounds1_w - ioptr_w))) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_slice32(\n uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n wuffs_base__slice_u8 src,\n uint32_t length) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > length) {\n n = length;\n }\n if (n > ((size_t)(iobounds1_w - ioptr_w))) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(\n wuffs_base__io_reader* o,\n uint8_t* ioptr_r,\n uint64_t limit) {\n if (o && (((size_t)(o->pri" +
"vate_impl.bounds[1] - ioptr_r)) > limit)) {\n o->private_impl.bounds[1] = ioptr_r + limit;\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_mark(\n wuffs_base__io_reader* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set(\n wuffs_base__io_writer* o,\n wuffs_base__io_buffer* b,\n uint8_t** ioptr1_ptr,\n uint8_t** ioptr2_ptr,\n wuffs_base__slice_u8 s) {\n b->ptr = s.ptr;\n b->len = s.len;\n b->wi = 0;\n b->ri = 0;\n b->closed = false;\n o->private_impl.buf = b;\n o->private_impl.bounds[0] = s.ptr;\n o->private_impl.bounds[1] = s.ptr + s.len;\n *ioptr1_ptr = s.ptr;\n *ioptr2_ptr = s.ptr + s.len;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(\n wuffs_base__io_writer* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base_" +
"_empty_struct){});\n}\n\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n\n#endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n" +
""
const baseImplC = "" +
+5 -5
View File
@@ -1791,11 +1791,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -1812,7 +1812,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1832,7 +1832,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1846,7 +1846,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});
+5 -5
View File
@@ -1836,11 +1836,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -1857,7 +1857,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1877,7 +1877,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1891,7 +1891,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});
+5 -5
View File
@@ -1836,11 +1836,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -1857,7 +1857,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1877,7 +1877,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1891,7 +1891,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});
+5 -5
View File
@@ -1924,11 +1924,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -1945,7 +1945,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1965,7 +1965,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1979,7 +1979,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});
+5 -5
View File
@@ -2041,11 +2041,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -2062,7 +2062,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -2082,7 +2082,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -2096,7 +2096,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});
+5 -5
View File
@@ -2076,11 +2076,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -2097,7 +2097,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -2117,7 +2117,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -2131,7 +2131,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});
+5 -5
View File
@@ -1860,11 +1860,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -1881,7 +1881,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1901,7 +1901,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -1915,7 +1915,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});
+5 -5
View File
@@ -2074,11 +2074,11 @@ static inline uint32_t wuffs_base__io_writer__copy_from_reader32(
uint32_t length) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = length;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
uint8_t* ioptr_r = *ptr_ioptr_r;
if (n > iobounds1_r - ioptr_r) {
if (n > ((size_t)(iobounds1_r - ioptr_r))) {
n = iobounds1_r - ioptr_r;
}
if (n > 0) {
@@ -2095,7 +2095,7 @@ static inline uint64_t wuffs_base__io_writer__copy_from_slice(
wuffs_base__slice_u8 src) {
uint8_t* ioptr_w = *ptr_ioptr_w;
size_t n = src.len;
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -2115,7 +2115,7 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
if (n > length) {
n = length;
}
if (n > iobounds1_w - ioptr_w) {
if (n > ((size_t)(iobounds1_w - ioptr_w))) {
n = iobounds1_w - ioptr_w;
}
if (n > 0) {
@@ -2129,7 +2129,7 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
wuffs_base__io_reader* o,
uint8_t* ioptr_r,
uint64_t limit) {
if (o && ((o->private_impl.bounds[1] - ioptr_r) > limit)) {
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
o->private_impl.bounds[1] = ioptr_r + limit;
}
return ((wuffs_base__empty_struct){});