shithub: opus

Download patch

ref: 907a52315dd55811701fc6e778799e6d62f2c508
parent: 729bd2f4d43e7a17e5deed098f6593bd6be2e01b
author: Nirbheek Chauhan <[email protected]>
date: Sat Jul 18 07:18:23 EDT 2020

Replace WIN32 with _WIN32 everywhere

_WIN32 is defined on all Windows platforms by every compiler that
targets Windows. We do not need WIN32 at all.

Signed-off-by: Mark Harris <[email protected]>
Resolves https://github.com/xiph/opus/pull/104

--- a/celt/stack_alloc.h
+++ b/celt/stack_alloc.h
@@ -40,7 +40,7 @@
 #endif
 
 #ifdef USE_ALLOCA
-# ifdef WIN32
+# ifdef _WIN32
 #  include <malloc.h>
 # else
 #  ifdef HAVE_ALLOCA_H
@@ -102,7 +102,7 @@
 
 #define VARDECL(type, var) type *var
 
-# ifdef WIN32
+# ifdef _WIN32
 #  define ALLOC(var, size, type) var = ((type*)_alloca(sizeof(type)*(size)))
 # else
 #  define ALLOC(var, size, type) var = ((type*)alloca(sizeof(type)*(size)))
--- a/include/opus_defines.h
+++ b/include/opus_defines.h
@@ -64,7 +64,7 @@
 /**Export control for opus functions */
 
 #ifndef OPUS_EXPORT
-# if defined(WIN32)
+# if defined(_WIN32)
 #  if defined(OPUS_BUILD) && defined(DLL_EXPORT)
 #   define OPUS_EXPORT __declspec(dllexport)
 #  else
--- a/silk/debug.c
+++ b/silk/debug.c
@@ -67,7 +67,7 @@
 int           silk_Timer_nTimers = 0;
 int           silk_Timer_depth_ctr = 0;
 char          silk_Timer_tags[silk_NUM_TIMERS_MAX][silk_NUM_TIMERS_MAX_TAG_LEN];
-#ifdef WIN32
+#ifdef _WIN32
 LARGE_INTEGER silk_Timer_start[silk_NUM_TIMERS_MAX];
 #else
 unsigned long silk_Timer_start[silk_NUM_TIMERS_MAX];
@@ -78,7 +78,7 @@
 opus_int64     silk_Timer_max[silk_NUM_TIMERS_MAX];
 opus_int64     silk_Timer_depth[silk_NUM_TIMERS_MAX];
 
-#ifdef WIN32
+#ifdef _WIN32
 void silk_TimerSave(char *file_name)
 {
     if( silk_Timer_nTimers > 0 )
--- a/tests/test_opus_decode.c
+++ b/tests/test_opus_decode.c
@@ -36,7 +36,7 @@
 #include <math.h>
 #include <string.h>
 #include <time.h>
-#if (!defined WIN32 && !defined _WIN32) || defined(__MINGW32__)
+#ifndef _WIN32
 #include <unistd.h>
 #else
 #include <process.h>
--- a/win32/VS2015/common.props
+++ b/win32/VS2015/common.props
@@ -23,7 +23,7 @@
       <CompileAsManaged>false</CompileAsManaged>
       <CompileAsWinRT>false</CompileAsWinRT>
       <AdditionalIncludeDirectories>..\..;..\..\include;..\..\silk;..\..\celt;..\..\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>HAVE_CONFIG_H;WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeTypeInfo>false</RuntimeTypeInfo>
       <OpenMPSupport>false</OpenMPSupport>
     </ClCompile>