From 89cb0487c3534a957e82c964095e7fe261a052b0 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Tue, 11 May 2004 16:51:15 +0000 Subject: [PATCH] ICU-3747 Change int32_t default type from long to int X-SVN-Rev: 15252 --- icu4c/source/common/unicode/platform.h.in | 12 +---- icu4c/source/common/unicode/pwin32.h | 16 ++----- icu4c/source/config/mh-alpha-linux-cc | 3 -- icu4c/source/config/mh-alpha-osf | 3 -- icu4c/source/test/intltest/strtest.cpp | 53 +++++++++++++++-------- icu4c/source/test/intltest/strtest.h | 3 +- 6 files changed, 41 insertions(+), 49 deletions(-) diff --git a/icu4c/source/common/unicode/platform.h.in b/icu4c/source/common/unicode/platform.h.in index b7f0e0f944..593c1b396a 100644 --- a/icu4c/source/common/unicode/platform.h.in +++ b/icu4c/source/common/unicode/platform.h.in @@ -142,19 +142,11 @@ typedef unsigned short uint16_t; #endif #if ! U_HAVE_INT32_T -# if defined(_LP64) - typedef signed int int32_t; -# else - typedef signed long int32_t; -# endif +typedef signed int int32_t; #endif #if ! U_HAVE_UINT32_T -# if defined(_LP64) - typedef unsigned int uint32_t; -# else - typedef unsigned long uint32_t; -# endif +typedef unsigned int uint32_t; #endif #if ! U_HAVE_INT64_T diff --git a/icu4c/source/common/unicode/pwin32.h b/icu4c/source/common/unicode/pwin32.h index 57eb45ec21..886956f0b0 100644 --- a/icu4c/source/common/unicode/pwin32.h +++ b/icu4c/source/common/unicode/pwin32.h @@ -119,29 +119,21 @@ typedef unsigned short uint16_t; #endif #if ! U_HAVE_INT32_T -# if defined(_LP64) - typedef signed int int32_t; -# else - typedef signed long int32_t; -# endif +typedef signed int int32_t; #endif #if ! U_HAVE_UINT32_T -# if defined(_LP64) - typedef unsigned int uint32_t; -# else - typedef unsigned long uint32_t; -# endif +typedef unsigned int uint32_t; #endif #if ! U_HAVE_INT64_T /* Could use _MSC_VER to detect Microsoft compiler. */ - typedef signed __int64 int64_t; + typedef signed __int64 int64_t; #endif #if ! U_HAVE_UINT64_T /* Could use _MSC_VER to detect Microsoft compiler. */ - typedef unsigned __int64 uint64_t; + typedef unsigned __int64 uint64_t; #endif #endif diff --git a/icu4c/source/config/mh-alpha-linux-cc b/icu4c/source/config/mh-alpha-linux-cc index 2adfeafbca..43fe1c3173 100644 --- a/icu4c/source/config/mh-alpha-linux-cc +++ b/icu4c/source/config/mh-alpha-linux-cc @@ -16,9 +16,6 @@ SHAREDLIBCPPFLAGS = -DPIC LIBCPPFLAGS = -D_REENTRANT THREADSCPPFLAGS = -D_REENTRANT -# Use int for int32_t -DEFS += -D_LP64 - # The tests need complete IEEE floating point support CFLAGS += -ieee CXXFLAGS += -ieee diff --git a/icu4c/source/config/mh-alpha-osf b/icu4c/source/config/mh-alpha-osf index 3754f11c7c..07799ad404 100644 --- a/icu4c/source/config/mh-alpha-osf +++ b/icu4c/source/config/mh-alpha-osf @@ -16,9 +16,6 @@ SHAREDLIBCPPFLAGS = LIBCPPFLAGS = -D_REENTRANT THREADSCPPFLAGS = -D_REENTRANT -pthread -# Use int for int32_t -DEFS += -D_LP64 - # The tests need complete IEEE floating point support CFLAGS += -ieee CXXFLAGS += -ieee diff --git a/icu4c/source/test/intltest/strtest.cpp b/icu4c/source/test/intltest/strtest.cpp index ca2d76c255..d7d0fb744f 100644 --- a/icu4c/source/test/intltest/strtest.cpp +++ b/icu4c/source/test/intltest/strtest.cpp @@ -36,26 +36,47 @@ void StringTest::TestEndian(void) { } } -void StringTest::TestSizeofWCharT(void) { +void StringTest::TestSizeofTypes(void) { if(U_SIZEOF_WCHAR_T!=sizeof(wchar_t)) { errln("TestSizeofWCharT: U_SIZEOF_WCHAR_T!=sizeof(wchar_t) - U_SIZEOF_WCHAR_T needs to be fixed in platform.h"); } -} - -void StringTest::TestSizeofInt64(void) { #ifdef U_INT64_T_UNAVAILABLE errln("int64_t and uint64_t are undefined."); #else if(8!=sizeof(int64_t)) { - errln("TestSizeofInt64: 8!=sizeof(int64_t) - int64_t needs to be fixed in platform.h"); + errln("TestSizeofTypes: 8!=sizeof(int64_t) - int64_t needs to be fixed in platform.h"); } if(8!=sizeof(uint64_t)) { - errln("TestSizeofInt64: 8!=sizeof(uint64_t) - uint64_t needs to be fixed in platform.h"); + errln("TestSizeofTypes: 8!=sizeof(uint64_t) - uint64_t needs to be fixed in platform.h"); } #endif if(8!=sizeof(double)) { errln("8!=sizeof(double) - putil.c code may not work"); } + if(4!=sizeof(int32_t)) { + errln("4!=sizeof(int32_t)"); + } + if(4!=sizeof(uint32_t)) { + errln("4!=sizeof(uint32_t)"); + } + if(2!=sizeof(int16_t)) { + errln("2!=sizeof(int16_t)"); + } + if(2!=sizeof(uint16_t)) { + errln("2!=sizeof(uint16_t)"); + } + if(2!=sizeof(UChar)) { + errln("2!=sizeof(UChar)"); + } + if(1!=sizeof(int8_t)) { + errln("1!=sizeof(int8_t)"); + } + if(1!=sizeof(uint8_t)) { + errln("1!=sizeof(uint8_t)"); + } + if(1!=sizeof(UBool)) { + errln("1!=sizeof(UBool)"); + } } void StringTest::TestCharsetFamily(void) { @@ -81,24 +102,18 @@ void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, ch } break; case 1: - name="TestSizeofWCharT"; + name="TestSizeofTypes"; if(exec) { - TestSizeofWCharT(); + TestSizeofTypes(); } break; case 2: - name="TestSizeofInt64"; - if(exec) { - TestSizeofInt64(); - } - break; - case 3: name="TestCharsetFamily"; if(exec) { TestCharsetFamily(); } break; - case 4: + case 3: name="Test_U_STRING"; if(exec) { U_STRING_INIT(ustringVar, "aZ0 -", 5); @@ -115,7 +130,7 @@ void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, ch } } break; - case 5: + case 4: name="Test_UNICODE_STRING"; if(exec) { UnicodeString ustringVar=UNICODE_STRING("aZ0 -", 5); @@ -131,7 +146,7 @@ void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, ch } } break; - case 6: + case 5: name="Test_UNICODE_STRING_SIMPLE"; if(exec) { UnicodeString ustringVar=UNICODE_STRING_SIMPLE("aZ0 -"); @@ -147,7 +162,7 @@ void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, ch } } break; - case 7: + case 6: name="Test_UTF8_COUNT_TRAIL_BYTES"; if(exec) { if(UTF8_COUNT_TRAIL_BYTES(0x7F) != 0 @@ -160,7 +175,7 @@ void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, ch } } break; - case 8: + case 7: name="TestSTLCompatibility"; if(exec) { #if defined(WIN32) && defined(_MSC_VER) diff --git a/icu4c/source/test/intltest/strtest.h b/icu4c/source/test/intltest/strtest.h index 103f255a26..b3c978e03a 100644 --- a/icu4c/source/test/intltest/strtest.h +++ b/icu4c/source/test/intltest/strtest.h @@ -31,8 +31,7 @@ public: private: void TestEndian(void); - void TestSizeofWCharT(void); - void TestSizeofInt64(void); + void TestSizeofTypes(void); void TestCharsetFamily(void); };