intl/icu-patches/bug-899722-2
author Ryan VanderMeulen <ryanvm@gmail.com>
Sun, 19 Jan 2014 23:04:26 -0500
changeset 175883 2f9b15aa2f8b6a4b8e4fd8e8667e4d4a4e36fdfa
parent 156455 02017a95970f98893f146c8c09cb2c4fe41aeed6
permissions -rw-r--r--
Backed out changesets ce0ef3278d5f, d9d1983edb5c, and 7e0609e54c24 (bug 914847) for bustage. a=backout

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)) {