From eb9a4b9034453ae3093d678a6f3898303dc5a5a0 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 12 Jun 2023 18:32:12 +0200 Subject: 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 --- lib/tar/test/tar_write_simple.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/tar/test/tar_write_simple.c') 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; } -- cgit v1.2.3