Mercurial > audlegacy-plugins
changeset 3098:cdf79f7b0d9e
gio: fread()/fwrite(): return size / nmemb, not total bytes read/written.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Thu, 30 Apr 2009 09:06:55 -0500 |
parents | 1e48d5a52760 |
children | a60e13ff3a21 |
files | src/gio/gio.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gio/gio.c Thu Apr 30 08:54:31 2009 -0500 +++ b/src/gio/gio.c Thu Apr 30 09:06:55 2009 -0500 @@ -110,6 +110,7 @@ VFSGIOHandle *handle; goffset count = 0; gsize realsize = (size * nmemb); + gsize ret; g_return_val_if_fail(file != NULL, EOF); g_return_val_if_fail(file->handle != NULL, EOF); @@ -129,7 +130,8 @@ } } - return (g_input_stream_read(G_INPUT_STREAM(handle->istream), (ptr + count), (realsize - count), NULL, NULL) + count); + ret = (g_input_stream_read(G_INPUT_STREAM(handle->istream), (ptr + count), (realsize - count), NULL, NULL) + count); + return (ret / size); } size_t @@ -139,13 +141,15 @@ VFSFile * file) { VFSGIOHandle *handle; + gsize ret; g_return_val_if_fail(file != NULL, EOF); g_return_val_if_fail(file->handle != NULL, EOF); handle = (VFSGIOHandle *) file->handle; - return g_output_stream_write(G_OUTPUT_STREAM(handle->ostream), ptr, size * nmemb, NULL, NULL); + ret = g_output_stream_write(G_OUTPUT_STREAM(handle->ostream), ptr, size * nmemb, NULL, NULL); + return (ret / size); } gint