]> granicus.if.org Git - icu/commitdiff
ICU-8784 commit iSeries porting fixes into trunk
authorSteven R. Loomis <srl@icu-project.org>
Thu, 15 Sep 2011 19:34:17 +0000 (19:34 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Thu, 15 Sep 2011 19:34:17 +0000 (19:34 +0000)
X-SVN-Rev: 30667

19 files changed:
icu4c/source/common/cmemory.c
icu4c/source/common/messagepattern.cpp
icu4c/source/common/putilimp.h
icu4c/source/common/ucmndata.c
icu4c/source/common/unicode/ubrk.h
icu4c/source/config/gmakever.mk
icu4c/source/config/mh-os400
icu4c/source/i18n/msgfmt.cpp
icu4c/source/i18n/smpdtfmt.cpp
icu4c/source/runConfigureICU
icu4c/source/test/cintltst/cbiapts.c
icu4c/source/test/cintltst/spooftest.c
icu4c/source/test/intltest/plurfmts.cpp
icu4c/source/test/intltest/plurults.cpp
icu4c/source/test/intltest/regextst.cpp
icu4c/source/test/intltest/regextst.h
icu4c/source/test/intltest/tmsgfmt.cpp
icu4c/source/tools/pkgdata/pkgdata.cpp
icu4c/source/tools/toolutil/package.cpp

index 0f93f36a63d9d43e4894dba9047950597042b661..5b72e7e5a8ed9ba2f8c6f24ffd8320ded7d26ebd 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-*   Copyright (C) 2002-2003, International Business Machines
+*   Copyright (C) 2002-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
@@ -20,6 +20,7 @@
 */
 #include "unicode/uclean.h"
 #include "cmemory.h"
+#include "putilimp.h"
 #include <stdlib.h>
 
 /* uprv_malloc(0) returns a pointer to this read-only data. */                
@@ -42,7 +43,7 @@ uprv_malloc(size_t s) {
         if (pAlloc) {
             return (*pAlloc)(pContext, s);
         } else {
-            return malloc(s);
+            return uprv_default_malloc(s);
         }
     } else {
         return (void *)zeroMem;
@@ -57,7 +58,7 @@ uprv_realloc(void * buffer, size_t size) {
         if (pFree) {
             (*pFree)(pContext, buffer);
         } else {
-            free(buffer);
+            uprv_default_free(buffer);
         }
         return (void *)zeroMem;
     } else {
@@ -65,7 +66,7 @@ uprv_realloc(void * buffer, size_t size) {
         if (pRealloc) {
             return (*pRealloc)(pContext, buffer, size);
         } else {
-            return realloc(buffer, size);
+            return uprv_default_realloc(buffer, size);
         }
     }
 }
@@ -76,7 +77,7 @@ uprv_free(void *buffer) {
         if (pFree) {
             (*pFree)(pContext, buffer);
         } else {
-            free(buffer);
+            uprv_default_free(buffer);
         }
     }
 }
index a7812ac49250155727ea7765855f79d4b6c2096c..f77be8c2a38f7a9e08d990b6c9c3bb869435bc8f 100644 (file)
@@ -342,7 +342,7 @@ MessagePattern::autoQuoteApostropheDeep() const {
     for(int32_t i=count; i>0;) {
         const Part &part=getPart(--i);
         if(part.getType()==UMSGPAT_PART_TYPE_INSERT_CHAR) {
-            modified.insert(part.index, (UChar)part.value);
+           modified.insert(part.index, (UChar)part.value);
         }
     }
     return modified;
index b101172cbbb026c62981a912e3d6f38a1b9af7c6..d6b857501f429d8775ea4aad06460468aa5b5ea8 100644 (file)
@@ -502,6 +502,24 @@ U_INTERNAL UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symb
  */
 /* U_INTERNAL void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */
 
+
+/**
+ * Define malloc and related functions
+ * @internal
+ */
+#if defined(OS400)
+# define uprv_default_malloc(x) _C_TS_malloc(x)
+# define uprv_default_realloc(x,y) _C_TS_realloc(x,y)
+# define uprv_default_free(x) _C_TS_free(x)
+/* also _C_TS_calloc(x) */
+#else
+/* C defaults */
+# define uprv_default_malloc(x) malloc(x)
+# define uprv_default_realloc(x,y) realloc(x,y)
+# define uprv_default_free(x) free(x)
+#endif
+
+
 #endif
 
 #endif
index 1d3f2fc58994e1fe41b2a607a911e5bbb0fba221..b9a11eb66aac770ee967c53f9e711c7bd12da16b 100644 (file)
@@ -317,7 +317,9 @@ U_CFUNC void udata_checkCommonData(UDataMemory *udm, UErrorCode *err) {
         return;
     }
 
-    if(!(udm->pHeader->dataHeader.magic1==0xda &&
+    if(udm==NULL || udm->pHeader==NULL) {
+      *err=U_INVALID_FORMAT_ERROR;
+    } else if(!(udm->pHeader->dataHeader.magic1==0xda &&
         udm->pHeader->dataHeader.magic2==0x27 &&
         udm->pHeader->info.isBigEndian==U_IS_BIG_ENDIAN &&
         udm->pHeader->info.charsetFamily==U_CHARSET_FAMILY)
index c093797f92ba2f4ac5e7b92bfc397af1a20bf839..5dcb49aa735e000ce252a9335377ee5bbb41fd11 100644 (file)
@@ -267,7 +267,7 @@ ubrk_safeClone(
   * A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone().
   * @stable ICU 2.0
   */
-#define U_BRK_SAFECLONE_BUFFERSIZE 512
+#define U_BRK_SAFECLONE_BUFFERSIZE 528
 
 /**
 * Close a UBreakIterator.
index d93bd5b2fa4ebb687bf40eaf56b254bbdf009ff1..1b66c07792a53290457ee38e2949e20ba38c533c 100644 (file)
@@ -1,6 +1,6 @@
 ## -*-makefile-*-
 #******************************************************************************
-#   Copyright (C) 2008-2010, International Business Machines
+#   Copyright (C) 2008-2011, International Business Machines
 #   Corporation and others.  All Rights Reserved.
 #******************************************************************************
 # Make sure we have the right version of Make.
@@ -12,7 +12,9 @@ endif
 ifeq ($(PLATFORM),OS390)
 at_least=3.79.1
 endif
-
+ifeq ($(MACHTYPE),powerpc-ibm-os400)
+at_least=3.77
+endif
 
 latest_a=$(firstword $(sort $(MAKE_VERSION) $(at_least)))
 
@@ -23,6 +25,5 @@ err:
 else
 ok:
        @echo "$(MAKE_VERSION) (we wanted at least $(at_least))"
-       @true
 endif
 
index b4a8e092e4b0de6204235fd66b657055efe93c48..1a236de541ce689c531a0a535c177d197e3f76d8 100644 (file)
@@ -1,6 +1,6 @@
 ## -*-makefile-*-
 ## OS400-specific setup (for cross build)
-## Copyright (c) 1999-2005, International Business Machines Corporation and
+## Copyright (c) 1999-2011, International Business Machines Corporation and
 ## others. All Rights Reserved.
 
 GEN_DEPS.c=    $(CC1) -E -M $(DEFS) $(CPPFLAGS)
@@ -12,13 +12,16 @@ THREADSCPPFLAGS = -D_MULTI_THREADED
 # -qTERASPACE: large pointers
 # -qPFROPT=*STRDONLY: Strings are read-only
 COMPILE.c=     $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c -qTERASPACE=*YES -qSTGMDL=*INHERIT -qPFROPT=*STRDONLY
-COMPILE.cc=    $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c -qTERASPACE=*YES -qSTGMDL=*INHERIT -qPFROPT=*STRDONLY
+COMPILE.cc=    $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c -qTERASPACE=*YES -qSTGMDL=*INHERIT -qPFROPT=*STRDONLY -qRTTIALL
+
+## ICULD program - run bldiculd.sh in icu/as_is/os400/ to build it
+ICULD=/qsys.lib/$(OUTPUTDIR).lib/iculd.pgm
 
 ## Commands to link
 ## We need to use the C++ linker, even when linking C programs, since
 ##  our libraries contain C++ code (C++ static init not called)
-LINK.c=                $(CXX) $(CXXFLAGS) $(LDFLAGS) -qOPTION='*DUPPROC *DUPVAR'
-LINK.cc=       $(CXX) $(CXXFLAGS) $(LDFLAGS) -qOPTION='*DUPPROC *DUPVAR'
+LINK.c=                $(ICULD)  $(CXXFLAGS) $(LDFLAGS) -qOPTION='*DUPPROC *DUPVAR'
+LINK.cc=       $(ICULD) $(CXXFLAGS) $(LDFLAGS) -qOPTION='*DUPPROC *DUPVAR'
 
 ## Commands to make a shared library
 # -qALWLIBUPD: It allows the compiled service program to have dependencies on
index 67a3d858127a6178f1aadd22699406237789b67e..9fcadec0d0d3f87b5e40d5b1da7e96ca0fc8ae5b 100644 (file)
@@ -399,7 +399,7 @@ MessageFormat::operator==(const Format& rhs) const
     if (count != rhs_count) {
         return FALSE;
     }
-    int idx = 0, rhs_idx = 0, pos = -1, rhs_pos = -1;
+    int32_t idx = 0, rhs_idx = 0, pos = -1, rhs_pos = -1;
     for (; idx < count && rhs_idx < rhs_count && U_SUCCESS(ec); ++idx, ++rhs_idx) {
         const UHashElement* cur = uhash_nextElement(customFormatArgStarts, &pos);
         const UHashElement* rhs_cur = uhash_nextElement(that.customFormatArgStarts, &rhs_pos);
index 8316ea37b8800a6ac9b57a7c15941389c1ffff79..253f33ef8811f7f23109233d9daf0c60251e7179 100644 (file)
@@ -1394,7 +1394,7 @@ SimpleDateFormat::processOverrideString(const Locale &locale, const UnicodeStrin
     UBool moreToProcess = TRUE;
 
     while (moreToProcess) {
-        int32_t delimiterPosition = str.indexOf(ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE,start);
+        int32_t delimiterPosition = str.indexOf((UChar)ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE,start);
         if (delimiterPosition == -1) {
             moreToProcess = FALSE;
             len = str.length() - start;
@@ -1402,7 +1402,7 @@ SimpleDateFormat::processOverrideString(const Locale &locale, const UnicodeStrin
             len = delimiterPosition - start;
         }
         UnicodeString currentString(str,start,len);
-        int32_t equalSignPosition = currentString.indexOf(ULOC_KEYWORD_ASSIGN_UNICODE,0);
+        int32_t equalSignPosition = currentString.indexOf((UChar)ULOC_KEYWORD_ASSIGN_UNICODE,0);
         if (equalSignPosition == -1) { // Simple override string such as "hebrew"
             nsName.setTo(currentString);
             ovrField.setToBogus();
index 5a2777ed7b125b3c8aff4a852cb49f8bbbe34a40..dbedb7814e26f8cf001a2238d0619071e662e5af 100755 (executable)
@@ -180,10 +180,13 @@ case $platform in
     IBMi)
         THE_OS="IBM i"
         THE_COMP="the iCC C++"
-        CC=/usr/bin/icc; export CC
-        CXX=/usr/bin/icc; export CXX
+        CC=icc; export CC
+        CXX=icc; export CXX
         CPP="$CC -c -qpponly"; export CPP
-        MAKE=/usr/bin/gmake; export MAKE
+        MAKE=gmake; export MAKE
+        U_MAKE=gmake; export U_MAKE
+        # gmake is a .pgm and may not be on the path.  Don't use a full path, just use gmake.
+        ac_cv_path_U_MAKE=gmake; export ac_cv_path_U_MAKE
         RELEASE_CFLAGS='-O4'
         RELEASE_CXXFLAGS='-O4'
         ;;
index 9c491ae64735644ce1d8e71d30bca06b5211258c..3396958fd9820742d98cea2e043629e09c3b978e 100644 (file)
@@ -423,7 +423,7 @@ static void TestBreakIteratorSafeClone(void)
         /* Verify our define is large enough  */
         if (U_BRK_SAFECLONE_BUFFERSIZE < bufferSize)
         {
-            log_err("FAIL: Pre-calculated buffer size is too small\n");
+          log_err("FAIL: Pre-calculated buffer size is too small - %d but needed %d\n", U_BRK_SAFECLONE_BUFFERSIZE, bufferSize);
         }
         /* Verify we can use this run-time calculated size */
         if (0 == (brk = ubrk_safeClone(someIterators[i], buffer[i], &bufferSize, &status)) || U_FAILURE(status))
index 2b8f7723def52587d73e61c873f0d6092f6f3fed..ff9a34372dd5a85b42a0af905c090889411317c8 100644 (file)
@@ -144,7 +144,7 @@ static void TestUSpoofCAPI(void) {
     fileName = malloc(strlen(dataSrcDir) + 100);
     strcpy(fileName, dataSrcDir);
     strcat(fileName, U_FILE_SEP_STRING "unidata" U_FILE_SEP_STRING "confusables.txt");
-    f = fopen(fileName, "r");
+    f = fopen(fileName, "rb");
     TEST_ASSERT_NE(f, NULL);
     confusables = malloc(3000000);
     confusablesLength = fread(confusables, 1, 3000000, f);
@@ -153,7 +153,7 @@ static void TestUSpoofCAPI(void) {
     
     strcpy(fileName, dataSrcDir);
     strcat(fileName, U_FILE_SEP_STRING "unidata" U_FILE_SEP_STRING "confusablesWholeScript.txt");
-    f = fopen(fileName, "r");
+    f = fopen(fileName, "rb");
     TEST_ASSERT_NE(f, NULL);
     confusablesWholeScript = malloc(1000000);
     confusablesWholeScriptLength = fread(confusablesWholeScript, 1, 1000000, f);
index f62aae3f1b8f8afdebc4491bcba4fd930b28b6bc..b45b262134969620705ff90e12f2ac94bfa8ca75 100644 (file)
@@ -268,7 +268,7 @@ void PluralFormatTest::pluralFormatUnitTest(/*char *par*/)
     }
     numberFormatTest(&pluralFmt, numFmt, 5, 5, NULL, NULL, FALSE, &message);
     pluralFmt.applyPattern(UNICODE_STRING_SIMPLE("odd__{odd} other{even}"), status);
-    if (pluralFmt.format(1, status) != UNICODE_STRING_SIMPLE("even")) {
+    if (pluralFmt.format((int32_t)1, status) != UNICODE_STRING_SIMPLE("even")) {
         errln("SetLocale should reset rules but did not.");
     }
     status = U_ZERO_ERROR;
@@ -527,7 +527,7 @@ PluralFormatTest::pluralFormatExtendedTest(void) {
     dataerrln("Failed to apply pattern - %s", u_errorName(status));
     return;
   }
-  for (int i = 0; i < 7; ++i) {
+  for (int32_t i = 0; i < 7; ++i) {
     UnicodeString result = pf.format(i, status);
     if (U_FAILURE(status)) {
       errln("PluralFormat.format(value %d) failed - %s", i, u_errorName(status));
index bf7eb66efbe4519a3cad902acb1d2c1c54337388..2a599077a627a0b7dffa9ca8b4518513adf2d8df 100644 (file)
@@ -439,7 +439,7 @@ void PluralRulesTest::testWithin() {
     return;
   }
 
-  UnicodeString keyword = rules->select(26);
+  UnicodeString keyword = rules->select((int32_t)26);
   if (keyword != "a") {
     errln("expected 'a' for 26 but didn't get it.");
   }
index e9cd536ec928a60cf85078aca6144d76c8ec779e..5de144cd09300edb4bd472c5dc8f0ca36d090924 100644 (file)
 //      ICU Regular Expressions test, part of intltest.
 //
 
+/*
+     NOTE!!
+
+     PLEASE be careful about ASCII assumptions in this test.
+     This test is one of the worst repeat offenders.
+     If you have questions, contact someone on the ICU PMC
+     who has access to an EBCDIC system.
+
+ */
+
 #include "intltest.h"
 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
 
@@ -114,6 +124,9 @@ void RegexTest::runIndexedTest( int32_t index, UBool exec, const char* &name, ch
         case 19: name = "Bug 7029";
             if (exec) Bug7029();
             break;
+        case 20: name = "CheckInvBufSize";
+            if (exec) CheckInvBufSize();
+            break;
 
         default: name = "";
             break; //needed to end loop
@@ -121,6 +134,7 @@ void RegexTest::runIndexedTest( int32_t index, UBool exec, const char* &name, ch
 }
 
 
+
 /**
  * Calls utext_openUTF8 after, potentially, converting invariant text from the compilation codepage
  * into ASCII. 
@@ -128,18 +142,6 @@ void RegexTest::runIndexedTest( int32_t index, UBool exec, const char* &name, ch
  */
 static UText* regextst_openUTF8FromInvariant(UText* ut, const char *inv, int64_t length, UErrorCode *status);
 
-static UText* regextst_openUTF8FromInvariant(UText *ut, const char *inv, int64_t length, UErrorCode *status) {
-#if U_CHARSET_FAMILY==U_ASCII_FAMILY
-  return utext_openUTF8(ut, inv, length, status);
-#else
-  char buf[1024];
-
-  uprv_aestrncpy((uint8_t*)buf, (const uint8_t*)inv, length);
-  
-  return utext_openUTF8(ut, buf, length, status);
-#endif
-}
-
 //---------------------------------------------------------------------------
 //
 //   Error Checking / Reporting macros used in all of the tests.
@@ -175,6 +177,53 @@ static void utextToPrintable(char *buf, int32_t bufLen, UText *text) {
   utext_setNativeIndex(text, oldIndex);
 }
 
+static inline UChar toHex(int32_t i) {
+    return (UChar)(i + (i < 10 ? 0x30 : (0x41 - 10)));
+}
+
+static UnicodeString& escape(const UnicodeString& s, UnicodeString& result) {
+    for (int32_t i=0; i<s.length(); ++i) {
+        UChar c = s[i];
+        if ((c <= (UChar)0x7F) && (c>0)) {
+            result += c;
+        } else {
+            result += (UChar)0x5c;
+            result += (UChar)0x75;
+            result += toHex((c >> 12) & 0xF);
+            result += toHex((c >>  8) & 0xF);
+            result += toHex((c >>  4) & 0xF);
+            result += toHex( c        & 0xF);
+        }
+    }
+    return result;
+}
+
+static char ASSERT_BUF[1024];
+
+static const char* extractToAssertBuf(const UnicodeString& message) {
+  if(message.length()==0) {
+    strcpy(ASSERT_BUF, "[[empty UnicodeString]]");
+  } else {
+    UnicodeString buf;
+    escape(message, buf);
+    if(buf.length()==0) {
+      strcpy(ASSERT_BUF, "[[escape() returned 0 chars]]");
+    } else {
+      buf.extract(0, 0x7FFFFFFF, ASSERT_BUF, sizeof(ASSERT_BUF)-1);
+      if(ASSERT_BUF[0]==0) {
+        ASSERT_BUF[0]=0;
+        for(int32_t i=0;i<buf.length();i++) {
+          UChar ch = buf[i];
+          sprintf(ASSERT_BUF+strlen(ASSERT_BUF),"\\u%02x",ch);
+        }
+      }
+    }
+  }
+  ASSERT_BUF[sizeof(ASSERT_BUF)-1] = 0;
+  return ASSERT_BUF;
+}
+
+
 #define REGEX_VERBOSE_TEXT(text) {char buf[200];utextToPrintable(buf,sizeof(buf)/sizeof(buf[0]),text);logln("%s:%d: UText %s=\"%s\"", __FILE__, __LINE__, #text, buf);}
 
 #define REGEX_CHECK_STATUS {if (U_FAILURE(status)) {dataerrln("%s:%d: RegexTest failure.  status=%s", \
@@ -192,6 +241,8 @@ if (status!=errcode) {dataerrln("RegexTest failure at line %d.  Expected status=
 #define REGEX_ASSERT_L(expr, line) {if ((expr)==FALSE) { \
     errln("RegexTest failure at line %d, from %d.", __LINE__, (line)); return;}}
 
+#define REGEX_ASSERT_UNISTR(ustr,inv) {if (!(ustr==inv)) {errln("%s:%d: RegexTest failure: REGEX_ASSERT_UNISTR(%s,%s) failed \n", __FILE__, __LINE__, extractToAssertBuf(ustr),inv);};}
+
 /**
  * @param expected expected text in UTF-8 (not platform) codepage
  */
@@ -249,6 +300,45 @@ void RegexTest::assertUTextInvariant(const char *expected, UText *actual, const
  */
 #define REGEX_ASSERT_UTEXT_INVARIANT(expected, actual) assertUTextInvariant((expected), (actual), __FILE__, __LINE__)
 
+/**
+ * This buffer ( inv_buf ) is used to hold the UTF-8 strings
+ * passed into utext_openUTF8. An error will be given if
+ * INV_BUFSIZ is too small.  It's only used on EBCDIC systems.
+ */ 
+
+#define INV_BUFSIZ 2048 /* increase this if too small */
+
+static int32_t inv_next=0;
+
+#if U_CHARSET_FAMILY!=U_ASCII_FAMILY
+static char inv_buf[INV_BUFSIZ];
+#endif
+
+static UText* regextst_openUTF8FromInvariant(UText *ut, const char *inv, int64_t length, UErrorCode *status) {
+  if(length==-1) length=strlen(inv);
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+  inv_next+=length;
+  return utext_openUTF8(ut, inv, length, status);
+#else
+  if(inv_next+length+1>INV_BUFSIZ) {
+    fprintf(stderr, "%s:%d Error: INV_BUFSIZ #defined to be %d but needs to be at least %d.\n",
+            __FILE__, __LINE__, INV_BUFSIZ, (inv_next+length+1));
+    *status = U_MEMORY_ALLOCATION_ERROR;
+    return NULL;
+  }
+
+  unsigned char *buf = (unsigned char*)inv_buf+inv_next;
+  uprv_aestrncpy(buf, (const uint8_t*)inv, length);
+  inv_next+=length;
+
+#if 0
+  fprintf(stderr, " Note: INV_BUFSIZ at %d, used=%d\n", INV_BUFSIZ, inv_next);
+#endif
+
+  return utext_openUTF8(ut, (const char*)buf, length, status);
+#endif
+}
+
 
 //---------------------------------------------------------------------------
 //
@@ -2965,11 +3055,11 @@ void RegexTest::API_Pattern_UTF8() {
     REGEX_ASSERT(pat1->pattern() == "");
     REGEX_ASSERT_UTEXT_UTF8("", pat1->patternText(status));
     delete pat1;
-
-    regextst_openUTF8FromInvariant(&re1, "(Hello, world)*", -1, &status);
+    const char *helloWorldInvariant = "(Hello, world)*";
+    regextst_openUTF8FromInvariant(&re1, helloWorldInvariant, -1, &status);
     pat1 = RegexPattern::compile(&re1, pe, status);
     REGEX_CHECK_STATUS;
-    REGEX_ASSERT(pat1->pattern() == "(Hello, world)*");
+    REGEX_ASSERT_UNISTR(pat1->pattern(),"(Hello, world)*");
     REGEX_ASSERT_UTEXT_INVARIANT("(Hello, world)*", pat1->patternText(status));
     delete pat1;
 
@@ -5088,5 +5178,15 @@ void RegexTest::Bug7029() {
     REGEX_ASSERT(numFields == 8);
     delete pMatcher;
 }
+
+void RegexTest::CheckInvBufSize() {
+  if(inv_next>=INV_BUFSIZ) {
+    errln("%s: increase #define of INV_BUFSIZ ( is %d but needs to be at least %d )\n",
+          __FILE__, INV_BUFSIZ, inv_next);
+  } else {
+    logln("%s: INV_BUFSIZ is %d, usage %d\n", __FILE__, INV_BUFSIZ, inv_next);
+  }
+}
+
 #endif  /* !UCONFIG_NO_REGULAR_EXPRESSIONS  */
 
index e066aae1a96613128618262462398d25843054e7..870d8f7c03acc15099461a90c704121a2348f63b 100644 (file)
@@ -45,7 +45,8 @@ public:
     virtual void Bug7740();
     virtual void Bug8479();
     virtual void Bug7029();
-
+    virtual void CheckInvBufSize();
+    
     // The following functions are internal to the regexp tests.
     virtual void assertUText(const char *expected, UText *actual, const char *file, int line);
     virtual void assertUTextInvariant(const char *invariant, UText *actual, const char *file, int line);
index dff738538f2733b0a7db23855d976104f2e70963..236313fcdc22889a6cf893e2bdd72985be130fbf 100644 (file)
@@ -634,7 +634,7 @@ void TestMessageFormat::testApostropheInPluralAndSelect() {
         return;
     }
     UnicodeString expected = UNICODE_STRING_SIMPLE("abc_3#3{3'_def_sel}ect'_xyz");
-    Formattable args[] = { 3, UNICODE_STRING_SIMPLE("x") };
+    Formattable args[] = { (int32_t)3, UNICODE_STRING_SIMPLE("x") };
     internalFormat(
         &msgFmt, args, 2, expected,
         "MessageFormat with apostrophes in plural/select arguments failed:\n");
@@ -1639,7 +1639,7 @@ void TestMessageFormat::TestCompatibleApostrophe() {
         errln("wrong value from  icuMsg.getApostropheMode().");
     }
 
-    Formattable zero0[] = { 0 };
+    Formattable zero0[] = { (int32_t)0 };
     FieldPosition fieldpos(0);
     UnicodeString buffer1, buffer2;
     assertEquals("incompatible ICU MessageFormat compatibility-apostrophe behavior",
@@ -1798,7 +1798,7 @@ void TestMessageFormat::TestTrimArgumentName() {
     if (errorCode.logDataIfFailureAndReset("Unable to instantiate MessageFormat")) {
         return;
     }
-    Formattable args[1] = { 2 };
+    Formattable args[1] = { (int32_t)2 };
     FieldPosition ignore(0);
     UnicodeString result;
     assertEquals("trim-numbered-arg format() failed", "a  #,#2.0  z",
index cc52e2d6483d708d659923050f6f531c1d2cd6fa..8bdc68dbb04c3e108226f587cb3cf2b75de87cf9 100644 (file)
@@ -1378,7 +1378,7 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
             uprv_strcpy(tempObjectFile, gencmnFile);
             tempObjectFile[uprv_strlen(tempObjectFile) - 1] = 'o';
             
-            sprintf(cmd, "%s %s -o %s %s"
+            sprintf(cmd, "%s %s -o %s %s",
                         pkgDataFlags[COMPILER],
                         pkgDataFlags[LIBFLAGS],
                         tempObjectFile,
index 792bdea0e0c5954ad2967d5c6e436ccd7759ea9a..c76c6918bad723dffda3ddaeb96e973b1d10fca8 100644 (file)
@@ -329,9 +329,10 @@ readFile(const char *path, const char *name, int32_t &length, char &type) {
 
     /* allocate the buffer, pad to multiple of 16 */
     length=(fileLength+0xf)&~0xf;
-    data=(uint8_t *)malloc(length);
+    data=(uint8_t *)uprv_malloc(length);
     if(data==NULL) {
         fclose(file);
+        fprintf(stderr, "icupkg: malloc error allocating %d bytes.\n", (int)length);
         exit(U_MEMORY_ALLOCATION_ERROR);
     }