]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/ucnvmbcs.c
ICU-8.11.2.tar.gz
[apple/icu.git] / icuSources / common / ucnvmbcs.c
index 9f9c6f329aa6515147deda307ea2d9fbcede5108..84bae8a9f2596e6dc841ea64b7d92e3a383b6b17 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-*   Copyright (C) 2000-2004, International Business Machines
+*   Copyright (C) 2000-2006, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
@@ -344,7 +344,7 @@ gb18030Ranges[13][4]={
 static void
 _getUnicodeSetForBytes(const UConverterSharedData *sharedData,
                        const int32_t (*stateTable)[256], const uint16_t *unicodeCodeUnits,
-                       USetAdder *sa,
+                       const USetAdder *sa,
                        UConverterUnicodeSet which,
                        uint8_t state, uint32_t offset, int32_t lowByte, int32_t highByte,
                       
@@ -421,7 +421,7 @@ _getUnicodeSetForBytes(const UConverterSharedData *sharedData,
  */
 U_CFUNC void
 ucnv_MBCSGetUnicodeSetForBytes(const UConverterSharedData *sharedData,
-                           USetAdder *sa,
+                           const USetAdder *sa,
                            UConverterUnicodeSet which,
                            uint8_t state, int32_t lowByte, int32_t highByte,
                            UErrorCode *pErrorCode) {
@@ -434,7 +434,7 @@ ucnv_MBCSGetUnicodeSetForBytes(const UConverterSharedData *sharedData,
 
 U_CFUNC void
 ucnv_MBCSGetUnicodeSetForUnicode(const UConverterSharedData *sharedData,
-                             USetAdder *sa,
+                             const USetAdder *sa,
                              UConverterUnicodeSet which,
                              UErrorCode *pErrorCode) {
     const UConverterMBCSTable *mbcsTable;
@@ -571,7 +571,7 @@ ucnv_MBCSGetUnicodeSetForUnicode(const UConverterSharedData *sharedData,
 
 static void
 ucnv_MBCSGetUnicodeSet(const UConverter *cnv,
-                   USetAdder *sa,
+                   const USetAdder *sa,
                    UConverterUnicodeSet which,
                    UErrorCode *pErrorCode) {
     if(cnv->options&_MBCS_OPTION_GB18030) {
@@ -589,7 +589,7 @@ ucnv_MBCSGetUnicodeSet(const UConverter *cnv,
  * Definition of LINEAR macros and gb18030Ranges see near the beginning of the file.
  *
  * In the future, conversion extensions may handle m:n mappings and delta tables,
- * see http://oss.software.ibm.com/cvs/icu/~checkout~/icuhtml/design/conversion/conversion_extensions.html
+ * see http://dev.icu-project.org/cgi-bin/viewcvs.cgi/~checkout~/icuhtml/design/conversion/conversion_extensions.html
  *
  * If an input character cannot be mapped, then these functions set an error
  * code. The framework will then call the callback function.
@@ -1411,7 +1411,7 @@ ucnv_MBCSSingleToBMPWithOffsets(UConverterToUnicodeArgs *pArgs,
     source=(const uint8_t *)pArgs->source;
     sourceLimit=(const uint8_t *)pArgs->sourceLimit;
     target=pArgs->target;
-    targetCapacity=pArgs->targetLimit-pArgs->target;
+    targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
     offsets=pArgs->offsets;
 
     if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
@@ -1428,7 +1428,7 @@ ucnv_MBCSSingleToBMPWithOffsets(UConverterToUnicodeArgs *pArgs,
      * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
      * for the minimum of the sourceLength and targetCapacity
      */
-    length=sourceLimit-source;
+    length=(int32_t)(sourceLimit-source);
     if(length<targetCapacity) {
         targetCapacity=length;
     }
@@ -1578,8 +1578,8 @@ unrolled:
             }
 
             /* recalculate the targetCapacity after an extension mapping */
-            targetCapacity=pArgs->targetLimit-target;
-            length=sourceLimit-source;
+            targetCapacity=(int32_t)(pArgs->targetLimit-target);
+            length=(int32_t)(sourceLimit-source);
             if(length<targetCapacity) {
                 targetCapacity=length;
             }
@@ -2531,7 +2531,7 @@ ucnv_MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
     source=pArgs->source;
     sourceLimit=pArgs->sourceLimit;
     target=(uint8_t *)pArgs->target;
-    targetCapacity=pArgs->targetLimit-pArgs->target;
+    targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
     offsets=pArgs->offsets;
 
     table=cnv->sharedData->mbcs.fromUnicodeTable;
@@ -2650,7 +2650,7 @@ unassigned:
                     /* a mapping was written to the target, continue */
 
                     /* recalculate the targetCapacity after an extension mapping */
-                    targetCapacity=pArgs->targetLimit-(char *)target;
+                    targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
 
                     /* normal end of conversion: prepare for a new character */
                     sourceIndex=nextSourceIndex;
@@ -2736,7 +2736,7 @@ ucnv_MBCSSingleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
     source=pArgs->source;
     sourceLimit=pArgs->sourceLimit;
     target=(uint8_t *)pArgs->target;
-    targetCapacity=pArgs->targetLimit-pArgs->target;
+    targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
     offsets=pArgs->offsets;
 
     table=cnv->sharedData->mbcs.fromUnicodeTable;
@@ -2855,7 +2855,7 @@ unassigned:
                     /* a mapping was written to the target, continue */
 
                     /* recalculate the targetCapacity after an extension mapping */
-                    targetCapacity=pArgs->targetLimit-(char *)target;
+                    targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
 
                     /* normal end of conversion: prepare for a new character */
                     sourceIndex=nextSourceIndex;
@@ -2906,7 +2906,7 @@ ucnv_MBCSSingleFromBMPWithOffsets(UConverterFromUnicodeArgs *pArgs,
     source=pArgs->source;
     sourceLimit=pArgs->sourceLimit;
     target=(uint8_t *)pArgs->target;
-    targetCapacity=pArgs->targetLimit-pArgs->target;
+    targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
     offsets=pArgs->offsets;
 
     table=cnv->sharedData->mbcs.fromUnicodeTable;
@@ -2935,7 +2935,7 @@ ucnv_MBCSSingleFromBMPWithOffsets(UConverterFromUnicodeArgs *pArgs,
      * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
      * for the minimum of the sourceLength and targetCapacity
      */
-    length=sourceLimit-source;
+    length=(int32_t)(sourceLimit-source);
     if(length<targetCapacity) {
         targetCapacity=length;
     }
@@ -3086,8 +3086,8 @@ getTrail:
             /* a mapping was written to the target, continue */
 
             /* recalculate the targetCapacity after an extension mapping */
-            targetCapacity=pArgs->targetLimit-(char *)target;
-            length=sourceLimit-source;
+            targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
+            length=(int32_t)(sourceLimit-source);
             if(length<targetCapacity) {
                 targetCapacity=length;
             }
@@ -3177,7 +3177,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
     source=pArgs->source;
     sourceLimit=pArgs->sourceLimit;
     target=(uint8_t *)pArgs->target;
-    targetCapacity=pArgs->targetLimit-pArgs->target;
+    targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
     offsets=pArgs->offsets;
 
     table=cnv->sharedData->mbcs.fromUnicodeTable;
@@ -3475,7 +3475,7 @@ unassigned:
                     /* a mapping was written to the target, continue */
 
                     /* recalculate the targetCapacity after an extension mapping */
-                    targetCapacity=pArgs->targetLimit-(char *)target;
+                    targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
 
                     /* normal end of conversion: prepare for a new character */
                     if(offsets!=NULL) {
@@ -3877,7 +3877,7 @@ ucnv_MBCSWriteSub(UConverterFromUnicodeArgs *pArgs,
         length=1;
     } else {
         /* select subChar in all other cases */
-        subchar=(char *)cnv->subChar;
+        subchar=(char *)cnv->subChars;
         length=cnv->subCharLen;
     }