зеркало из https://github.com/mozilla/gecko-dev.git
111 строки
4.3 KiB
Plaintext
111 строки
4.3 KiB
Plaintext
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)) {
|
|
|