mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 01:01:35 +01:00
Drop the "?" from "copy_from32?".
Also add a PUFFS_COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND macro. Also add a loop to decoder.decode, as the code generator was previously (incorrectly) not generating a coro_susp_point at the end of the function.
This commit is contained in:
1 parent
0e09aa8c10
commit
585ea2024d
10 files changed
+218
-134
No files matched your search
@@ -15,7 +15,15 @@
|
||||
// so that clang-format doesn't get confused by the unusual "case"s.
|
||||
#define PUFFS_COROUTINE_SUSPENSION_POINT(n) \
|
||||
coro_susp_point = n; \
|
||||
case n:
|
||||
case n:;
|
||||
|
||||
#define PUFFS_COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \
|
||||
if (status <= 0) { \
|
||||
goto exit; \
|
||||
} \
|
||||
coro_susp_point = n; \
|
||||
goto suspend; \
|
||||
case n:;
|
||||
|
||||
// Clang also defines "__GNUC__".
|
||||
#if defined(__GNUC__)
|
||||
@@ -132,6 +140,27 @@ static inline uint64_t puffs_base_slice_u8_copy_from(puffs_base_slice_u8 dst,
|
||||
return n;
|
||||
}
|
||||
|
||||
static inline uint32_t puffs_base_writer1_copy_from32(uint8_t** ptr_wptr,
|
||||
uint8_t* wend,
|
||||
uint8_t** ptr_rptr,
|
||||
uint8_t* rend,
|
||||
uint32_t length) {
|
||||
uint8_t* wptr = *ptr_wptr;
|
||||
if (length > (wend - wptr)) {
|
||||
length = wend - wptr;
|
||||
}
|
||||
uint8_t* rptr = *ptr_rptr;
|
||||
if (length > (rend - rptr)) {
|
||||
length = rend - rptr;
|
||||
}
|
||||
if (length > 0) {
|
||||
memmove(wptr, rptr, length);
|
||||
*ptr_wptr += length;
|
||||
*ptr_rptr += length;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
static inline uint32_t puffs_base_writer1_copy_history32(uint8_t** ptr_ptr,
|
||||
uint8_t* start,
|
||||
uint8_t* end,
|
||||
|
||||
Reference in new issue
Block a user