aboutsummaryrefslogtreecommitdiff
path: root/lib/io
diff options
context:
space:
mode:
Diffstat (limited to 'lib/io')
-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
7 files changed, 20 insertions, 20 deletions
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);