aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/common/src/data_reader_dump.c4
-rw-r--r--lib/io/src/get_line.c4
-rw-r--r--lib/io/src/istream.c14
-rw-r--r--lib/io/src/xfrm/istream.c6
-rw-r--r--lib/io/src/xfrm/ostream.c4
-rw-r--r--lib/io/test/istream_mem.c6
-rw-r--r--lib/io/test/sparse_fb.c2
-rw-r--r--lib/io/test/xfrm.c4
-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
11 files changed, 36 insertions, 35 deletions
diff --git a/lib/common/src/data_reader_dump.c b/lib/common/src/data_reader_dump.c
index 7902c25..29043f8 100644
--- a/lib/common/src/data_reader_dump.c
+++ b/lib/common/src/data_reader_dump.c
@@ -36,7 +36,7 @@ int sqfs_data_reader_dump(const char *name, sqfs_data_reader_t *data,
return -1;
}
- err = ostream_append(fp, chunk, chunk_size);
+ err = fp->append(fp, chunk, chunk_size);
free(chunk);
if (err)
@@ -54,7 +54,7 @@ int sqfs_data_reader_dump(const char *name, sqfs_data_reader_t *data,
return -1;
}
- err = ostream_append(fp, chunk, chunk_size);
+ err = fp->append(fp, chunk, chunk_size);
free(chunk);
if (err)
diff --git a/lib/io/src/get_line.c b/lib/io/src/get_line.c
index 4dc221a..7ebce0e 100644
--- a/lib/io/src/get_line.c
+++ b/lib/io/src/get_line.c
@@ -50,7 +50,7 @@ int istream_get_line(istream_t *strm, char **out,
const sqfs_u8 *ptr;
int ret;
- ret = istream_get_buffered_data(strm, &ptr, &avail, 0);
+ ret = strm->get_buffered_data(strm, &ptr, &avail, 0);
if (ret < 0)
goto fail_free;
if (ret > 0) {
@@ -85,7 +85,7 @@ int istream_get_line(istream_t *strm, char **out,
line_len += count;
line[line_len] = '\0';
- istream_advance_buffer(strm, i);
+ strm->advance_buffer(strm, i);
if (have_line) {
if (line_len > 0 && line[line_len - 1] == '\r')
diff --git a/lib/io/src/istream.c b/lib/io/src/istream.c
index 9340dd6..473f1af 100644
--- a/lib/io/src/istream.c
+++ b/lib/io/src/istream.c
@@ -19,7 +19,7 @@ sqfs_s32 istream_read(istream_t *strm, void *data, size_t size)
size_t diff;
int ret;
- ret = istream_get_buffered_data(strm, &ptr, &diff, size);
+ ret = strm->get_buffered_data(strm, &ptr, &diff, size);
if (ret > 0)
break;
if (ret < 0)
@@ -29,7 +29,7 @@ sqfs_s32 istream_read(istream_t *strm, void *data, size_t size)
diff = size;
memcpy(data, ptr, diff);
- istream_advance_buffer(strm, diff);
+ strm->advance_buffer(strm, diff);
data = (char *)data + diff;
size -= diff;
total += diff;
@@ -45,7 +45,7 @@ int istream_skip(istream_t *strm, sqfs_u64 size)
size_t diff;
int ret;
- ret = istream_get_buffered_data(strm, &ptr, &diff, size);
+ ret = strm->get_buffered_data(strm, &ptr, &diff, size);
if (ret < 0)
return ret;
if (ret > 0) {
@@ -58,7 +58,7 @@ int istream_skip(istream_t *strm, sqfs_u64 size)
diff = size;
size -= diff;
- istream_advance_buffer(strm, diff);
+ strm->advance_buffer(strm, diff);
}
return 0;
@@ -76,7 +76,7 @@ sqfs_s32 istream_splice(istream_t *in, ostream_t *out, sqfs_u32 size)
size_t diff;
int ret;
- ret = istream_get_buffered_data(in, &ptr, &diff, size);
+ ret = in->get_buffered_data(in, &ptr, &diff, size);
if (ret < 0)
return ret;
if (ret > 0)
@@ -85,12 +85,12 @@ sqfs_s32 istream_splice(istream_t *in, ostream_t *out, sqfs_u32 size)
if (diff > size)
diff = size;
- if (ostream_append(out, ptr, diff))
+ if (out->append(out, ptr, diff))
return -1;
total += diff;
size -= diff;
- istream_advance_buffer(in, diff);
+ in->advance_buffer(in, diff);
}
return total;
diff --git a/lib/io/src/xfrm/istream.c b/lib/io/src/xfrm/istream.c
index c9bc41a..632409c 100644
--- a/lib/io/src/xfrm/istream.c
+++ b/lib/io/src/xfrm/istream.c
@@ -38,8 +38,8 @@ static int precache(istream_t *base)
const sqfs_u8 *ptr;
size_t avail;
- ret = istream_get_buffered_data(xfrm->wrapped, &ptr, &avail,
- sizeof(xfrm->uncompressed));
+ ret = xfrm->wrapped->get_buffered_data(xfrm->wrapped, &ptr,
+ &avail, BUFSZ);
if (ret < 0)
return ret;
if (ret > 0)
@@ -58,7 +58,7 @@ static int precache(istream_t *base)
}
xfrm->buffer_used = out_off;
- istream_advance_buffer(xfrm->wrapped, in_off);
+ xfrm->wrapped->advance_buffer(xfrm->wrapped, in_off);
if (ret == XFRM_STREAM_BUFFER_FULL || out_off >= BUFSZ)
break;
diff --git a/lib/io/src/xfrm/ostream.c b/lib/io/src/xfrm/ostream.c
index bd94515..79ed49a 100644
--- a/lib/io/src/xfrm/ostream.c
+++ b/lib/io/src/xfrm/ostream.c
@@ -42,7 +42,7 @@ static int flush_inbuf(ostream_xfrm_t *xfrm, bool finish)
return -1;
}
- if (ostream_append(xfrm->wrapped, xfrm->outbuf, off_out))
+ if (xfrm->wrapped->append(xfrm->wrapped, xfrm->outbuf, off_out))
return -1;
off_out = 0;
@@ -52,7 +52,7 @@ static int flush_inbuf(ostream_xfrm_t *xfrm, bool finish)
}
if (off_out > 0) {
- if (ostream_append(xfrm->wrapped, xfrm->outbuf, off_out))
+ if (xfrm->wrapped->append(xfrm->wrapped, xfrm->outbuf, off_out))
return -1;
}
diff --git a/lib/io/test/istream_mem.c b/lib/io/test/istream_mem.c
index a486899..ca5146c 100644
--- a/lib/io/test/istream_mem.c
+++ b/lib/io/test/istream_mem.c
@@ -45,10 +45,10 @@ int main(int argc, char **argv)
TEST_NOT_NULL(in);
TEST_EQUAL_UI(((sqfs_object_t *)in)->refcount, 1);
- TEST_STR_EQUAL(istream_get_filename(in), "memstream.txt");
+ TEST_STR_EQUAL(in->get_filename(in), "memstream.txt");
for (i = 0; i < end2; i += diff) {
- ret = istream_get_buffered_data(in, &ptr, &size, 61);
+ ret = in->get_buffered_data(in, &ptr, &size, 61);
TEST_EQUAL_I(ret, 0);
if ((end2 - i) >= 61) {
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
diff = eat_all ? size : (size / 2);
eat_all = !eat_all;
- istream_advance_buffer(in, diff);
+ in->advance_buffer(in, diff);
}
sqfs_drop(in);
diff --git a/lib/io/test/sparse_fb.c b/lib/io/test/sparse_fb.c
index fa4b840..5ee6004 100644
--- a/lib/io/test/sparse_fb.c
+++ b/lib/io/test/sparse_fb.c
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
ret = ostream_append_sparse(&dummy, ref);
TEST_EQUAL_I(ret, 0);
- ret = ostream_flush(&dummy);
+ ret = dummy.flush(&dummy);
TEST_EQUAL_I(ret, 0);
TEST_EQUAL_UI(ref, total);
diff --git a/lib/io/test/xfrm.c b/lib/io/test/xfrm.c
index 323987c..c2e450c 100644
--- a/lib/io/test/xfrm.c
+++ b/lib/io/test/xfrm.c
@@ -469,11 +469,11 @@ static void run_pack_test(void)
TEST_EQUAL_UI(((sqfs_object_t *)&mem_ostream)->refcount, 2);
for (i = 0; i < (sizeof(orig) - 1); ++i) {
- ret = ostream_append(ostream, orig + i, 1);
+ ret = ostream->append(ostream, orig + i, 1);
TEST_EQUAL_I(ret, 0);
}
- ret = ostream_flush(ostream);
+ ret = ostream->flush(ostream);
TEST_EQUAL_I(ret, 0);
TEST_ASSERT(mo_flushed);
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);