# HG changeset patch # User William Pitcock # Date 1241100415 18000 # Node ID cdf79f7b0d9e55adb43e62f2bd15bd5e6dc4c31c # Parent 1e48d5a52760e04c5894dad339ea926286faee95 gio: fread()/fwrite(): return size / nmemb, not total bytes read/written. diff -r 1e48d5a52760 -r cdf79f7b0d9e src/gio/gio.c --- 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