]> granicus.if.org Git - icu/commitdiff
ICU-8601 replace C U_INLINE hack with C++ inline, and also rename a few other .c...
authorMarkus Scherer <markus.icu@gmail.com>
Thu, 26 May 2011 20:05:39 +0000 (20:05 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Thu, 26 May 2011 20:05:39 +0000 (20:05 +0000)
X-SVN-Rev: 30148

57 files changed:
icu4c/source/common/brkiter.cpp
icu4c/source/common/common.vcxproj
icu4c/source/common/common.vcxproj.filters
icu4c/source/common/locid.cpp
icu4c/source/common/punycode.cpp [moved from icu4c/source/common/punycode.c with 99% similarity]
icu4c/source/common/putil.cpp [moved from icu4c/source/common/putil.c with 99% similarity]
icu4c/source/common/resbund.cpp
icu4c/source/common/ucase.cpp [moved from icu4c/source/common/ucase.c with 99% similarity]
icu4c/source/common/ucase.h
icu4c/source/common/ucasemap.cpp [moved from icu4c/source/common/ucasemap.c with 98% similarity]
icu4c/source/common/ucnv2022.cpp [moved from icu4c/source/common/ucnv2022.c with 99% similarity]
icu4c/source/common/ucnv_bld.cpp [moved from icu4c/source/common/ucnv_bld.c with 98% similarity]
icu4c/source/common/ucnv_bld.h
icu4c/source/common/ucnv_cnv.h
icu4c/source/common/ucnv_ext.cpp [moved from icu4c/source/common/ucnv_ext.c with 99% similarity]
icu4c/source/common/ucnv_imp.h
icu4c/source/common/ucnv_io.cpp [moved from icu4c/source/common/ucnv_io.c with 98% similarity]
icu4c/source/common/ucnvbocu.cpp [moved from icu4c/source/common/ucnvbocu.c with 99% similarity]
icu4c/source/common/ucnvmbcs.h
icu4c/source/common/uloc.cpp [moved from icu4c/source/common/uloc.c with 98% similarity]
icu4c/source/common/unames.cpp [moved from icu4c/source/common/unames.c with 99% similarity]
icu4c/source/common/unicode/ppalmos.h
icu4c/source/common/unicode/pwin32.h
icu4c/source/common/unicode/umachine.h
icu4c/source/common/uresbund.cpp [moved from icu4c/source/common/uresbund.c with 99% similarity]
icu4c/source/common/uset.cpp
icu4c/source/common/ushape.cpp [moved from icu4c/source/common/ushape.c with 98% similarity]
icu4c/source/common/ustr_imp.h
icu4c/source/common/ustr_wcs.cpp [moved from icu4c/source/common/ustr_wcs.c with 99% similarity]
icu4c/source/common/ustrcase.cpp [moved from icu4c/source/common/ustrcase.c with 97% similarity]
icu4c/source/common/ustring.cpp [moved from icu4c/source/common/ustring.c with 99% similarity]
icu4c/source/common/ustrtrns.cpp [moved from icu4c/source/common/ustrtrns.c with 99% similarity]
icu4c/source/common/utrie.cpp [moved from icu4c/source/common/utrie.c with 99% similarity]
icu4c/source/common/utrie2.cpp
icu4c/source/common/utrie2_builder.cpp [moved from icu4c/source/common/utrie2_builder.c with 99% similarity]
icu4c/source/i18n/ucol_wgt.cpp
icu4c/source/io/io.vcxproj
icu4c/source/io/io.vcxproj.filters
icu4c/source/io/locbund.cpp [moved from icu4c/source/io/locbund.c with 94% similarity]
icu4c/source/io/locbund.h
icu4c/source/test/cintltst/bocu1tst.c
icu4c/source/test/cintltst/ccapitst.c
icu4c/source/test/intltest/tsputil.cpp
icu4c/source/test/intltest/tsputil.h
icu4c/source/tools/ctestfw/unicode/utimer.h
icu4c/source/tools/genrb/errmsg.c
icu4c/source/tools/genrb/errmsg.h
icu4c/source/tools/genrb/genrb.vcxproj
icu4c/source/tools/genrb/genrb.vcxproj.filters
icu4c/source/tools/genrb/parse.cpp [moved from icu4c/source/tools/genrb/parse.c with 99% similarity]
icu4c/source/tools/genrb/read.c
icu4c/source/tools/genrb/read.h
icu4c/source/tools/genrb/ustr.c
icu4c/source/tools/genrb/ustr.h
icu4c/source/tools/makeconv/genmbcs.cpp [moved from icu4c/source/tools/makeconv/genmbcs.c with 99% similarity]
icu4c/source/tools/makeconv/makeconv.vcxproj
icu4c/source/tools/makeconv/makeconv.vcxproj.filters

index 26f7b6a82e8b8981dce42a08d8fca6a2a42e81cc..10e32e9a0db07309d501aba7ea1a4d5ce97861a4 100644 (file)
@@ -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);
index ecd8f034dff314fe7564829b61d0e24d58d8b3fc..8afd9ec3531096e76ec193fbc02f29a054df52ac 100644 (file)
     <ClCompile Include="ubidi_props.c" />\r
     <ClCompile Include="ubidiln.c" />\r
     <ClCompile Include="ubidiwrt.c" />\r
-    <ClCompile Include="ushape.c" />\r
+    <ClCompile Include="ushape.cpp" />\r
     <ClCompile Include="brkeng.cpp" />\r
     <ClCompile Include="brkiter.cpp" />\r
     <ClCompile Include="dictbe.cpp" />\r
     <ClCompile Include="ulist.c" />\r
     <ClCompile Include="ustack.cpp" />\r
     <ClCompile Include="ustrenum.cpp" />\r
