/*
******************************************************************************
*
-* Copyright (C) 2000-2012, International Business Machines
+* Copyright (C) 2000-2013, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
uint32_t stage2Entry;
uint32_t asciiRoundtrips;
uint32_t value;
- uint8_t si_value[2] = {0, 0};
- uint8_t so_value[2] = {0, 0};
- uint8_t si_value_length, so_value_length;
+ /* Shift-In and Shift-Out byte sequences differ by encoding scheme. */
+ uint8_t siBytes[2] = {0, 0};
+ uint8_t soBytes[2] = {0, 0};
+ uint8_t siLength, soLength;
int32_t length = 0, prevLength;
uint8_t unicodeMask;
nextSourceIndex=0;
/* Get the SI/SO character for the converter */
- si_value_length = getSISOBytes(SI, cnv->options, si_value);
- so_value_length = getSISOBytes(SO, cnv->options, so_value);
+ siLength = getSISOBytes(SI, cnv->options, siBytes);
+ soLength = getSISOBytes(SO, cnv->options, soBytes);
/* conversion loop */
/*
length=1;
} else {
/* change from double-byte mode to single-byte */
- if (si_value_length == 1) {
- value|=(uint32_t)si_value[0]<<8;
+ if (siLength == 1) {
+ value|=(uint32_t)siBytes[0]<<8;
length = 2;
- } else if (si_value_length == 2) {
- value|=(uint32_t)si_value[1]<<8;
- value|=(uint32_t)si_value[0]<<16;
+ } else if (siLength == 2) {
+ value|=(uint32_t)siBytes[1]<<8;
+ value|=(uint32_t)siBytes[0]<<16;
length = 3;
}
prevLength=1;
length=2;
} else {
/* change from single-byte mode to double-byte */
- if (so_value_length == 1) {
- value|=(uint32_t)so_value[0]<<16;
+ if (soLength == 1) {
+ value|=(uint32_t)soBytes[0]<<16;
length = 3;
- } else if (so_value_length == 2) {
- value|=(uint32_t)so_value[1]<<16;
- value|=(uint32_t)so_value[0]<<24;
+ } else if (soLength == 2) {
+ value|=(uint32_t)soBytes[1]<<16;
+ value|=(uint32_t)soBytes[0]<<24;
length = 4;
}
prevLength=2;
length=1;
} else {
/* change from double-byte mode to single-byte */
- if (si_value_length == 1) {
- value|=(uint32_t)si_value[0]<<8;
+ if (siLength == 1) {
+ value|=(uint32_t)siBytes[0]<<8;
length = 2;
- } else if (si_value_length == 2) {
- value|=(uint32_t)si_value[1]<<8;
- value|=(uint32_t)si_value[0]<<16;
+ } else if (siLength == 2) {
+ value|=(uint32_t)siBytes[1]<<8;
+ value|=(uint32_t)siBytes[0]<<16;
length = 3;
}
prevLength=1;
length=2;
} else {
/* change from single-byte mode to double-byte */
- if (so_value_length == 1) {
- value|=(uint32_t)so_value[0]<<16;
+ if (soLength == 1) {
+ value|=(uint32_t)soBytes[0]<<16;
length = 3;
- } else if (so_value_length == 2) {
- value|=(uint32_t)so_value[1]<<16;
- value|=(uint32_t)so_value[0]<<24;
+ } else if (soLength == 2) {
+ value|=(uint32_t)soBytes[1]<<16;
+ value|=(uint32_t)soBytes[0]<<24;
length = 4;
}
prevLength=2;
) {
/* EBCDIC_STATEFUL ending with DBCS: emit an SI to return the output stream to SBCS */
if(targetCapacity>0) {
- *target++=(uint8_t)si_value[0];
- if (si_value_length == 2) {
+ *target++=(uint8_t)siBytes[0];
+ if (siLength == 2) {
if (targetCapacity<2) {
- cnv->charErrorBuffer[0]=(uint8_t)si_value[1];
+ cnv->charErrorBuffer[0]=(uint8_t)siBytes[1];
cnv->charErrorBufferLength=1;
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
} else {
- *target++=(uint8_t)si_value[1];
+ *target++=(uint8_t)siBytes[1];
}
}
if(offsets!=NULL) {
}
} else {
/* target is full */
- cnv->charErrorBuffer[0]=(uint8_t)si_value[0];
- if (si_value_length == 2) {
- cnv->charErrorBuffer[1]=(uint8_t)si_value[1];
+ cnv->charErrorBuffer[0]=(uint8_t)siBytes[0];
+ if (siLength == 2) {
+ cnv->charErrorBuffer[1]=(uint8_t)siBytes[1];
}
- cnv->charErrorBufferLength=si_value_length;
+ cnv->charErrorBufferLength=siLength;
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
}
prevLength=1; /* we switched into SBCS */