aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/src/block_processor
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-12 18:32:12 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 13:38:25 +0200
commiteb9a4b9034453ae3093d678a6f3898303dc5a5a0 (patch)
treecd024b5ff5e1c77400a561adee50522f10fdadcd /lib/sqfs/src/block_processor
parent63bc750fecb00fc5878ca889204fc65510893778 (diff)
libio: remove ostream_append_sparse and fallback implementation
Instead of a separate append-sparse function, simply accept NULL as an input for append. For both Unix and Win32, a fallback needs to be implemented. For XFRM, we can just memset the input buffer to zero, same for the libsquashfs data writer. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/src/block_processor')
-rw-r--r--lib/sqfs/src/block_processor/frontend.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/sqfs/src/block_processor/frontend.c b/lib/sqfs/src/block_processor/frontend.c
index e8a4207..de89913 100644
--- a/lib/sqfs/src/block_processor/frontend.c
+++ b/lib/sqfs/src/block_processor/frontend.c
@@ -114,6 +114,7 @@ int sqfs_block_processor_append(sqfs_block_processor_t *proc, const void *data,
sqfs_block_t *new;
sqfs_u64 filesize;
size_t diff;
+ void *dst;
int err;
if (!proc->begin_called)
@@ -152,12 +153,17 @@ int sqfs_block_processor_append(sqfs_block_processor_t *proc, const void *data,
if (diff > size)
diff = size;
- memcpy(proc->blk_current->data + proc->blk_current->size,
- data, diff);
+ dst = proc->blk_current->data + proc->blk_current->size;
+
+ if (data == NULL) {
+ memset(dst, 0, diff);
+ } else {
+ memcpy(dst, data, diff);
+ data = (const char *)data + diff;
+ }
size -= diff;
proc->blk_current->size += diff;
- data = (const char *)data + diff;
proc->stats.input_bytes_read += diff;
}