UChar *uTarget;
char *cTarget;
const char *cTargetLimit;
- char *cBuf;
- UChar *uBuf,*test;
+ char *cBuf = NULL;
+ UChar *uBuf = NULL;
+ UChar *test;
int32_t uBufSize = 120;
UErrorCode errorCode=U_ZERO_ERROR;
- UConverter *cnv;
+ UConverter *cnv = NULL;
int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
int32_t* myOff= offsets;
cnv=ucnv_open("HZ", &errorCode);
if(U_FAILURE(errorCode)) {
log_data_err("Unable to open HZ converter: %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uBuf = (UChar*)malloc(uBufSize * sizeof(UChar)*5);
ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
cSource = cBuf;
cSourceLimit =cTarget;
ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uSource = (const UChar*)in;
while(uSource<uSourceLimit){
TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
TestToAndFromUChars(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
TestJitterbug930("csISO2022JP");
+
+cleanup:
ucnv_close(cnv);
free(offsets);
free(uBuf);
UChar *uTarget;
char *cTarget;
const char *cTargetLimit;
- char *cBuf;
- UChar *uBuf,*test;
+ char *cBuf = NULL;
+ UChar *uBuf = NULL;
+ UChar *test;
int32_t uBufSize = 120;
UErrorCode errorCode=U_ZERO_ERROR;
- UConverter *cnv;
+ UConverter *cnv = NULL;
int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
int32_t* myOff= offsets;
cnv=ucnv_open("ISO_2022_JP_1", &errorCode);
if(U_FAILURE(errorCode)) {
log_data_err("Unable to open an ISO_2022_JP_1 converter: %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uBuf = (UChar*)malloc(uBufSize * sizeof(UChar)*5);
ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
cSource = cBuf;
cSourceLimit =cTarget;
ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uSource = (const UChar*)in;
TestGetNextUChar2022(cnv, cBuf, cTarget, in, "ISO-2022-JP encoding");
TestToAndFromUChars(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
TestJitterbug930("csISO2022JP");
+
+cleanup:
ucnv_close(cnv);
free(uBuf);
free(cBuf);
UChar *uTarget;
char *cTarget;
const char *cTargetLimit;
- char *cBuf;
- UChar *uBuf,*test;
+ char *cBuf = NULL;
+ UChar *uBuf = NULL;
+ UChar *test;
int32_t uBufSize = 120;
UErrorCode errorCode=U_ZERO_ERROR;
- UConverter *cnv;
+ UConverter *cnv = NULL;
int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
int32_t* myOff= offsets;
cnv=ucnv_open("ISO_2022_JP_2", &errorCode);
if(U_FAILURE(errorCode)) {
log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uBuf = (UChar*)malloc(uBufSize * sizeof(UChar)*5);
ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
cSource = cBuf;
cSourceLimit =cTarget;
ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uSource = (const UChar*)in;
while(uSource<uSourceLimit){
static const uint8_t source2[]={0x0e,0x24,0x053};
TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ZERO_ERROR, "an invalid character [ISO-2022-JP-2]");
}
+
+cleanup:
ucnv_close(cnv);
free(uBuf);
free(cBuf);
UChar *uTarget;
char *cTarget;
const char *cTargetLimit;
- char *cBuf;
- UChar *uBuf,*test;
+ char *cBuf = NULL;
+ UChar *uBuf = NULL;
+ UChar *test;
int32_t uBufSize = 120;
UErrorCode errorCode=U_ZERO_ERROR;
- UConverter *cnv;
+ UConverter *cnv = NULL;
int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
int32_t* myOff= offsets;
cnv=ucnv_open("ISO_2022,locale=kr", &errorCode);
if(U_FAILURE(errorCode)) {
log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uBuf = (UChar*)malloc(uBufSize * sizeof(UChar)*5);
ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
cSource = cBuf;
cSourceLimit =cTarget;
ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uSource = (const UChar*)in;
while(uSource<uSourceLimit){
ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_STOP, NULL, NULL, NULL, &errorCode);
TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ILLEGAL_ESCAPE_SEQUENCE, "an invalid character [ISO-2022-KR]");
}
+
+cleanup:
ucnv_close(cnv);
free(uBuf);
free(cBuf);
UChar *uTarget;
char *cTarget;
const char *cTargetLimit;
- char *cBuf;
- UChar *uBuf,*test;
+ char *cBuf = NULL;
+ UChar *uBuf = NULL;
+ UChar *test;
int32_t uBufSize = 120;
UErrorCode errorCode=U_ZERO_ERROR;
- UConverter *cnv;
+ UConverter *cnv = NULL;
int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
int32_t* myOff= offsets;
cnv=ucnv_open("ibm-25546", &errorCode);
if(U_FAILURE(errorCode)) {
log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uBuf = (UChar*)malloc(uBufSize * sizeof(UChar)*5);
ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
cSource = cBuf;
cSourceLimit =cTarget;
ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uSource = (const UChar*)in;
while(uSource<uSourceLimit){
ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_STOP, NULL, NULL, NULL, &errorCode);
TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ILLEGAL_ESCAPE_SEQUENCE, "an invalid character [ISO-2022-KR]");
}
+
+cleanup:
ucnv_close(cnv);
free(uBuf);
free(cBuf);
UChar *uTarget;
char *cTarget;
const char *cTargetLimit;
- char *cBuf;
- UChar *uBuf,*test;
+ char *cBuf = NULL;
+ UChar *uBuf = NULL;
+ UChar *test;
int32_t uBufSize = 180;
UErrorCode errorCode=U_ZERO_ERROR;
- UConverter *cnv;
+ UConverter *cnv = NULL;
int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
int32_t* myOff= offsets;
cnv=ucnv_open("ISO_2022,locale=cn,version=1", &errorCode);
if(U_FAILURE(errorCode)) {
log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uBuf = (UChar*)malloc(uBufSize * sizeof(UChar)*5);
ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
cSource = cBuf;
cSourceLimit =cTarget;
ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uSource = (const UChar*)in;
while(uSource<uSourceLimit){
static const uint8_t source2[]={0x0e,0x24,0x053};
TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ZERO_ERROR, "an invalid character [ISO-2022-CN-EXT]");
}
+
+cleanup:
ucnv_close(cnv);
free(uBuf);
free(cBuf);
UChar *uTarget;
char *cTarget;
const char *cTargetLimit;
- char *cBuf;
- UChar *uBuf,*test;
+ char *cBuf = NULL;
+ UChar *uBuf = NULL;
+ UChar *test;
int32_t uBufSize = 180;
UErrorCode errorCode=U_ZERO_ERROR;
- UConverter *cnv;
+ UConverter *cnv = NULL;
int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
int32_t* myOff= offsets;
cnv=ucnv_open("ISO_2022,locale=cn,version=0", &errorCode);
if(U_FAILURE(errorCode)) {
log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uBuf = (UChar*)malloc(uBufSize * sizeof(UChar)*5);
ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
cSource = cBuf;
cSourceLimit =cTarget;
ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
- return;
+ goto cleanup;
}
uSource = (const UChar*)in;
while(uSource<uSourceLimit){
TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ZERO_ERROR, "an invalid character [ISO-2022-CN]");
}
+cleanup:
ucnv_close(cnv);
free(uBuf);
free(cBuf);
/* Callback for TestJitterbug6175, should only get called for empty segment errors */
static void UCNV_TO_U_CALLBACK_EMPTYSEGMENT( const void *context, UConverterToUnicodeArgs *toArgs, const char* codeUnits,
int32_t length, UConverterCallbackReason reason, UErrorCode * err ) {
+ // suppress compiler warnings about unused variables
+ (void)context;
+ (void)codeUnits;
+ (void)length;
if (reason > UCNV_IRREGULAR) {
return;
}