mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 08:55:11 +01:00
Implement io_limit
This commit is contained in:
1 parent
58c30e9d6d
commit
78c7087eee
6 files changed
+152
-55
No files matched your search
@@ -34,6 +34,15 @@ wuffs_base__io__since(uint64_t mark, uint64_t index, uint8_t* ptr) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void //
|
||||
wuffs_base__io_reader__limit(const uint8_t** ptr_io2_r,
|
||||
const uint8_t* iop_r,
|
||||
uint64_t limit) {
|
||||
if (((uint64_t)(*ptr_io2_r - iop_r)) > limit) {
|
||||
*ptr_io2_r = iop_r + limit;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_reader__limited_copy_u32_to_slice(const uint8_t** ptr_iop_r,
|
||||
const uint8_t* io2_r,
|
||||
@@ -131,6 +140,15 @@ wuffs_base__io_writer__copy_from_slice(uint8_t** ptr_iop_w,
|
||||
return (uint64_t)(n);
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__io_writer__limit(uint8_t** ptr_io2_w,
|
||||
uint8_t* iop_w,
|
||||
uint64_t limit) {
|
||||
if (((uint64_t)(*ptr_io2_w - iop_w)) > limit) {
|
||||
*ptr_io2_w = iop_w + limit;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_writer__limited_copy_u32_from_history(uint8_t** ptr_iop_w,
|
||||
uint8_t* io1_w,
|
||||
|
||||
Reference in new issue
Block a user