On Tue, 26 Jun 2012, Måns Rullgård wrote:

Martin Storsjö <[email protected]> writes:

From: "Ronald S. Bultje" <[email protected]>

Mingw headers provide similar defines already (unconditional #defines,
without any #undef or #ifdef around it), while MSVC doesn't have
them.

As an alternative, this could be moved to os_support.h, but then the
sys/stat.h include would have to be moved there.
---
 libavformat/file.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/file.c b/libavformat/file.c
index cca9ec1..ad8ac40 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -31,6 +31,13 @@
 #include "os_support.h"
 #include "url.h"

+#ifndef S_IRUSR
+#define S_IRUSR S_IREAD
+#endif
+#ifndef S_IWUSR
+#define S_IWUSR S_IWRITE
+#endif

What guarantees that those fallbacks are defined?

Nothing really.

Thus, this probably belongs within some #if _WIN32 scope (since microsoft specs only the S_IREAD/S_IWRITE names).

Then we need to deal with the mingw headers that actually define similar fallbacks (undef them before defining ours), and deal with the sys/stat.h header being included both before and after os_support.h... Any hints on how to do that best?

The mingw header basically contains this (without any extra #ifdef or #undef):

#define _S_IWUSR        _S_IWRITE
#define S_IWUSR         _S_IWUSR
#define S_IRUSR         _S_IRUSR
#define _S_IRUSR        _S_IREAD


// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to