Bug 899722 Part 2: Backport upstream r32937 to fix symbol collision w/ truncate on BSD r=norbert r=waldo
authorLandry Breuil <landry@openbsd.org>
Wed, 14 Aug 2013 13:04:41 +0200
changeset 142652 02017a95970f98893f146c8c09cb2c4fe41aeed6
parent 142651 93c54132c3cbc6d72156e8c2adc033f5a09b07be
child 142653 65822b58fa9b65526375a2cba675a184c5412367
push id267
push useremorley@mozilla.com
push dateThu, 15 Aug 2013 12:37:58 +0000
treeherderb2g-inbound@9a71cafbece5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnorbert, waldo
bugs899722, 10290
milestone26.0a1
Bug 899722 Part 2: Backport upstream r32937 to fix symbol collision w/ truncate on BSD r=norbert r=waldo See http://bugs.icu-project.org/trac/ticket/10290
intl/icu-patches/bug-899722-2
intl/icu/source/tools/genrb/derb.c
intl/update-icu.sh
new file mode 100644
--- /dev/null
+++ b/intl/icu-patches/bug-899722-2
@@ -0,0 +1,110 @@
+Bug 899722 Part 2 - Backport upstream r32937 to fix symbol collision w/ truncate on BSD r=norbert
+
+http://bugs.icu-project.org/trac/ticket/10290
+diff --git a/intl/icu/source/tools/genrb/derb.c b/intl/icu/source/tools/genrb/derb.c
+--- a/intl/icu/source/tools/genrb/derb.c
++++ b/intl/icu/source/tools/genrb/derb.c
+@@ -49,17 +49,17 @@
+ #define DERB_VERSION "1.0"
+ 
+ #define DERB_DEFAULT_TRUNC 80
+ 
+ static UConverter *defaultConverter = 0;
+ 
+ static const int32_t indentsize = 4;
+ static int32_t truncsize = DERB_DEFAULT_TRUNC;
+-static UBool truncate = FALSE;
++static UBool opt_truncate = FALSE;
+ 
+ static const char *getEncodingName(const char *encoding);
+ static void reportError(const char *pname, UErrorCode *status, const char *when);
+ static UChar *quotedString(const UChar *string);
+ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *resource, int32_t indent, const char *pname, UErrorCode *status);
+ static void printString(FILE *out, UConverter *converter, const UChar *str, int32_t len);
+ static void printCString(FILE *out, UConverter *converter, const char *str, int32_t len);
+ static void printIndent(FILE *out, UConverter *converter, int32_t indent);
+@@ -147,24 +147,24 @@ main(int argc, char* argv[]) {
+         encoding = options[2].value;
+     }
+ 
+     if (options[3].doesOccur) {
+         tostdout = 1;
+     }
+ 
+     if(options[4].doesOccur) {
+-        truncate = TRUE;
++        opt_truncate = TRUE;
+         if(options[4].value != NULL) {
+             truncsize = atoi(options[4].value); /* user defined printable size */
+         } else {
+             truncsize = DERB_DEFAULT_TRUNC; /* we'll use default omitting size */
+         }
+     } else {
+-        truncate = FALSE;
++        opt_truncate = FALSE;
+     }
+ 
+     if(options[5].doesOccur) {
+         verbose = TRUE;
+     }
+ 
+     if (options[6].doesOccur) {
+         outputDir = options[6].value;
+@@ -468,17 +468,17 @@ static void printHex(FILE *out, UConvert
+     printString(out, converter, hex, (int32_t)(sizeof(hex)/sizeof(*hex)));
+ }
+ 
+ static void printOutAlias(FILE *out,  UConverter *converter, UResourceBundle *parent, Resource r, const char *key, int32_t indent, const char *pname, UErrorCode *status) {
+     static const UChar cr[] = { '\n' };
+     int32_t len = 0;
+     const UChar* thestr = res_getAlias(&(parent->fResData), r, &len);
+     UChar *string = quotedString(thestr);
+-    if(truncate && len > truncsize) {
++    if(opt_truncate && len > truncsize) {
+         char msg[128];
+         printIndent(out, converter, indent);
+         sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n",
+             (long)len, (long)truncsize/2);
+         printCString(out, converter, msg, -1);
+         len = truncsize;
+     }
+     if(U_SUCCESS(*status)) {
+@@ -512,17 +512,17 @@ static void printOutBundle(FILE *out, UC
+     switch(ures_getType(resource)) {
+     case URES_STRING :
+         {
+             int32_t len=0;
+             const UChar* thestr = ures_getString(resource, &len, status);
+             UChar *string = quotedString(thestr);
+ 
+             /* TODO: String truncation */
+-            if(truncate && len > truncsize) {
++            if(opt_truncate && len > truncsize) {
+                 char msg[128];
+                 printIndent(out, converter, indent);
+                 sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n",
+                         (long)len, (long)(truncsize/2));
+                 printCString(out, converter, msg, -1);
+                 len = truncsize/2;
+             }
+             printIndent(out, converter, indent);
+@@ -571,17 +571,17 @@ static void printOutBundle(FILE *out, UC
+             }
+             printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr)));
+             break;
+         }
+     case URES_BINARY :
+         {
+             int32_t len = 0;
+             const int8_t *data = (const int8_t *)ures_getBinary(resource, &len, status);
+-            if(truncate && len > truncsize) {
++            if(opt_truncate && len > truncsize) {
+                 char msg[128];
+                 printIndent(out, converter, indent);
+                 sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n",
+                         (long)len, (long)(truncsize/2));
+                 printCString(out, converter, msg, -1);
+                 len = truncsize;
+             }
+             if(U_SUCCESS(*status)) {
+
--- a/intl/icu/source/tools/genrb/derb.c
+++ b/intl/icu/source/tools/genrb/derb.c
@@ -49,17 +49,17 @@
 #define DERB_VERSION "1.0"
 
 #define DERB_DEFAULT_TRUNC 80
 
 static UConverter *defaultConverter = 0;
 
 static const int32_t indentsize = 4;
 static int32_t truncsize = DERB_DEFAULT_TRUNC;
-static UBool truncate = FALSE;
+static UBool opt_truncate = FALSE;
 
 static const char *getEncodingName(const char *encoding);
 static void reportError(const char *pname, UErrorCode *status, const char *when);
 static UChar *quotedString(const UChar *string);
 static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *resource, int32_t indent, const char *pname, UErrorCode *status);
 static void printString(FILE *out, UConverter *converter, const UChar *str, int32_t len);
 static void printCString(FILE *out, UConverter *converter, const char *str, int32_t len);
 static void printIndent(FILE *out, UConverter *converter, int32_t indent);
@@ -147,24 +147,24 @@ main(int argc, char* argv[]) {
         encoding = options[2].value;
     }
 
     if (options[3].doesOccur) {
         tostdout = 1;
     }
 
     if(options[4].doesOccur) {
-        truncate = TRUE;
+        opt_truncate = TRUE;
         if(options[4].value != NULL) {
             truncsize = atoi(options[4].value); /* user defined printable size */
         } else {
             truncsize = DERB_DEFAULT_TRUNC; /* we'll use default omitting size */
         }
     } else {
-        truncate = FALSE;
+        opt_truncate = FALSE;
     }
 
     if(options[5].doesOccur) {
         verbose = TRUE;
     }
 
     if (options[6].doesOccur) {
         outputDir = options[6].value;
@@ -468,17 +468,17 @@ static void printHex(FILE *out, UConvert
     printString(out, converter, hex, (int32_t)(sizeof(hex)/sizeof(*hex)));
 }
 
 static void printOutAlias(FILE *out,  UConverter *converter, UResourceBundle *parent, Resource r, const char *key, int32_t indent, const char *pname, UErrorCode *status) {
     static const UChar cr[] = { '\n' };
     int32_t len = 0;
     const UChar* thestr = res_getAlias(&(parent->fResData), r, &len);
     UChar *string = quotedString(thestr);
-    if(truncate && len > truncsize) {
+    if(opt_truncate && len > truncsize) {
         char msg[128];
         printIndent(out, converter, indent);
         sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n",
             (long)len, (long)truncsize/2);
         printCString(out, converter, msg, -1);
         len = truncsize;
     }
     if(U_SUCCESS(*status)) {
@@ -512,17 +512,17 @@ static void printOutBundle(FILE *out, UC
     switch(ures_getType(resource)) {
     case URES_STRING :
         {
             int32_t len=0;
             const UChar* thestr = ures_getString(resource, &len, status);
             UChar *string = quotedString(thestr);
 
             /* TODO: String truncation */
-            if(truncate && len > truncsize) {
+            if(opt_truncate && len > truncsize) {
                 char msg[128];
                 printIndent(out, converter, indent);
                 sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n",
                         (long)len, (long)(truncsize/2));
                 printCString(out, converter, msg, -1);
                 len = truncsize/2;
             }
             printIndent(out, converter, indent);
@@ -571,17 +571,17 @@ static void printOutBundle(FILE *out, UC
             }
             printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr)));
             break;
         }
     case URES_BINARY :
         {
             int32_t len = 0;
             const int8_t *data = (const int8_t *)ures_getBinary(resource, &len, status);
-            if(truncate && len > truncsize) {
+            if(opt_truncate && len > truncsize) {
                 char msg[128];
                 printIndent(out, converter, indent);
                 sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n",
                         (long)len, (long)(truncsize/2));
                 printCString(out, converter, msg, -1);
                 len = truncsize;
             }
             if(U_SUCCESS(*status)) {
--- a/intl/update-icu.sh
+++ b/intl/update-icu.sh
@@ -36,10 +36,11 @@ rm ${icu_dir}/source/data/region/*.txt
 rm ${icu_dir}/source/data/translit/*
 
 # Record `svn info`
 svn info $1 > ${icu_dir}/SVN-INFO
 
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-724533
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-853706
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-899722
+patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-899722-2
 
 hg addremove ${icu_dir}