diff --git a/icu4c/source/common/propsvec.c b/icu4c/source/common/propsvec.c index d3ece4eab05..41e8b9bbf73 100644 --- a/icu4c/source/common/propsvec.c +++ b/icu4c/source/common/propsvec.c @@ -276,11 +276,13 @@ upvec_setValue(UPropsVectors *pv, U_CAPI uint32_t U_EXPORT2 upvec_getValue(const UPropsVectors *pv, UChar32 c, int32_t column) { uint32_t *row; + UPropsVectors *ncpv; if(pv->isCompacted || c<0 || c>UPVEC_MAX_CP || column<0 || column>=(pv->columns-2)) { return 0; } - row=_findRow((UPropsVectors *)pv, c); + ncpv=(UPropsVectors *)pv; + row=_findRow(ncpv, c); return row[2+column]; } diff --git a/icu4c/source/common/uhash.c b/icu4c/source/common/uhash.c index f3ffd0497ba..0018167d05f 100644 --- a/icu4c/source/common/uhash.c +++ b/icu4c/source/common/uhash.c @@ -798,7 +798,8 @@ uhash_removeElement(UHashtable *hash, const UHashElement* e) { U_ASSERT(hash != NULL); U_ASSERT(e != NULL); if (!IS_EMPTY_OR_DELETED(e->hashcode)) { - return _uhash_internalRemoveElement(hash, (UHashElement*) e).pointer; + UHashElement *nce = (UHashElement *)e; + return _uhash_internalRemoveElement(hash, nce).pointer; } return NULL; } diff --git a/icu4c/source/i18n/repattrn.cpp b/icu4c/source/i18n/repattrn.cpp index bd4518cfe1e..bfe2520ad61 100644 --- a/icu4c/source/i18n/repattrn.cpp +++ b/icu4c/source/i18n/repattrn.cpp @@ -29,8 +29,6 @@ U_NAMESPACE_BEGIN // //-------------------------------------------------------------------------- RegexPattern::RegexPattern() { - UErrorCode status = U_ZERO_ERROR; - // Init all of this instance's data. init(); diff --git a/icu4c/source/i18n/tmutfmt.cpp b/icu4c/source/i18n/tmutfmt.cpp index 1576f69d92c..94e97e1fc84 100644 --- a/icu4c/source/i18n/tmutfmt.cpp +++ b/icu4c/source/i18n/tmutfmt.cpp @@ -800,12 +800,12 @@ U_CDECL_BEGIN * @param val2 the other value in comparison * @return TRUE if 2 values are the same, FALSE otherwise */ -static UBool U_CALLCONV hashTableValueComparator(UHashTok val1, UHashTok val2); +UBool U_CALLCONV tmutfmtHashTableValueComparator(UHashTok val1, UHashTok val2); U_CDECL_END UBool -U_CALLCONV hashTableValueComparator(UHashTok val1, UHashTok val2) { +U_CALLCONV tmutfmtHashTableValueComparator(UHashTok val1, UHashTok val2) { const MessageFormat** pattern1 = (const MessageFormat**)val1.pointer; const MessageFormat** pattern2 = (const MessageFormat**)val2.pointer; return *pattern1[0] == *pattern2[0] && *pattern1[1] == *pattern2[1]; @@ -822,7 +822,7 @@ TimeUnitFormat::initHash(UErrorCode& status) { status = U_MEMORY_ALLOCATION_ERROR; return NULL; } - hTable->setValueCompartor(hashTableValueComparator); + hTable->setValueCompartor(tmutfmtHashTableValueComparator); return hTable; } diff --git a/icu4c/source/i18n/unicode/tmutfmt.h b/icu4c/source/i18n/unicode/tmutfmt.h index 85b4795a43c..aa076aff907 100644 --- a/icu4c/source/i18n/unicode/tmutfmt.h +++ b/icu4c/source/i18n/unicode/tmutfmt.h @@ -1,6 +1,6 @@ /* ******************************************************************************* - * Copyright (C) 2008, Google, International Business Machines Corporation and * + * Copyright (C) 2009, Google, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -38,7 +38,7 @@ U_CDECL_BEGIN /** * @internal ICU 4.2 */ -static UBool U_CALLCONV hashTableValueComparator(UHashTok val1, UHashTok val2) ; +UBool U_CALLCONV tmutfmtHashTableValueComparator(UHashTok val1, UHashTok val2) ; U_CDECL_END @@ -228,7 +228,7 @@ private: PluralRules* fPluralRules; EStyle fStyle; - friend UBool U_CALLCONV hashTableValueComparator(UHashTok val1, UHashTok val2); + friend UBool U_CALLCONV tmutfmtHashTableValueComparator(UHashTok val1, UHashTok val2); void create(const Locale& locale, EStyle style, UErrorCode& status); diff --git a/icu4c/source/test/cintltst/callcoll.c b/icu4c/source/test/cintltst/callcoll.c index f37fa804c9f..36068b521af 100644 --- a/icu4c/source/test/cintltst/callcoll.c +++ b/icu4c/source/test/cintltst/callcoll.c @@ -503,7 +503,10 @@ backAndForth(UCollationElements *iter) /* synwee : changed */ while ((o = ucol_previous(iter, &status)) != UCOL_NULLORDER) { - int32_t offset = ucol_getOffset(iter); +#if TEST_OFFSETS + int32_t offset = +#endif + ucol_getOffset(iter); index -= 1; if (o != orders[index].order) { diff --git a/icu4c/source/test/cintltst/chashtst.c b/icu4c/source/test/cintltst/chashtst.c index c70ae2bca5d..ae83f5b10b1 100644 --- a/icu4c/source/test/cintltst/chashtst.c +++ b/icu4c/source/test/cintltst/chashtst.c @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 2000-2005, International Business Machines +* Copyright (C) 2000-2009, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * Date Name Description @@ -47,26 +47,26 @@ void addHashtableTest(TestNode** root); *********************************************************************/ static UBool -_compareChars(void* a, void* b) { +_compareChars(const void* a, const void* b) { UHashTok s, t; - s.pointer = a; - t.pointer = b; + s.pointer = (void *)a; + t.pointer = (void *)b; return uhash_compareChars(s, t); } static UBool -_compareIChars(void* a, void* b) { +_compareIChars(const void* a, const void* b) { UHashTok s, t; - s.pointer = a; - t.pointer = b; + s.pointer = (void *)a; + t.pointer = (void *)b; return uhash_compareIChars(s, t); } static UBool -_compareUChars(void* a, void* b) { +_compareUChars(const void* a, const void* b) { UHashTok s, t; - s.pointer = a; - t.pointer = b; + s.pointer = (void *)a; + t.pointer = (void *)b; return uhash_compareUChars(s, t); } diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c index 4e0a860c886..69f8effe48c 100644 --- a/icu4c/source/test/cintltst/cloctst.c +++ b/icu4c/source/test/cintltst/cloctst.c @@ -2605,7 +2605,7 @@ typedef struct OrientationStructTag { ULayoutType line; } OrientationStruct; -const char* ULayoutTypeToString(ULayoutType type) +static const char* ULayoutTypeToString(ULayoutType type) { switch(type) { @@ -5205,7 +5205,7 @@ static void TestLikelySubtags() const char* const minimal = basic_maximize_data[i][0]; const char* const maximal = basic_maximize_data[i][1]; - const int32_t length = + /* const int32_t length = */ uloc_addLikelySubtags( minimal, buffer, @@ -5231,7 +5231,7 @@ static void TestLikelySubtags() const char* const maximal = basic_minimize_data[i][0]; const char* const minimal = basic_minimize_data[i][1]; - const int32_t length = + /* const int32_t length = */ uloc_minimizeSubtags( maximal, buffer, @@ -5258,7 +5258,7 @@ static void TestLikelySubtags() const char* const minimal = full_data[i][0]; const char* const maximal = full_data[i][1]; - const int32_t length = + /* const int32_t length = */ uloc_addLikelySubtags( minimal, buffer, @@ -5286,7 +5286,7 @@ static void TestLikelySubtags() if (strlen(maximal) > 0) { - const int32_t length = + /* const int32_t length = */ uloc_minimizeSubtags( maximal, buffer, diff --git a/icu4c/source/test/cintltst/creststn.c b/icu4c/source/test/cintltst/creststn.c index ba95321204b..9dcef6e2153 100644 --- a/icu4c/source/test/cintltst/creststn.c +++ b/icu4c/source/test/cintltst/creststn.c @@ -37,8 +37,6 @@ static int32_t pass; static int32_t fail; -static void TestCLDRVersion(); - /*****************************************************************************/ /** @@ -182,6 +180,7 @@ static void TestGetFunctionalEquivalent(void); static void TestCLDRStyleAliases(void); static void TestFallbackCodes(void); static void TestGetUTF8String(void); +static void TestCLDRVersion(void); /***************************************************************************************/ @@ -2956,7 +2955,7 @@ TestGetUTF8String() { ures_close(res); } -void TestCLDRVersion() { +static void TestCLDRVersion(void) { UVersionInfo zeroVersion; UVersionInfo testExpect; UVersionInfo testCurrent; @@ -2983,9 +2982,6 @@ void TestCLDRVersion() { { UResourceBundle *res; const char *testdatapath; - char buffer8[16]; - const char *s8; - int32_t length8; status = U_ZERO_ERROR; testdatapath = loadTestData(&status); diff --git a/icu4c/source/test/cintltst/spooftest.c b/icu4c/source/test/cintltst/spooftest.c index d8e96bd3cf1..c7c839ec28a 100644 --- a/icu4c/source/test/cintltst/spooftest.c +++ b/icu4c/source/test/cintltst/spooftest.c @@ -63,29 +63,6 @@ log_err("Test Failure at file %s, line %d: \"%s\" is false.\n", __FILE__, __LINE } -static void test_assert_string(const char *expected, const UChar *actual, UBool nulTerm, const char *file, int line) { - char buf_inside_macro[120]; - int32_t len = (int32_t)strlen(expected); - UBool success; - if (nulTerm) { - u_austrncpy(buf_inside_macro, (actual), len+1); - buf_inside_macro[len+2] = 0; - success = (strcmp((expected), buf_inside_macro) == 0); - } else { - u_austrncpy(buf_inside_macro, (actual), len); - buf_inside_macro[len+1] = 0; - success = (strncmp((expected), buf_inside_macro, len) == 0); - } - if (success == FALSE) { - log_err("Failure at file %s, line %d, expected \"%s\", got \"%s\"\n", - file, line, (expected), buf_inside_macro); - } -} - -#define TEST_ASSERT_STRING(expected, actual, nulTerm) test_assert_string(expected, actual, nulTerm, __FILE__, __LINE__) - - - static void TestUSpoofCAPI(void); void addUSpoofTest(TestNode** root); diff --git a/icu4c/source/test/cintltst/spreptst.c b/icu4c/source/test/cintltst/spreptst.c index ed7ccbf294a..f0d18581929 100644 --- a/icu4c/source/test/cintltst/spreptst.c +++ b/icu4c/source/test/cintltst/spreptst.c @@ -751,7 +751,7 @@ UStringPrepProfileType getTypeFromProfileName(const char* profileName) { } static void TestStringPrepProfiles(void) { UErrorCode status = U_ZERO_ERROR; - char *profileName; + const char *profileName = NULL; UChar src[SPREP_PROFILE_TEST_MAX_LENGTH]; UChar expected[SPREP_PROFILE_TEST_MAX_LENGTH]; UChar result[SPREP_PROFILE_TEST_MAX_LENGTH]; diff --git a/icu4c/source/test/cintltst/ucnvseltst.c b/icu4c/source/test/cintltst/ucnvseltst.c index bbb0580fcbd..076120864e0 100644 --- a/icu4c/source/test/cintltst/ucnvseltst.c +++ b/icu4c/source/test/cintltst/ucnvseltst.c @@ -30,6 +30,7 @@ #define TDSRCPATH ".." U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING static void TestSelector(void); +void addCnvSelTest(TestNode** root); /* Declaration required to suppress compiler warnings. */ void addCnvSelTest(TestNode** root) { diff --git a/icu4c/source/test/intltest/ssearch.cpp b/icu4c/source/test/intltest/ssearch.cpp index c95768cb519..a48648b8a9f 100644 --- a/icu4c/source/test/intltest/ssearch.cpp +++ b/icu4c/source/test/intltest/ssearch.cpp @@ -1561,7 +1561,7 @@ const char *cPattern = "maketh houndes ete hem"; //j = (j + i)%5; } - printf("%d, %d\n", pm-longishText, j); + printf("%ld, %d\n", pm-longishText, j); #ifndef TEST_BOYER_MOORE usearch_close(uss); #else diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index f45be294e88..3a101ce9150 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -215,7 +215,7 @@ enum { }; static char libFileNames[LIB_FILENAMES_SIZE][256]; -static void pkg_checkFlag(UPKGOptions *o); +static UPKGOptions *pkg_checkFlag(UPKGOptions *o); const char options_help[][320]={ "Set the data name", @@ -1271,7 +1271,7 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U } #endif -static void pkg_checkFlag(UPKGOptions *o) { +static UPKGOptions *pkg_checkFlag(UPKGOptions *o) { #ifdef U_AIX /* AIX needs a map file. */ char *flag = NULL; @@ -1372,6 +1372,9 @@ static void pkg_checkFlag(UPKGOptions *o) { } } #endif + // Don't really need a return value, just need to stop compiler warnings about + // the unused parameter 'o' on platforms where it is not otherwise used. + return o; } static void loadLists(UPKGOptions *o, UErrorCode *status) diff --git a/icu4c/source/tools/toolutil/pkg_genc.h b/icu4c/source/tools/toolutil/pkg_genc.h index 3c23d3d8b41..750b363a366 100644 --- a/icu4c/source/tools/toolutil/pkg_genc.h +++ b/icu4c/source/tools/toolutil/pkg_genc.h @@ -10,7 +10,7 @@ #include "unicode/utypes.h" U_INTERNAL void U_EXPORT2 -printAssemblyHeadersToStdErr(); +printAssemblyHeadersToStdErr(void); U_INTERNAL UBool U_EXPORT2 checkAssemblyHeaderName(const char* optAssembly);