diff options
-rw-r--r-- | src/adlmidi.cpp | 2 | ||||
-rw-r--r-- | src/adlmidi_private.hpp | 28 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index bf03285..8648308 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -120,7 +120,7 @@ ADLMIDI_EXPORT int adl_setBank(ADL_MIDIPlayer *device, int bank) if(static_cast<uint32_t>(bankno) >= NumBanks) { char errBuf[150]; - snprintf(errBuf, 150, "Embedded bank number may only be 0..%" PRIu32 "!\n", (NumBanks - 1)); + snprintf(errBuf, 150, "Embedded bank number may only be 0..%u!\n", static_cast<unsigned int>(NumBanks - 1)); play->setErrorString(errBuf); return -1; } diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 9fd6f97..d66daf4 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -88,17 +88,13 @@ typedef int32_t ssize_t; #include <cstdarg> #include <cstdio> #include <cassert> -#if !(defined(__APPLE__) && defined(__GLIBCXX__)) && !defined(__ANDROID__) -#include <cinttypes> //PRId32, PRIu32, etc. -#else -#include <inttypes.h> -#endif #include <vector> // vector #include <deque> // deque #include <cmath> // exp, log, ceil #if defined(__WATCOMC__) #include <math.h> // round, sqrt #endif +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <limits> // numeric_limit @@ -110,6 +106,28 @@ typedef int32_t ssize_t; #include <deque> #include <algorithm> +/* + * Workaround for some compilers are has no those macros in their headers! + */ +#ifndef INT8_MIN +#define INT8_MIN (-0x7f - 1) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-0x7fff - 1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-0x7fffffff - 1) +#endif +#ifndef INT8_MAX +#define INT8_MAX 0x7f +#endif +#ifndef INT16_MAX +#define INT16_MAX 0x7fff +#endif +#ifndef INT32_MAX +#define INT32_MAX 0x7fffffff +#endif + #ifdef _MSC_VER #pragma warning(disable:4319) #pragma warning(disable:4267) |