From 0ffabbc5dc3d73406d10bb389e28dc7c789699e8 Mon Sep 17 00:00:00 2001 From: dave Date: Sat, 2 Sep 2006 17:21:49 +0000 Subject: [PATCH] Mac compat .. This was SVN commit r4287. --- source/lib/posix_types.h | 7 +++---- source/lib/res/file/file_stats.cpp | 2 +- source/lib/res/sound/snd_mgr.cpp | 10 +++++----- source/lib/string_s.cpp | 2 +- source/lib/types.h | 10 +++++----- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/source/lib/posix_types.h b/source/lib/posix_types.h index b950e82aad..b6f1d4202b 100644 --- a/source/lib/posix_types.h +++ b/source/lib/posix_types.h @@ -34,8 +34,7 @@ #else // unix/linux/glibc/gcc says that this macro has to be defined when including // stdint.h from C++ for stdint.h to define SIZE_MAX and friends -# ifndef __STDC_LIMIT_MACROS -# define __STDC_LIMIT_MACROS -# endif -# include +#ifndef SIZE_MAX + #define SIZE_MAX ((size_t)-1) +#endif #endif // #if OS_WIN diff --git a/source/lib/res/file/file_stats.cpp b/source/lib/res/file/file_stats.cpp index 7759dea25b..1b4bf89891 100644 --- a/source/lib/res/file/file_stats.cpp +++ b/source/lib/res/file/file_stats.cpp @@ -307,7 +307,7 @@ void stats_dump() "Accessed files: %u (%g MB) -- %u%% of data set\n" "Max. concurrent: %u; leaked: %u.\n", unique_names, unique_name_len_total/1000, - opened_files.size(), opened_file_size_total/MB, percent(opened_files.size(), vfs_files), + opened_files.size(), opened_file_size_total/MB, percent(opened_files.size(), (size_t)vfs_files), open_files_max, open_files_cur ); diff --git a/source/lib/res/sound/snd_mgr.cpp b/source/lib/res/sound/snd_mgr.cpp index 80855497f5..29571bf5de 100644 --- a/source/lib/res/sound/snd_mgr.cpp +++ b/source/lib/res/sound/snd_mgr.cpp @@ -256,7 +256,7 @@ static LibError alc_init() // ignore } #else - alc_dev = alcOpenDevice((ALubyte*)alc_dev_name); + alc_dev = alcOpenDevice((ALCchar*)alc_dev_name); #endif if(alc_dev) @@ -677,7 +677,7 @@ static const char * devs; */ LibError snd_dev_prepare_enum() { - if(alcIsExtensionPresent(0, (ALubyte*)"ALC_ENUMERATION_EXT") != AL_TRUE) + if(alcIsExtensionPresent(0, (ALCchar*)"ALC_ENUMERATION_EXT") != AL_TRUE) WARN_RETURN(ERR_NO_SYS); devs = (const char*)alcGetString(0, ALC_DEVICE_SPECIFIER); @@ -1822,10 +1822,10 @@ static void vsrc_latch(VSrc * vs) #ifndef NDEBUG // paranoid value checking; helps determine which parameter is // the problem when the below AL_CHECK fails. - debug_assert(!isnan(vs->pos[0]) && !isnan(vs->pos[1]) && !isnan(vs->pos[2])); + debug_assert(!std::isnan(vs->pos[0]) && !std::isnan(vs->pos[1]) && !std::isnan(vs->pos[2])); debug_assert(vs->relative == AL_TRUE || vs->relative == AL_FALSE); - debug_assert(!isnan(vs->gain)); - debug_assert(!isnan(vs->pitch) && vs->pitch > 0.0f); + debug_assert(!std::isnan(vs->gain)); + debug_assert(!std::isnan(vs->pitch) && vs->pitch > 0.0f); debug_assert(vs->loop == AL_TRUE || vs->loop == AL_FALSE); #endif diff --git a/source/lib/string_s.cpp b/source/lib/string_s.cpp index b72a298394..905b205b18 100644 --- a/source/lib/string_s.cpp +++ b/source/lib/string_s.cpp @@ -25,7 +25,7 @@ #include #include "lib.h" -#include "posix.h" // SIZE_MAX +#include "posix_types.h" // SIZE_MAX // written against http://std.dkuug.dk/jtc1/sc22/wg14/www/docs/n1031.pdf . diff --git a/source/lib/types.h b/source/lib/types.h index f76ae5ce39..8916f96862 100644 --- a/source/lib/types.h +++ b/source/lib/types.h @@ -48,10 +48,10 @@ typedef unsigned int PS_uint; // the standard only guarantees 16 bits. // we use this for memory offsets and ranges, so it better be big enough. -#ifdef SIZE_MAX -# if SIZE_MAX < 0xFFFFFFFF -# error "check size_t and SIZE_MAX - too small?" -# endif -#endif +//#ifdef SIZE_MAX +//# if SIZE_MAX < 0xFFFFFFFF +//# error "check size_t and SIZE_MAX - too small?" +//# endif +//#endif #endif // #ifndef __TYPES_H__