]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/sprpdata.c
ICU-64252.0.1.tar.gz
[apple/icu.git] / icuSources / test / cintltst / sprpdata.c
index 4865d67e64c605edbea2b11360d2d3741862ac2b..b3ac72d79c1754dcfb1ebce71f6b55c53c92adbd 100644 (file)
@@ -1,12 +1,14 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
  *******************************************************************************
  *
- *   Copyright (C) 2003-2011, International Business Machines
+ *   Copyright (C) 2003-2012, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  *
  *******************************************************************************
  *   file name:  spreptst.c
- *   encoding:   US-ASCII
+ *   encoding:   UTF-8
  *   tab size:   8 (not used)
  *   indentation:4
  *
@@ -150,7 +152,7 @@ compareMapping(UStringPrepProfile* data, uint32_t codepoint, uint32_t* mapping,i
     int32_t length=0;
     UBool isIndex = FALSE;
     UStringPrepType retType;
-    int32_t value=0, index=0, delta=0;
+    int32_t value=0, idx=0, delta=0;
     int32_t* indexes = data->indexes;
     UTrie trie = data->sprepTrie;
     const uint16_t* mappingData = data->mappingData;
@@ -169,18 +171,18 @@ compareMapping(UStringPrepProfile* data, uint32_t codepoint, uint32_t* mapping,i
     }
 
     if(isIndex){
-        index = value;
-        if(index >= indexes[_SPREP_ONE_UCHAR_MAPPING_INDEX_START] &&
-                 index < indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START]){
+        idx = value;
+        if(idx >= indexes[_SPREP_ONE_UCHAR_MAPPING_INDEX_START] &&
+                 idx < indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START]){
             length = 1;
-        }else if(index >= indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START] &&
-                 index < indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START]){
+        }else if(idx >= indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START] &&
+                 idx < indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START]){
             length = 2;
-        }else if(index >= indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START] &&
-                 index < indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START]){
+        }else if(idx >= indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START] &&
+                 idx < indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START]){
             length = 3;
         }else{
-            length = mappingData[index++];
+            length = mappingData[idx++];
         }
     }else{
         delta = value;
@@ -203,15 +205,15 @@ compareMapping(UStringPrepProfile* data, uint32_t codepoint, uint32_t* mapping,i
     if(isIndex){
         for(i =0; i< mapLength; i++){
             if(mapping[i] <= 0xFFFF){
-                if(mappingData[index+i] != (uint16_t)mapping[i]){
-                    log_err("Did not get the expected result. Expected: 0x%04X Got: 0x%04X \n", mapping[i], mappingData[index+i]);
+                if(mappingData[idx+i] != (uint16_t)mapping[i]){
+                    log_err("Did not get the expected result. Expected: 0x%04X Got: 0x%04X \n", mapping[i], mappingData[idx+i]);
                 }
             }else{
                 UChar lead  = U16_LEAD(mapping[i]);
                 UChar trail = U16_TRAIL(mapping[i]);
-                if(mappingData[index+i] != lead ||
-                    mappingData[index+i+1] != trail){
-                    log_err( "Did not get the expected result. Expected: 0x%04X 0x%04X  Got: 0x%04X 0x%04X\n", lead, trail, mappingData[index+i], mappingData[index+i+1]);
+                if(mappingData[idx+i] != lead ||
+                    mappingData[idx+i+1] != trail){
+                    log_err( "Did not get the expected result. Expected: 0x%04X 0x%04X  Got: 0x%04X 0x%04X\n", lead, trail, mappingData[idx+i], mappingData[idx+i+1]);
                 }
             }
         }