aboutsummaryrefslogtreecommitdiff
path: root/lib/tar
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-11 23:27:16 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 13:38:25 +0200
commit63bc750fecb00fc5878ca889204fc65510893778 (patch)
treef3a8280ce30308e6bd86e534df19599587ce5914 /lib/tar
parentd8a01253aba94759aae2bbc78e9103843f28dd78 (diff)
libio: remove single line wrapper functions
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/tar')
-rw-r--r--lib/tar/src/iterator.c11
-rw-r--r--lib/tar/src/write_header.c6
-rw-r--r--lib/tar/test/tar_write_simple.c10
3 files changed, 14 insertions, 13 deletions
diff --git a/lib/tar/src/iterator.c b/lib/tar/src/iterator.c
index 5d44c28..1f26e76 100644
--- a/lib/tar/src/iterator.c
+++ b/lib/tar/src/iterator.c
@@ -118,8 +118,9 @@ static int strm_get_buffered_data(istream_t *strm, const sqfs_u8 **out,
*size = (diff <= sizeof(tar->buffer)) ?
diff : sizeof(tar->buffer);
} else {
- ret = istream_get_buffered_data(tar->parent->stream,
- out, size, diff);
+ ret = tar->parent->stream->
+ get_buffered_data(tar->parent->stream,
+ out, size, diff);
if (ret > 0)
goto fail_borked;
if (ret < 0)
@@ -146,7 +147,7 @@ static void strm_advance_buffer(istream_t *strm, size_t count)
tar_istream_t *tar = (tar_istream_t *)strm;
if (!tar->parent->last_sparse) {
- istream_advance_buffer(tar->parent->stream, count);
+ tar->parent->stream->advance_buffer(tar->parent->stream, count);
tar->parent->record_size -= count;
}
@@ -371,8 +372,8 @@ dir_iterator_t *tar_open_stream(istream_t *strm)
it->read_xattr = it_read_xattr;
/* proble if the stream is compressed */
- ret = istream_get_buffered_data(strm, &ptr, &size,
- sizeof(tar_header_t));
+ ret = strm->get_buffered_data(strm, &ptr, &size,
+ sizeof(tar_header_t));
if (ret != 0)
goto out_strm;
diff --git a/lib/tar/src/write_header.c b/lib/tar/src/write_header.c
index 039d1fe..726b15d 100644
--- a/lib/tar/src/write_header.c
+++ b/lib/tar/src/write_header.c
@@ -98,7 +98,7 @@ static int write_header(ostream_t *fp, const struct stat *sb, const char *name,
update_checksum(&hdr);
- return ostream_append(fp, &hdr, sizeof(hdr));
+ return fp->append(fp, &hdr, sizeof(hdr));
}
static int write_ext_header(ostream_t *fp, const struct stat *orig,
@@ -114,7 +114,7 @@ static int write_ext_header(ostream_t *fp, const struct stat *orig,
if (write_header(fp, &sb, name, NULL, type))
return -1;
- if (ostream_append(fp, payload, payload_len))
+ if (fp->append(fp, payload, payload_len))
return -1;
return padd_file(fp, payload_len);
@@ -288,5 +288,5 @@ int write_hard_link(ostream_t *fp, const struct stat *sb, const char *name,
write_number(hdr.devminor, 0, sizeof(hdr.devminor));
update_checksum(&hdr);
- return ostream_append(fp, &hdr, sizeof(hdr));
+ return fp->append(fp, &hdr, sizeof(hdr));
}
diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c
index 8a41c8f..2302307 100644
--- a/lib/tar/test/tar_write_simple.c
+++ b/lib/tar/test/tar_write_simple.c
@@ -138,7 +138,7 @@ int main(int argc, char **argv)
NULL, NULL, 9);
TEST_EQUAL_I(ret, 0);
- ret = ostream_append(&mem_stream, "Hello, World!\n", 14);
+ ret = mem_stream.append(&mem_stream, "Hello, World!\n", 14);
TEST_EQUAL_I(ret, 0);
ret = padd_file(&mem_stream, 14);
TEST_EQUAL_I(ret, 0);
@@ -157,7 +157,7 @@ int main(int argc, char **argv)
TEST_EQUAL_I(ret, 0);
sqfs_xattr_list_free(xattr);
- ret = ostream_append(&mem_stream, ":-)\n", 4);
+ ret = mem_stream.append(&mem_stream, ":-)\n", 4);
TEST_EQUAL_I(ret, 0);
ret = padd_file(&mem_stream, 4);
TEST_EQUAL_I(ret, 0);
@@ -174,9 +174,9 @@ int main(int argc, char **argv)
NULL, NULL, 12);
TEST_EQUAL_I(ret, 0);
- ret = ostream_append(&mem_stream,
- "Annoy people with really long file paths!\n",
- 42);
+ ret = mem_stream.append(&mem_stream,
+ "Annoy people with really long file paths!\n",
+ 42);
TEST_EQUAL_I(ret, 0);
ret = padd_file(&mem_stream, 42);
TEST_EQUAL_I(ret, 0);