From 521f931c7ec3b05982a1a24a31b8293e55beb4d4 Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Wed, 14 Aug 2013 13:04:41 +0200 Subject: [PATCH] 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 | 110 +++++++++++++++++++++++++++++ intl/icu/source/tools/genrb/derb.c | 12 ++-- intl/update-icu.sh | 1 + 3 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 intl/icu-patches/bug-899722-2 diff --git a/intl/icu-patches/bug-899722-2 b/intl/icu-patches/bug-899722-2 new file mode 100644 index 000000000000..73f25ba80542 --- /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)) { + diff --git a/intl/icu/source/tools/genrb/derb.c b/intl/icu/source/tools/genrb/derb.c index 2a48d98f5429..4aff26e0bdad 100644 --- a/intl/icu/source/tools/genrb/derb.c +++ b/intl/icu/source/tools/genrb/derb.c @@ -54,7 +54,7 @@ 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); @@ -152,14 +152,14 @@ main(int argc, char* argv[]) { } 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) { @@ -473,7 +473,7 @@ static void printOutAlias(FILE *out, UConverter *converter, UResourceBundle *pa 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", @@ -517,7 +517,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re 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", @@ -576,7 +576,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re { 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", diff --git a/intl/update-icu.sh b/intl/update-icu.sh index dbd38acd0632..209c006753a8 100755 --- a/intl/update-icu.sh +++ b/intl/update-icu.sh @@ -41,5 +41,6 @@ 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}