mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 16:32:11 +01:00
Add a workbuf argument to decode_io_writer
This commit is contained in:
1 parent
91f7f4b70a
commit
c9830ceb9a
16 files changed
+111
-52
No files matched your search
@@ -53,6 +53,9 @@ uint8_t lgtm_ptr[] = {
|
||||
};
|
||||
size_t lgtm_len = 20;
|
||||
|
||||
#define WORK_BUFFER_SIZE (32768 + 512)
|
||||
uint8_t work_buffer[WORK_BUFFER_SIZE];
|
||||
|
||||
// ignore_return_value suppresses errors from -Wall -Werror.
|
||||
static void ignore_return_value(int ignored) {}
|
||||
|
||||
@@ -89,8 +92,11 @@ static const char* decode() {
|
||||
free(dec);
|
||||
return status;
|
||||
}
|
||||
status =
|
||||
wuffs_deflate__decoder__decode_io_writer(dec, dst_writer, src_reader);
|
||||
status = wuffs_deflate__decoder__decode_io_writer(dec, dst_writer, src_reader,
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = work_buffer,
|
||||
.len = WORK_BUFFER_SIZE,
|
||||
}));
|
||||
if (status) {
|
||||
free(dec);
|
||||
return status;
|
||||
|
||||
+8
-1
@@ -69,8 +69,11 @@ for a C compiler $CC, such as clang or gcc.
|
||||
#define SRC_BUFFER_SIZE (128 * 1024)
|
||||
#endif
|
||||
|
||||
#define WORK_BUFFER_SIZE (32768 + 512)
|
||||
|
||||
uint8_t dst_buffer[DST_BUFFER_SIZE];
|
||||
uint8_t src_buffer[SRC_BUFFER_SIZE];
|
||||
uint8_t work_buffer[WORK_BUFFER_SIZE];
|
||||
|
||||
// ignore_return_value suppresses errors from -Wall -Werror.
|
||||
static void ignore_return_value(int ignored) {}
|
||||
@@ -114,7 +117,11 @@ static const char* decode() {
|
||||
while (true) {
|
||||
status = wuffs_gzip__decoder__decode_io_writer(
|
||||
&dec, wuffs_base__io_buffer__writer(&dst),
|
||||
wuffs_base__io_buffer__reader(&src));
|
||||
wuffs_base__io_buffer__reader(&src),
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = work_buffer,
|
||||
.len = WORK_BUFFER_SIZE,
|
||||
}));
|
||||
|
||||
if (dst.meta.wi) {
|
||||
// TODO: handle EINTR and other write errors; see "man 2 write".
|
||||
|
||||
Reference in new issue
Block a user