-    <ClCompile Include="utrie.c" />\r
+    <ClCompile Include="utrie.cpp" />\r
     <ClCompile Include="utrie2.cpp" />\r
-    <ClCompile Include="utrie2_builder.c" />\r
+    <ClCompile Include="utrie2_builder.cpp" />\r
     <ClCompile Include="uvector.cpp" />\r
     <ClCompile Include="uvectr32.cpp" />\r
     <ClCompile Include="uvectr64.cpp" />\r
       <DisableLanguageExtensions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</DisableLanguageExtensions>\r
     </ClCompile>\r
     <ClCompile Include="mutex.cpp" />\r
-    <ClCompile Include="putil.c">\r
+    <ClCompile Include="putil.cpp">\r
       <DisableLanguageExtensions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</DisableLanguageExtensions>\r
       <DisableLanguageExtensions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</DisableLanguageExtensions>\r
       <DisableLanguageExtensions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</DisableLanguageExtensions>\r
       <DisableLanguageExtensions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</DisableLanguageExtensions>\r
     </ClCompile>\r
     <ClCompile Include="ucnv.c" />\r
-    <ClCompile Include="ucnv2022.c" />\r
-    <ClCompile Include="ucnv_bld.c" />\r
+    <ClCompile Include="ucnv2022.cpp" />\r
+    <ClCompile Include="ucnv_bld.cpp" />\r
     <ClCompile Include="ucnv_cb.c" />\r
     <ClCompile Include="ucnv_cnv.c" />\r
     <ClCompile Include="ucnv_ct.c" />\r
     <ClCompile Include="ucnv_err.c" />\r
-    <ClCompile Include="ucnv_ext.c" />\r
-    <ClCompile Include="ucnv_io.c" />\r
+    <ClCompile Include="ucnv_ext.cpp" />\r
+    <ClCompile Include="ucnv_io.cpp" />\r
     <ClCompile Include="ucnv_lmb.c" />\r
     <ClCompile Include="ucnv_set.c" />\r
     <ClCompile Include="ucnv_u16.c" />\r
     <ClCompile Include="ucnv_u32.c" />\r
     <ClCompile Include="ucnv_u7.c" />\r
     <ClCompile Include="ucnv_u8.c" />\r
-    <ClCompile Include="ucnvbocu.c" />\r
+    <ClCompile Include="ucnvbocu.cpp" />\r
     <ClCompile Include="ucnvdisp.c" />\r
     <ClCompile Include="ucnvhz.c" />\r
     <ClCompile Include="ucnvisci.c" />\r
     <ClCompile Include="ustrfmt.c" />\r
     <ClCompile Include="util.cpp" />\r
     <ClCompile Include="util_props.cpp" />\r
-    <ClCompile Include="punycode.c" />\r
+    <ClCompile Include="punycode.cpp" />\r
     <ClCompile Include="uidna.cpp" />\r
     <ClCompile Include="uts46.cpp" />\r
     <ClCompile Include="locavailable.cpp" />\r
     <ClCompile Include="resbund.cpp" />\r
     <ClCompile Include="resbund_cnv.cpp" />\r
     <ClCompile Include="ucat.c" />\r
-    <ClCompile Include="uloc.c" />\r
+    <ClCompile Include="uloc.cpp" />\r
     <ClCompile Include="uloc_tag.c" />\r
     <ClCompile Include="ures_cnv.c" />\r
-    <ClCompile Include="uresbund.c" />\r
+    <ClCompile Include="uresbund.cpp" />\r
     <ClCompile Include="uresdata.c" />\r
     <ClCompile Include="caniter.cpp" />\r
     <ClCompile Include="filterednormalizer2.cpp" />\r
     <ClCompile Include="patternprops.cpp" />\r
     <ClCompile Include="propname.cpp" />\r
     <ClCompile Include="ruleiter.cpp" />\r
-    <ClCompile Include="ucase.c" />\r
+    <ClCompile Include="ucase.cpp" />\r
     <ClCompile Include="uchar.c" />\r
-    <ClCompile Include="unames.c" />\r
+    <ClCompile Include="unames.cpp" />\r
     <ClCompile Include="unifilt.cpp" />\r
     <ClCompile Include="unifunct.cpp" />\r
     <ClCompile Include="uniset.cpp" />\r
     <ClCompile Include="schriter.cpp" />\r
     <ClCompile Include="stringpiece.cpp" />\r
     <ClCompile Include="stringtriebuilder.cpp" />\r
-    <ClCompile Include="ucasemap.c" />\r
+    <ClCompile Include="ucasemap.cpp" />\r
     <ClCompile Include="ucharstrie.cpp" />\r
     <ClCompile Include="ucharstriebuilder.cpp" />\r
     <ClCompile Include="ucharstrieiterator.cpp" />\r
     <ClCompile Include="unistr_cnv.cpp" />\r
     <ClCompile Include="unistr_props.cpp" />\r
     <ClCompile Include="ustr_cnv.c" />\r
-    <ClCompile Include="ustr_wcs.c" />\r
-    <ClCompile Include="ustrcase.c" />\r
-    <ClCompile Include="ustring.c" />\r
-    <ClCompile Include="ustrtrns.c" />\r
+    <ClCompile Include="ustr_wcs.cpp" />\r
+    <ClCompile Include="ustrcase.cpp" />\r
+    <ClCompile Include="ustring.cpp" />\r
+    <ClCompile Include="ustrtrns.cpp" />\r
     <ClCompile Include="utext.cpp" />\r
     <ClCompile Include="utf_impl.c" />\r
   </ItemGroup>\r
