changeset 326:90a843d02970 trunk

[svn] - some OSes use macros for some f*() functions, therefore make sure we properly cast our opaque data to a FILE* struct.
author nenolod
date Sat, 02 Dec 2006 14:43:27 -0800
parents 31c9d8f37474
children f3f77cbd58f3
files ChangeLog src/stdio/stdio.c
diffstat 2 files changed, 54 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Dec 01 00:03:10 2006 -0800
+++ b/ChangeLog	Sat Dec 02 14:43:27 2006 -0800
@@ -1,3 +1,11 @@
+2006-12-01 08:03:10 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [714]
+  - disable the playlist when loading = false.
+  
+  trunk/src/console/Nsfe_Emu.cxx |    1 +
+  1 file changed, 1 insertion(+)
+
+
 2006-12-01 07:08:19 +0000  William Pitcock <nenolod@nenolod.net>
   revision [712]
   - should return -1, not 1.
--- a/src/stdio/stdio.c	Fri Dec 01 00:03:10 2006 -0800
+++ b/src/stdio/stdio.c	Sat Dec 02 14:43:27 2006 -0800
@@ -53,8 +53,11 @@
     if (file == NULL)
         return -1;
 
-    if (file->handle) {
-        if (fclose(file->handle) != 0)
+    if (file->handle)
+    {
+        FILE *handle = (FILE *) file->handle;
+
+        if (fclose(handle) != 0)
             ret = -1;
     }
 
@@ -67,10 +70,14 @@
           size_t nmemb,
           VFSFile * file)
 {
+    FILE *handle;
+
     if (file == NULL)
         return 0;
 
-    return fread(ptr, size, nmemb, file->handle);
+    handle = (FILE *) file->handle;
+
+    return fread(ptr, size, nmemb, handle);
 }
 
 size_t
@@ -79,22 +86,30 @@
            size_t nmemb,
            VFSFile * file)
 {
+    FILE *handle;
+
     if (file == NULL)
         return 0;
 
-    return fwrite(ptr, size, nmemb, file->handle);
+    handle = (FILE *) file->handle;
+
+    return fwrite(ptr, size, nmemb, handle);
 }
 
 gint
 stdio_vfs_getc_impl(VFSFile *stream)
 {
-  return getc( stream->handle );
+  FILE *handle = (FILE *) stream->handle;
+
+  return getc( handle );
 }
 
 gint
 stdio_vfs_ungetc_impl(gint c, VFSFile *stream)
 {
-  return ungetc( c , stream->handle );
+  FILE *handle = (FILE *) stream->handle;
+
+  return ungetc( c , handle );
 }
 
 gint
@@ -102,46 +117,66 @@
           glong offset,
           gint whence)
 {
+    FILE *handle;
+
     if (file == NULL)
         return 0;
 
-    return fseek(file->handle, offset, whence);
+    handle = (FILE *) file->handle;
+
+    return fseek(handle, offset, whence);
 }
 
 void
 stdio_vfs_rewind_impl(VFSFile * file)
 {
+    FILE *handle;
+
     if (file == NULL)
         return;
 
-    rewind(file->handle);
+    handle = (FILE *) file->handle;
+
+    rewind(handle);
 }
 
 glong
 stdio_vfs_ftell_impl(VFSFile * file)
 {
+    FILE *handle;
+
     if (file == NULL)
         return 0;
 
-    return ftell(file->handle);
+    handle = (FILE *) file->handle;
+
+    return ftell(handle);
 }
 
 gboolean
 stdio_vfs_feof_impl(VFSFile * file)
 {
+    FILE *handle;
+
     if (file == NULL)
         return FALSE;
 
-    return (gboolean) feof(file->handle);
+    handle = (FILE *) file->handle;
+
+    return (gboolean) feof(handle);
 }
 
 gint
 stdio_vfs_truncate_impl(VFSFile * file, glong size)
 {
+    FILE *handle;
+
     if (file == NULL)
         return -1;
 
-    return ftruncate(fileno(file->handle), size);
+    handle = (FILE *) file->handle;
+
+    return ftruncate(fileno(handle), size);
 }
 
 VFSConstructor file_const = {