mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
Simplify the base-impl set_limit method
This commit is contained in:
1 parent
227f8610fc
commit
a69948b23d
9 files changed
+47
-73
No files matched your search
+6
-9
@@ -1810,15 +1810,12 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct
|
||||
wuffs_base__io_reader__set_limit_internal(wuffs_base__io_reader* o,
|
||||
uint64_t limit,
|
||||
size_t ri_override) {
|
||||
if (o && o->private_impl.buf) {
|
||||
uint8_t* p = o->private_impl.buf->ptr + ri_override;
|
||||
if ((o->private_impl.bounds[1] - p) > limit) {
|
||||
o->private_impl.bounds[1] = p + limit;
|
||||
}
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint8_t* rptr,
|
||||
uint64_t limit) {
|
||||
if (o && ((o->private_impl.bounds[1] - rptr) > limit)) {
|
||||
o->private_impl.bounds[1] = rptr + limit;
|
||||
}
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user