]> git.sesse.net Git - vlc/blobdiff - compat/flockfile.c
qt4: fix COM leak and handle errors
[vlc] / compat / flockfile.c
index f0b61bb070eef1133a59f09c81c32f74b5ad2cd4..d01fd1ffd83ac6fc82f2682ea91c68c5a72c2ccc 100644 (file)
 
 #include <stdio.h>
 
-#ifdef WIN32
+#ifdef _WIN32
 # ifndef HAVE__LOCK_FILE
 #  warning Broken SDK: VLC logs will be garbage.
 #  define _lock_file(s) ((void)(s))
 #  define _unlock_file(s) ((void)(s))
+#  undef _getc_nolock
+#  define _getc_nolock(s) getc(s)
+#  undef _putc_nolock
+#  define _putc_nolock(s,c) putc(s,c)
 # endif
 
 void flockfile (FILE *stream)
@@ -52,21 +56,21 @@ int getc_unlocked (FILE *stream)
     return _getc_nolock (stream);
 }
 
-int getchar_unlocked (void)
+int putc_unlocked (int c, FILE *stream)
 {
-    return _getchar_nolock ();
+    return _putc_nolock (c, stream);
 }
 
-int putc_unlocked (int c, FILE *stream)
+#else
+# error flockfile not implemented on your platform!
+#endif
+
+int getchar_unlocked (void)
 {
-    return _putc_nolock (c, stream);
+    return getc_unlocked (stdin);
 }
 
 int putchar_unlocked (int c)
 {
-    return _putchar_nolock (c);
+    return putc_unlocked (c, stdout);
 }
-
-#else
-# error flockfile not implemented on your platform!
-#endif