@@ -1749,4 +1749,4 @@ copy "%(FullPath)"  ..\..\include\unicode\%(FileName).h</Command>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>
+</Project>\r
index 63911235f68abae02f3d15c247cca2d4cac108c0..562c42063317af0efe8eecb83ce1b424e1e1d157 100644 (file)
@@ -61,7 +61,7 @@
     <ClCompile Include="ubidiwrt.c">\r
       <Filter>bidi</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ushape.c">\r
+    <ClCompile Include="ushape.cpp">\r
       <Filter>bidi</Filter>\r
     </ClCompile>\r
     <ClCompile Include="brkeng.cpp">\r
     <ClCompile Include="ustrenum.cpp">\r
       <Filter>collections</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="utrie.c">\r
+    <ClCompile Include="utrie.cpp">\r
       <Filter>collections</Filter>\r
     </ClCompile>\r
     <ClCompile Include="utrie2.cpp">\r
       <Filter>collections</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="utrie2_builder.c">\r
+    <ClCompile Include="utrie2_builder.cpp">\r
       <Filter>collections</Filter>\r
     </ClCompile>\r
     <ClCompile Include="uvector.cpp">\r
     <ClCompile Include="mutex.cpp">\r
       <Filter>configuration</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="putil.c">\r
+    <ClCompile Include="putil.cpp">\r
       <Filter>configuration</Filter>\r
     </ClCompile>\r
     <ClCompile Include="umath.c">\r
     <ClCompile Include="ucnv.c">\r
       <Filter>conversion</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ucnv2022.c">\r
+    <ClCompile Include="ucnv2022.cpp">\r
       <Filter>conversion</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ucnv_bld.c">\r
+    <ClCompile Include="ucnv_bld.cpp">\r
       <Filter>conversion</Filter>\r
     </ClCompile>\r
     <ClCompile Include="ucnv_cb.c">\r
     <ClCompile Include="ucnv_err.c">\r
       <Filter>conversion</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ucnv_ext.c">\r
+    <ClCompile Include="ucnv_ext.cpp">\r
       <Filter>conversion</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ucnv_io.c">\r
+    <ClCompile Include="ucnv_io.cpp">\r
       <Filter>conversion</Filter>\r
     </ClCompile>\r
     <ClCompile Include="ucnv_lmb.c">\r
     <ClCompile Include="ucnv_u8.c">\r
       <Filter>conversion</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ucnvbocu.c">\r
+    <ClCompile Include="ucnvbocu.cpp">\r
       <Filter>conversion</Filter>\r
     </ClCompile>\r
     <ClCompile Include="ucnvdisp.c">\r
     <ClCompile Include="util_props.cpp">\r
       <Filter>formatting</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="punycode.c">\r
+    <ClCompile Include="punycode.cpp">\r
       <Filter>idna</Filter>\r
     </ClCompile>\r
     <ClCompile Include="uidna.cpp">\r
     <ClCompile Include="ucat.c">\r
       <Filter>locales &amp; resources</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="uloc.c">\r
+    <ClCompile Include="uloc.cpp">\r
       <Filter>locales &amp; resources</Filter>\r
     </ClCompile>\r
     <ClCompile Include="uloc_tag.c">\r
     <ClCompile Include="ures_cnv.c">\r
       <Filter>locales &amp; resources</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="uresbund.c">\r
+    <ClCompile Include="uresbund.cpp">\r
       <Filter>locales &amp; resources</Filter>\r
     </ClCompile>\r
     <ClCompile Include="uresdata.c">\r
     <ClCompile Include="ruleiter.cpp">\r
       <Filter>properties &amp; sets</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ucase.c">\r
+    <ClCompile Include="ucase.cpp">\r
       <Filter>properties &amp; sets</Filter>\r
     </ClCompile>\r
     <ClCompile Include="uchar.c">\r
       <Filter>properties &amp; sets</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="unames.c">\r
+    <ClCompile Include="unames.cpp">\r
       <Filter>properties &amp; sets</Filter>\r
     </ClCompile>\r
     <ClCompile Include="unifilt.cpp">\r
     <ClCompile Include="stringpiece.cpp">\r
       <Filter>strings</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ucasemap.c">\r
+    <ClCompile Include="ucasemap.cpp">\r
       <Filter>strings</Filter>\r
     </ClCompile>\r
     <ClCompile Include="uchriter.cpp">\r
     <ClCompile Include="ustr_cnv.c">\r
       <Filter>strings</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ustr_wcs.c">\r
+    <ClCompile Include="ustr_wcs.cpp">\r
       <Filter>strings</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ustrcase.c">\r
+    <ClCompile Include="ustrcase.cpp">\r
       <Filter>strings</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ustring.c">\r
+    <ClCompile Include="ustring.cpp">\r
       <Filter>strings</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ustrtrns.c">\r
+    <ClCompile Include="ustrtrns.cpp">\r
       <Filter>strings</Filter>\r
     </ClCompile>\r
     <ClCompile Include="utext.cpp">\r
