mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Remove wuffs_base__io_{reader,writer} mark field
This commit is contained in:
1 parent
d0ffe6fe6a
commit
d3342e7b4a
18 files changed
+120
-237
No files matched your search
@@ -257,11 +257,11 @@ static inline bool wuffs_base__io_writer__is_valid(wuffs_base__io_writer o) {
|
||||
|
||||
static inline uint32_t wuffs_base__io_writer__copy_from_history32(
|
||||
uint8_t** ptr_ptr,
|
||||
uint8_t* start, // May be NULL, meaning an unmarked io_writer.
|
||||
uint8_t* start,
|
||||
uint8_t* end,
|
||||
uint32_t distance,
|
||||
uint32_t length) {
|
||||
if (!start || !distance) {
|
||||
if (!distance) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t* ptr = *ptr_ptr;
|
||||
@@ -300,7 +300,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_history32(
|
||||
// wuffs_base__io_writer__copy_from_history32__bco is a Bounds Check Optimized
|
||||
// version of the wuffs_base__io_writer__copy_from_history32 function above.
|
||||
// The caller needs to prove that:
|
||||
// - start != NULL
|
||||
// - distance > 0
|
||||
// - distance <= (*ptr_ptr - start)
|
||||
// - length <= (end - *ptr_ptr)
|
||||
@@ -384,18 +383,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
// Note that the *__limit and *__mark methods are private (in base-impl.h) not
|
||||
// public (in base-header.h). We assume that, at the boundary between user code
|
||||
// and Wuffs code, the io_reader and io_writer's private_impl fields (including
|
||||
// limit and mark) are NULL. Otherwise, some internal assumptions break down.
|
||||
// For example, limits could be represented as pointers, even though
|
||||
// conceptually they are counts, but that pointer-to-count correspondence
|
||||
// becomes invalid if a buffer is re-used (e.g. on resuming a coroutine).
|
||||
//
|
||||
// Admittedly, some of the Wuffs test code calls these methods, but that test
|
||||
// code is still Wuffs code, not user code. Other Wuffs test code modifies
|
||||
// private_impl fields directly.
|
||||
|
||||
static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t* ptr_to_len) {
|
||||
@@ -408,7 +395,7 @@ static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__mark(
|
||||
wuffs_base__io_reader* o,
|
||||
uint8_t* mark) {
|
||||
o->private_impl.mark = mark;
|
||||
o->private_impl.bounds[0] = mark;
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
|
||||
@@ -417,6 +404,6 @@ static inline wuffs_base__empty_struct wuffs_base__io_reader__mark(
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_writer__mark(
|
||||
wuffs_base__io_writer* o,
|
||||
uint8_t* mark) {
|
||||
o->private_impl.mark = mark;
|
||||
o->private_impl.bounds[0] = mark;
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
Reference in new issue
Block a user