diff --git a/icu4c/source/common/brkiter.cpp b/icu4c/source/common/brkiter.cpp
index 26f7b6a82e8..10e32e9a0db 100644
--- a/icu4c/source/common/brkiter.cpp
+++ b/icu4c/source/common/brkiter.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 1997-2010, International Business Machines Corporation and
+* Copyright (C) 1997-2011, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@@ -94,7 +94,7 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, int32_t kind,
// Use the string if we found it
if (U_SUCCESS(status) && brkfname) {
uprv_strncpy(actualLocale,
- ures_getLocale(brkName, &status),
+ ures_getLocaleInternal(brkName, &status),
sizeof(actualLocale)/sizeof(actualLocale[0]));
UChar* extStart=u_strchr(brkfname, 0x002e);
diff --git a/icu4c/source/common/common.vcxproj b/icu4c/source/common/common.vcxproj
index ecd8f034dff..8afd9ec3531 100644
--- a/icu4c/source/common/common.vcxproj
+++ b/icu4c/source/common/common.vcxproj
@@ -236,7 +236,7 @@
-
+
@@ -264,9 +264,9 @@
-
+
-
+
@@ -279,7 +279,7 @@
false
-
+
false
false
false
@@ -301,21 +301,21 @@
false
-
-
+
+
-
-
+
+
-
+
@@ -347,7 +347,7 @@
-
+
@@ -360,10 +360,10 @@
-
+
-
+
@@ -377,9 +377,9 @@
-
+
-
+
@@ -413,7 +413,7 @@
-
+
@@ -425,10 +425,10 @@
-
-
-
-
+
+
+
+
@@ -1749,4 +1749,4 @@ copy "%(FullPath)" ..\..\include\unicode\%(FileName).h
-
+
diff --git a/icu4c/source/common/common.vcxproj.filters b/icu4c/source/common/common.vcxproj.filters
index 63911235f68..562c4206331 100644
--- a/icu4c/source/common/common.vcxproj.filters
+++ b/icu4c/source/common/common.vcxproj.filters
@@ -61,7 +61,7 @@
bidi
-
+
bidi
@@ -130,13 +130,13 @@
collections
-
+
collections
collections
-
+
collections
@@ -160,7 +160,7 @@
configuration
-
+
configuration
@@ -181,10 +181,10 @@
conversion
-
+
conversion
-
+
conversion
@@ -196,10 +196,10 @@
conversion
-
+
conversion
-
+
conversion
@@ -220,7 +220,7 @@
conversion
-
+
conversion
@@ -286,7 +286,7 @@
formatting
-
+
idna
@@ -325,7 +325,7 @@
locales & resources
-
+
locales & resources
@@ -334,7 +334,7 @@
locales & resources
-
+
locales & resources
@@ -373,13 +373,13 @@
properties & sets
-
+
properties & sets
properties & sets
-
+
properties & sets
@@ -463,7 +463,7 @@
strings
-
+
strings
@@ -490,16 +490,16 @@
strings
-
+
strings
-
+
strings
-
+
strings
-
+
strings
diff --git a/icu4c/source/common/locid.cpp b/icu4c/source/common/locid.cpp
index e6a93eaf1c4..3a8690812c0 100644
--- a/icu4c/source/common/locid.cpp
+++ b/icu4c/source/common/locid.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
- * Copyright (C) 1997-2010, International Business Machines
+ * Copyright (C) 1997-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
diff --git a/icu4c/source/common/punycode.c b/icu4c/source/common/punycode.cpp
similarity index 99%
rename from icu4c/source/common/punycode.c
rename to icu4c/source/common/punycode.cpp
index bf85b67f6f1..e3c5f7eff47 100644
--- a/icu4c/source/common/punycode.c
+++ b/icu4c/source/common/punycode.cpp
@@ -1,11 +1,11 @@
/*
*******************************************************************************
*
-* Copyright (C) 2002-2010, International Business Machines
+* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: punycode.c
+* file name: punycode.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -86,7 +86,7 @@ Disclaimer and license
* range 0 to BASE-1. The lowercase form is used unless the uppercase flag is
* nonzero, in which case the uppercase form is used.
*/
-static U_INLINE char
+static inline char
digitToBasic(int32_t digit, UBool uppercase) {
/* 0..25 map to ASCII a..z or A..Z */
/* 26..35 map to ASCII 0..9 */
@@ -133,7 +133,7 @@ basicToDigit[256]={
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
-static U_INLINE char
+static inline char
asciiCaseMap(char b, UBool uppercase) {
if(uppercase) {
if(_SMALL_A<=b && b<=_SMALL_Z) {
diff --git a/icu4c/source/common/putil.c b/icu4c/source/common/putil.cpp
similarity index 99%
rename from icu4c/source/common/putil.c
rename to icu4c/source/common/putil.cpp
index 48838addda7..15cea60d50d 100644
--- a/icu4c/source/common/putil.c
+++ b/icu4c/source/common/putil.cpp
@@ -144,6 +144,8 @@ Cleanly installed Solaris can use this #define.
#include "icucfg.h"
#endif
+#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
+
/* Define the extension for data files, again... */
#define DATA_TYPE "dat"
@@ -805,7 +807,7 @@ static const char* remapShortTimeZone(const char *stdID, const char *dstID, int3
#ifdef DEBUG_TZNAME
fprintf(stderr, "TZ=%s std=%s dst=%s daylight=%d offset=%d\n", getenv("TZ"), stdID, dstID, daylightType, offset);
#endif
- for (idx = 0; idx < (int32_t)sizeof(OFFSET_ZONE_MAPPINGS)/sizeof(OFFSET_ZONE_MAPPINGS[0]); idx++)
+ for (idx = 0; idx < LENGTHOF(OFFSET_ZONE_MAPPINGS); idx++)
{
if (offset == OFFSET_ZONE_MAPPINGS[idx].offsetSeconds
&& daylightType == OFFSET_ZONE_MAPPINGS[idx].daylightType
@@ -1479,7 +1481,7 @@ The leftmost codepage (.xxx) wins.
if ((p = uprv_strchr(posixID, '.')) != NULL) {
/* assume new locale can't be larger than old one? */
- correctedPOSIXLocale = uprv_malloc(uprv_strlen(posixID)+1);
+ correctedPOSIXLocale = reinterpret_cast(uprv_malloc(uprv_strlen(posixID)+1));
/* Exit on memory allocation error. */
if (correctedPOSIXLocale == NULL) {
return NULL;
@@ -1496,7 +1498,7 @@ The leftmost codepage (.xxx) wins.
/* Note that we scan the *uncorrected* ID. */
if ((p = uprv_strrchr(posixID, '@')) != NULL) {
if (correctedPOSIXLocale == NULL) {
- correctedPOSIXLocale = uprv_malloc(uprv_strlen(posixID)+1);
+ correctedPOSIXLocale = reinterpret_cast(uprv_malloc(uprv_strlen(posixID)+1));
/* Exit on memory allocation error. */
if (correctedPOSIXLocale == NULL) {
return NULL;
@@ -1847,7 +1849,7 @@ getCodepageFromPOSIXID(const char *localeName, char * buffer, int32_t buffCapaci
localeBuf[localeCapacity-1] = 0; /* ensure NULL termination */
name = uprv_strncpy(buffer, name+1, buffCapacity);
buffer[buffCapacity-1] = 0; /* ensure NULL termination */
- if ((variant = (uprv_strchr(name, '@'))) != NULL) {
+ if ((variant = const_cast(uprv_strchr(name, '@'))) != NULL) {
*variant = 0;
}
name = remapPlatformDependentCodepage(localeBuf, name);
diff --git a/icu4c/source/common/resbund.cpp b/icu4c/source/common/resbund.cpp
index e1a58d2dc7e..f87a5724160 100644
--- a/icu4c/source/common/resbund.cpp
+++ b/icu4c/source/common/resbund.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1997-2010, International Business Machines
+* Copyright (C) 1997-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
diff --git a/icu4c/source/common/ucase.c b/icu4c/source/common/ucase.cpp
similarity index 99%
rename from icu4c/source/common/ucase.c
rename to icu4c/source/common/ucase.cpp
index 0f9c526e662..d5eb60ede9d 100644
--- a/icu4c/source/common/ucase.c
+++ b/icu4c/source/common/ucase.cpp
@@ -1,11 +1,11 @@
/*
*******************************************************************************
*
-* Copyright (C) 2004-2010, International Business Machines
+* Copyright (C) 2004-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: ucase.c
+* file name: ucase.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -52,7 +52,7 @@ ucase_getSingleton() {
/* set of property starts for UnicodeSet ------------------------------------ */
static UBool U_CALLCONV
-_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
+_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 /*end*/, uint32_t /*value*/) {
/* add the start code point to the USet */
const USetAdder *sa=(const USetAdder *)context;
sa->add(sa->set, start);
@@ -308,7 +308,7 @@ ucase_addCaseClosure(const UCaseProps *csp, UChar32 c, const USetAdder *sa) {
* compare s, which has a length, with t, which has a maximum length or is NUL-terminated
* must be length>0 and max>0 and length<=max
*/
-static U_INLINE int32_t
+static inline int32_t
strcmpMax(const UChar *s, int32_t length, const UChar *t, int32_t max) {
int32_t c1, c2;
@@ -415,7 +415,7 @@ ucase_getTypeOrIgnorable(const UCaseProps *csp, UChar32 c) {
}
/** @return UCASE_NO_DOT, UCASE_SOFT_DOTTED, UCASE_ABOVE, UCASE_OTHER_ACCENT */
-static U_INLINE int32_t
+static inline int32_t
getDotType(const UCaseProps *csp, UChar32 c) {
uint16_t props=UTRIE2_GET16(&csp->trie, c);
if(!PROPS_HAS_EXCEPTION(props)) {
diff --git a/icu4c/source/common/ucase.h b/icu4c/source/common/ucase.h
index be28fa24c8d..4c1ce84f7a1 100644
--- a/icu4c/source/common/ucase.h
+++ b/icu4c/source/common/ucase.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 2004-2010, International Business Machines
+* Copyright (C) 2004-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -161,6 +161,8 @@ struct UCaseContext {
};
typedef struct UCaseContext UCaseContext;
+#define UCASECONTEXT_INITIALIZER { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+
enum {
/**
* For string case mappings, a single character (a code point) is mapped
diff --git a/icu4c/source/common/ucasemap.c b/icu4c/source/common/ucasemap.cpp
similarity index 98%
rename from icu4c/source/common/ucasemap.c
rename to icu4c/source/common/ucasemap.cpp
index 9f94235ae91..d7543df87dd 100644
--- a/icu4c/source/common/ucasemap.c
+++ b/icu4c/source/common/ucasemap.cpp
@@ -1,11 +1,11 @@
/*
*******************************************************************************
*
-* Copyright (C) 2005-2010, International Business Machines
+* Copyright (C) 2005-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: ucasemap.c
+* file name: ucasemap.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -102,7 +102,7 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) {
}
U_CAPI void U_EXPORT2
-ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode) {
+ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode * /*pErrorCode*/) {
csm->options=options;
}
@@ -114,7 +114,7 @@ ucasemap_getBreakIterator(const UCaseMap *csm) {
}
U_CAPI void U_EXPORT2
-ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode) {
+ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode * /*pErrorCode*/) {
ubrk_close(csm->iter);
csm->iter=iterToAdopt;
}
@@ -126,7 +126,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode
/* TODO(markus): Move to a new, separate utf8case.c file. */
/* append a full case mapping result, see UCASE_MAX_STRING_LENGTH */
-static U_INLINE int32_t
+static inline int32_t
appendResult(uint8_t *dest, int32_t destIndex, int32_t destCapacity,
int32_t result, const UChar *s) {
UChar32 c;
@@ -490,7 +490,7 @@ caseMap(const UCaseMap *csm,
destLength=utf8_foldCase(csm->csp, dest, destCapacity, src, srcLength,
csm->options, pErrorCode);
} else {
- UCaseContext csc={ NULL };
+ UCaseContext csc=UCASECONTEXT_INITIALIZER;
csc.p=(void *)src;
csc.limit=srcLength;
diff --git a/icu4c/source/common/ucnv2022.c b/icu4c/source/common/ucnv2022.cpp
similarity index 99%
rename from icu4c/source/common/ucnv2022.c
rename to icu4c/source/common/ucnv2022.cpp
index 22ebe244c83..628804846cc 100644
--- a/icu4c/source/common/ucnv2022.c
+++ b/icu4c/source/common/ucnv2022.cpp
@@ -1,9 +1,9 @@
/*
**********************************************************************
-* Copyright (C) 2000-2010, International Business Machines
+* Copyright (C) 2000-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
-* file name: ucnv2022.c
+* file name: ucnv2022.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -393,15 +393,19 @@ static void
T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args, UErrorCode* err);
#endif
+namespace {
+
/*const UConverterSharedData _ISO2022Data;*/
-static const UConverterSharedData _ISO2022JPData;
-static const UConverterSharedData _ISO2022KRData;
-static const UConverterSharedData _ISO2022CNData;
+extern const UConverterSharedData _ISO2022JPData;
+extern const UConverterSharedData _ISO2022KRData;
+extern const UConverterSharedData _ISO2022CNData;
+
+} // namespace
/*************** Converter implementations ******************/
/* The purpose of this function is to get around gcc compiler warnings. */
-static U_INLINE void
+static inline void
fromUWriteUInt8(UConverter *cnv,
const char *bytes, int32_t length,
uint8_t **target, const char *targetLimit,
@@ -416,8 +420,8 @@ fromUWriteUInt8(UConverter *cnv,
}
-static U_INLINE void
-setInitialStateToUnicodeKR(UConverter* converter, UConverterDataISO2022 *myConverterData){
+static inline void
+setInitialStateToUnicodeKR(UConverter* /*converter*/, UConverterDataISO2022 *myConverterData){
if(myConverterData->version == 1) {
UConverter *cnv = myConverterData->currentConverter;
@@ -427,7 +431,7 @@ setInitialStateToUnicodeKR(UConverter* converter, UConverterDataISO2022 *myConve
}
}
-static U_INLINE void
+static inline void
setInitialStateFromUnicodeKR(UConverter* converter,UConverterDataISO2022 *myConverterData){
/* in ISO-2022-KR the designator sequence appears only once
* in a file so we append it only once
@@ -456,7 +460,7 @@ _ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataISO2022));
if(cnv->extraInfo != NULL) {
UConverterNamePieces stackPieces;
- UConverterLoadArgs stackArgs={ (int32_t)sizeof(UConverterLoadArgs) };
+ UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
UConverterDataISO2022 *myConverterData=(UConverterDataISO2022 *) cnv->extraInfo;
uint32_t version;
@@ -1005,10 +1009,10 @@ DONE:
*to determine the longest possible convertible
*data stream
*/
-static U_INLINE const char*
+static inline const char*
getEndOfBuffer_2022(const char** source,
const char* sourceLimit,
- UBool flush){
+ UBool /*flush*/){
const char* mySource = *source;
@@ -1057,7 +1061,7 @@ getEndOfBuffer_2022(const char** source,
* any future change in _MBCSFromUChar32() function should be reflected here.
* @return number of bytes in *value; negative number if fallback; 0 if no mapping
*/
-static U_INLINE int32_t
+static inline int32_t
MBCS_FROM_UCHAR32_ISO2022(UConverterSharedData* sharedData,
UChar32 c,
uint32_t* value,
@@ -1128,7 +1132,7 @@ MBCS_FROM_UCHAR32_ISO2022(UConverterSharedData* sharedData,
* @param retval pointer to output byte
* @return 1 roundtrip byte 0 no mapping -1 fallback byte
*/
-static U_INLINE int32_t
+static inline int32_t
MBCS_SINGLE_FROM_UCHAR32(UConverterSharedData* sharedData,
UChar32 c,
uint32_t* retval,
@@ -1161,7 +1165,7 @@ MBCS_SINGLE_FROM_UCHAR32(UConverterSharedData* sharedData,
* to move it to the ISO 2022 range 21..7E.
* Return 0 if out of range.
*/
-static U_INLINE uint32_t
+static inline uint32_t
_2022FromGR94DBCS(uint32_t value) {
if( (uint16_t)(value - 0xa1a1) <= (0xfefe - 0xa1a1) &&
(uint8_t)(value - 0xa1) <= (0xfe - 0xa1)
@@ -1178,7 +1182,7 @@ _2022FromGR94DBCS(uint32_t value) {
* 2 byte value that is in the range A1..FE for each byte. Otherwise it returns the 2022 code point
* unchanged.
*/
-static U_INLINE uint32_t
+static inline uint32_t
_2022ToGR94DBCS(uint32_t value) {
uint32_t returnValue = value + 0x8080;
if( (uint16_t)(returnValue - 0xa1a1) <= (0xfefe - 0xa1a1) &&
@@ -1430,7 +1434,7 @@ static const int8_t escSeqCharsLen[] ={
*/
/* Map 00..7F to Unicode according to JIS X 0201. */
-static U_INLINE uint32_t
+static inline uint32_t
jisx201ToU(uint32_t value) {
if(value < 0x5c) {
return value;
@@ -1444,7 +1448,7 @@ jisx201ToU(uint32_t value) {
}
/* Map Unicode to 00..7F according to JIS X 0201. Return U+FFFE if unmappable. */
-static U_INLINE uint32_t
+static inline uint32_t
jisx201FromU(uint32_t value) {
if(value<=0x7f) {
if(value!=0x5c && value!=0x7e) {
@@ -1463,7 +1467,7 @@ jisx201FromU(uint32_t value) {
* to JIS X 0208, and convert it to a pair of 21..7E bytes.
* Return 0 if the byte pair is out of range.
*/
-static U_INLINE uint32_t
+static inline uint32_t
_2022FromSJIS(uint32_t value) {
uint8_t trail;
@@ -1501,7 +1505,7 @@ _2022FromSJIS(uint32_t value) {
* Some invalid byte values already turn into equally invalid Shift-JIS
* byte values and need not be tested explicitly.
*/
-static U_INLINE void
+static inline void
_2022ToSJIS(uint8_t c1, uint8_t c2, char bytes[2]) {
if(c1&1) {
++c1;
@@ -3732,7 +3736,10 @@ static const UConverterImpl _ISO2022Impl={
_ISO2022getName,
_ISO_2022_WriteSub,
_ISO_2022_SafeClone,
- _ISO_2022_GetUnicodeSet
+ _ISO_2022_GetUnicodeSet,
+
+ NULL,
+ NULL
};
static const UConverterStaticData _ISO2022StaticData={
sizeof(UConverterStaticData),
@@ -3758,7 +3765,7 @@ const UConverterSharedData _ISO2022Data={
&_ISO2022StaticData,
FALSE,
&_ISO2022Impl,
- 0
+ 0, UCNV_MBCS_TABLE_INITIALIZER
};
/*************JP****************/
@@ -3782,7 +3789,10 @@ static const UConverterImpl _ISO2022JPImpl={
_ISO2022getName,
_ISO_2022_WriteSub,
_ISO_2022_SafeClone,
- _ISO_2022_GetUnicodeSet
+ _ISO_2022_GetUnicodeSet,
+
+ NULL,
+ NULL
};
static const UConverterStaticData _ISO2022JPStaticData={
sizeof(UConverterStaticData),
@@ -3800,7 +3810,10 @@ static const UConverterStaticData _ISO2022JPStaticData={
0,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
};
-static const UConverterSharedData _ISO2022JPData={
+
+namespace {
+
+const UConverterSharedData _ISO2022JPData={
sizeof(UConverterSharedData),
~((uint32_t) 0),
NULL,
@@ -3808,9 +3821,11 @@ static const UConverterSharedData _ISO2022JPData={
&_ISO2022JPStaticData,
FALSE,
&_ISO2022JPImpl,
- 0
+ 0, UCNV_MBCS_TABLE_INITIALIZER
};
+} // namespace
+
/************* KR ***************/
static const UConverterImpl _ISO2022KRImpl={
UCNV_ISO_2022,
@@ -3832,7 +3847,10 @@ static const UConverterImpl _ISO2022KRImpl={
_ISO2022getName,
_ISO_2022_WriteSub,
_ISO_2022_SafeClone,
- _ISO_2022_GetUnicodeSet
+ _ISO_2022_GetUnicodeSet,
+
+ NULL,
+ NULL
};
static const UConverterStaticData _ISO2022KRStaticData={
sizeof(UConverterStaticData),
@@ -3850,7 +3868,10 @@ static const UConverterStaticData _ISO2022KRStaticData={
0,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
};
-static const UConverterSharedData _ISO2022KRData={
+
+namespace {
+
+const UConverterSharedData _ISO2022KRData={
sizeof(UConverterSharedData),
~((uint32_t) 0),
NULL,
@@ -3858,9 +3879,11 @@ static const UConverterSharedData _ISO2022KRData={
&_ISO2022KRStaticData,
FALSE,
&_ISO2022KRImpl,
- 0
+ 0, UCNV_MBCS_TABLE_INITIALIZER
};
+} // namespace
+
/*************** CN ***************/
static const UConverterImpl _ISO2022CNImpl={
@@ -3883,7 +3906,10 @@ static const UConverterImpl _ISO2022CNImpl={
_ISO2022getName,
_ISO_2022_WriteSub,
_ISO_2022_SafeClone,
- _ISO_2022_GetUnicodeSet
+ _ISO_2022_GetUnicodeSet,
+
+ NULL,
+ NULL
};
static const UConverterStaticData _ISO2022CNStaticData={
sizeof(UConverterStaticData),
@@ -3901,7 +3927,10 @@ static const UConverterStaticData _ISO2022CNStaticData={
0,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
};
-static const UConverterSharedData _ISO2022CNData={
+
+namespace {
+
+const UConverterSharedData _ISO2022CNData={
sizeof(UConverterSharedData),
~((uint32_t) 0),
NULL,
@@ -3909,9 +3938,9 @@ static const UConverterSharedData _ISO2022CNData={
&_ISO2022CNStaticData,
FALSE,
&_ISO2022CNImpl,
- 0
+ 0, UCNV_MBCS_TABLE_INITIALIZER
};
-
+} // namespace
#endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */
diff --git a/icu4c/source/common/ucnv_bld.c b/icu4c/source/common/ucnv_bld.cpp
similarity index 98%
rename from icu4c/source/common/ucnv_bld.c
rename to icu4c/source/common/ucnv_bld.cpp
index 657e5c811f1..efef4f24d64 100644
--- a/icu4c/source/common/ucnv_bld.c
+++ b/icu4c/source/common/ucnv_bld.cpp
@@ -1,11 +1,11 @@
/*
********************************************************************
* COPYRIGHT:
- * Copyright (c) 1996-2010, International Business Machines Corporation and
+ * Copyright (c) 1996-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************
*
- * uconv_bld.c:
+ * uconv_bld.cpp:
*
* Defines functions that are used in the creation/initialization/deletion
* of converters and related structures.
@@ -220,8 +220,8 @@ static UBool U_CALLCONV ucnv_cleanup(void) {
}
static UBool U_CALLCONV
-isCnvAcceptable(void *context,
- const char *type, const char *name,
+isCnvAcceptable(void * /*context*/,
+ const char * /*type*/, const char * /*name*/,
const UDataInfo *pInfo) {
return (UBool)(
pInfo->size>=20 &&
@@ -574,7 +574,7 @@ ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err) {
* It must be sharedData->referenceCounter != ~0
* and this function must be called inside umtx_lock(&cnvCacheMutex).
*/
-void
+U_CAPI void
ucnv_unload(UConverterSharedData *sharedData) {
if(sharedData != NULL) {
if (sharedData->referenceCounter > 0) {
@@ -587,7 +587,7 @@ ucnv_unload(UConverterSharedData *sharedData) {
}
}
-void
+U_CFUNC void
ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData)
{
/*
@@ -595,14 +595,14 @@ ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData)
in multithreaded applications because the value never changes.
Don't check referenceCounter for any other value.
*/
- if(sharedData != NULL && sharedData->referenceCounter != ~0) {
+ if(sharedData != NULL && sharedData->referenceCounter != (uint32_t)~0) {
umtx_lock(&cnvCacheMutex);
ucnv_unload(sharedData);
umtx_unlock(&cnvCacheMutex);
}
}
-void
+U_CFUNC void
ucnv_incrementRefCount(UConverterSharedData *sharedData)
{
/*
@@ -610,7 +610,7 @@ ucnv_incrementRefCount(UConverterSharedData *sharedData)
in multithreaded applications because the value never changes.
Don't check referenceCounter for any other value.
*/
- if(sharedData != NULL && sharedData->referenceCounter != ~0) {
+ if(sharedData != NULL && sharedData->referenceCounter != (uint32_t)~0) {
umtx_lock(&cnvCacheMutex);
sharedData->referenceCounter++;
umtx_unlock(&cnvCacheMutex);
@@ -710,7 +710,7 @@ parseConverterOptions(const char *inName,
* -Call dataConverter initializer (Data=TRUE, Cached=TRUE)
* -Call AlgorithmicConverter initializer (Data=FALSE, Cached=TRUE)
*/
-UConverterSharedData *
+U_CFUNC UConverterSharedData *
ucnv_loadSharedData(const char *converterName,
UConverterNamePieces *pPieces,
UConverterLoadArgs *pArgs,
@@ -824,11 +824,11 @@ ucnv_loadSharedData(const char *converterName,
return mySharedConverterData;
}
-UConverter *
+U_CAPI UConverter *
ucnv_createConverter(UConverter *myUConverter, const char *converterName, UErrorCode * err)
{
UConverterNamePieces stackPieces;
- UConverterLoadArgs stackArgs={ (int32_t)sizeof(UConverterLoadArgs) };
+ UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
UConverterSharedData *mySharedConverterData;
UTRACE_ENTRY_OC(UTRACE_UCNV_OPEN);
@@ -858,7 +858,7 @@ U_CFUNC UBool
ucnv_canCreateConverter(const char *converterName, UErrorCode *err) {
UConverter myUConverter;
UConverterNamePieces stackPieces;
- UConverterLoadArgs stackArgs={ (int32_t)sizeof(UConverterLoadArgs) };
+ UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
UConverterSharedData *mySharedConverterData;
UTRACE_ENTRY_OC(UTRACE_UCNV_OPEN);
@@ -886,7 +886,7 @@ ucnv_createAlgorithmicConverter(UConverter *myUConverter,
UErrorCode *err) {
UConverter *cnv;
const UConverterSharedData *sharedData;
- UConverterLoadArgs stackArgs={ (int32_t)sizeof(UConverterLoadArgs) };
+ UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
UTRACE_ENTRY_OC(UTRACE_UCNV_OPEN_ALGORITHMIC);
UTRACE_DATA1(UTRACE_OPEN_CLOSE, "open algorithmic converter type %d", (int32_t)type);
@@ -903,7 +903,7 @@ ucnv_createAlgorithmicConverter(UConverter *myUConverter,
in multithreaded applications because the value never changes.
Don't check referenceCounter for any other value.
*/
- if(sharedData == NULL || sharedData->referenceCounter != ~0) {
+ if(sharedData == NULL || sharedData->referenceCounter != (uint32_t)~0) {
/* not a valid type, or not an algorithmic converter */
*err = U_ILLEGAL_ARGUMENT_ERROR;
UTRACE_EXIT_STATUS(U_ILLEGAL_ARGUMENT_ERROR);
@@ -921,13 +921,13 @@ ucnv_createAlgorithmicConverter(UConverter *myUConverter,
return cnv;
}
-UConverter*
+U_CFUNC UConverter*
ucnv_createConverterFromPackage(const char *packageName, const char *converterName, UErrorCode * err)
{
UConverter *myUConverter;
UConverterSharedData *mySharedConverterData;
UConverterNamePieces stackPieces;
- UConverterLoadArgs stackArgs={ (int32_t)sizeof(UConverterLoadArgs) };
+ UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
UTRACE_ENTRY_OC(UTRACE_UCNV_OPEN_PACKAGE);
@@ -973,7 +973,7 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
}
-UConverter*
+U_CFUNC UConverter*
ucnv_createConverterFromSharedData(UConverter *myUConverter,
UConverterSharedData *mySharedConverterData,
UConverterLoadArgs *pArgs,
@@ -1194,10 +1194,10 @@ would be the same type of default converter for a successive string.
Since the name is a returned via ucnv_getDefaultName without copying,
you shouldn't be modifying or deleting the string from a separate thread.
*/
-static U_INLINE void
+static inline void
internalSetName(const char *name, UErrorCode *status) {
UConverterNamePieces stackPieces;
- UConverterLoadArgs stackArgs={ (int32_t)sizeof(UConverterLoadArgs) };
+ UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
int32_t length=(int32_t)(uprv_strlen(name));
UBool containsOption = (UBool)(uprv_strchr(name, UCNV_OPTION_SEP_CHAR) != NULL);
const UConverterSharedData *algorithmicSharedData;
@@ -1396,7 +1396,7 @@ ucnv_swap(const UDataSwapper *ds,
staticDataSize=ds->readUInt32(inStaticData->structSize);
} else {
length-=headerSize;
- if( lengthreadUInt32(inStaticData->structSize))
) {
udata_printError(ds, "ucnv_swap(): too few bytes (%d after header) for an ICU .cnv conversion table\n",
@@ -1437,7 +1437,7 @@ ucnv_swap(const UDataSwapper *ds,
inMBCSHeader=(const _MBCSHeader *)inBytes;
outMBCSHeader=(_MBCSHeader *)outBytes;
- if(0<=length && lengthreferenceCounter != ~0
* and this function must be called inside umtx_lock(&cnvCacheMutex).
*/
-void
+U_CAPI void
ucnv_unload(UConverterSharedData *sharedData);
/**
diff --git a/icu4c/source/common/ucnv_cnv.h b/icu4c/source/common/ucnv_cnv.h
index 6334b2417f8..402e2c946b8 100644
--- a/icu4c/source/common/ucnv_cnv.h
+++ b/icu4c/source/common/ucnv_cnv.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1999-2010, International Business Machines
+* Copyright (C) 1999-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -56,6 +56,9 @@ typedef struct {
const char *pkg, *name, *locale;
} UConverterLoadArgs;
+#define UCNV_LOAD_ARGS_INITIALIZER \
+ { (int32_t)sizeof(UConverterLoadArgs), 0, FALSE, FALSE, 0, 0, NULL, NULL, NULL }
+
typedef void (*UConverterLoad) (UConverterSharedData *sharedData,
UConverterLoadArgs *pArgs,
const uint8_t *raw, UErrorCode *pErrorCode);
diff --git a/icu4c/source/common/ucnv_ext.c b/icu4c/source/common/ucnv_ext.cpp
similarity index 99%
rename from icu4c/source/common/ucnv_ext.c
rename to icu4c/source/common/ucnv_ext.cpp
index 8e8b326e9fa..898a235713e 100644
--- a/icu4c/source/common/ucnv_ext.c
+++ b/icu4c/source/common/ucnv_ext.cpp
@@ -1,11 +1,11 @@
/*
******************************************************************************
*
-* Copyright (C) 2003-2009, International Business Machines
+* Copyright (C) 2003-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
-* file name: ucnv_ext.c
+* file name: ucnv_ext.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -31,7 +31,7 @@
/*
* @return lookup value for the byte, if found; else 0
*/
-static U_INLINE uint32_t
+static inline uint32_t
ucnv_extFindToU(const uint32_t *toUSection, int32_t length, uint8_t byte) {
uint32_t word0, word;
int32_t i, start, limit;
@@ -121,7 +121,7 @@ ucnv_extMatchToU(const int32_t *cx, int8_t sisoState,
const char *pre, int32_t preLength,
const char *src, int32_t srcLength,
uint32_t *pMatchValue,
- UBool useFallback, UBool flush) {
+ UBool /*useFallback*/, UBool flush) {
const uint32_t *toUTable, *toUSection;
uint32_t value, matchValue;
@@ -229,7 +229,7 @@ ucnv_extMatchToU(const int32_t *cx, int8_t sisoState,
return matchLength;
}
-static U_INLINE void
+static inline void
ucnv_extWriteToU(UConverter *cnv, const int32_t *cx,
uint32_t value,
UChar **target, const UChar *targetLimit,
@@ -448,7 +448,7 @@ ucnv_extContinueMatchToU(UConverter *cnv,
/*
* @return index of the UChar, if found; else <0
*/
-static U_INLINE int32_t
+static inline int32_t
ucnv_extFindFromU(const UChar *fromUSection, int32_t length, UChar u) {
int32_t i, start, limit;
@@ -665,7 +665,7 @@ ucnv_extMatchFromU(const int32_t *cx,
/*
* @param value fromUnicode mapping table value; ignores roundtrip and reserved bits
*/
-static U_INLINE void
+static inline void
ucnv_extWriteFromU(UConverter *cnv, const int32_t *cx,
uint32_t value,
char **target, const char *targetLimit,
diff --git a/icu4c/source/common/ucnv_imp.h b/icu4c/source/common/ucnv_imp.h
index 54b0197a2f3..27c373a98f5 100644
--- a/icu4c/source/common/ucnv_imp.h
+++ b/icu4c/source/common/ucnv_imp.h
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (C) 1999-2009, International Business Machines
+* Copyright (C) 1999-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -56,7 +56,8 @@ ucnv_canCreateConverter(const char *converterName, UErrorCode *err);
* @param err The error code
* @return the newly created converter
*/
-UConverter *ucnv_createConverter (UConverter *myUConverter, const char *converterName, UErrorCode * err);
+U_CAPI UConverter *
+ucnv_createConverter(UConverter *myUConverter, const char *converterName, UErrorCode * err);
/*
* Open a purely algorithmic converter, specified by a type constant.
@@ -81,14 +82,14 @@ ucnv_createAlgorithmicConverter(UConverter *myUConverter,
* unload mySharedConverterData, except via ucnv_close(return value)
* if this function is successful.
*/
-UConverter*
+U_CFUNC UConverter *
ucnv_createConverterFromSharedData(UConverter *myUConverter,
UConverterSharedData *mySharedConverterData,
UConverterLoadArgs *pArgs,
UErrorCode *err);
-UConverter* ucnv_createConverterFromPackage(const char *packageName, const char *converterName,
- UErrorCode *err);
+U_CFUNC UConverter *
+ucnv_createConverterFromPackage(const char *packageName, const char *converterName, UErrorCode *err);
/**
* Load a converter but do not create a UConverter object.
@@ -105,7 +106,7 @@ UConverter* ucnv_createConverterFromPackage(const char *packageName, const char
* - pieces!=NULL && args!=NULL
* @internal
*/
-UConverterSharedData *
+U_CFUNC UConverterSharedData *
ucnv_loadSharedData(const char *converterName,
UConverterNamePieces *pieces,
UConverterLoadArgs *pArgs,
@@ -115,13 +116,13 @@ ucnv_loadSharedData(const char *converterName,
* This may unload the shared data in a thread safe manner.
* This will only unload the data if no other converters are sharing it.
*/
-void
+U_CFUNC void
ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData);
/**
* This is a thread safe way to increment the reference count.
*/
-void
+U_CFUNC void
ucnv_incrementRefCount(UConverterSharedData *sharedData);
/**
diff --git a/icu4c/source/common/ucnv_io.c b/icu4c/source/common/ucnv_io.cpp
similarity index 98%
rename from icu4c/source/common/ucnv_io.c
rename to icu4c/source/common/ucnv_io.cpp
index 3b806d1c4a2..36d7f0ebdfd 100644
--- a/icu4c/source/common/ucnv_io.c
+++ b/icu4c/source/common/ucnv_io.cpp
@@ -1,13 +1,13 @@
/*
******************************************************************************
*
-* Copyright (C) 1999-2008, International Business Machines
+* Copyright (C) 1999-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
*
-* ucnv_io.c:
+* ucnv_io.cpp:
* initializes global variables and defines functions pertaining to converter
* name resolution aspect of the conversion code.
*
@@ -198,8 +198,8 @@ static UConverterAlias gMainTable;
#define GET_NORMALIZED_STRING(idx) (const char *)(gMainTable.normalizedStringTable + (idx))
static UBool U_CALLCONV
-isAcceptable(void *context,
- const char *type, const char *name,
+isAcceptable(void * /*context*/,
+ const char * /*type*/, const char * /*name*/,
const UDataInfo *pInfo) {
return (UBool)(
pInfo->size>=20 &&
@@ -327,7 +327,7 @@ haveAliasData(UErrorCode *pErrorCode) {
return TRUE;
}
-static U_INLINE UBool
+static inline UBool
isAlias(const char *alias, UErrorCode *pErrorCode) {
if(alias==NULL) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
@@ -559,7 +559,7 @@ ucnv_compareNames(const char *name1, const char *name2) {
* search for an alias
* return the converter number index for gConverterList
*/
-static U_INLINE uint32_t
+static inline uint32_t
findConverter(const char *alias, UBool *containsOption, UErrorCode *pErrorCode) {
uint32_t mid, start, limit;
uint32_t lastMid;
@@ -628,7 +628,7 @@ findConverter(const char *alias, UBool *containsOption, UErrorCode *pErrorCode)
* Is this alias in this list?
* alias and listOffset should be non-NULL.
*/
-static U_INLINE UBool
+static inline UBool
isAliasInList(const char *alias, uint32_t listOffset) {
if (listOffset) {
uint32_t currAlias;
@@ -760,7 +760,7 @@ ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *p
}
static int32_t U_CALLCONV
-ucnv_io_countStandardAliases(UEnumeration *enumerator, UErrorCode *pErrorCode) {
+ucnv_io_countStandardAliases(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) {
int32_t value = 0;
UAliasContext *myContext = (UAliasContext *)(enumerator->context);
uint32_t listOffset = myContext->listOffset;
@@ -774,7 +774,7 @@ ucnv_io_countStandardAliases(UEnumeration *enumerator, UErrorCode *pErrorCode) {
static const char* U_CALLCONV
ucnv_io_nextStandardAliases(UEnumeration *enumerator,
int32_t* resultLength,
- UErrorCode *pErrorCode)
+ UErrorCode * /*pErrorCode*/)
{
UAliasContext *myContext = (UAliasContext *)(enumerator->context);
uint32_t listOffset = myContext->listOffset;
@@ -799,7 +799,7 @@ ucnv_io_nextStandardAliases(UEnumeration *enumerator,
}
static void U_CALLCONV
-ucnv_io_resetStandardAliases(UEnumeration *enumerator, UErrorCode *pErrorCode) {
+ucnv_io_resetStandardAliases(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) {
((UAliasContext *)(enumerator->context))->listIdx = 0;
}
@@ -835,13 +835,13 @@ ucnv_openStandardNames(const char *convName,
if (listOffset < gMainTable.taggedAliasListsSize) {
UAliasContext *myContext;
- myEnum = uprv_malloc(sizeof(UEnumeration));
+ myEnum = reinterpret_cast(uprv_malloc(sizeof(UEnumeration)));
if (myEnum == NULL) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_memcpy(myEnum, &gEnumAliases, sizeof(UEnumeration));
- myContext = uprv_malloc(sizeof(UAliasContext));
+ myContext = reinterpret_cast(uprv_malloc(sizeof(UAliasContext)));
if (myContext == NULL) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myEnum);
@@ -1006,14 +1006,14 @@ ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErro
}
static int32_t U_CALLCONV
-ucnv_io_countAllConverters(UEnumeration *enumerator, UErrorCode *pErrorCode) {
+ucnv_io_countAllConverters(UEnumeration * /*enumerator*/, UErrorCode * /*pErrorCode*/) {
return gMainTable.converterListSize;
}
static const char* U_CALLCONV
ucnv_io_nextAllConverters(UEnumeration *enumerator,
int32_t* resultLength,
- UErrorCode *pErrorCode)
+ UErrorCode * /*pErrorCode*/)
{
uint16_t *myContext = (uint16_t *)(enumerator->context);
@@ -1032,7 +1032,7 @@ ucnv_io_nextAllConverters(UEnumeration *enumerator,
}
static void U_CALLCONV
-ucnv_io_resetAllConverters(UEnumeration *enumerator, UErrorCode *pErrorCode) {
+ucnv_io_resetAllConverters(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) {
*((uint16_t *)(enumerator->context)) = 0;
}
@@ -1052,13 +1052,13 @@ ucnv_openAllNames(UErrorCode *pErrorCode) {
if (haveAliasData(pErrorCode)) {
uint16_t *myContext;
- myEnum = uprv_malloc(sizeof(UEnumeration));
+ myEnum = reinterpret_cast(uprv_malloc(sizeof(UEnumeration)));
if (myEnum == NULL) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_memcpy(myEnum, &gEnumAllConverters, sizeof(UEnumeration));
- myContext = uprv_malloc(sizeof(uint16_t));
+ myContext = reinterpret_cast(uprv_malloc(sizeof(uint16_t)));
if (myContext == NULL) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myEnum);
diff --git a/icu4c/source/common/ucnvbocu.c b/icu4c/source/common/ucnvbocu.cpp
similarity index 99%
rename from icu4c/source/common/ucnvbocu.c
rename to icu4c/source/common/ucnvbocu.cpp
index 8623b114208..23cf92b4051 100644
--- a/icu4c/source/common/ucnvbocu.c
+++ b/icu4c/source/common/ucnvbocu.cpp
@@ -1,11 +1,11 @@
/*
******************************************************************************
*
-* Copyright (C) 2002-2005, International Business Machines
+* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
-* file name: ucnvbocu.c
+* file name: ucnvbocu.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -217,7 +217,7 @@ bocu1TrailToByte[BOCU1_TRAIL_CONTROLS_COUNT]={
* @param c current code point, 0x3040..0xd7a3 (rest handled by macro below)
* @return "previous code point" state value
*/
-static U_INLINE int32_t
+static inline int32_t
bocu1Prev(int32_t c) {
/* compute new prev */
if(/* 0x3040<=c && */ c<=0x309f) {
@@ -857,7 +857,7 @@ getTrail:
* BOCU1_MIN<=bkeyword;
const char* rightString = ((const KeywordStruct *)right)->keyword;
return uprv_strcmp(leftString, rightString);
@@ -1163,7 +1163,7 @@ static int16_t _findIndex(const char* const* list, const char* key)
}
/* count the length of src while copying it to dest; return strlen(src) */
-static U_INLINE int32_t
+static inline int32_t
_copyCount(char *dest, int32_t destCapacity, const char *src) {
const char *anchor;
char c;
@@ -1468,7 +1468,7 @@ uloc_kw_closeKeywords(UEnumeration *enumerator) {
}
static int32_t U_CALLCONV
-uloc_kw_countKeywords(UEnumeration *en, UErrorCode *status) {
+uloc_kw_countKeywords(UEnumeration *en, UErrorCode * /*status*/) {
char *kw = ((UKeywordsContext *)en->context)->keywords;
int32_t result = 0;
while(*kw) {
@@ -1481,7 +1481,7 @@ uloc_kw_countKeywords(UEnumeration *en, UErrorCode *status) {
static const char* U_CALLCONV
uloc_kw_nextKeyword(UEnumeration* en,
int32_t* resultLength,
- UErrorCode* status) {
+ UErrorCode* /*status*/) {
const char* result = ((UKeywordsContext *)en->context)->current;
int32_t len = 0;
if(*result) {
@@ -1498,7 +1498,7 @@ uloc_kw_nextKeyword(UEnumeration* en,
static void U_CALLCONV
uloc_kw_resetKeywords(UEnumeration* en,
- UErrorCode* status) {
+ UErrorCode* /*status*/) {
((UKeywordsContext *)en->context)->current = ((UKeywordsContext *)en->context)->keywords;
}
@@ -1528,7 +1528,7 @@ uloc_openKeywordList(const char *keywordList, int32_t keywordListSize, UErrorCod
return NULL;
}
uprv_memcpy(result, &gKeywordsEnum, sizeof(UEnumeration));
- myContext = uprv_malloc(sizeof(UKeywordsContext));
+ myContext = reinterpret_cast(uprv_malloc(sizeof(UKeywordsContext)));
if (myContext == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
uprv_free(result);
@@ -1649,9 +1649,9 @@ _canonicalize(const char* localeID,
/* if we are doing a full canonicalization, then put results in
localeBuffer, if necessary; otherwise send them to result. */
if (/*OPTION_SET(options, _ULOC_CANONICALIZE) &&*/
- (result == NULL || resultCapacity < sizeof(localeBuffer))) {
+ (result == NULL || resultCapacity < (int32_t)sizeof(localeBuffer))) {
name = localeBuffer;
- nameCapacity = sizeof(localeBuffer);
+ nameCapacity = (int32_t)sizeof(localeBuffer);
} else {
name = result;
nameCapacity = resultCapacity;
@@ -2216,7 +2216,7 @@ typedef struct {
} _acceptLangItem;
static int32_t U_CALLCONV
-uloc_acceptLanguageCompare(const void *context, const void *a, const void *b)
+uloc_acceptLanguageCompare(const void * /*context*/, const void *a, const void *b)
{
const _acceptLangItem *aa = (const _acceptLangItem*)a;
const _acceptLangItem *bb = (const _acceptLangItem*)b;
@@ -2330,7 +2330,7 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult
}
if(n>=jSize) {
if(j==smallBuffer) { /* overflowed the small buffer. */
- j = uprv_malloc(sizeof(j[0])*(jSize*2));
+ j = reinterpret_cast<_acceptLangItem *>(uprv_malloc(sizeof(j[0])*(jSize*2)));
if(j!=NULL) {
uprv_memcpy(j,smallBuffer,sizeof(j[0])*jSize);
}
@@ -2338,7 +2338,7 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult
fprintf(stderr,"malloced at size %d\n", jSize);
#endif
} else {
- j = uprv_realloc(j, sizeof(j[0])*jSize*2);
+ j = reinterpret_cast<_acceptLangItem *>(uprv_realloc(j, sizeof(j[0])*jSize*2));
#if defined(ULOC_DEBUG)
fprintf(stderr,"re-alloced at size %d\n", jSize);
#endif
@@ -2360,7 +2360,7 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult
}
return -1;
}
- strs = uprv_malloc((size_t)(sizeof(strs[0])*n));
+ strs = reinterpret_cast(uprv_malloc((size_t)(sizeof(strs[0])*n)));
/* Check for null pointer */
if (strs == NULL) {
uprv_free(j); /* Free to avoid memory leak */
@@ -2405,7 +2405,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable,
if(U_FAILURE(*status)) {
return -1;
}
- fallbackList = uprv_malloc((size_t)(sizeof(fallbackList[0])*acceptListCount));
+ fallbackList = reinterpret_cast(uprv_malloc((size_t)(sizeof(fallbackList[0])*acceptListCount)));
if(fallbackList==NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return -1;
diff --git a/icu4c/source/common/unames.c b/icu4c/source/common/unames.cpp
similarity index 99%
rename from icu4c/source/common/unames.c
rename to icu4c/source/common/unames.cpp
index e02c6a8efd5..ac46af88cfb 100644
--- a/icu4c/source/common/unames.c
+++ b/icu4c/source/common/unames.cpp
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
-* Copyright (C) 1999-2009, International Business Machines
+* Copyright (C) 1999-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -28,13 +28,13 @@
/* prototypes ------------------------------------------------------------- */
-#define LENGTHOF(array) (sizeof(array)/sizeof((array)[0]))
+#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
static const char DATA_NAME[] = "unames";
static const char DATA_TYPE[] = "icu";
#define GROUP_SHIFT 5
-#define LINES_PER_GROUP (1UL<size>=20 &&
@@ -1433,7 +1433,7 @@ calcNameSetsLengths(UErrorCode *pErrorCode) {
}
/* set hex digits, used in various names, and <>-, used in extended names */
- for(i=0; icontext;
return ures_getSize(&ctx->installed);
}
@@ -2286,7 +2286,7 @@ ures_loc_nextLocale(UEnumeration* en,
static void U_CALLCONV
ures_loc_resetLocales(UEnumeration* en,
- UErrorCode* status) {
+ UErrorCode* /*status*/) {
UResourceBundle *res = &((ULocalesContext *)en->context)->installed;
ures_resetIterator(res);
}
@@ -2309,11 +2309,11 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
UResourceBundle *idx = NULL;
UEnumeration *en = NULL;
ULocalesContext *myContext = NULL;
-
+
if(U_FAILURE(*status)) {
return NULL;
}
- myContext = uprv_malloc(sizeof(ULocalesContext));
+ myContext = reinterpret_cast(uprv_malloc(sizeof(ULocalesContext)));
en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
if(!en || !myContext) {
*status = U_MEMORY_ALLOCATION_ERROR;
@@ -2322,7 +2322,7 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
return NULL;
}
uprv_memcpy(en, &gLocalesEnum, sizeof(UEnumeration));
-
+
ures_initStackObject(&myContext->installed);
ures_initStackObject(&myContext->curr);
idx = ures_openDirect(path, INDEX_LOCALE_NAME, status);
diff --git a/icu4c/source/common/uset.cpp b/icu4c/source/common/uset.cpp
index f4d34474514..74ddba37c15 100644
--- a/icu4c/source/common/uset.cpp
+++ b/icu4c/source/common/uset.cpp
@@ -1,11 +1,11 @@
/*
*******************************************************************************
*
-* Copyright (C) 2002-2010, International Business Machines
+* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: uset.c
+* file name: uset.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -531,7 +531,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
// ---
// #define USET_GROW_DELTA 20
//
-// static U_INLINE int32_t
+// static int32_t
// findChar(const UChar32* array, int32_t length, UChar32 c) {
// int32_t i;
//
diff --git a/icu4c/source/common/ushape.c b/icu4c/source/common/ushape.cpp
similarity index 98%
rename from icu4c/source/common/ushape.c
rename to icu4c/source/common/ushape.cpp
index 5ed5c1d74ee..c34f86dc0be 100644
--- a/icu4c/source/common/ushape.c
+++ b/icu4c/source/common/ushape.cpp
@@ -5,7 +5,7 @@
* Corporation and others. All Rights Reserved.
*
******************************************************************************
- * file name: ushape.c
+ * file name: ushape.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -25,6 +25,8 @@
#include "ustr_imp.h"
#include "ubidi_props.h"
+#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
+
#if UTF_SIZE<16
/*
* This implementation assumes that the internal encoding is UTF-16
@@ -373,7 +375,7 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length,
* U_SHAPE_TEXT_DIRECTION_LOGICAL
*/
static void
-invertBuffer(UChar *buffer,int32_t size,uint32_t options,int32_t lowlimit,int32_t highlimit) {
+invertBuffer(UChar *buffer, int32_t size, uint32_t /*options*/, int32_t lowlimit, int32_t highlimit) {
UChar temp;
int32_t i=0,j=0;
for(i=lowlimit,j=size-highlimit-1;i=0x064B && ch<= 0x0652 );
}
@@ -463,7 +465,7 @@ isTashkeelChar(UChar ch) {
*Name : isTashkeelCharFE
*Function : Returns 1 for Tashkeel characters in FE range else return 0
*/
-static U_INLINE int32_t
+static inline int32_t
isTashkeelCharFE(UChar ch) {
return (int32_t)( ch>=0xFE70 && ch<= 0xFE7F );
}
@@ -472,7 +474,7 @@ isTashkeelCharFE(UChar ch) {
*Name : isAlefChar
*Function : Returns 1 for Alef characters else return 0
*/
-static U_INLINE int32_t
+static inline int32_t
isAlefChar(UChar ch) {
return (int32_t)( (ch==0x0622)||(ch==0x0623)||(ch==0x0625)||(ch==0x0627) );
}
@@ -481,7 +483,7 @@ isAlefChar(UChar ch) {
*Name : isLamAlefChar
*Function : Returns 1 for LamAlef characters else return 0
*/
-static U_INLINE int32_t
+static inline int32_t
isLamAlefChar(UChar ch) {
return (int32_t)((ch>=0xFEF5)&&(ch<=0xFEFC) );
}
@@ -491,7 +493,7 @@ isLamAlefChar(UChar ch) {
*Function : returns 1 if the character matches one of the tail characters (0xfe73 or 0x200b) otherwise returns 0
*/
-static U_INLINE int32_t
+static inline int32_t
isTailChar(UChar ch) {
if(ch == OLD_TAIL_CHAR || ch == NEW_TAIL_CHAR){
return 1;
@@ -506,7 +508,7 @@ isTailChar(UChar ch) {
* in the FE range otherwise returns 0
*/
-static U_INLINE int32_t
+static inline int32_t
isSeenTailFamilyChar(UChar ch) {
if(ch >= 0xfeb1 && ch < 0xfebf){
return tailFamilyIsolatedFinal [ch - 0xFEB1];
@@ -520,7 +522,7 @@ isSeenTailFamilyChar(UChar ch) {
* 06 range otherwise returns 0
*/
-static U_INLINE int32_t
+static inline int32_t
isSeenFamilyChar(UChar ch){
if(ch >= 0x633 && ch <= 0x636){
return 1;
@@ -535,7 +537,7 @@ isSeenFamilyChar(UChar ch){
*Function : returns 1 if the character is a Alef Maksoura Final or isolated
* otherwise returns 0
*/
-static U_INLINE int32_t
+static inline int32_t
isAlefMaksouraChar(UChar ch) {
return (int32_t)( (ch == 0xFEEF) || ( ch == 0xFEF0) || (ch == 0x0649));
}
@@ -545,7 +547,7 @@ isAlefMaksouraChar(UChar ch) {
* Function : returns 1 if the character is a yehHamza isolated or yehhamza
* final is found otherwise returns 0
*/
-static U_INLINE int32_t
+static inline int32_t
isYehHamzaChar(UChar ch) {
if((ch==0xFE89)||(ch==0xFE8A)){
return 1;
@@ -561,7 +563,7 @@ isYehHamzaChar(UChar ch) {
* Tashkeel with shadda on tatweel (FC range)return 2 otherwise
* returns 0
*/
-static U_INLINE int32_t
+static inline int32_t
isTashkeelOnTatweelChar(UChar ch){
if(ch >= 0xfe70 && ch <= 0xfe7f && ch != NEW_TAIL_CHAR && ch != 0xFE75 && ch != SHADDA_TATWEEL_CHAR)
{
@@ -580,7 +582,7 @@ isTashkeelOnTatweelChar(UChar ch){
* with shadda is in the isolated form (i.e. Unicode FC range)
* returns 2 otherwise returns 0
*/
-static U_INLINE int32_t
+static inline int32_t
isIsolatedTashkeelChar(UChar ch){
if(ch >= 0xfe70 && ch <= 0xfe7f && ch != NEW_TAIL_CHAR && ch != 0xFE75){
return (1 - tashkeelMedial [ch - 0xFE70]);
@@ -661,8 +663,8 @@ int32_t destSize,uint32_t options) {
*/
static int32_t
handleTashkeelWithTatweel(UChar *dest, int32_t sourceLength,
- int32_t destSize,uint32_t options,
- UErrorCode *pErrorCode) {
+ int32_t /*destSize*/, uint32_t /*options*/,
+ UErrorCode * /*pErrorCode*/) {
int i;
for(i = 0; i < sourceLength; i++){
if((isTashkeelOnTatweelChar(dest[i]) == 1)){
@@ -1541,8 +1543,8 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
}
/* Start of Arabic letter shaping part */
- if(outputSize<=sizeof(buffer)/U_SIZEOF_UCHAR) {
- outputSize=sizeof(buffer)/U_SIZEOF_UCHAR;
+ if(outputSize<=LENGTHOF(buffer)) {
+ outputSize=LENGTHOF(buffer);
tempbuffer=buffer;
} else {
tempbuffer = (UChar *)uprv_malloc(outputSize*U_SIZEOF_UCHAR);
diff --git a/icu4c/source/common/ustr_imp.h b/icu4c/source/common/ustr_imp.h
index f0ec5a5a236..43291d733dc 100644
--- a/icu4c/source/common/ustr_imp.h
+++ b/icu4c/source/common/ustr_imp.h
@@ -99,6 +99,12 @@ struct UCaseMap {
typedef struct UCaseMap UCaseMap;
#endif
+#if UCONFIG_NO_BREAK_ITERATION
+# define UCASEMAP_INITIALIZER { NULL, { 0 }, 0, 0 }
+#else
+# define UCASEMAP_INITIALIZER { NULL, NULL, { 0 }, 0, 0 }
+#endif
+
enum {
TO_LOWER,
TO_UPPER,
diff --git a/icu4c/source/common/ustr_wcs.c b/icu4c/source/common/ustr_wcs.cpp
similarity index 99%
rename from icu4c/source/common/ustr_wcs.c
rename to icu4c/source/common/ustr_wcs.cpp
index 9de5e223155..4b1460fbc9d 100644
--- a/icu4c/source/common/ustr_wcs.c
+++ b/icu4c/source/common/ustr_wcs.cpp
@@ -1,11 +1,11 @@
/*
*******************************************************************************
*
-* Copyright (C) 2001-2010, International Business Machines
+* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: ustr_wcs.c
+* file name: ustr_wcs.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -31,7 +31,7 @@
#define _BUFFER_CAPACITY_MULTIPLIER 2
#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
-static U_INLINE UBool
+static inline UBool
u_growAnyBufferFromStatic(void *context,
void **pBuffer, int32_t *pCapacity, int32_t reqCapacity,
int32_t length, int32_t size) {
diff --git a/icu4c/source/common/ustrcase.c b/icu4c/source/common/ustrcase.cpp
similarity index 97%
rename from icu4c/source/common/ustrcase.c
rename to icu4c/source/common/ustrcase.cpp
index 4b62fb95c3a..15740527db5 100644
--- a/icu4c/source/common/ustrcase.c
+++ b/icu4c/source/common/ustrcase.cpp
@@ -1,11 +1,11 @@
/*
*******************************************************************************
*
-* Copyright (C) 2001-2010, International Business Machines
+* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: ustrcase.c
+* file name: ustrcase.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -27,10 +27,12 @@
#include "ucase.h"
#include "ustr_imp.h"
+#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
+
/* string casing ------------------------------------------------------------ */
/* append a full case mapping result, see UCASE_MAX_STRING_LENGTH */
-static U_INLINE int32_t
+static inline int32_t
appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
int32_t result, const UChar *s) {
UChar32 c;
@@ -154,7 +156,7 @@ _caseMap(const UCaseMap *csm, UCaseMapFull *map,
}
static void
-setTempCaseMapLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) {
+setTempCaseMapLocale(UCaseMap *csm, const char *locale, UErrorCode * /*pErrorCode*/) {
/*
* We could call ucasemap_setLocale(), but here we really only care about
* the initial language subtag, we need not return the real string via
@@ -188,7 +190,7 @@ setTempCaseMapLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode)
* Set parameters on an empty UCaseMap, for UCaseMap-less API functions.
* Do this fast because it is called with every function call.
*/
-static U_INLINE void
+static inline void
setTempCaseMap(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) {
if(csm->csp==NULL) {
csm->csp=ucase_getSingleton();
@@ -346,8 +348,8 @@ ustr_toLower(const UCaseProps *csp,
const UChar *src, int32_t srcLength,
const char *locale,
UErrorCode *pErrorCode) {
- UCaseMap csm={ NULL };
- UCaseContext csc={ NULL };
+ UCaseMap csm=UCASEMAP_INITIALIZER;
+ UCaseContext csc=UCASECONTEXT_INITIALIZER;
csm.csp=csp;
setTempCaseMap(&csm, locale, pErrorCode);
@@ -366,8 +368,8 @@ ustr_toUpper(const UCaseProps *csp,
const UChar *src, int32_t srcLength,
const char *locale,
UErrorCode *pErrorCode) {
- UCaseMap csm={ NULL };
- UCaseContext csc={ NULL };
+ UCaseMap csm=UCASEMAP_INITIALIZER;
+ UCaseContext csc=UCASECONTEXT_INITIALIZER;
csm.csp=csp;
setTempCaseMap(&csm, locale, pErrorCode);
@@ -389,8 +391,8 @@ ustr_toTitle(const UCaseProps *csp,
UBreakIterator *titleIter,
const char *locale, uint32_t options,
UErrorCode *pErrorCode) {
- UCaseMap csm={ NULL };
- UCaseContext csc={ NULL };
+ UCaseMap csm=UCASEMAP_INITIALIZER;
+ UCaseContext csc=UCASECONTEXT_INITIALIZER;
int32_t length;
csm.csp=csp;
@@ -484,7 +486,7 @@ caseMap(const UCaseMap *csm,
(dest>=src && dest<(src+srcLength)))
) {
/* overlap: provide a temporary destination buffer and later copy the result */
- if(destCapacity<=(sizeof(buffer)/U_SIZEOF_UCHAR)) {
+ if(destCapacity<=LENGTHOF(buffer)) {
/* the stack buffer is large enough */
temp=buffer;
} else {
@@ -505,7 +507,7 @@ caseMap(const UCaseMap *csm,
destLength=ustr_foldCase(csm->csp, temp, destCapacity, src, srcLength,
csm->options, pErrorCode);
} else {
- UCaseContext csc={ NULL };
+ UCaseContext csc=UCASECONTEXT_INITIALIZER;
csc.p=(void *)src;
csc.limit=srcLength;
@@ -556,7 +558,7 @@ u_strToLower(UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
const char *locale,
UErrorCode *pErrorCode) {
- UCaseMap csm={ NULL };
+ UCaseMap csm=UCASEMAP_INITIALIZER;
setTempCaseMap(&csm, locale, pErrorCode);
return caseMap(&csm,
dest, destCapacity,
@@ -569,7 +571,7 @@ u_strToUpper(UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
const char *locale,
UErrorCode *pErrorCode) {
- UCaseMap csm={ NULL };
+ UCaseMap csm=UCASEMAP_INITIALIZER;
setTempCaseMap(&csm, locale, pErrorCode);
return caseMap(&csm,
dest, destCapacity,
@@ -585,7 +587,7 @@ u_strToTitle(UChar *dest, int32_t destCapacity,
UBreakIterator *titleIter,
const char *locale,
UErrorCode *pErrorCode) {
- UCaseMap csm={ NULL };
+ UCaseMap csm=UCASEMAP_INITIALIZER;
int32_t length;
csm.iter=titleIter;
@@ -618,7 +620,7 @@ u_strFoldCase(UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
uint32_t options,
UErrorCode *pErrorCode) {
- UCaseMap csm={ NULL };
+ UCaseMap csm=UCASEMAP_INITIALIZER;
csm.csp=ucase_getSingleton();
csm.options=options;
return caseMap(&csm,
diff --git a/icu4c/source/common/ustring.c b/icu4c/source/common/ustring.cpp
similarity index 99%
rename from icu4c/source/common/ustring.c
rename to icu4c/source/common/ustring.cpp
index e9f917dc89d..2d181aa72b7 100644
--- a/icu4c/source/common/ustring.c
+++ b/icu4c/source/common/ustring.cpp
@@ -1,12 +1,12 @@
/*
******************************************************************************
*
-* Copyright (C) 1998-2010, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
-* File ustring.h
+* File ustring.cpp
*
* Modification History:
*
@@ -35,7 +35,7 @@
* All pointers refer to the same buffer.
* The limit pointer may be NULL, all others must be real pointers.
*/
-static U_INLINE UBool
+static inline UBool
isMatchAtCPBoundary(const UChar *start, const UChar *match, const UChar *matchLimit, const UChar *limit) {
if(U16_IS_TRAIL(*match) && start!=match && U16_IS_LEAD(*(match-1))) {
/* the leading edge of the match is in the middle of a surrogate pair */
diff --git a/icu4c/source/common/ustrtrns.c b/icu4c/source/common/ustrtrns.cpp
similarity index 99%
rename from icu4c/source/common/ustrtrns.c
rename to icu4c/source/common/ustrtrns.cpp
index aa18ef5bee2..6c17b661202 100644
--- a/icu4c/source/common/ustrtrns.c
+++ b/icu4c/source/common/ustrtrns.cpp
@@ -1,12 +1,12 @@
/*
******************************************************************************
*
-* Copyright (C) 2001-2010, International Business Machines
+* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
-* File ustrtrns.c
+* File ustrtrns.cpp
*
* Modification History:
*
@@ -945,7 +945,7 @@ u_strFromUTF8Lenient(UChar *dest,
return dest;
}
-static U_INLINE uint8_t *
+static inline uint8_t *
_appendUTF8(uint8_t *pDest, UChar32 c) {
/* it is 0<=c<=0x10ffff and not a surrogate if called by a validating function */
if((c)<=0x7f) {
diff --git a/icu4c/source/common/utrie.c b/icu4c/source/common/utrie.cpp
similarity index 99%
rename from icu4c/source/common/utrie.c
rename to icu4c/source/common/utrie.cpp
index ddb94bb22c5..eb97aaa55b1 100644
--- a/icu4c/source/common/utrie.c
+++ b/icu4c/source/common/utrie.cpp
@@ -1,11 +1,11 @@
/*
******************************************************************************
*
-* Copyright (C) 2001-2009, International Business Machines
+* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
-* file name: utrie.c
+* file name: utrie.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -31,7 +31,7 @@
#undef ABS
#define ABS(x) ((x)>=0 ? (x) : -(x))
-static U_INLINE UBool
+static inline UBool
equal_uint32(const uint32_t *s, const uint32_t *t, int32_t length) {
while(length>0 && *s==*t) {
++s;
@@ -862,7 +862,7 @@ utrie_unserialize(UTrie *trie, const void *data, int32_t length, UErrorCode *pEr
}
/* enough data for a trie header? */
- if(lengthfirstFreeBlock=block;
}
-static U_INLINE UBool
+static inline UBool
isWritableBlock(UNewTrie2 *trie, int32_t block) {
return (UBool)(block!=trie->dataNullOffset && 1==trie->map[block>>UTRIE2_SHIFT_2]);
}
-static U_INLINE void
+static inline void
setIndex2Entry(UNewTrie2 *trie, int32_t i2, int32_t block) {
int32_t oldBlock;
++trie->map[block>>UTRIE2_SHIFT_2]; /* increment first, in case block==oldBlock! */
@@ -841,7 +841,7 @@ utrie2_setRange32(UTrie2 *trie,
/* compaction --------------------------------------------------------------- */
-static U_INLINE UBool
+static inline UBool
equal_int32(const int32_t *s, const int32_t *t, int32_t length) {
while(length>0 && *s==*t) {
++s;
@@ -851,7 +851,7 @@ equal_int32(const int32_t *s, const int32_t *t, int32_t length) {
return (UBool)(length==0);
}
-static U_INLINE UBool
+static inline UBool
equal_uint32(const uint32_t *s, const uint32_t *t, int32_t length) {
while(length>0 && *s==*t) {
++s;
diff --git a/icu4c/source/i18n/ucol_wgt.cpp b/icu4c/source/i18n/ucol_wgt.cpp
index 87d34fe73a7..57d49fca798 100644
--- a/icu4c/source/i18n/ucol_wgt.cpp
+++ b/icu4c/source/i18n/ucol_wgt.cpp
@@ -5,7 +5,7 @@
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: ucol_wgt.c
+* file name: ucol_wgt.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -35,7 +35,7 @@
/* helper functions for CE weights */
-static U_INLINE int32_t
+static inline int32_t
lengthOfWeight(uint32_t weight) {
if((weight&0xffffff)==0) {
return 1;
@@ -48,23 +48,23 @@ lengthOfWeight(uint32_t weight) {
}
}
-static U_INLINE uint32_t
+static inline uint32_t
getWeightTrail(uint32_t weight, int32_t length) {
return (uint32_t)(weight>>(8*(4-length)))&0xff;
}
-static U_INLINE uint32_t
+static inline uint32_t
setWeightTrail(uint32_t weight, int32_t length, uint32_t trail) {
length=8*(4-length);
return (uint32_t)((weight&(0xffffff00<
-
+
@@ -319,4 +319,4 @@
-
+
diff --git a/icu4c/source/io/io.vcxproj.filters b/icu4c/source/io/io.vcxproj.filters
index 83e23d661b7..e21d18ccb22 100644
--- a/icu4c/source/io/io.vcxproj.filters
+++ b/icu4c/source/io/io.vcxproj.filters
@@ -15,7 +15,7 @@
-
+
Source Files
diff --git a/icu4c/source/io/locbund.c b/icu4c/source/io/locbund.cpp
similarity index 94%
rename from icu4c/source/io/locbund.c
rename to icu4c/source/io/locbund.cpp
index 1859999b158..b2dfa1b74d4 100644
--- a/icu4c/source/io/locbund.c
+++ b/icu4c/source/io/locbund.cpp
@@ -1,12 +1,12 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-2007, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
*
-* File locbund.c
+* File locbund.cpp
*
* Modification History:
*
@@ -45,7 +45,7 @@ static UBool U_CALLCONV locbund_cleanup(void) {
U_CDECL_END
-static U_INLINE UNumberFormat * copyInvariantFormatter(ULocaleBundle *result, UNumberFormatStyle style) {
+static inline UNumberFormat * copyInvariantFormatter(ULocaleBundle *result, UNumberFormatStyle style) {
if (result->fNumberFormat[style-1] == NULL) {
UErrorCode status = U_ZERO_ERROR;
UBool needsInit;
@@ -69,7 +69,7 @@ static U_INLINE UNumberFormat * copyInvariantFormatter(ULocaleBundle *result, UN
return result->fNumberFormat[style-1];
}
-ULocaleBundle*
+U_CAPI ULocaleBundle *
u_locbund_init(ULocaleBundle *result, const char *loc)
{
int32_t len;
@@ -96,14 +96,14 @@ u_locbund_init(ULocaleBundle *result, const char *loc)
return result;
}
-/*ULocaleBundle*
+/*U_CAPI ULocaleBundle *
u_locbund_new(const char *loc)
{
ULocaleBundle *result = (ULocaleBundle*) uprv_malloc(sizeof(ULocaleBundle));
return u_locbund_init(result, loc);
}
-ULocaleBundle*
+U_CAPI ULocaleBundle *
u_locbund_clone(const ULocaleBundle *bundle)
{
ULocaleBundle *result = (ULocaleBundle*)uprv_malloc(sizeof(ULocaleBundle));
@@ -141,7 +141,7 @@ u_locbund_clone(const ULocaleBundle *bundle)
return result;
}*/
-void
+U_CAPI void
u_locbund_close(ULocaleBundle *bundle)
{
int32_t styleIdx;
@@ -158,7 +158,7 @@ u_locbund_close(ULocaleBundle *bundle)
/* uprv_free(bundle);*/
}
-UNumberFormat*
+U_CAPI UNumberFormat *
u_locbund_getNumberFormat(ULocaleBundle *bundle, UNumberFormatStyle style)
{
UNumberFormat *formatAlias = NULL;
diff --git a/icu4c/source/io/locbund.h b/icu4c/source/io/locbund.h
index f4ff449b1f1..1eac6227b1d 100644
--- a/icu4c/source/io/locbund.h
+++ b/icu4c/source/io/locbund.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-2006s, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -41,7 +41,7 @@ typedef struct ULocaleBundle {
* @param loc The locale of the ULocaleBundle.
* @return A pointer to a ULocaleBundle, or 0 if loc was invalid.
*/
-ULocaleBundle*
+U_CAPI ULocaleBundle *
u_locbund_init(ULocaleBundle *result, const char *loc);
/**
@@ -49,7 +49,7 @@ u_locbund_init(ULocaleBundle *result, const char *loc);
* @param loc The locale of the ULocaleBundle.
* @return A pointer to a ULocaleBundle, or 0 if loc was invalid.
*/
-/*ULocaleBundle*
+/*U_CAPI ULocaleBundle *
u_locbund_new(const char *loc);*/
/**
@@ -57,14 +57,14 @@ u_locbund_new(const char *loc);*/
* @param bundle The ULocaleBundle to clone.
* @return A new ULocaleBundle.
*/
-/*ULocaleBundle*
+/*U_CAPI ULocaleBundle *
u_locbund_clone(const ULocaleBundle *bundle);*/
/**
* Delete the specified ULocaleBundle, freeing all associated memory.
* @param bundle The ULocaleBundle to delete
*/
-void
+U_CAPI void
u_locbund_close(ULocaleBundle *bundle);
/**
@@ -72,7 +72,7 @@ u_locbund_close(ULocaleBundle *bundle);
* @param bundle The ULocaleBundle to use
* @return A pointer to the NumberFormat used for number formatting and parsing.
*/
-UNumberFormat*
+U_CAPI UNumberFormat *
u_locbund_getNumberFormat(ULocaleBundle *bundle, UNumberFormatStyle style);
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/icu4c/source/test/cintltst/bocu1tst.c b/icu4c/source/test/cintltst/bocu1tst.c
index 6189af2ce52..41647ffb41d 100644
--- a/icu4c/source/test/cintltst/bocu1tst.c
+++ b/icu4c/source/test/cintltst/bocu1tst.c
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
-* Copyright (C) 2002-2010, International Business Machines
+* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -250,7 +250,7 @@ decodeBocu1(Bocu1Rx *pRx, uint8_t b);
* @param c current code point, 0..0x10ffff
* @return "previous code point" state value
*/
-static U_INLINE int32_t
+static int32_t
bocu1Prev(int32_t c) {
/* compute new prev */
if(0x3040<=c && c<=0x309f) {
@@ -749,7 +749,7 @@ readString(const uint8_t *p, int32_t length, UChar *s) {
return sLength;
}
-static U_INLINE char
+static char
hexDigit(uint8_t digit) {
return digit<=9 ? (char)('0'+digit) : (char)('a'-10+digit);
}
diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c
index b6fb7c0c93a..85f503cbd52 100644
--- a/icu4c/source/test/cintltst/ccapitst.c
+++ b/icu4c/source/test/cintltst/ccapitst.c
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2010, International Business Machines Corporation and
+ * Copyright (c) 1997-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
@@ -3479,7 +3479,7 @@ static void TestDefaultName(void) {
/* Test that ucnv_compareNames() matches names according to spec. ----------- */
-static U_INLINE int
+static int
sign(int n) {
if(n==0) {
return 0;
diff --git a/icu4c/source/test/intltest/tsputil.cpp b/icu4c/source/test/intltest/tsputil.cpp
index b059c12eebe..222225a9c35 100644
--- a/icu4c/source/test/intltest/tsputil.cpp
+++ b/icu4c/source/test/intltest/tsputil.cpp
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2010, International Business Machines Corporation and
+ * Copyright (c) 1997-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -21,7 +21,6 @@ PUtilTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /
CASE(2, testPositiveInfinity)
CASE(3, testNegativeInfinity)
CASE(4, testZero)
- CASE(5, testU_INLINE)
// CASE(, testIEEEremainder)
default: name = ""; break; //needed to end loop
@@ -551,15 +550,3 @@ PUtilTest::NaNNE(void)
logln("WARNING: NaN != 10.0 returned FALSE, should be TRUE");
}
}
-
-U_INLINE int32_t inlineTriple(int32_t x) {
- return 3*x;
-}
-
-// "code" coverage test for Jitterbug 4515 RFE: in C++, use U_INLINE=inline
-void
-PUtilTest::testU_INLINE() {
- if(inlineTriple(2)!=6 || inlineTriple(-55)!=-165) {
- errln("inlineTriple() failed");
- }
-}
diff --git a/icu4c/source/test/intltest/tsputil.h b/icu4c/source/test/intltest/tsputil.h
index 77cd52b2b31..b5767c44112 100644
--- a/icu4c/source/test/intltest/tsputil.h
+++ b/icu4c/source/test/intltest/tsputil.h
@@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2005, International Business Machines Corporation and
+ * Copyright (c) 1997-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@@ -30,7 +30,6 @@ private:
void testPositiveInfinity(void);
void testNegativeInfinity(void);
void testZero(void);
- void testU_INLINE();
// subtests of testNaN
void testIsNaN(void);
diff --git a/icu4c/source/tools/ctestfw/unicode/utimer.h b/icu4c/source/tools/ctestfw/unicode/utimer.h
index 7974540f4a6..b59867cb006 100644
--- a/icu4c/source/tools/ctestfw/unicode/utimer.h
+++ b/icu4c/source/tools/ctestfw/unicode/utimer.h
@@ -1,6 +1,6 @@
/*
************************************************************************
-* Copyright (c) 1997-2010, International Business Machines
+* Copyright (c) 1997-2011, International Business Machines
* Corporation and others. All Rights Reserved.
************************************************************************
*/
@@ -214,7 +214,7 @@ typedef void FuntionToBeTimed(void* param);
*
* @param timer A pointer to UTimer struct to recieve the current time
*/
-static U_INLINE void U_EXPORT2
+static inline void U_EXPORT2
utimer_getTime(UTimer* timer){
uprv_initFrequency(timer);
uprv_start(timer);
@@ -228,7 +228,7 @@ utimer_getTime(UTimer* timer){
* @param timer2 A pointer to UTimer struct to be used as end time
* @return Time in seconds
*/
-static U_INLINE double U_EXPORT2
+static inline double U_EXPORT2
utimer_getDeltaSeconds(UTimer* timer1, UTimer* timer2){
if(uprv_compareFrequency(timer1,timer2)){
return uprv_delta(timer1,timer2);
@@ -243,7 +243,7 @@ utimer_getDeltaSeconds(UTimer* timer1, UTimer* timer2){
* @param timer A pointer to UTimer struct to be used as starting time
* @return Time elapsed in seconds
*/
-static U_INLINE double U_EXPORT2
+static inline double U_EXPORT2
utimer_getElapsedSeconds(UTimer* timer){
UTimer temp;
utimer_getTime(&temp);
@@ -259,7 +259,7 @@ utimer_getElapsedSeconds(UTimer* timer){
* @param param Parameters to be passed to the fn
* @return the time elapsed in seconds
*/
-static U_INLINE double U_EXPORT2
+static inline double U_EXPORT2
utimer_loopUntilDone(double thresholdTimeVal,
int32_t* loopCount,
FuntionToBeTimed fn,
diff --git a/icu4c/source/tools/genrb/errmsg.c b/icu4c/source/tools/genrb/errmsg.c
index 8b47f261a32..420c12399e6 100644
--- a/icu4c/source/tools/genrb/errmsg.c
+++ b/icu4c/source/tools/genrb/errmsg.c
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-2004, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -20,7 +20,7 @@
#include "cstring.h"
#include "errmsg.h"
-void error(uint32_t linenumber, const char *msg, ...)
+U_CFUNC void error(uint32_t linenumber, const char *msg, ...)
{
va_list va;
@@ -33,30 +33,30 @@ void error(uint32_t linenumber, const char *msg, ...)
static UBool gShowWarning = TRUE;
-void setShowWarning(UBool val)
+U_CFUNC void setShowWarning(UBool val)
{
gShowWarning = val;
}
-UBool getShowWarning(){
+U_CFUNC UBool getShowWarning(){
return gShowWarning;
}
static UBool gStrict =FALSE;
-UBool isStrict(){
+U_CFUNC UBool isStrict(){
return gStrict;
}
-void setStrict(UBool val){
+U_CFUNC void setStrict(UBool val){
gStrict = val;
}
static UBool gVerbose =FALSE;
-UBool isVerbose(){
+U_CFUNC UBool isVerbose(){
return gVerbose;
}
-void setVerbose(UBool val){
+U_CFUNC void setVerbose(UBool val){
gVerbose = val;
}
-void warning(uint32_t linenumber, const char *msg, ...)
+U_CFUNC void warning(uint32_t linenumber, const char *msg, ...)
{
if (gShowWarning)
{
@@ -69,4 +69,3 @@ void warning(uint32_t linenumber, const char *msg, ...)
va_end(va);
}
}
-
diff --git a/icu4c/source/tools/genrb/errmsg.h b/icu4c/source/tools/genrb/errmsg.h
index dbb8c66ffeb..545a872906d 100644
--- a/icu4c/source/tools/genrb/errmsg.h
+++ b/icu4c/source/tools/genrb/errmsg.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-1999, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -20,9 +20,8 @@
extern const char *gCurrentFileName;
-void error (uint32_t linenumber, const char *msg, ...);
-void warning (uint32_t linenumber, const char *msg, ...);
-
+U_CFUNC void error(uint32_t linenumber, const char *msg, ...);
+U_CFUNC void warning(uint32_t linenumber, const char *msg, ...);
/* Show warnings? */
U_CFUNC void setShowWarning(UBool val);
diff --git a/icu4c/source/tools/genrb/genrb.vcxproj b/icu4c/source/tools/genrb/genrb.vcxproj
index 35c1d086db4..b7f48efbfc6 100644
--- a/icu4c/source/tools/genrb/genrb.vcxproj
+++ b/icu4c/source/tools/genrb/genrb.vcxproj
@@ -240,7 +240,7 @@
-
+
@@ -278,4 +278,4 @@
-
+
diff --git a/icu4c/source/tools/genrb/genrb.vcxproj.filters b/icu4c/source/tools/genrb/genrb.vcxproj.filters
index 735313a22a1..c45441c64ec 100644
--- a/icu4c/source/tools/genrb/genrb.vcxproj.filters
+++ b/icu4c/source/tools/genrb/genrb.vcxproj.filters
@@ -21,7 +21,7 @@
Source Files
-
+
Source Files
diff --git a/icu4c/source/tools/genrb/parse.c b/icu4c/source/tools/genrb/parse.cpp
similarity index 99%
rename from icu4c/source/tools/genrb/parse.c
rename to icu4c/source/tools/genrb/parse.cpp
index 86bed258a24..d990d462212 100644
--- a/icu4c/source/tools/genrb/parse.c
+++ b/icu4c/source/tools/genrb/parse.cpp
@@ -6,7 +6,7 @@
*
*******************************************************************************
*
-* File parse.c
+* File parse.cpp
*
* Modification History:
*
@@ -264,7 +264,7 @@ static char *getInvariantString(ParseState* state, uint32_t *line, struct UStrin
return NULL;
}
- result = uprv_malloc(count+1);
+ result = reinterpret_cast(uprv_malloc(count+1));
if (result == NULL)
{
@@ -277,7 +277,7 @@ static char *getInvariantString(ParseState* state, uint32_t *line, struct UStrin
}
static struct SResource *
-parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
+parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct UString* /*comment*/, UErrorCode *status)
{
struct SResource *result = NULL;
struct UString *tokenValue;
@@ -380,7 +380,7 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
{
c = unescape(ucbuf, status);
- if (c == U_ERR)
+ if (c == (UChar32)U_ERR)
{
uprv_free(pTarget);
T_FileStream_close(file);
@@ -396,7 +396,7 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
}
/* Append UChar * after dissembling if c > 0xffff*/
- if (c != U_EOF)
+ if (c != (UChar32)U_EOF)
{
U_APPEND_CHAR32(c, target,len);
}
@@ -422,7 +422,7 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
}
static struct SResource *
-parseTransliterator(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
+parseTransliterator(ParseState* state, char *tag, uint32_t startline, const struct UString* /*comment*/, UErrorCode *status)
{
struct SResource *result = NULL;
struct UString *tokenValue;
@@ -903,7 +903,7 @@ addCollation(ParseState* state, struct SResource *result, uint32_t startline, U
uint8_t *data = NULL;
UCollator *coll = NULL;
int32_t reorderCodes[USCRIPT_CODE_LIMIT + (UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST)];
- uint32_t reorderCodeCount;
+ int32_t reorderCodeCount;
int32_t reorderCodeIndex;
UParseError parseError;
@@ -935,7 +935,7 @@ addCollation(ParseState* state, struct SResource *result, uint32_t startline, U
struct SResource *collationBin = bin_open(state->bundle, "%%CollationBin", len, data, NULL, NULL, status);
table_add(result, collationBin, line, status);
uprv_free(data);
-
+
reorderCodeCount = ucol_getReorderCodes(
coll, reorderCodes, USCRIPT_CODE_LIMIT + (UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST), &intStatus);
if (U_SUCCESS(intStatus) && reorderCodeCount > 0) {
@@ -1454,7 +1454,7 @@ parseBinary(ParseState* state, char *tag, uint32_t startline, const struct UStri
count = (uint32_t)uprv_strlen(string);
if (count > 0){
if((count % 2)==0){
- value = uprv_malloc(sizeof(uint8_t) * count);
+ value = reinterpret_cast(uprv_malloc(sizeof(uint8_t) * count));
if (value == NULL)
{
@@ -1842,7 +1842,7 @@ void initParser(UBool omitBinaryCollation, UBool omitCollationRules)
gOmitCollationRules = omitCollationRules;
}
-static U_INLINE UBool isTable(enum EResourceType type) {
+static inline UBool isTable(enum EResourceType type) {
return (UBool)(type==RT_TABLE || type==RT_TABLE_NO_FALLBACK);
}
@@ -1865,7 +1865,7 @@ parseResourceType(ParseState* state, UErrorCode *status)
/* Search for normal types */
result=RT_UNKNOWN;
- while (++result < RT_RESERVED) {
+ while ((result=(EResourceType)(result+1)) < RT_RESERVED) {
if (u_strcmp(tokenValue->fChars, gResourceTypes[result].nameUChars) == 0) {
break;
}
diff --git a/icu4c/source/tools/genrb/read.c b/icu4c/source/tools/genrb/read.c
index 15c4db4d868..8efad67c1ac 100644
--- a/icu4c/source/tools/genrb/read.c
+++ b/icu4c/source/tools/genrb/read.c
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-2009, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -47,7 +47,7 @@ static void seekUntilEndOfComment (UCHARBUF *buf, struct UString *token, UErr
static UBool isWhitespace (UChar32 c);
static UBool isNewline (UChar32 c);
-void resetLineNumber() {
+U_CFUNC void resetLineNumber() {
lineCount = 1;
}
@@ -59,11 +59,12 @@ void resetLineNumber() {
never return eString twice in a row; instead, multiple adjacent
string tokens will be merged into one, with no intervening
space. */
-enum ETokenType getNextToken(UCHARBUF* buf,
- struct UString *token,
- uint32_t *linenumber, /* out: linenumber of token */
- struct UString *comment,
- UErrorCode *status) {
+U_CFUNC enum ETokenType
+getNextToken(UCHARBUF* buf,
+ struct UString *token,
+ uint32_t *linenumber, /* out: linenumber of token */
+ struct UString *comment,
+ UErrorCode *status) {
enum ETokenType result;
UChar32 c;
@@ -428,8 +429,7 @@ static void seekUntilEndOfComment(UCHARBUF *buf,
}
}
-UChar32 unescape(UCHARBUF *buf,
- UErrorCode *status) {
+U_CFUNC UChar32 unescape(UCHARBUF *buf, UErrorCode *status) {
if (U_FAILURE(*status)) {
return U_EOF;
}
diff --git a/icu4c/source/tools/genrb/read.h b/icu4c/source/tools/genrb/read.h
index 96bd9608128..f79b145f25a 100644
--- a/icu4c/source/tools/genrb/read.h
+++ b/icu4c/source/tools/genrb/read.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-2003, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -38,14 +38,15 @@ enum ETokenType
TOK_TOKEN_COUNT /* Number of "real" token types */
};
-UChar32 unescape(UCHARBUF *buf, UErrorCode *status);
+U_CFUNC UChar32 unescape(UCHARBUF *buf, UErrorCode *status);
-void resetLineNumber(void);
+U_CFUNC void resetLineNumber(void);
-enum ETokenType getNextToken(UCHARBUF *buf,
- struct UString *token,
- uint32_t *linenumber, /* out: linenumber of token */
- struct UString *comment,
- UErrorCode *status);
+U_CFUNC enum ETokenType
+getNextToken(UCHARBUF *buf,
+ struct UString *token,
+ uint32_t *linenumber, /* out: linenumber of token */
+ struct UString *comment,
+ UErrorCode *status);
#endif
diff --git a/icu4c/source/tools/genrb/ustr.c b/icu4c/source/tools/genrb/ustr.c
index ff7487b386d..faa03adef4e 100644
--- a/icu4c/source/tools/genrb/ustr.c
+++ b/icu4c/source/tools/genrb/ustr.c
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-2008, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -27,14 +27,14 @@ static void ustr_resize(struct UString *s, int32_t len, UErrorCode *status);
/* Macros */
#define ALLOCATION(minSize) (minSize < 0x80 ? 0x80 : (2 * minSize + 0x80) & ~(0x80 - 1))
-void
+U_CFUNC void
ustr_init(struct UString *s)
{
s->fChars = 0;
s->fLength = s->fCapacity = 0;
}
-void
+U_CFUNC void
ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode *status)
{
int i = 0;
@@ -65,7 +65,7 @@ ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode
}
}
-void
+U_CFUNC void
ustr_deinit(struct UString *s)
{
if (s) {
@@ -75,7 +75,7 @@ ustr_deinit(struct UString *s)
}
}
-void
+U_CFUNC void
ustr_cpy(struct UString *dst,
const struct UString *src,
UErrorCode *status)
@@ -96,7 +96,7 @@ ustr_cpy(struct UString *dst,
dst->fChars[dst->fLength] = 0x0000;
}
-void
+U_CFUNC void
ustr_setlen(struct UString *s,
int32_t len,
UErrorCode *status)
@@ -114,7 +114,7 @@ ustr_setlen(struct UString *s,
s->fChars[len] = 0x0000;
}
-void
+U_CFUNC void
ustr_cat(struct UString *dst,
const struct UString *src,
UErrorCode *status)
@@ -122,7 +122,7 @@ ustr_cat(struct UString *dst,
ustr_ncat(dst, src, src->fLength, status);
}
-void
+U_CFUNC void
ustr_ncat(struct UString *dst,
const struct UString *src,
int32_t n,
@@ -143,7 +143,7 @@ ustr_ncat(struct UString *dst,
dst->fChars[dst->fLength] = 0x0000;
}
-void
+U_CFUNC void
ustr_ucat(struct UString *dst,
UChar c,
UErrorCode *status)
@@ -162,7 +162,7 @@ ustr_ucat(struct UString *dst,
dst->fLength += 1;
dst->fChars[dst->fLength] = 0x0000;
}
-void
+U_CFUNC void
ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status){
if(c > 0x10FFFF){
*status = U_ILLEGAL_CHAR_FOUND;
@@ -175,7 +175,7 @@ ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status){
ustr_ucat(dst, (UChar) c, status);
}
}
-void
+U_CFUNC void
ustr_uscat(struct UString *dst,
const UChar* src,int len,
UErrorCode *status)
diff --git a/icu4c/source/tools/genrb/ustr.h b/icu4c/source/tools/genrb/ustr.h
index 085643a8d7a..b2d597256bd 100644
--- a/icu4c/source/tools/genrb/ustr.h
+++ b/icu4c/source/tools/genrb/ustr.h
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
-* Copyright (C) 1998-2003, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -42,25 +42,25 @@ struct UString {
int32_t fCapacity;
};
-void ustr_init(struct UString *s);
+U_CFUNC void ustr_init(struct UString *s);
-void
+U_CFUNC void
ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode *status);
-void ustr_deinit(struct UString *s);
+U_CFUNC void ustr_deinit(struct UString *s);
-void ustr_setlen(struct UString *s, int32_t len, UErrorCode *status);
+U_CFUNC void ustr_setlen(struct UString *s, int32_t len, UErrorCode *status);
-void ustr_cpy(struct UString *dst, const struct UString *src,
- UErrorCode *status);
+U_CFUNC void ustr_cpy(struct UString *dst, const struct UString *src,
+ UErrorCode *status);
-void ustr_cat(struct UString *dst, const struct UString *src,
- UErrorCode *status);
+U_CFUNC void ustr_cat(struct UString *dst, const struct UString *src,
+ UErrorCode *status);
-void ustr_ncat(struct UString *dst, const struct UString *src,
- int32_t n, UErrorCode *status);
+U_CFUNC void ustr_ncat(struct UString *dst, const struct UString *src,
+ int32_t n, UErrorCode *status);
-void ustr_ucat(struct UString *dst, UChar c, UErrorCode *status);
-void ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status);
-void ustr_uscat(struct UString *dst, const UChar* src,int len,UErrorCode *status);
+U_CFUNC void ustr_ucat(struct UString *dst, UChar c, UErrorCode *status);
+U_CFUNC void ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status);
+U_CFUNC void ustr_uscat(struct UString *dst, const UChar* src,int len,UErrorCode *status);
#endif
diff --git a/icu4c/source/tools/makeconv/genmbcs.c b/icu4c/source/tools/makeconv/genmbcs.cpp
similarity index 99%
rename from icu4c/source/tools/makeconv/genmbcs.c
rename to icu4c/source/tools/makeconv/genmbcs.cpp
index 840438339b8..5c4c911b377 100644
--- a/icu4c/source/tools/makeconv/genmbcs.c
+++ b/icu4c/source/tools/makeconv/genmbcs.cpp
@@ -1,11 +1,11 @@
/*
*******************************************************************************
*
-* Copyright (C) 2000-2010, International Business Machines
+* Copyright (C) 2000-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
-* file name: genmbcs.c
+* file name: genmbcs.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -102,12 +102,12 @@ MBCSWrite(NewConverter *cnvData, const UConverterStaticData *staticData,
/* helper ------------------------------------------------------------------- */
-static U_INLINE char
+static inline char
hexDigit(uint8_t digit) {
return digit<=9 ? (char)('0'+digit) : (char)('a'-10+digit);
}
-static U_INLINE char *
+static inline char *
printBytes(char *buffer, const uint8_t *bytes, int32_t length) {
char *s=buffer;
while(length>0) {
@@ -555,7 +555,7 @@ MBCSIsValid(NewConverter *cnvData,
static UBool
MBCSSingleAddFromUnicode(MBCSData *mbcsData,
- const uint8_t *bytes, int32_t length,
+ const uint8_t *bytes, int32_t /*length*/,
UChar32 c,
int8_t flag) {
uint16_t *stage3, *p;
@@ -1322,7 +1322,7 @@ compactStage2(MBCSData *mbcsData) {
}
static void
-MBCSPostprocess(MBCSData *mbcsData, const UConverterStaticData *staticData) {
+MBCSPostprocess(MBCSData *mbcsData, const UConverterStaticData * /*staticData*/) {
UCMStates *states;
int32_t maxCharLength, stage3Width;
@@ -1408,7 +1408,7 @@ MBCSWrite(NewConverter *cnvData, const UConverterStaticData *staticData,
int32_t i, stage1Top;
uint32_t headerLength;
- _MBCSHeader header={ { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0 };
+ _MBCSHeader header=UCNV_MBCS_HEADER_INITIALIZER;
stage2Length=mbcsData->stage2Top;
if(mbcsData->omitFromU) {
diff --git a/icu4c/source/tools/makeconv/makeconv.vcxproj b/icu4c/source/tools/makeconv/makeconv.vcxproj
index f2d8f336e2e..751a248f94c 100644
--- a/icu4c/source/tools/makeconv/makeconv.vcxproj
+++ b/icu4c/source/tools/makeconv/makeconv.vcxproj
@@ -239,7 +239,7 @@
-
+
@@ -260,4 +260,4 @@
-
+
diff --git a/icu4c/source/tools/makeconv/makeconv.vcxproj.filters b/icu4c/source/tools/makeconv/makeconv.vcxproj.filters
index 5ec7b299f8a..3f34f13873e 100644
--- a/icu4c/source/tools/makeconv/makeconv.vcxproj.filters
+++ b/icu4c/source/tools/makeconv/makeconv.vcxproj.filters
@@ -18,7 +18,7 @@
Source Files
-
+
Source Files