diff options
Diffstat (limited to 'lib')
29 files changed, 85 insertions, 75 deletions
diff --git a/lib/io/Makemodule.am b/lib/io/Makemodule.am index badaa99..9e442be 100644 --- a/lib/io/Makemodule.am +++ b/lib/io/Makemodule.am @@ -1,7 +1,7 @@ -libio_a_SOURCES = include/io/istream.h include/io/ostream.h include/io/xfrm.h \ +libio_a_SOURCES = include/io/istream.h include/io/xfrm.h \ include/io/file.h include/io/std.h include/io/dir_entry.h \ include/io/dir_iterator.h include/io/mem.h lib/io/src/internal.h \ - lib/io/src/istream.c lib/io/src/get_line.c lib/io/src/xfrm/ostream.c \ + lib/io/src/get_line.c lib/io/src/xfrm/ostream.c \ lib/io/src/xfrm/istream.c lib/io/src/dir_tree_iterator.c \ lib/io/src/dir_entry.c lib/io/src/mem.c libio_a_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) $(XZ_CFLAGS) @@ -18,8 +18,7 @@ endif noinst_LIBRARIES += libio.a -LIBIO_TESTS = test_istream_mem test_get_line test_istream_read \ - test_istream_skip test_stream_splice test_dir_iterator \ +LIBIO_TESTS = test_istream_mem test_get_line test_dir_iterator \ test_dir_tree_iterator test_dir_tree_iterator2 test_dir_tree_iterator3 test_istream_mem_SOURCES = lib/io/test/istream_mem.c @@ -30,15 +29,6 @@ test_get_line_SOURCES = lib/io/test/get_line.c test_get_line_LDADD = libio.a libcompat.a test_get_line_CPPFLAGS = $(AM_CPPFLAGS) -test_istream_read_SOURCES = lib/io/test/istream_read.c -test_istream_read_LDADD = libio.a libutil.a libcompat.a - -test_istream_skip_SOURCES = lib/io/test/istream_skip.c -test_istream_skip_LDADD = libio.a libutil.a libcompat.a - -test_stream_splice_SOURCES = lib/io/test/stream_splice.c -test_stream_splice_LDADD = libio.a libutil.a libcompat.a - test_dir_iterator_SOURCES = lib/io/test/dir_iterator.c test_dir_iterator_LDADD = libio.a libutil.a libcompat.a test_dir_iterator_CPPFLAGS = $(AM_CPPFLAGS) @@ -61,7 +51,7 @@ test_dir_tree_iterator3_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/io/test/testdir if WITH_XZ test_io_xfrm_xz_SOURCES = lib/io/test/xfrm.c -test_io_xfrm_xz_LDADD = libio.a libxfrm.a libcompat.a $(XZ_LIBS) +test_io_xfrm_xz_LDADD = libsquashfs.la libio.a libxfrm.a libcompat.a $(XZ_LIBS) test_io_xfrm_xz_CPPFLAGS = $(AM_CPPFLAGS) -DDO_XZ=1 LIBIO_TESTS += test_io_xfrm_xz @@ -69,7 +59,8 @@ endif if WITH_BZIP2 test_io_xfrm_bzip2_SOURCES = lib/io/test/xfrm.c -test_io_xfrm_bzip2_LDADD = libio.a libxfrm.a libcompat.a $(BZIP2_LIBS) +test_io_xfrm_bzip2_LDADD = libsquashfs.la libio.a libxfrm.a \ + libcompat.a $(BZIP2_LIBS) test_io_xfrm_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DDO_BZIP2=1 LIBIO_TESTS += test_io_xfrm_bzip2 @@ -77,7 +68,8 @@ endif if WITH_GZIP test_io_xfrm_gzip_SOURCES = lib/io/test/xfrm.c -test_io_xfrm_gzip_LDADD = libio.a libxfrm.a libcompat.a $(ZLIB_LIBS) +test_io_xfrm_gzip_LDADD = libsquashfs.la libio.a libxfrm.a \ + libcompat.a $(ZLIB_LIBS) test_io_xfrm_gzip_CPPFLAGS = $(AM_CPPFLAGS) -DDO_GZIP=1 LIBIO_TESTS += test_io_xfrm_gzip @@ -86,7 +78,8 @@ endif if WITH_ZSTD if HAVE_ZSTD_STREAM test_io_xfrm_zstd_SOURCES = lib/io/test/xfrm.c -test_io_xfrm_zstd_LDADD = libio.a libxfrm.a libcompat.a $(ZSTD_LIBS) +test_io_xfrm_zstd_LDADD = libsquashfs.la libio.a libxfrm.a \ + libcompat.a $(ZSTD_LIBS) test_io_xfrm_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DDO_ZSTD=1 LIBIO_TESTS += test_io_xfrm_zstd diff --git a/lib/io/src/get_line.c b/lib/io/src/get_line.c index 9ab4928..ad37be6 100644 --- a/lib/io/src/get_line.c +++ b/lib/io/src/get_line.c @@ -5,6 +5,7 @@ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ #include "internal.h" +#include "sqfs/io.h" static void ltrim(char *buffer) { diff --git a/lib/io/src/internal.h b/lib/io/src/internal.h index 1e51012..e010727 100644 --- a/lib/io/src/internal.h +++ b/lib/io/src/internal.h @@ -10,7 +10,6 @@ #include "config.h" #include "compat.h" #include "io/istream.h" -#include "io/ostream.h" #include "io/file.h" #include "io/xfrm.h" #include "io/std.h" diff --git a/lib/io/src/mem.c b/lib/io/src/mem.c index 435a169..7150d1f 100644 --- a/lib/io/src/mem.c +++ b/lib/io/src/mem.c @@ -7,6 +7,7 @@ #include "config.h" #include "io/mem.h" #include "compat.h" +#include "sqfs/io.h" #include <stdlib.h> #include <string.h> diff --git a/lib/io/src/unix/istream.c b/lib/io/src/unix/istream.c index fc76bab..39d570f 100644 --- a/lib/io/src/unix/istream.c +++ b/lib/io/src/unix/istream.c @@ -5,6 +5,7 @@ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ #include "../internal.h" +#include "sqfs/io.h" typedef struct { sqfs_istream_t base; diff --git a/lib/io/src/win32/istream.c b/lib/io/src/win32/istream.c index 223b20d..e6cb266 100644 --- a/lib/io/src/win32/istream.c +++ b/lib/io/src/win32/istream.c @@ -5,6 +5,7 @@ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ #include "../internal.h" +#include "sqfs/io.h" #define WIN32_LEAN_AND_MEAN #include <windows.h> diff --git a/lib/io/src/xfrm/istream.c b/lib/io/src/xfrm/istream.c index 5c23d28..c499f6c 100644 --- a/lib/io/src/xfrm/istream.c +++ b/lib/io/src/xfrm/istream.c @@ -5,6 +5,7 @@ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ #include "../internal.h" +#include "sqfs/io.h" typedef struct istream_xfrm_t { sqfs_istream_t base; diff --git a/lib/io/src/xfrm/ostream.c b/lib/io/src/xfrm/ostream.c index 81c19dd..4c77f42 100644 --- a/lib/io/src/xfrm/ostream.c +++ b/lib/io/src/xfrm/ostream.c @@ -5,6 +5,7 @@ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ #include "../internal.h" +#include "sqfs/io.h" typedef struct ostream_xfrm_t { sqfs_ostream_t base; diff --git a/lib/io/test/istream_mem.c b/lib/io/test/istream_mem.c index f364fd3..d5e0c2c 100644 --- a/lib/io/test/istream_mem.c +++ b/lib/io/test/istream_mem.c @@ -8,6 +8,7 @@ #include "util/test.h" #include "io/mem.h" +#include "sqfs/io.h" static const size_t end0 = 449; /* region 1: filled with 'A' */ static const size_t end1 = 521; /* region 2: filled with 'B' */ diff --git a/lib/io/test/xfrm.c b/lib/io/test/xfrm.c index 1b48e6f..b871610 100644 --- a/lib/io/test/xfrm.c +++ b/lib/io/test/xfrm.c @@ -7,6 +7,7 @@ #include "xfrm/compress.h" #include "xfrm/stream.h" #include "util/test.h" +#include "sqfs/io.h" #include "io/xfrm.h" #include "io/mem.h" @@ -430,15 +431,15 @@ static void run_unpack_test(const void *blob, size_t size) TEST_EQUAL_UI(((sqfs_object_t *)mem_istream)->refcount, 2); for (i = 0; i < (sizeof(orig) - 1); ++i) { - ret = istream_read(istream, &c, 1); + ret = sqfs_istream_read(istream, &c, 1); TEST_EQUAL_I(ret, 1); TEST_EQUAL_I(c, orig[i]); } - ret = istream_read(istream, &c, 1); + ret = sqfs_istream_read(istream, &c, 1); TEST_EQUAL_I(ret, 0); - ret = istream_read(istream, &c, 1); + ret = sqfs_istream_read(istream, &c, 1); TEST_EQUAL_I(ret, 0); sqfs_drop(istream); diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am index d54134c..2727b11 100644 --- a/lib/sqfs/Makemodule.am +++ b/lib/sqfs/Makemodule.am @@ -30,7 +30,7 @@ libsquashfs_la_SOURCES = $(LIBSQFS_HEARDS) lib/sqfs/src/id_table.c \ lib/sqfs/src/block_processor/block_processor.c \ lib/sqfs/src/block_processor/backend.c \ lib/sqfs/src/frag_table.c lib/sqfs/src/block_writer.c \ - lib/sqfs/src/misc.c + lib/sqfs/src/misc.c lib/sqfs/src/istream.c libsquashfs_la_CPPFLAGS = $(AM_CPPFLAGS) libsquashfs_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBSQUASHFS_SO_VERSION) libsquashfs_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS) @@ -122,9 +122,18 @@ xattr_benchmark_LDADD = libcommon.a libsquashfs.la libcompat.a test_get_node_path_SOURCES = lib/sqfs/test/get_node_path.c test_get_node_path_LDADD = libcommon.a libsquashfs.la libcompat.a -LIBSQFS_TESTS = \ - test_abi test_xattr test_table test_xattr_writer test_get_node_path +test_istream_read_SOURCES = lib/sqfs/test/istream_read.c +test_istream_read_LDADD = libio.a libsquashfs.la libutil.a libcompat.a + +test_istream_skip_SOURCES = lib/sqfs/test/istream_skip.c +test_istream_skip_LDADD = libsquashfs.la libio.a libutil.a libcompat.a +test_stream_splice_SOURCES = lib/sqfs/test/stream_splice.c +test_stream_splice_LDADD = libsquashfs.la libio.a libutil.a libcompat.a + +LIBSQFS_TESTS = \ + test_abi test_xattr test_table test_xattr_writer test_get_node_path \ + test_istream_read test_istream_skip test_stream_splice noinst_PROGRAMS += xattr_benchmark check_PROGRAMS += $(LIBSQFS_TESTS) diff --git a/lib/io/src/istream.c b/lib/sqfs/src/istream.c index 6fbc67b..3d89461 100644 --- a/lib/io/src/istream.c +++ b/lib/sqfs/src/istream.c @@ -1,13 +1,17 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* SPDX-License-Identifier: LGPL-3.0-or-later */ /* * istream.c * * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ -#include "internal.h" +#define SQFS_BUILDING_DLL +#include "config.h" +#include "sqfs/io.h" -sqfs_s32 istream_read(sqfs_istream_t *strm, void *data, size_t size) +#include <string.h> + +sqfs_s32 sqfs_istream_read(sqfs_istream_t *strm, void *data, size_t size) { sqfs_s32 total = 0; @@ -38,7 +42,7 @@ sqfs_s32 istream_read(sqfs_istream_t *strm, void *data, size_t size) return total; } -int istream_skip(sqfs_istream_t *strm, sqfs_u64 size) +int sqfs_istream_skip(sqfs_istream_t *strm, sqfs_u64 size) { while (size > 0) { const sqfs_u8 *ptr; @@ -48,11 +52,8 @@ int istream_skip(sqfs_istream_t *strm, sqfs_u64 size) ret = strm->get_buffered_data(strm, &ptr, &diff, size); if (ret < 0) return ret; - if (ret > 0) { - fprintf(stderr, "%s: unexpected end-of-file\n", - strm->get_filename(strm)); - return -1; - } + if (ret > 0) + break; if ((sqfs_u64)diff > size) diff = size; @@ -64,7 +65,8 @@ int istream_skip(sqfs_istream_t *strm, sqfs_u64 size) return 0; } -sqfs_s32 istream_splice(sqfs_istream_t *in, sqfs_ostream_t *out, sqfs_u32 size) +sqfs_s32 sqfs_istream_splice(sqfs_istream_t *in, sqfs_ostream_t *out, + sqfs_u32 size) { sqfs_s32 total = 0; @@ -85,8 +87,9 @@ sqfs_s32 istream_splice(sqfs_istream_t *in, sqfs_ostream_t *out, sqfs_u32 size) if (diff > size) diff = size; - if (out->append(out, ptr, diff)) - return -1; + ret = out->append(out, ptr, diff); + if (ret) + return ret; total += diff; size -= diff; diff --git a/lib/io/test/istream_read.c b/lib/sqfs/test/istream_read.c index 66fec4b..f8facea 100644 --- a/lib/io/test/istream_read.c +++ b/lib/sqfs/test/istream_read.c @@ -6,8 +6,8 @@ */ #include "config.h" -#include "io/istream.h" #include "util/test.h" +#include "sqfs/io.h" #include "io/mem.h" static const sqfs_u64 end0 = 449; /* region 1: filled with 'A' */ @@ -50,7 +50,7 @@ int main(int argc, char **argv) if (read_diff > sizeof(read_buffer)) read_diff = sizeof(read_buffer); - int ret = istream_read(dummy, read_buffer, read_diff); + int ret = sqfs_istream_read(dummy, read_buffer, read_diff); TEST_ASSERT(ret > 0); TEST_ASSERT((size_t)ret <= read_diff); @@ -68,7 +68,7 @@ int main(int argc, char **argv) if (read_diff > sizeof(read_buffer)) read_diff = sizeof(read_buffer); - int ret = istream_read(dummy, read_buffer, read_diff); + int ret = sqfs_istream_read(dummy, read_buffer, read_diff); TEST_ASSERT(ret > 0); TEST_ASSERT((size_t)ret <= read_diff); @@ -83,7 +83,7 @@ int main(int argc, char **argv) for (;;) { size_t read_diff = sizeof(read_buffer); - int ret = istream_read(dummy, read_buffer, read_diff); + int ret = sqfs_istream_read(dummy, read_buffer, read_diff); TEST_ASSERT(ret >= 0); TEST_ASSERT((size_t)ret <= read_diff); diff --git a/lib/io/test/istream_skip.c b/lib/sqfs/test/istream_skip.c index 0fc3e11..d8a81f2 100644 --- a/lib/io/test/istream_skip.c +++ b/lib/sqfs/test/istream_skip.c @@ -6,7 +6,7 @@ */ #include "config.h" -#include "io/istream.h" +#include "sqfs/io.h" #include "util/test.h" #include "io/mem.h" @@ -50,7 +50,7 @@ int main(int argc, char **argv) if (read_diff > sizeof(read_buffer)) read_diff = sizeof(read_buffer); - int ret = istream_read(dummy, read_buffer, read_diff); + int ret = sqfs_istream_read(dummy, read_buffer, read_diff); TEST_ASSERT(ret > 0); TEST_ASSERT((size_t)ret <= read_diff); @@ -63,7 +63,7 @@ int main(int argc, char **argv) /* region 2 */ { - int ret = istream_skip(dummy, end2 - end1); + int ret = sqfs_istream_skip(dummy, end2 - end1); TEST_EQUAL_I(ret, 0); read_off += (end2 - end1); } @@ -72,7 +72,7 @@ int main(int argc, char **argv) for (;;) { size_t read_diff = sizeof(read_buffer); - int ret = istream_read(dummy, read_buffer, read_diff); + int ret = sqfs_istream_read(dummy, read_buffer, read_diff); TEST_ASSERT(ret >= 0); TEST_ASSERT((size_t)ret <= read_diff); diff --git a/lib/io/test/stream_splice.c b/lib/sqfs/test/stream_splice.c index a9edd76..6f40d1f 100644 --- a/lib/io/test/stream_splice.c +++ b/lib/sqfs/test/stream_splice.c @@ -6,10 +6,9 @@ */ #include "config.h" -#include "io/istream.h" -#include "io/ostream.h" #include "io/mem.h" #include "util/test.h" +#include "sqfs/io.h" static const sqfs_u64 end0 = 449; /* region 1: filled with 'A' */ static const sqfs_u64 end1 = 521; /* region 2: filled with 'B' */ @@ -43,7 +42,6 @@ static sqfs_ostream_t out = { out_append, NULL, NULL, - NULL, }; static int out_append(sqfs_ostream_t *strm, const void *data, size_t size) @@ -79,7 +77,7 @@ int main(int argc, char **argv) TEST_NOT_NULL(in); for (;;) { - ret = istream_splice(in, &out, 211); + ret = sqfs_istream_splice(in, &out, 211); TEST_ASSERT(ret >= 0); if (ret == 0) diff --git a/lib/tar/src/iterator.c b/lib/tar/src/iterator.c index 5920b46..93c931c 100644 --- a/lib/tar/src/iterator.c +++ b/lib/tar/src/iterator.c @@ -177,13 +177,13 @@ static int it_next(dir_iterator_t *it, dir_entry_t **out) return tar->state; retry: if (tar->record_size > 0) { - ret = istream_skip(tar->stream, tar->record_size); + ret = sqfs_istream_skip(tar->stream, tar->record_size); if (ret) goto fail; } if (tar->padding > 0) { - ret = istream_skip(tar->stream, tar->padding); + ret = sqfs_istream_skip(tar->stream, tar->padding); if (ret) goto fail; } diff --git a/lib/tar/src/read_header.c b/lib/tar/src/read_header.c index 3117d8a..16fc9d7 100644 --- a/lib/tar/src/read_header.c +++ b/lib/tar/src/read_header.c @@ -175,7 +175,7 @@ int read_header(sqfs_istream_t *fp, tar_header_decoded_t *out) memset(out, 0, sizeof(*out)); for (;;) { - ret = istream_read(fp, &hdr, sizeof(hdr)); + ret = sqfs_istream_read(fp, &hdr, sizeof(hdr)); if (ret < 0) goto fail; @@ -226,7 +226,7 @@ int read_header(sqfs_istream_t *fp, tar_header_decoded_t *out) goto fail; if (pax_size % 512) pax_size += 512 - (pax_size % 512); - istream_skip(fp, pax_size); + sqfs_istream_skip(fp, pax_size); continue; case TAR_TYPE_PAX: clear_header(out); diff --git a/lib/tar/src/read_sparse_map_new.c b/lib/tar/src/read_sparse_map_new.c index a1f37fd..4e317a8 100644 --- a/lib/tar/src/read_sparse_map_new.c +++ b/lib/tar/src/read_sparse_map_new.c @@ -41,7 +41,7 @@ sparse_map_t *read_gnu_new_sparse(sqfs_istream_t *fp, tar_header_decoded_t *out) if (out->record_size < 512) goto fail_format; - ret = istream_read(fp, buffer, 512); + ret = sqfs_istream_read(fp, buffer, 512); if (ret < 0) goto fail; @@ -68,7 +68,7 @@ sparse_map_t *read_gnu_new_sparse(sqfs_istream_t *fp, tar_header_decoded_t *out) if (out->record_size < 512) goto fail_format; - ret = istream_read(fp, buffer + 512, 512); + ret = sqfs_istream_read(fp, buffer + 512, 512); if (ret < 0) goto fail; diff --git a/lib/tar/src/read_sparse_map_old.c b/lib/tar/src/read_sparse_map_old.c index 832329b..1794073 100644 --- a/lib/tar/src/read_sparse_map_old.c +++ b/lib/tar/src/read_sparse_map_old.c @@ -59,7 +59,7 @@ sparse_map_t *read_gnu_old_sparse(sqfs_istream_t *fp, tar_header_t *hdr) return list; do { - ret = istream_read(fp, &sph, sizeof(sph)); + ret = sqfs_istream_read(fp, &sph, sizeof(sph)); if (ret < 0) goto fail; diff --git a/lib/tar/src/record_to_memory.c b/lib/tar/src/record_to_memory.c index 1bd31aa..597d6f8 100644 --- a/lib/tar/src/record_to_memory.c +++ b/lib/tar/src/record_to_memory.c @@ -18,7 +18,7 @@ char *record_to_memory(sqfs_istream_t *fp, size_t size) if (buffer == NULL) goto fail_errno; - ret = istream_read(fp, buffer, size); + ret = sqfs_istream_read(fp, buffer, size); if (ret < 0) goto fail; @@ -28,7 +28,7 @@ char *record_to_memory(sqfs_istream_t *fp, size_t size) } if (size % 512) { - if (istream_skip(fp, 512 - (size % 512))) + if (sqfs_istream_skip(fp, 512 - (size % 512))) goto fail; } diff --git a/lib/tar/test/tar_fuzz.c b/lib/tar/test/tar_fuzz.c index bdea98e..92c0952 100644 --- a/lib/tar/test/tar_fuzz.c +++ b/lib/tar/test/tar_fuzz.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) if (ret < 0) goto fail; - ret = istream_skip(fp, hdr.record_size); + ret = sqfs_istream_skip(fp, hdr.record_size); clear_header(&hdr); if (ret < 0) diff --git a/lib/tar/test/tar_iterator.c b/lib/tar/test/tar_iterator.c index 25e1389..f51ecd6 100644 --- a/lib/tar/test/tar_iterator.c +++ b/lib/tar/test/tar_iterator.c @@ -83,12 +83,12 @@ int main(int argc, char **argv) TEST_EQUAL_UI(((sqfs_object_t *)ti)->refcount, 1); /* read the data from the stream */ - ret = istream_read(ti, buffer, sizeof(buffer)); + ret = sqfs_istream_read(ti, buffer, sizeof(buffer)); TEST_EQUAL_I(ret, 5); buffer[5] = '\0'; TEST_STR_EQUAL(buffer, "test\n"); - ret = istream_read(ti, buffer, sizeof(buffer)); + ret = sqfs_istream_read(ti, buffer, sizeof(buffer)); TEST_EQUAL_I(ret, 0); sqfs_drop(ti); diff --git a/lib/tar/test/tar_iterator2.c b/lib/tar/test/tar_iterator2.c index 6f472ae..7483e81 100644 --- a/lib/tar/test/tar_iterator2.c +++ b/lib/tar/test/tar_iterator2.c @@ -76,7 +76,7 @@ int main(int argc, char **argv) offset = 0; for (;;) { - ret = istream_read(ti, buffer, sizeof(buffer)); + ret = sqfs_istream_read(ti, buffer, sizeof(buffer)); TEST_ASSERT(ret >= 0); if (ret == 0) diff --git a/lib/tar/test/tar_iterator3.c b/lib/tar/test/tar_iterator3.c index 39e7b42..11c2fd2 100644 --- a/lib/tar/test/tar_iterator3.c +++ b/lib/tar/test/tar_iterator3.c @@ -86,10 +86,10 @@ int main(int argc, char **argv) TEST_EQUAL_I(ret, 0); TEST_NOT_NULL(ti); - TEST_ASSERT(istream_read(ti, buffer, sizeof(buffer)) == 5); + TEST_ASSERT(sqfs_istream_read(ti, buffer, sizeof(buffer)) == 5); buffer[5] = '\0'; TEST_STR_EQUAL(buffer, "test\n"); - TEST_ASSERT(istream_read(ti, buffer, sizeof(buffer)) == 0); + TEST_ASSERT(sqfs_istream_read(ti, buffer, sizeof(buffer)) == 0); ti = sqfs_drop(ti); ret = it->next(it, &ent); @@ -105,10 +105,10 @@ int main(int argc, char **argv) TEST_EQUAL_I(ret, 0); TEST_NOT_NULL(ti); - TEST_ASSERT(istream_read(ti, buffer, sizeof(buffer)) == 5); + TEST_ASSERT(sqfs_istream_read(ti, buffer, sizeof(buffer)) == 5); buffer[5] = '\0'; TEST_STR_EQUAL(buffer, "test\n"); - TEST_ASSERT(istream_read(ti, buffer, sizeof(buffer)) == 0); + TEST_ASSERT(sqfs_istream_read(ti, buffer, sizeof(buffer)) == 0); ti = sqfs_drop(ti); /* "deep" directory hierarchy containg a hard link */ diff --git a/lib/tar/test/tar_simple.c b/lib/tar/test/tar_simple.c index 656e59b..a666eb5 100644 --- a/lib/tar/test/tar_simple.c +++ b/lib/tar/test/tar_simple.c @@ -55,7 +55,7 @@ int main(int argc, char **argv) TEST_STR_EQUAL(hdr.name, fname); TEST_ASSERT(!hdr.unknown_record); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); + TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5); buffer[5] = '\0'; TEST_STR_EQUAL(buffer, "test\n"); clear_header(&hdr); diff --git a/lib/tar/test/tar_target_filled.c b/lib/tar/test/tar_target_filled.c index 815728a..4f061c0 100644 --- a/lib/tar/test/tar_target_filled.c +++ b/lib/tar/test/tar_target_filled.c @@ -50,10 +50,10 @@ int main(int argc, char **argv) "20_characters_here03/20_characters_here04/" "errored_file_tst"); TEST_EQUAL_UI(hdr.actual_size, 5); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); + TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5); buffer[5] = '\0'; TEST_STR_EQUAL(buffer, "test\n"); - TEST_ASSERT(istream_skip(fp, 512 - 5) == 0); + TEST_ASSERT(sqfs_istream_skip(fp, 512 - 5) == 0); clear_header(&hdr); TEST_ASSERT(read_header(fp, &hdr) == 0); @@ -62,10 +62,10 @@ int main(int argc, char **argv) "20_characters_here03/20_characters_here04/" "some_test_file"); TEST_EQUAL_UI(hdr.actual_size, 5); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); + TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5); buffer[5] = '\0'; TEST_STR_EQUAL(buffer, "test\n"); - TEST_ASSERT(istream_skip(fp, 512 - 5) == 0); + TEST_ASSERT(sqfs_istream_skip(fp, 512 - 5) == 0); clear_header(&hdr); /* "deep" directory hierarchy containg a hard link */ diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c index 98ac25b..ca8d1e5 100644 --- a/lib/tar/test/tar_write_simple.c +++ b/lib/tar/test/tar_write_simple.c @@ -6,7 +6,7 @@ */ #include "config.h" #include "tar/tar.h" -#include "io/ostream.h" +#include "sqfs/io.h" #include "io/file.h" #include "util/test.h" #include "sqfs/xattr.h" @@ -191,11 +191,11 @@ int main(int argc, char **argv) fp = istream_open_file(STRVALUE(TESTPATH) "/" STRVALUE(TESTFILE)); TEST_NOT_NULL(fp); - ret = istream_read(fp, rd_buffer, sizeof(rd_buffer)); + ret = sqfs_istream_read(fp, rd_buffer, sizeof(rd_buffer)); TEST_ASSERT(ret > 0); TEST_EQUAL_UI(ret, sizeof(rd_buffer)); - ret = istream_read(fp, rd_buffer, sizeof(rd_buffer)); + ret = sqfs_istream_read(fp, rd_buffer, sizeof(rd_buffer)); TEST_EQUAL_I(ret, 0); sqfs_drop(fp); diff --git a/lib/tar/test/tar_xattr.c b/lib/tar/test/tar_xattr.c index 657b73d..26a2cd0 100644 --- a/lib/tar/test/tar_xattr.c +++ b/lib/tar/test/tar_xattr.c @@ -27,7 +27,7 @@ int main(int argc, char **argv) TEST_EQUAL_UI(hdr.mtime, 1543094477); TEST_STR_EQUAL(hdr.name, "input.txt"); TEST_ASSERT(!hdr.unknown_record); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); + TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5); buffer[5] = '\0'; TEST_STR_EQUAL(buffer, "test\n"); diff --git a/lib/tar/test/tar_xattr_bin.c b/lib/tar/test/tar_xattr_bin.c index f897bce..94c8d76 100644 --- a/lib/tar/test/tar_xattr_bin.c +++ b/lib/tar/test/tar_xattr_bin.c @@ -35,7 +35,7 @@ int main(int argc, char **argv) TEST_EQUAL_UI(hdr.mtime, 1543094477); TEST_STR_EQUAL(hdr.name, "input.txt"); TEST_ASSERT(!hdr.unknown_record); - TEST_ASSERT(istream_read(fp, buffer, 5) == 5); + TEST_ASSERT(sqfs_istream_read(fp, buffer, 5) == 5); buffer[5] = '\0'; TEST_STR_EQUAL(buffer, "test\n"); |