ICU-311 updates for callback changes

X-SVN-Rev: 1687
This commit is contained in:
Steven R. Loomis 2000-06-29 00:14:01 +00:00
parent b475ecc06f
commit d7b44985af
7 changed files with 36 additions and 27 deletions

View file

@ -797,7 +797,7 @@ void T_UConverter_toUnicode_EBCDIC_STATEFUL (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
ToU_CALLBACK_MACRO(_this->toUContext,
@ -934,7 +934,7 @@ void T_UConverter_toUnicode_EBCDIC_STATEFUL_OFFSETS_LOGIC (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* call back handles the offset array */
ToU_CALLBACK_MACRO(_this->toUContext,
@ -1077,7 +1077,7 @@ void T_UConverter_fromUnicode_EBCDIC_STATEFUL (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* HSYS: to do: more smarts */
FromU_CALLBACK_MACRO(args.converter->fromUContext,
@ -1213,7 +1213,7 @@ void T_UConverter_fromUnicode_EBCDIC_STATEFUL_OFFSETS_LOGIC (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* HSYS: to do: more smarts, including offsets */
FromU_CALLBACK_MACRO(args.converter->fromUContext,

View file

@ -187,8 +187,6 @@ struct UConverter {
U_CDECL_END /* end of UConverter */
typedef struct UConverter UConverter;
typedef struct
{

View file

@ -70,7 +70,8 @@ void T_UConverter_toUnicode_UTF8 (UConverter * _this,
UBool flush,
UErrorCode * err)
{
const unsigned char *mySource = (unsigned char *) *source, *srcTemp;
const unsigned char *mySource = (unsigned char *) *source;
const char *srcTemp; /* to match the Args definition */
UChar *myTarget = *target, *tgtTemp;
int32_t mySourceIndex = 0;
int32_t myTargetIndex = 0;
@ -185,7 +186,7 @@ void T_UConverter_toUnicode_UTF8 (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
ToU_CALLBACK_MACRO(_this->toUContext,
args,
@ -196,7 +197,7 @@ void T_UConverter_toUnicode_UTF8 (UConverter * _this,
if (U_FAILURE (*err)) break;
_this->invalidCharLength = 0;
myTargetIndex = *(args.pTarget) - myTarget;
mySourceIndex = *(args.pSource) - mySource;
mySourceIndex = *(args.pSource) - (const char *)mySource;
}
}
}
@ -223,7 +224,8 @@ void T_UConverter_toUnicode_UTF8_OFFSETS_LOGIC (UConverter * _this,
UBool flush,
UErrorCode * err)
{
const unsigned char *mySource = (unsigned char *) *source, *srcTemp;
const unsigned char *mySource = (unsigned char *) *source;
const char *srcTemp;
UChar *myTarget = *target, *tgtTemp;
int32_t mySourceIndex = 0;
int32_t myTargetIndex = 0;
@ -331,7 +333,7 @@ void T_UConverter_toUnicode_UTF8_OFFSETS_LOGIC (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* To do HSYS: more smarts here, including offsets */
ToU_CALLBACK_MACRO(_this->toUContext,
@ -346,7 +348,7 @@ void T_UConverter_toUnicode_UTF8_OFFSETS_LOGIC (UConverter * _this,
if (U_FAILURE (*err)) break;
_this->invalidCharLength = 0;
myTargetIndex = *(args.pTarget) - myTarget;
mySourceIndex = *(args.pSource) - mySource;
mySourceIndex = *(args.pSource) - (const char*)mySource;
}
}
}

View file

@ -164,7 +164,7 @@ static void T_UConverter_toUnicode_MBCS (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* to do hsys: add more smarts to the codeUnits and length later */
@ -325,7 +325,7 @@ static void T_UConverter_toUnicode_MBCS_OFFSETS_LOGIC (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* to do hsys: add more smarts to the codeUnits and length later and offsets */
@ -604,7 +604,7 @@ static void T_UConverter_fromUnicode_MBCS_OFFSETS_LOGIC (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* Needed explicit cast for myTarget on MVS to make compiler happy - JJD */
/* HSYS: to do: more smarts including offsets*/

View file

@ -68,7 +68,8 @@ void T_UConverter_toUnicode_SBCS (UConverter * _this,
UBool flush,
UErrorCode * err)
{
char *mySource = (char *) *source, *srcTemp;
char *mySource = (char *) *source;
const char *srcTemp;
UChar *myTarget = *target, *tgtTemp;
int32_t mySourceIndex = 0;
int32_t myTargetIndex = 0;
@ -121,7 +122,7 @@ void T_UConverter_toUnicode_SBCS (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* to do hsys: add more smarts to the codeUnits and length later */
@ -162,7 +163,8 @@ void T_UConverter_fromUnicode_SBCS (UConverter * _this,
UErrorCode * err)
{
const UChar *mySource = *source, *srcTemp;
unsigned char *myTarget = (unsigned char *) *target, *tgtTemp;
unsigned char *myTarget = (unsigned char *) *target;
char *tgtTemp;
int32_t mySourceIndex = 0;
int32_t myTargetIndex = 0;
int32_t targetLength = targetLimit - (char *) myTarget;
@ -212,7 +214,7 @@ void T_UConverter_fromUnicode_SBCS (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* Needed explicit cast for myTarget on MVS to make compiler happy - JJD */
/* HSYS: to do: more smarts */
@ -227,7 +229,7 @@ void T_UConverter_fromUnicode_SBCS (UConverter * _this,
{
break;
}
myTargetIndex = *(args.pTarget) - myTarget;
myTargetIndex = *(args.pTarget) - (char*)myTarget;
mySourceIndex = *(args.pSource) - mySource;
_this->invalidUCharLength = 0;
}
@ -455,7 +457,7 @@ void T_UConverter_toUnicode_DBCS (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
/* to do hsys: add more smarts to the codeUnits and length later */
@ -511,7 +513,8 @@ void T_UConverter_fromUnicode_DBCS (UConverter * _this,
UErrorCode * err)
{
const UChar *mySource = *source, *srcTemp;
unsigned char *myTarget = (unsigned char *) *target, *tgtTemp;
unsigned char *myTarget = (unsigned char *) *target;
char *tgtTemp;
int32_t mySourceIndex = 0;
int32_t myTargetIndex = 0;
int32_t targetLength = targetLimit - (char *) myTarget;
@ -588,7 +591,7 @@ void T_UConverter_fromUnicode_DBCS (UConverter * _this,
args.pSource = &srcTemp;
args.sourceLimit = sourceLimit;
args.flush = flush;
args.offsets = offsets+myTargetIndex;
args.offsets = offsets?offsets+myTargetIndex:0;
args.size = sizeof(args);
FromU_CALLBACK_MACRO(args.converter->fromUContext,
args,
@ -601,7 +604,7 @@ void T_UConverter_fromUnicode_DBCS (UConverter * _this,
{
break;
}
myTargetIndex = *(args.pTarget) - myTarget;
myTargetIndex = *(args.pTarget) - (char*)myTarget;
mySourceIndex = *(args.pSource) - mySource;
_this->invalidUCharLength = 0;
}

View file

@ -25,6 +25,10 @@
#ifndef UCNV_H
#define UCNV_H
/* Forward declaring the UConverter structure */
struct UConverter;
typedef struct UConverter UConverter;
#include "unicode/utypes.h"
#include "unicode/ucnv_err.h"

View file

@ -30,6 +30,11 @@
* and to substitute with a codepage specific substitutions sequence when converting from Codepage -> Unicode
*/
/* This file isn't designed to be included by itself. */
#ifndef UCNV_H
# include "unicode/ucnv.h"
/* and the rest of this file will be ignored. */
#endif
#ifndef UCNV_ERR_H
#define UCNV_ERR_H
@ -55,9 +60,6 @@ typedef enum {
UCNV_CLOSE = 4,
} UConverterCallbackReason;
/* Forward declaring the UConverter structure */
struct UConverter;
typedef struct UConverter UConverter;
/**
* The structure for the fromUnicode callback function parameter.