Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / icu / source / tools / toolutil / ucm.c
index 8d4f33a..adb3ebd 100644 (file)
@@ -1,7 +1,7 @@
 /*
 *******************************************************************************
 *
-*   Copyright (C) 2003-2009, International Business Machines
+*   Copyright (C) 2003-2013, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
@@ -327,7 +327,7 @@ checkBaseExtUnicode(UCMStates *baseStates, UCMTable *base, UCMTable *ext,
                 return result;
             }
 
-            if(0<=mb->f && mb->f<=2) {
+            if((0<=mb->f && mb->f<=2) || mb->f==4) {
                 break;
             }
 
@@ -339,7 +339,7 @@ checkBaseExtUnicode(UCMStates *baseStates, UCMTable *base, UCMTable *ext,
                 return result;
             }
 
-            if(0<=me->f && me->f<=2) {
+            if((0<=me->f && me->f<=2) || me->f==4) {
                 break;
             }
 
@@ -857,8 +857,8 @@ ucm_parseMappingLine(UCMapping *m,
             break;
         } else if(*s=='|') {
             f=(int8_t)(s[1]-'0');
-            if((uint8_t)f>3) {
-                fprintf(stderr, "ucm error: fallback indicator must be |0..|3 - \"%s\"\n", line);
+            if((uint8_t)f>4) {
+                fprintf(stderr, "ucm error: fallback indicator must be |0..|4 - \"%s\"\n", line);
                 return FALSE;
             }
             break;
@@ -1030,8 +1030,8 @@ ucm_open() {
 U_CAPI void U_EXPORT2
 ucm_close(UCMFile *ucm) {
     if(ucm!=NULL) {
-        uprv_free(ucm->base);
-        uprv_free(ucm->ext);
+        ucm_closeTable(ucm->base);
+        ucm_closeTable(ucm->ext);
         uprv_free(ucm);
     }
 }
@@ -1051,6 +1051,7 @@ ucm_mappingType(UCMStates *baseStates,
     /*
      * Suitable for an ICU conversion base table means:
      * - a 1:1 mapping (1 Unicode code point : 1 byte sequence)
+     * - precision flag 0..3
      * - SBCS: any 1:1 mapping
      *         (the table stores additional bits to distinguish mapping types)
      * - MBCS: not a |2 SUB mapping for <subchar1>
@@ -1070,7 +1071,7 @@ ucm_mappingType(UCMStates *baseStates,
      * makeconv uses a hack for moving mappings only for the fromUnicode table
      * that only works with non-negative values of f.
      */
-    if( m->uLen==1 && count==1 &&
+    if( m->uLen==1 && count==1 && m->f<=3 &&
         (baseStates->maxCharLength==1 ||
             !((m->f==2 && m->bLen==1) ||
               (m->f==1 && bytes[0]==0) ||
@@ -1146,7 +1147,7 @@ ucm_readTable(UCMFile *ucm, FileStream* convFile,
     char line[500];
     char *end;
     UBool isOK;
-    
+
     if(U_FAILURE(*pErrorCode)) {
         return;
     }