intl/icu-patches/genrb-omitCollationRules.diff

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 diff --git a/intl/icu/source/tools/genrb/genrb.c b/intl/icu/source/tools/genrb/genrb.c
     2 --- a/intl/icu/source/tools/genrb/genrb.c
     3 +++ b/intl/icu/source/tools/genrb/genrb.c
     4 @@ -1,7 +1,7 @@
     5  /*
     6  *******************************************************************************
     7  *
     8 -*   Copyright (C) 1998-2012, International Business Machines
     9 +*   Copyright (C) 1998-2014, International Business Machines
    10  *   Corporation and others.  All Rights Reserved.
    11  *
    12  *******************************************************************************
    13 @@ -280,7 +280,7 @@
    14          }
    15      }
    17 -    initParser(options[NO_COLLATION_RULES].doesOccur);
    18 +    initParser();
    20      /*added by Jing*/
    21      if(options[LANGUAGE].doesOccur) {
    22 @@ -557,7 +557,8 @@
    23          printf("autodetected encoding %s\n", cp);
    24      }
    25      /* Parse the data into an SRBRoot */
    26 -    data = parse(ucbuf, inputDir, outputDir, !omitBinaryCollation, status);
    27 +    data = parse(ucbuf, inputDir, outputDir,
    28 +                 !omitBinaryCollation, options[NO_COLLATION_RULES].doesOccur, status);
    30      if (data == NULL || U_FAILURE(*status)) {
    31          fprintf(stderr, "couldn't parse the file %s. Error:%s\n", filename,u_errorName(*status));
    32 diff --git a/intl/icu/source/tools/genrb/parse.cpp b/intl/icu/source/tools/genrb/parse.cpp
    33 --- a/intl/icu/source/tools/genrb/parse.cpp
    34 +++ b/intl/icu/source/tools/genrb/parse.cpp
    35 @@ -85,10 +85,9 @@
    36      const char     *outputdir;
    37      uint32_t        outputdirLength;
    38      UBool           makeBinaryCollation;
    39 +    UBool           omitCollationRules;
    40  } ParseState;
    42 -static UBool gOmitCollationRules  = FALSE;
    43 -
    44  typedef struct SResource *
    45  ParseResourceFunction(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status);
    47 @@ -323,7 +322,7 @@
    48      }
    49      uprv_strcat(filename, cs);
    51 -    if(gOmitCollationRules) {
    52 +    if(state->omitCollationRules) {
    53          return res_none();
    54      }
    56 @@ -771,7 +770,7 @@
    57      }
    59      /* Parse the data into an SRBRoot */
    60 -    data = parse(ucbuf, genrbdata->inputDir, genrbdata->outputDir, FALSE, status);
    61 +    data = parse(ucbuf, genrbdata->inputDir, genrbdata->outputDir, FALSE, FALSE, status);
    63      root = data->fRoot;
    64      collations = resLookup(root, "collations");
    65 @@ -1007,7 +1006,7 @@
    66  #endif
    67              /* in order to achieve smaller data files, we can direct genrb */
    68              /* to omit collation rules */
    69 -            if(gOmitCollationRules) {
    70 +            if(state->omitCollationRules) {
    71                  bundle_closeString(state->bundle, member);
    72              } else {
    73                  table_add(result, member, line, status);
    74 @@ -1839,7 +1838,7 @@
    75      {"reserved", NULL, NULL}
    76  };
    78 -void initParser(UBool omitCollationRules)
    79 +void initParser()
    80  {
    81      U_STRING_INIT(k_type_string,    "string",    6);
    82      U_STRING_INIT(k_type_binary,    "binary",    6);
    83 @@ -1858,8 +1857,6 @@
    84      U_STRING_INIT(k_type_plugin_collation,      "process(collation)",        18);
    85      U_STRING_INIT(k_type_plugin_transliterator, "process(transliterator)",   23);
    86      U_STRING_INIT(k_type_plugin_dependency,     "process(dependency)",       19);
    87 -
    88 -    gOmitCollationRules = omitCollationRules;
    89  }
    91  static inline UBool isTable(enum EResourceType type) {
    92 @@ -2039,8 +2036,8 @@
    94  /* parse the top-level resource */
    95  struct SRBRoot *
    96 -parse(UCHARBUF *buf, const char *inputDir, const char *outputDir, UBool makeBinaryCollation,
    97 -      UErrorCode *status)
    98 +parse(UCHARBUF *buf, const char *inputDir, const char *outputDir,
    99 +      UBool makeBinaryCollation, UBool omitCollationRules, UErrorCode *status)
   100  {
   101      struct UString    *tokenValue;
   102      struct UString    comment;
   103 @@ -2064,6 +2061,7 @@
   104      state.outputdir       = outputDir;
   105      state.outputdirLength = (state.outputdir != NULL) ? (uint32_t)uprv_strlen(state.outputdir) : 0;
   106      state.makeBinaryCollation = makeBinaryCollation;
   107 +    state.omitCollationRules = omitCollationRules;
   109      ustr_init(&comment);
   110      expect(&state, TOK_STRING, &tokenValue, &comment, NULL, status);
   111 diff --git a/intl/icu/source/tools/genrb/parse.h b/intl/icu/source/tools/genrb/parse.h
   112 --- a/intl/icu/source/tools/genrb/parse.h
   113 +++ b/intl/icu/source/tools/genrb/parse.h
   114 @@ -1,7 +1,7 @@
   115  /*
   116  *******************************************************************************
   117  *
   118 -*   Copyright (C) 1998-2011, International Business Machines
   119 +*   Copyright (C) 1998-2014, International Business Machines
   120  *   Corporation and others.  All Rights Reserved.
   121  *
   122  *******************************************************************************
   123 @@ -24,11 +24,11 @@
   125  U_CDECL_BEGIN
   126  /* One time parser initalisation */
   127 -void initParser(UBool omitCollationRules);
   128 +void initParser();
   130  /* Parse a ResourceBundle text file */
   131  struct SRBRoot* parse(UCHARBUF *buf, const char* inputDir, const char* outputDir,
   132 -                      UBool omitBinaryCollation, UErrorCode *status);
   133 +                      UBool makeBinaryCollation, UBool omitCollationRules, UErrorCode *status);
   135  U_CDECL_END

mercurial