aboutsummaryrefslogtreecommitdiff
path: root/lib/tar/test/tar_write_simple.c
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/tar/test/tar_write_simple.c
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/tar/test/tar_write_simple.c')
-rw-r--r--lib/tar/test/tar_write_simple.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c
index 2302307..b34c9c5 100644
--- a/lib/tar/test/tar_write_simple.c
+++ b/lib/tar/test/tar_write_simple.c
@@ -21,7 +21,6 @@ static ostream_t mem_stream = {
{ 1, NULL, NULL },
buffer_append,
NULL,
- NULL,
buffer_get_filename,
};
@@ -33,12 +32,16 @@ static sqfs_u8 rd_buffer[1024 * 10];
static int buffer_append(ostream_t *strm, const void *data, size_t size)
{
TEST_ASSERT(strm == &mem_stream);
- TEST_NOT_NULL(data);
TEST_ASSERT(wr_offset < sizeof(wr_buffer));
TEST_ASSERT(size > 0);
TEST_ASSERT((sizeof(wr_buffer) - wr_offset) >= size);
- memcpy(wr_buffer + wr_offset, data, size);
+ if (data == NULL) {
+ memset(wr_buffer + wr_offset, 0, size);
+ } else {
+ memcpy(wr_buffer + wr_offset, data, size);
+ }
+
wr_offset += size;
return 0;
}