Bug 974845 - Fixed compilation on mingw with secure APIs enabled by default. r=Jan
authorJacek Caban <jacek@codeweavers.com>
Thu, 20 Feb 2014 17:22:34 +0100
changeset 170058 62a6b1b8d6fa33d15d92c4890e377c30903308ca
parent 170057 1ed1c0688bbdf9cb6195c66a80fe8e9057191dea
child 170059 997127a13fd5b27f19dee82c5664f896b21d0dc5
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersJan
bugs974845
milestone30.0a1
Bug 974845 - Fixed compilation on mingw with secure APIs enabled by default. r=Jan
media/libvpx/mingw.patch
media/libvpx/update.py
media/libvpx/vpx/src/svc_encodeframe.c
new file mode 100644
--- /dev/null
+++ b/media/libvpx/mingw.patch
@@ -0,0 +1,30 @@
+diff --git a/media/libvpx/vpx/src/svc_encodeframe.c b/media/libvpx/vpx/src/svc_encodeframe.c
+index 57d21dc..2514ad3 100644
+--- a/media/libvpx/vpx/src/svc_encodeframe.c
++++ b/media/libvpx/vpx/src/svc_encodeframe.c
+@@ -18,21 +18,23 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #define VPX_DISABLE_CTRL_TYPECHECKS 1
+ #define VPX_CODEC_DISABLE_COMPAT 1
+ #include "vpx/svc_context.h"
+ #include "vpx/vp8cx.h"
+ #include "vpx/vpx_encoder.h"
+ 
+-#if defined(__MINGW32__) && !defined(MINGW_HAS_SECURE_API)
++#ifdef __MINGW32__
+ #define strtok_r strtok_s
++#ifndef MINGW_HAS_SECURE_API
+ // proto from /usr/x86_64-w64-mingw32/include/sec_api/string_s.h
+ _CRTIMP char *__cdecl strtok_s(char *str, const char *delim, char **context);
+-#endif
++#endif  /* MINGW_HAS_SECURE_API */
++#endif  /* __MINGW32__ */
+ 
+ #ifdef _MSC_VER
+ #define strdup _strdup
+ #define strtok_r strtok_s
+ #endif
+ 
+ #define SVC_REFERENCE_FRAMES 8
+ #define SUPERFRAME_SLOTS (8)
--- a/media/libvpx/update.py
+++ b/media/libvpx/update.py
@@ -447,16 +447,17 @@ def update_and_remove_files(prefix, libv
         for f in removed_files:
             os.unlink(f)
             print '    ', f
 
 def apply_patches():
     # Patch to permit vpx users to specify their own <stdint.h> types.
     os.system("patch -p3 < stdint.patch")
     os.system("patch -p3 < unified.patch")
+    os.system("patch -p3 < mingw.patch")
 
 def update_readme(commit):
     with open('README_MOZILLA') as f:
         readme = f.read()
 
     if 'The git commit ID used was' in readme:
         new_readme = re.sub('The git commit ID used was [a-f0-9]+',
             'The git commit ID used was %s' % commit, readme)
--- a/media/libvpx/vpx/src/svc_encodeframe.c
+++ b/media/libvpx/vpx/src/svc_encodeframe.c
@@ -18,21 +18,23 @@
 #include <stdlib.h>
 #include <string.h>
 #define VPX_DISABLE_CTRL_TYPECHECKS 1
 #define VPX_CODEC_DISABLE_COMPAT 1
 #include "vpx/svc_context.h"
 #include "vpx/vp8cx.h"
 #include "vpx/vpx_encoder.h"
 
-#if defined(__MINGW32__) && !defined(MINGW_HAS_SECURE_API)
+#ifdef __MINGW32__
 #define strtok_r strtok_s
+#ifndef MINGW_HAS_SECURE_API
 // proto from /usr/x86_64-w64-mingw32/include/sec_api/string_s.h
 _CRTIMP char *__cdecl strtok_s(char *str, const char *delim, char **context);
-#endif
+#endif  /* MINGW_HAS_SECURE_API */
+#endif  /* __MINGW32__ */
 
 #ifdef _MSC_VER
 #define strdup _strdup
 #define strtok_r strtok_s
 #endif
 
 #define SVC_REFERENCE_FRAMES 8
 #define SUPERFRAME_SLOTS (8)