index e6a93eaf1c4603f1f0c0db5d8e8ed82a116a58ec..3a8690812c0d1bb5fbb5490a6752e3ae82479860 100644 (file)
@@ -1,6 +1,6 @@
 /*
  **********************************************************************
- *   Copyright (C) 1997-2010, International Business Machines
+ *   Copyright (C) 1997-2011, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  **********************************************************************
 *
similarity index 99%
rename from icu4c/source/common/punycode.c
rename to icu4c/source/common/punycode.cpp
index bf85b67f6f1c493dea1d98a5f32ed7b908c5babe..e3c5f7eff4771db52b46a0647eb04adb67d8f1c4 100644 (file)
@@ -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) {
similarity index 99%
rename from icu4c/source/common/putil.c
rename to icu4c/source/common/putil.cpp
index 48838addda72f69f464aa1601b88ec9bbe20b805..15cea60d50db04632863b73f460be0b752e3a65b 100644 (file)
@@ -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<char *>(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<char *>(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<char *>(uprv_strchr(name, '@'))) != NULL) {
             *variant = 0;
         }
         name = remapPlatformDependentCodepage(localeBuf, name);
index e1a58d2dc7ecdb2dfe4f82e3e9f85cc3f4076612..f87a572416042d6355b88ceda091b28c09790997 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 1997-2010, International Business Machines
+*   Copyright (C) 1997-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *
similarity index 99%
rename from icu4c/source/common/ucase.c
rename to icu4c/source/common/ucase.cpp
index 0f9c526e66253307f034dc26801f0a245bde67f8..d5eb60ede9d48896f9dc5c0bae9d07a0fd34a73f 100644 (file)
@@ -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)) {
index be28fa24c8dfbba47ac5421235359933812408bf..4c1ce84f7a1653d731db2d76737df69265bf1953 100644 (file)
@@ -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
similarity index 98%
rename from icu4c/source/common/ucasemap.c
rename to icu4c/source/common/ucasemap.cpp
index 9f94235ae918cd4d2056a4ded0fd7db636e61918..d7543df87ddd20fbdfa7336d69b62cffa6199f43 100644 (file)
@@ -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;
similarity index 99%
rename from icu4c/source/common/ucnv2022.c
rename to icu4c/source/common/ucnv2022.cpp
index 22ebe244c8344bf1ce117be724c140fb6d72edeb..628804846ccea6747b4ff8c95410fa8cb917cc7c 100644 (file)
@@ -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 */
similarity index 98%
rename from icu4c/source/common/ucnv_bld.c
rename to icu4c/source/common/ucnv_bld.cpp
index 657e5c811f1002e903a005d69599594d1dabc535..efef4f24d6499cfc4380559368fde09e3f7fe7d2 100644 (file)
@@ -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( length<sizeof(UConverterStaticData) ||
+        if( length<(int32_t)sizeof(UConverterStaticData) ||
             (uint32_t)length<(staticDataSize=ds->readUInt32(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 && length<sizeof(_MBCSHeader)) {
+        if(0<=length && length<(int32_t)sizeof(_MBCSHeader)) {
             udata_printError(ds, "ucnv_swap(): too few bytes (%d after headers) for an ICU MBCS .cnv conversion table\n",
                                 length);
             *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
index 227c495d2b65c17638c954cf7f3e5c862695de53..d8e21774d39e09808c7b27a12c44118d6ab589e1 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 1999-2009 International Business Machines
+*   Copyright (C) 1999-2011 International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *
@@ -260,7 +260,7 @@ ucnv_bld_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode);
  * Load a non-algorithmic converter.
  * If pkg==NULL, then this function must be called inside umtx_lock(&cnvCacheMutex).
  */
-UConverterSharedData *
+U_CAPI UConverterSharedData *
 ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err);
 
 /**
@@ -268,7 +268,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);
 
 /**
index 6334b2417f85367212933c570ebaef89eb9cdee4..402e2c946b8a528f6d093ce331afd04df335b1b5 100644 (file)
@@ -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);
similarity index 99%
rename from icu4c/source/common/ucnv_ext.c
rename to icu4c/source/common/ucnv_ext.cpp
index 8e8b326e9fa1f05d6bef042e518b2f9c721dc530..898a235713eab33f59eb9633296a6c69c21aa1ca 100644 (file)
@@ -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,
index 54b0197a2f3a11f5552cc995dad4d5f06fb2ffc1..27c373a98f5e9c851dab549b80902294cbe5605c 100644 (file)
@@ -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);
 
 /**
similarity index 98%
rename from icu4c/source/common/ucnv_io.c
rename to icu4c/source/common/ucnv_io.cpp
index 3b806d1c4a24a119bfc358bd629b090ed925fa6d..36d7f0ebdfd73ec2da6719d9fbea17e521522c11 100644 (file)
@@ -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<UEnumeration *>(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<UAliasContext *>(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<UEnumeration *>(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<uint16_t *>(uprv_malloc(sizeof(uint16_t)));
         if (myContext == NULL) {
             *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
             uprv_free(myEnum);
similarity index 99%
rename from icu4c/source/common/ucnvbocu.c
rename to icu4c/source/common/ucnvbocu.cpp
index 8623b11420845c045259d02f39ac98718b5be78c..23cf92b405143097ef03972c87ad081e3fcb2884 100644 (file)
@@ -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<=b<BOCU1_START_NEG_2 or BOCU1_START_POS_2<=b<BOCU1_MAX_LEAD
  * @return (diff<<2)|count
  */
-static U_INLINE int32_t
+static inline int32_t
 decodeBocu1LeadByte(int32_t b) {
     int32_t diff, count;
 
@@ -906,7 +906,7 @@ decodeBocu1LeadByte(int32_t b) {
  *
  * @see decodeBocu1
  */
-static U_INLINE int32_t
+static inline int32_t
 decodeBocu1TrailByte(int32_t count, int32_t b) {
     if(b<=0x20) {
         /* skip some C0 controls and make the trail byte range contiguous */
@@ -1368,7 +1368,10 @@ static const UConverterImpl _Bocu1Impl={
     NULL,
     NULL,
     NULL,
-    ucnv_getCompleteUnicodeSet
+    ucnv_getCompleteUnicodeSet,
+
+    NULL,
+    NULL
 };
 
 static const UConverterStaticData _Bocu1StaticData={
@@ -1387,7 +1390,8 @@ static const UConverterStaticData _Bocu1StaticData={
 const UConverterSharedData _Bocu1Data={
     sizeof(UConverterSharedData), ~((uint32_t)0),
     NULL, NULL, &_Bocu1StaticData, FALSE, &_Bocu1Impl,
-    0
+    0,
+    UCNV_MBCS_TABLE_INITIALIZER
 };
 
 #endif
index 9e4f2957033b755b5a7d8dc5158cc3a47aed7ad1..7875f826d2e614be731bfbb3be1491128a381e0f 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-*   Copyright (C) 2000-2007, International Business Machines
+*   Copyright (C) 2000-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
@@ -397,6 +397,41 @@ typedef struct UConverterMBCSTable {
     const int32_t *extIndexes;
 } UConverterMBCSTable;
 
+#define UCNV_MBCS_TABLE_INITIALIZER { \
+    /* toUnicode */ \
+    0, 0, 0, \
+    0, \
+     \
+    NULL, \
+    NULL, \
+    NULL, \
+    NULL, \
+     \
+    /* fromUnicode */ \
+    NULL, \
+    NULL, \
+    { 0 }, \
+    NULL, \
+    NULL, \
+    0, \
+    0, 0, \
+    FALSE, \
+    0, \
+     \
+    /* roundtrips */ \
+    0, \
+     \
+    /* reconstituted data that was omitted from the .cnv file */ \
+    NULL, \
+     \
+    /* converter name for swaplfnl */ \
+    NULL, \
+     \
+    /* extension data */ \
+    NULL, \
+    NULL \
+}
+
 enum {
     MBCS_OPT_LENGTH_MASK=0x3f,
     MBCS_OPT_NO_FROM_U=0x40,
@@ -437,6 +472,8 @@ typedef struct {
     uint32_t fullStage2Length;  /* number of 32-bit units */
 } _MBCSHeader;
 
+#define UCNV_MBCS_HEADER_INITIALIZER { { 0 },  0, 0, 0, 0, 0, 0, 0,  0,  0 }
+
 /*
  * This is a simple version of _MBCSGetNextUChar() that is used
  * by other converter implementations.
similarity index 98%
rename from icu4c/source/common/uloc.c
rename to icu4c/source/common/uloc.cpp
index 6f8496711530be7fbee11df0b0f6f909b260b60a..50a0fdb6ac2bbc94d86cc79a7b24fa157e414e5d 100644 (file)
@@ -626,7 +626,7 @@ typedef struct {
 } KeywordStruct;
 
 static int32_t U_CALLCONV
-compareKeywordStructs(const void *context, const void *left, const void *right) {
+compareKeywordStructs(const void * /*context*/, const void *left, const void *right) {
     const char* leftString = ((const KeywordStruct *)left)->keyword;
     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<UKeywordsContext *>(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<char **>(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<char **>(uprv_malloc((size_t)(sizeof(fallbackList[0])*acceptListCount)));
     if(fallbackList==NULL) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         return -1;
similarity index 99%
rename from icu4c/source/common/unames.c
rename to icu4c/source/common/unames.cpp
index e02c6a8efd5c463550105e1c553d0b9e3454ee86..ac46af88cfb65db28c113bbc0ab20ed49df26730 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-*   Copyright (C) 1999-2009, International Business Machines
+*   Copyright (C) 1999-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
 
 /* 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<<GROUP_SHIFT)
+#define LINES_PER_GROUP (1L<<GROUP_SHIFT)
 #define GROUP_MASK (LINES_PER_GROUP-1)
 
 /*
@@ -171,8 +171,8 @@ static UBool U_CALLCONV unames_cleanup(void)
 }
 
 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 &&
@@ -1433,7 +1433,7 @@ calcNameSetsLengths(UErrorCode *pErrorCode) {
     }
 
     /* set hex digits, used in various names, and <>-, used in extended names */
-    for(i=0; i<sizeof(extChars)-1; ++i) {
+    for(i=0; i<(int32_t)sizeof(extChars)-1; ++i) {
         SET_ADD(gNameSet, extChars[i]);
     }
 
index c15b2ceae327efa6890f9efb0f98355518270590..87ea4b08e57ceb51f48efbe9519bd4cea15cb9ff 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-*   Copyright (C) 1997-2006, International Business Machines
+*   Copyright (C) 1997-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
@@ -243,17 +243,9 @@ typedef unsigned int uint32_t;
 #define U_IMPORT
 
 /*===========================================================================*/
-/* Code alignment and C function inlining                                    */
+/* Code alignment                                                            */
 /*===========================================================================*/
 
-#ifndef U_INLINE
-#   ifdef __cplusplus
-#       define U_INLINE inline
-#   else
-#       define U_INLINE __inline
-#   endif
-#endif
-
 #if defined(_MSC_VER) && defined(_M_IX86)
 #define U_ALIGN_CODE(val)    __asm      align val
 #else
index 32a9881dafcae9294a4faeec21104a3f7d409472..09670f6412a1045cd8673f219b3e4fa70f17a72f 100644 (file)
@@ -310,7 +310,7 @@ typedef unsigned int uint32_t;
 /** @} */
 
 /*===========================================================================*/
-/** @{ Symbol import-export control                                              */
+/** @{ Symbol import-export control                                          */
 /*===========================================================================*/
 
 #ifdef U_STATIC_IMPLEMENTATION
@@ -323,17 +323,9 @@ typedef unsigned int uint32_t;
 /** @} */
 
 /*===========================================================================*/
-/** @{ Code alignment and C function inlining                                    */
+/** @{ Code alignment                                                        */
 /*===========================================================================*/
 
-#ifndef U_INLINE
-#   ifdef __cplusplus
-#       define U_INLINE inline
-#   else
-#       define U_INLINE __inline
-#   endif
-#endif
-
 #if defined(_MSC_VER) && defined(_M_IX86) && !defined(_MANAGED)
 #define U_ALIGN_CODE(val)    __asm      align val
 #else
@@ -351,7 +343,7 @@ typedef unsigned int uint32_t;
 /** @} */
 
 /*===========================================================================*/
-/** @{ Programs used by ICU code                                                 */
+/** @{ Programs used by ICU code                                             */
 /*===========================================================================*/
 
 #ifndef U_MAKE
index 9bac02f46e4788a90644c156543e165f5f4ecb61..1ff91a3574fb58683c1435076c45e1120b1c915d 100644 (file)
@@ -342,7 +342,7 @@ typedef int8_t UBool;
 typedef int32_t UChar32;
 
 /*==========================================================================*/
-/* U_INLINE and U_ALIGN_CODE   Set default values if these are not already  */
+/* U_ALIGN_CODE                Set default values if these are not already  */
 /*                             defined.  Definitions normally are in        */
 /*                             platform.h or the corresponding file for     */
 /*                             the OS in use.                               */
@@ -362,20 +362,6 @@ typedef int32_t UChar32;
 
 #endif /* U_HIDE_INTERNAL_API */
 
-/**
- * \def U_INLINE
- * This is used to request inlining of a function, on platforms and languages which support it.
- * @internal
- */
-#ifndef U_INLINE
-#   ifdef XP_CPLUSPLUS
-#       define U_INLINE inline
-#   else
-#       define U_INLINE
-#   endif
-#endif
-
 #include "unicode/urename.h"
 
 #endif
similarity index 99%
rename from icu4c/source/common/uresbund.c
rename to icu4c/source/common/uresbund.cpp
index 2422b8c6a970c3d9b04a9f3823e18a6c1dd97fe5..93bc559030404f5909a5428bff9a2638058fa0dc 100644 (file)
@@ -876,8 +876,8 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
                 if(capacity < len) {
                     capacity = len;
                 }
-                if(capacity <= sizeof(stackAlias)) {
-                    capacity = sizeof(stackAlias);
+                if(capacity <= (int32_t)sizeof(stackAlias)) {
+                    capacity = (int32_t)sizeof(stackAlias);
                     chAlias = stackAlias;
                 } else {
                     chAlias = (char *)uprv_malloc(capacity);
@@ -2260,7 +2260,7 @@ ures_loc_closeLocales(UEnumeration *enumerator) {
 }
 
 static int32_t U_CALLCONV
-ures_loc_countLocales(UEnumeration *en, UErrorCode *status) {
+ures_loc_countLocales(UEnumeration *en, UErrorCode * /*status*/) {
     ULocalesContext *ctx = (ULocalesContext *)en->context;
     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<ULocalesContext *>(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);
index f4d34474514c37ae30b9631904d4f58a2055d0d9..74ddba37c152d86667428e2e85c370d77509f9f0 100644 (file)
@@ -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;
 // 
similarity index 98%
rename from icu4c/source/common/ushape.c
rename to icu4c/source/common/ushape.cpp
index 5ed5c1d74ee977cb0daa4f2a0c8fa4bac0ddebc3..c34f86dc0bee3a6310d861a587fb74862bde22cb 100644 (file)
@@ -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<j;i++,j--) {
@@ -391,7 +393,7 @@ invertBuffer(UChar *buffer,int32_t size,uint32_t options,int32_t lowlimit,int32_
  *           later it'll be converted into the 0xFExx LamAlefs
  *           in the shaping function.
  */
-static U_INLINE UChar
+static inline UChar
 changeLamAlef(UChar ch) {
     switch(ch) {
     case 0x0622 :
@@ -435,7 +437,7 @@ getLink(UChar ch) {
  *           at each end of the logical buffer
  */
 static void
-countSpaces(UChar *dest,int32_t size,uint32_t options,int32_t *spacesCountl,int32_t *spacesCountr) {
+countSpaces(UChar *dest, int32_t size, uint32_t /*options*/, int32_t *spacesCountl, int32_t *spacesCountr) {
     int32_t i = 0;
     int32_t countl = 0,countr = 0;
     while(dest[i] == SPACE_CHAR) {
@@ -454,7 +456,7 @@ countSpaces(UChar *dest,int32_t size,uint32_t options,int32_t *spacesCountl,int3
  *Name     : isTashkeelChar
  *Function : Returns 1 for Tashkeel characters in 06 range else return 0
  */
-static U_INLINE int32_t
+static inline int32_t
 isTashkeelChar(UChar ch) {
     return (int32_t)( ch>=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);
index f0ec5a5a2362f2363ec81df9a13c283ddfbb1dda..43291d733dc2d1d1c0ae7ef86bfddfefcbc8b3d4 100644 (file)
@@ -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,
similarity index 99%
rename from icu4c/source/common/ustr_wcs.c
rename to icu4c/source/common/ustr_wcs.cpp
index 9de5e223155880d9fab0f2d6a83c35cecced5f36..4b1460fbc9dc4e5c39d4071c1a9b950a3c8f64d9 100644 (file)
@@ -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) {
similarity index 97%
rename from icu4c/source/common/ustrcase.c
rename to icu4c/source/common/ustrcase.cpp
index 4b62fb95c3a14cb4f98ab365a54548d42f8f76e0..15740527db5e38b7c57fa00ad0b3e5799e2b9455 100644 (file)
@@ -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
 #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,
similarity index 99%
rename from icu4c/source/common/ustring.c
rename to icu4c/source/common/ustring.cpp
index e9f917dc89d019f0a0c77b02ab13b9b7f02e0e3d..2d181aa72b7708eb55cdcc3757cc85bd1c5ff5de 100644 (file)
@@ -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 */
similarity index 99%
rename from icu4c/source/common/ustrtrns.c
rename to icu4c/source/common/ustrtrns.cpp
index aa18ef5bee24cd73e75f56dfea851e82d8b52ffa..6c17b661202aeeae90f3508e1c50ff9a1149e06a 100644 (file)
@@ -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) {
similarity index 99%
rename from icu4c/source/common/utrie.c
rename to icu4c/source/common/utrie.cpp
index ddb94bb22c58db33194aa981b0d5c0afe62b237a..eb97aaa55b1b77b08b3e8222927438406b08e78e 100644 (file)
@@ -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(length<sizeof(UTrieHeader)) {
+    if(length<(int32_t)sizeof(UTrieHeader)) {
         *pErrorCode=U_INVALID_FORMAT_ERROR;
         return -1;
     }
@@ -1045,7 +1045,7 @@ utrie_unserializeDummy(UTrie *trie,
 
 /* default UTrieEnumValue() returns the input value itself */
 static uint32_t U_CALLCONV
-enumSameValue(const void *context, uint32_t value) {
+enumSameValue(const void * /*context*/, uint32_t value) {
     return value;
 }
 
index 55678605ba816781d5960176d151fa5ecdf562c0..e07860ef9254f86cc87389167e71b2e903421ca0 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-*   Copyright (C) 2001-2010, International Business Machines
+*   Copyright (C) 2001-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
@@ -79,7 +79,7 @@ utrie2_get32FromLeadSurrogateCodeUnit(const UTrie2 *trie, UChar32 c) {
     }
 }
 
-static U_INLINE int32_t
+static inline int32_t
 u8Index(const UTrie2 *trie, UChar32 c, int32_t i) {
     int32_t idx=
         _UTRIE2_INDEX_FROM_CP(
similarity index 99%
rename from icu4c/source/common/utrie2_builder.c
rename to icu4c/source/common/utrie2_builder.cpp
index 1f3c4c1352df9d72d477498c61387c33ea000ffa..8d2a4e12ecb41d9e57a9569dc6d3bbd13bb74b69 100644 (file)
@@ -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:  utrie2_builder.c
+*   file name:  utrie2_builder.cpp
 *   encoding:   US-ASCII
 *   tab size:   8 (not used)
 *   indentation:4
@@ -455,7 +455,7 @@ utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode
     return context.trie;
 }
 
-static U_INLINE UBool
+static inline UBool
 isInNullBlock(UNewTrie2 *trie, UChar32 c, UBool forLSCP) {
     int32_t i2, block;
 
@@ -562,12 +562,12 @@ releaseDataBlock(UNewTrie2 *trie, int32_t block) {
     trie->firstFreeBlock=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;
index 87d34fe73a718005181973c290062747a3845688..57d49fca7987f8897fd1035a01102ec4758e4b7c 100644 (file)
@@ -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<<length))|(trail<<length));
 }
 
-static U_INLINE uint32_t
+static inline uint32_t
 getWeightByte(uint32_t weight, int32_t idx) {
     return getWeightTrail(weight, idx); /* same calculation */
 }
 
-static U_INLINE uint32_t
+static inline uint32_t
 setWeightByte(uint32_t weight, int32_t idx, uint32_t byte) {
     uint32_t mask; /* 0xffffffff except a 00 "hole" for the index-th byte */
 
@@ -88,22 +88,22 @@ setWeightByte(uint32_t weight, int32_t idx, uint32_t byte) {
     return (uint32_t)((weight&mask)|(byte<<idx));
 }
 
-static U_INLINE uint32_t
+static inline uint32_t
 truncateWeight(uint32_t weight, int32_t length) {
     return (uint32_t)(weight&(0xffffffff<<(8*(4-length))));
 }
 
-static U_INLINE uint32_t
+static inline uint32_t
 incWeightTrail(uint32_t weight, int32_t length) {
     return (uint32_t)(weight+(1UL<<(8*(4-length))));
 }
 
-static U_INLINE uint32_t
+static inline uint32_t
 decWeightTrail(uint32_t weight, int32_t length) {
     return (uint32_t)(weight-(1UL<<(8*(4-length))));
 }
 
-static U_INLINE uint32_t
+static inline uint32_t
 incWeight(uint32_t weight, int32_t length, uint32_t maxByte) {
     uint32_t byte;
 
@@ -119,7 +119,7 @@ incWeight(uint32_t weight, int32_t length, uint32_t maxByte) {
     }
 }
 
-static U_INLINE int32_t
+static inline int32_t
 lengthenRange(WeightRange *range, uint32_t maxByte, uint32_t countBytes) {
     int32_t length;
 
@@ -152,7 +152,7 @@ compareRanges(const void * /*context*/, const void *left, const void *right) {
  * possible ranges of weights between the two limits, excluding them
  * for weights with up to 4 bytes there are up to 2*4-1=7 ranges
  */
-static U_INLINE int32_t
+static inline int32_t
 getWeightRanges(uint32_t lowerLimit, uint32_t upperLimit,
                 uint32_t maxByte, uint32_t countBytes,
                 WeightRange ranges[7]) {
index 73e46b94ae6aed369fca5f476dbc7b68b52bded8..e0405d7b5bc8c88cc270bf150417011ce2d31c50 100644 (file)
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
-    <ClCompile Include="locbund.c" />\r
+    <ClCompile Include="locbund.cpp" />\r
     <ClCompile Include="sprintf.c" />\r
     <ClCompile Include="sscanf.c" />\r
     <ClCompile Include="ucln_io.c">\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>
+</Project>\r
index 83e23d661b764a012232499cfee10a1ace6768d2..e21d18ccb22ef10453eee3af887d49af92c4c023 100644 (file)
@@ -15,7 +15,7 @@
     </Filter>\r
   </ItemGroup>\r
   <ItemGroup>\r
-    <ClCompile Include="locbund.c">\r
+    <ClCompile Include="locbund.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="sprintf.c">\r
similarity index 94%
rename from icu4c/source/io/locbund.c
rename to icu4c/source/io/locbund.cpp
index 1859999b158303343af36fd47d9c422f7654f548..b2dfa1b74d408fd891e454d52c5c2d735d4438d3 100644 (file)
@@ -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;
index f4ff449b1f1748aae595ee59aecd7dc27776d4f0..1eac6227b1d5eb172221a8b30ff82f066bd34af5 100644 (file)
@@ -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 <TT>loc</TT> 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 <TT>loc</TT> 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 */
index 6189af2ce5253d8fcb0fe8ef7957eaa49206fa48..41647ffb41d393519b6c864f66fa8c7ef235c760 100644 (file)
@@ -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);
 }
index b6fb7c0c93ab1775775e24283832b6a5d751f519..85f503cbd52a060ede2619ac3dec99f5e41489db 100644 (file)
@@ -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;
index b059c12eebe129708c65d3c90aa3ccb21d2784fb..222225a9c35c02ed4c095ad5aab4f82fb7676642 100644 (file)
@@ -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");
-    }
-}
index 77cd52b2b317987cf5523ec5bc689490e651fcb5..b5767c441127ec6ca5662cc28246013d0254b23f 100644 (file)
@@ -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);
index 7974540f4a68ce7a630e8a8352cac9cccc99bf92..b59867cb006520622361b115a7dc2e598703b71f 100644 (file)
@@ -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, 
index 8b47f261a32c838033ef57c7aac770d2b4d0e1d0..420c12399e607bf7a4950c289abab8d3dd224e61 100644 (file)
@@ -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);
     }
 }
-
index dbb8c66ffebc9079b10252e37e1f545fff890c6a..545a872906d081fb6a7a00227ad46a55ca39b441 100644 (file)
@@ -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);
index 35c1d086db43c7c048e4f562015f28def085a6ac..b7f48efbfc6648818281055c08e6234c176e94b7 100644 (file)
   <ItemGroup>\r
     <ClCompile Include="errmsg.c" />\r
     <ClCompile Include="genrb.c" />\r
-    <ClCompile Include="parse.c" />\r
+    <ClCompile Include="parse.cpp" />\r
     <ClCompile Include="prscmnts.cpp" />\r
     <ClCompile Include="rbutil.c" />\r
     <ClCompile Include="read.c" />\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>
+</Project>\r
index 735313a22a1c246783dbe6047224b77367596c25..c45441c64ecda45b94f586a54d1061ba4620a626 100644 (file)
@@ -21,7 +21,7 @@
     <ClCompile Include="genrb.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="parse.c">\r
+    <ClCompile Include="parse.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="prscmnts.cpp">\r
similarity index 99%
rename from icu4c/source/tools/genrb/parse.c
rename to icu4c/source/tools/genrb/parse.cpp
index 86bed258a242174e55a9ecc14ca3c596394b2156..d990d4622120a1c791fe223039b89daf27988e95 100644 (file)
@@ -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<char *>(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<uint8_t *>(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;
         }
index 15c4db4d8684cd688d64a827aafb3c03a7cea045..8efad67c1ac8268478564c789b4223f2f74fcdb3 100644 (file)
@@ -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;
     }
index 96bd9608128fdc2a3de12b164f97af5a2fc3bbd8..f79b145f25aa36f9ddb71cc141234139b333ca5b 100644 (file)
@@ -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
index ff7487b386d789d1084e329e1dd0d2a492272ff0..faa03adef4e8e75be8aa82fc309c5f260215694d 100644 (file)
@@ -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)
index 085643a8d7a7d25985917f4ef445cc83e934383a..b2d597256bd0f580aee04dfa407eb9ea377cdd2e 100644 (file)
@@ -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
similarity index 99%
rename from icu4c/source/tools/makeconv/genmbcs.c
rename to icu4c/source/tools/makeconv/genmbcs.cpp
index 840438339b8f091822195ed2031fed85c6965442..5c4c911b37724ca8a8e9f3790639cee97d676bd0 100644 (file)
@@ -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) {
index f2d8f336e2e4e23bb458feeff4d93919dce288d7..751a248f94cec81cd52019758a83ae1af24920e0 100644 (file)
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
     <ClCompile Include="gencnvex.c" />\r
-    <ClCompile Include="genmbcs.c" />\r
+    <ClCompile Include="genmbcs.cpp" />\r
     <ClCompile Include="makeconv.c" />\r
     <ClCompile Include="ucnvstat.c" />\r
   </ItemGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>
+</Project>\r
index 5ec7b299f8aa801701316b3c623bafd73cfecc27..3f34f13873eb8480cd272db7823d921117aae15a 100644 (file)
@@ -18,7 +18,7 @@
     <ClCompile Include="gencnvex.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="genmbcs.c">\r
+    <ClCompile Include="genmbcs.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="makeconv.c">\r