From cf10f4c24f4c02f05c305be32ff61aa63603e02f Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 17 Nov 2014 20:57:15 +0000 Subject: [PATCH] Now that we're using C++11 and cstdint is standard, we no longer need to worry about inttypes.h and associated defines. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3085 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- configure | 4 +- src/common/bspf.hxx | 47 ++++++--------------- src/emucore/MT24LC256.cxx | 6 +-- src/gui/LauncherDialog.cxx | 8 ++-- src/macosx/stella.xcodeproj/project.pbxproj | 3 -- src/zlib/zconf.h | 4 -- 6 files changed, 23 insertions(+), 49 deletions(-) diff --git a/configure b/configure index d9065ae78..0d3f4917c 100755 --- a/configure +++ b/configure @@ -714,12 +714,12 @@ LIBS="$LIBS `$_sdlconfig $_sdl_conf_libs`" LD=$CXX case $_host_os in unix) - DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES" + DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY" MODULES="$MODULES $SRC/unix" INCLUDES="$INCLUDES -I$SRC/unix" ;; win32) - DEFINES="$DEFINES -DBSPF_WINDOWS -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES" + DEFINES="$DEFINES -DBSPF_WINDOWS -DHAVE_GETTIMEOFDAY" MODULES="$MODULES $SRC/windows" INCLUDES="$INCLUDES -I$SRC/windows" LIBS="$LIBS -lmingw32 -lwinmm" diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index bcaa48d0b..f0c4a7bc4 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -28,38 +28,19 @@ @version $Id$ */ -#ifdef HAVE_INTTYPES - #include - - // Types for 8-bit signed and unsigned integers - typedef int8_t Int8; - typedef uint8_t uInt8; - // Types for 16-bit signed and unsigned integers - typedef int16_t Int16; - typedef uint16_t uInt16; - // Types for 32-bit signed and unsigned integers - typedef int32_t Int32; - typedef uint32_t uInt32; - // Types for 64-bit signed and unsigned integers - typedef int64_t Int64; - typedef uint64_t uInt64; -#elif defined BSPF_WINDOWS - // Types for 8-bit signed and unsigned integers - typedef signed char Int8; - typedef unsigned char uInt8; - // Types for 16-bit signed and unsigned integers - typedef signed short Int16; - typedef unsigned short uInt16; - // Types for 32-bit signed and unsigned integers - typedef signed int Int32; - typedef unsigned int uInt32; - // Types for 64-bit signed and unsigned integers - typedef __int64 Int64; - typedef unsigned __int64 uInt64; -#else - #error Update src/common/bspf.hxx for datatypes -#endif - +#include +// Types for 8-bit signed and unsigned integers +typedef int8_t Int8; +typedef uint8_t uInt8; +// Types for 16-bit signed and unsigned integers +typedef int16_t Int16; +typedef uint16_t uInt16; +// Types for 32-bit signed and unsigned integers +typedef int32_t Int32; +typedef uint32_t uInt32; +// Types for 64-bit signed and unsigned integers +typedef int64_t Int64; +typedef uint64_t uInt64; // The following code should provide access to the standard C++ objects and // types: cout, cerr, string, ostream, istream, etc. @@ -183,7 +164,7 @@ inline size_t BSPF_findIgnoreCase(const string& s1, const string& s2, int startp { auto pos = std::search(s1.begin()+startpos, s1.end(), s2.begin(), s2.end(), [](char ch1, char ch2) { - return toupper((unsigned char)ch1) == toupper((unsigned char)ch2); + return toupper((uInt8)ch1) == toupper((uInt8)ch2); }); return pos == s1.end() ? string::npos : pos - (s1.begin()+startpos); } diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx index ba60a5bfe..f2c580bf6 100644 --- a/src/emucore/MT24LC256.cxx +++ b/src/emucore/MT24LC256.cxx @@ -270,7 +270,7 @@ void MT24LC256::jpee_clock_fall() { if (!jpee_pptr) { - jpee_packet[0] = (unsigned char)jpee_nb; + jpee_packet[0] = (uInt8)jpee_nb; if (jpee_smallmode && ((jpee_nb & 0xF0) == 0xA0)) { jpee_packet[1] = (jpee_nb >> 1) & 7; @@ -312,7 +312,7 @@ void MT24LC256::jpee_clock_fall() { if (!jpee_pptr) { - jpee_packet[0] = (unsigned char)jpee_nb; + jpee_packet[0] = (uInt8)jpee_nb; if (jpee_smallmode) jpee_pptr=2; else @@ -321,7 +321,7 @@ void MT24LC256::jpee_clock_fall() else if (jpee_pptr < 70) { JPEE_LOG1("I2C_SENT(%02X)",jpee_nb & 0xFF); - jpee_packet[jpee_pptr++] = (unsigned char)jpee_nb; + jpee_packet[jpee_pptr++] = (uInt8)jpee_nb; jpee_address = (jpee_packet[1] << 8) | jpee_packet[2]; if (jpee_pptr > 2) jpee_ad_known = 1; diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 464568dbf..b3014058e 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -398,7 +398,7 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const const char* haystack = s.c_str(); const char* needle = pattern.c_str(); - unsigned char b = tolower((unsigned char) *needle); + uInt8 b = tolower((uInt8) *needle); needle++; for (;; haystack++) @@ -407,7 +407,7 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const return false; /* The first character matches */ - if (tolower ((unsigned char) *haystack) == b) + if (tolower ((uInt8) *haystack) == b) { const char* rhaystack = haystack + 1; const char* rneedle = needle; @@ -420,8 +420,8 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const return false; /* Nothing in this round */ - if (tolower ((unsigned char) *rhaystack) - != tolower ((unsigned char) *rneedle)) + if (tolower ((uInt8) *rhaystack) + != tolower ((uInt8) *rneedle)) break; } } diff --git a/src/macosx/stella.xcodeproj/project.pbxproj b/src/macosx/stella.xcodeproj/project.pbxproj index adc9fee12..c7c6c3dd2 100644 --- a/src/macosx/stella.xcodeproj/project.pbxproj +++ b/src/macosx/stella.xcodeproj/project.pbxproj @@ -2325,7 +2325,6 @@ GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - HAVE_INTTYPES, HAVE_GETTIMEOFDAY, CHEATCODE_SUPPORT, DEBUGGER_SUPPORT, @@ -2377,7 +2376,6 @@ GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = ( - HAVE_INTTYPES, HAVE_GETTIMEOFDAY, CHEATCODE_SUPPORT, DEBUGGER_SUPPORT, @@ -2428,7 +2426,6 @@ GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = ( - HAVE_INTTYPES, HAVE_GETTIMEOFDAY, CHEATCODE_SUPPORT, DEBUGGER_SUPPORT, diff --git a/src/zlib/zconf.h b/src/zlib/zconf.h index cc75b952b..87809d308 100644 --- a/src/zlib/zconf.h +++ b/src/zlib/zconf.h @@ -8,10 +8,6 @@ #ifndef ZCONF_H #define ZCONF_H -/** Added by SA *********/ -#ifdef HAVE_INTTYPES - #define Z_HAVE_UNISTD_H -#endif #define ZLIB_CONST /**************************/