]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/tools/genrb/parse.cpp
ICU-511.32.tar.gz
[apple/icu.git] / icuSources / tools / genrb / parse.cpp
index b9e393c2881e8b88305fa2b51d272a44a14e7203..5546411581eb1ca6accf4e216a7b0be4bca5b0f2 100644 (file)
@@ -73,7 +73,7 @@ const char *tokenNames[TOK_TOKEN_COUNT] =
 };
 
 /* Just to store "TRUE" */
 };
 
 /* Just to store "TRUE" */
-static const UChar trueValue[] = {0x0054, 0x0052, 0x0055, 0x0045, 0x0000};
+//static const UChar trueValue[] = {0x0054, 0x0052, 0x0055, 0x0045, 0x0000};
 
 typedef struct {
     struct Lookahead  lookahead[MAX_LOOKAHEAD + 1];
 
 typedef struct {
     struct Lookahead  lookahead[MAX_LOOKAHEAD + 1];
@@ -139,7 +139,7 @@ static void
 cleanupLookahead(ParseState* state)
 {
     uint32_t i;
 cleanupLookahead(ParseState* state)
 {
     uint32_t i;
-    for (i = 0; i < MAX_LOOKAHEAD; i++)
+    for (i = 0; i <= MAX_LOOKAHEAD; i++)
     {
         ustr_deinit(&state->lookahead[i].value);
         ustr_deinit(&state->lookahead[i].comment);
     {
         ustr_deinit(&state->lookahead[i].value);
         ustr_deinit(&state->lookahead[i].comment);
@@ -262,7 +262,7 @@ static char *getInvariantString(ParseState* state, uint32_t *line, struct UStrin
         return NULL;
     }
 
         return NULL;
     }
 
-    result = reinterpret_cast<char *>(uprv_malloc(count+1));
+    result = static_cast<char *>(uprv_malloc(count+1));
 
     if (result == NULL)
     {
 
     if (result == NULL)
     {
@@ -283,7 +283,6 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
     char              filename[256] = { '\0' };
     char              cs[128]       = { '\0' };
     uint32_t          line;
     char              filename[256] = { '\0' };
     char              cs[128]       = { '\0' };
     uint32_t          line;
-    int               len=0;
     UBool quoted = FALSE;
     UCHARBUF *ucbuf=NULL;
     UChar32   c     = 0;
     UBool quoted = FALSE;
     UCHARBUF *ucbuf=NULL;
     UChar32   c     = 0;
@@ -363,7 +362,7 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
              * append at the end of the loop
              */
             while(c != ENDCOMMAND) {
              * append at the end of the loop
              */
             while(c != ENDCOMMAND) {
-                U_APPEND_CHAR32(c, target,len);
+                U_APPEND_CHAR32_ONLY(c, target);
                 c = ucbuf_getc(ucbuf, status);
             }
         }
                 c = ucbuf_getc(ucbuf, status);
             }
         }
@@ -396,7 +395,7 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
         /* Append UChar * after dissembling if c > 0xffff*/
         if (c != (UChar32)U_EOF)
         {
         /* Append UChar * after dissembling if c > 0xffff*/
         if (c != (UChar32)U_EOF)
         {
-            U_APPEND_CHAR32(c, target,len);
+            U_APPEND_CHAR32_ONLY(c, target);
         }
         else
         {
         }
         else
         {
@@ -1478,7 +1477,7 @@ parseBinary(ParseState* state, char *tag, uint32_t startline, const struct UStri
     count = (uint32_t)uprv_strlen(string);
     if (count > 0){
         if((count % 2)==0){
     count = (uint32_t)uprv_strlen(string);
     if (count > 0){
         if((count % 2)==0){
-            value = reinterpret_cast<uint8_t *>(uprv_malloc(sizeof(uint8_t) * count));
+            value = static_cast<uint8_t *>(uprv_malloc(sizeof(uint8_t) * count));
 
             if (value == NULL)
             {
 
             if (value == NULL)
             {
@@ -1765,6 +1764,8 @@ parseInclude(ParseState* state, char *tag, uint32_t startline, const struct UStr
     uBuffer = ucbuf_getBuffer(ucbuf,&len,status);
     result = string_open(state->bundle, tag, uBuffer, len, comment, status);
 
     uBuffer = ucbuf_getBuffer(ucbuf,&len,status);
     result = string_open(state->bundle, tag, uBuffer, len, comment, status);
 
+    ucbuf_close(ucbuf);
+
     uprv_free(pTarget);
 
     uprv_free(filename);
     uprv_free(pTarget);
 
     uprv_free(filename);
@@ -1789,7 +1790,6 @@ U_STRING_DECL(k_type_alias,     "alias",     5);
 U_STRING_DECL(k_type_intvector, "intvector", 9);
 U_STRING_DECL(k_type_import,    "import",    6);
 U_STRING_DECL(k_type_include,   "include",   7);
 U_STRING_DECL(k_type_intvector, "intvector", 9);
 U_STRING_DECL(k_type_import,    "import",    6);
 U_STRING_DECL(k_type_include,   "include",   7);
-U_STRING_DECL(k_type_reserved,  "reserved",  8);
 
 /* Various non-standard processing plugins that create one or more special resources. */
 U_STRING_DECL(k_type_plugin_uca_rules,      "process(uca_rules)",        18);
 
 /* Various non-standard processing plugins that create one or more special resources. */
 U_STRING_DECL(k_type_plugin_uca_rules,      "process(uca_rules)",        18);
@@ -1853,7 +1853,6 @@ void initParser(UBool omitCollationRules)
     U_STRING_INIT(k_type_alias,     "alias",     5);
     U_STRING_INIT(k_type_intvector, "intvector", 9);
     U_STRING_INIT(k_type_import,    "import",    6);
     U_STRING_INIT(k_type_alias,     "alias",     5);
     U_STRING_INIT(k_type_intvector, "intvector", 9);
     U_STRING_INIT(k_type_import,    "import",    6);
-    U_STRING_INIT(k_type_reserved,  "reserved",  8);
     U_STRING_INIT(k_type_include,   "include",   7);
 
     U_STRING_INIT(k_type_plugin_uca_rules,      "process(uca_rules)",        18);
     U_STRING_INIT(k_type_include,   "include",   7);
 
     U_STRING_INIT(k_type_plugin_uca_rules,      "process(uca_rules)",        18);