[vlc-commits] Win32: correctly implement flockfile() et al
Rémi Denis-Courmont
git at videolan.org
Thu Oct 18 17:42:39 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 18 13:58:25 2012 +0300| [2f8990294e4b5f37e932669d77c85c4a857d9701] | committer: Rémi Denis-Courmont
Win32: correctly implement flockfile() et al
This should fix gibberish interlaced log messages.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2f8990294e4b5f37e932669d77c85c4a857d9701
---
compat/flockfile.c | 28 ++++++++++++++++++----------
configure.ac | 3 +++
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/compat/flockfile.c b/compat/flockfile.c
index dc2a09c..f0b61bb 100644
--- a/compat/flockfile.c
+++ b/compat/flockfile.c
@@ -1,7 +1,7 @@
/*****************************************************************************
* flockfile.c: POSIX unlocked I/O stream stubs
*****************************************************************************
- * Copyright © 2011 Rémi Denis-Courmont
+ * Copyright © 2011-2012 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
@@ -24,41 +24,49 @@
#include <stdio.h>
-/* There is no way to implement this for real. We just pretend it works and
- * hope for the best (especially when outputting to stderr). */
+#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))
+# endif
void flockfile (FILE *stream)
{
- (void) stream;
+ _lock_file (stream);
}
int ftrylockfile (FILE *stream)
{
- (void) stream;
+ flockfile (stream); /* Move along people, there is nothing to see here. */
return 0;
}
void funlockfile (FILE *stream)
{
- (void) stream;
+ _unlock_file (stream);
}
int getc_unlocked (FILE *stream)
{
- return getc (stream);
+ return _getc_nolock (stream);
}
int getchar_unlocked (void)
{
- return getchar ();
+ return _getchar_nolock ();
}
int putc_unlocked (int c, FILE *stream)
{
- return putc (c, stream);
+ return _putc_nolock (c, stream);
}
int putchar_unlocked (int c)
{
- return putchar (c);
+ return _putchar_nolock (c);
}
+
+#else
+# error flockfile not implemented on your platform!
+#endif
diff --git a/configure.ac b/configure.ac
index 2a9c92d..1a02878 100644
--- a/configure.ac
+++ b/configure.ac
@@ -535,6 +535,9 @@ case "$SYS" in
"linux")
AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity])
;;
+ "mingw32")
+ AC_CHECK_FUNCS([_lock_file])
+ ;;
esac
AH_BOTTOM([#include <vlc_fixups.h>])
More information about the vlc-commits
mailing list