From 8b3a5e497992409d1b0c23e921ac8cc21c311144 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Tue, 4 May 2010 11:14:26 +0100 Subject: [PATCH] * Fix some confusions between _WIN32 (any compiler/runtime on that platform) and __MSVC__ (VC only, not e.g. mingw32) --- main/main.cpp | 3 +++ src/system/Allocators.h | 4 ++-- src/system/sysutils.h | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index cd193ed..b2724ea 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -41,6 +41,9 @@ using namespace RubberBand; #ifdef _WIN32 using RubberBand::gettimeofday; +#endif + +#ifdef __MSVC__ using RubberBand::usleep; #endif diff --git a/src/system/Allocators.h b/src/system/Allocators.h index af84840..740ccf7 100644 --- a/src/system/Allocators.h +++ b/src/system/Allocators.h @@ -45,7 +45,7 @@ T *allocate(size_t count) ptr = malloc(count * sizeof(T)); } #else -#ifdef _WIN32 +#ifdef __MSVC__ ptr = _aligned_malloc(count * sizeof(T), 16); #else // Note that malloc always aligns to 16 byte boundaries on OS/X, @@ -70,7 +70,7 @@ T *allocate_and_zero(size_t count) template void deallocate(T *ptr) { -#ifdef _WIN32 +#ifdef __MSVC__ if (ptr) _aligned_free((void *)ptr); #else if (ptr) free((void *)ptr); diff --git a/src/system/sysutils.h b/src/system/sysutils.h index 7c0d5be..249336d 100644 --- a/src/system/sysutils.h +++ b/src/system/sysutils.h @@ -45,6 +45,10 @@ extern void system_specific_application_initialise(); struct timeval { long tv_sec; long tv_usec; }; void gettimeofday(struct timeval *p, void *tz); +#endif + +#ifdef __MSVC__ + void usleep(unsigned long); #endif