aboutsummaryrefslogtreecommitdiff
path: root/lib/io/win32
diff options
context:
space:
mode:
Diffstat (limited to 'lib/io/win32')
-rw-r--r--lib/io/win32/istream.c8
-rw-r--r--lib/io/win32/ostream.c6
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/io/win32/istream.c b/lib/io/win32/istream.c
index b591584..be3d829 100644
--- a/lib/io/win32/istream.c
+++ b/lib/io/win32/istream.c
@@ -77,7 +77,6 @@ static void file_destroy(sqfs_object_t *obj)
istream_t *istream_open_file(const char *path)
{
file_istream_t *file = calloc(1, sizeof(*file));
- sqfs_object_t *obj = (sqfs_object_t *)file;
istream_t *strm = (istream_t *)file;
WCHAR *wpath = NULL;
@@ -86,6 +85,8 @@ istream_t *istream_open_file(const char *path)
return NULL;
}
+ sqfs_object_init(file, file_destroy, NULL);
+
wpath = path_to_windows(path);
if (wpath == NULL)
goto fail_free;
@@ -109,7 +110,6 @@ istream_t *istream_open_file(const char *path)
strm->buffer = file->buffer;
strm->precache = file_precache;
strm->get_filename = file_get_filename;
- obj->destroy = file_destroy;
return strm;
fail_path:
free(file->path);
@@ -122,7 +122,6 @@ fail_free:
istream_t *istream_open_stdin(void)
{
file_istream_t *file = calloc(1, sizeof(*file));
- sqfs_object_t *obj = (sqfs_object_t *)file;
istream_t *strm = (istream_t *)file;
if (file == NULL) {
@@ -130,9 +129,10 @@ istream_t *istream_open_stdin(void)
return NULL;
}
+ sqfs_object_init(file, file_destroy, NULL);
+
strm->buffer = file->buffer;
strm->precache = file_precache;
strm->get_filename = file_get_filename;
- obj->destroy = file_destroy;
return strm;
}
diff --git a/lib/io/win32/ostream.c b/lib/io/win32/ostream.c
index 2bd78c8..0fe04f3 100644
--- a/lib/io/win32/ostream.c
+++ b/lib/io/win32/ostream.c
@@ -135,6 +135,8 @@ ostream_t *ostream_open_file(const char *path, int flags)
return NULL;
}
+ sqfs_object_init(file, file_destroy, NULL);
+
wpath = path_to_windows(path);
if (wpath == NULL)
goto fail_free;
@@ -169,7 +171,6 @@ ostream_t *ostream_open_file(const char *path, int flags)
strm->append = file_append;
strm->flush = file_flush;
strm->get_filename = file_get_filename;
- obj->destroy = file_destroy;
return strm;
fail_path:
free(file->path);
@@ -189,9 +190,10 @@ ostream_t *ostream_open_stdout(void)
return NULL;
}
+ sqfs_object_init(strm, stdout_destroy, NULL);
+
strm->append = stdout_append;
strm->flush = stdout_flush;
strm->get_filename = stdout_get_filename;
- obj->destroy = stdout_destroy;
return strm;
}