ICU-432 Remember to close the converter.
X-SVN-Rev: 4124
This commit is contained in:
parent
3506137b6d
commit
a845bcdc78
@ -205,12 +205,14 @@ char *aescstrdup(const UChar* unichars){
|
|||||||
void *p;
|
void *p;
|
||||||
UErrorCode errorCode = U_ZERO_ERROR;
|
UErrorCode errorCode = U_ZERO_ERROR;
|
||||||
UConverter* conv = ucnv_open("US-ASCII",&errorCode);
|
UConverter* conv = ucnv_open("US-ASCII",&errorCode);
|
||||||
|
|
||||||
length = u_strlen( unichars);
|
length = u_strlen( unichars);
|
||||||
newString = (char*)ctst_malloc ( sizeof(char) * 8 * (length +1));
|
newString = (char*)ctst_malloc ( sizeof(char) * 8 * (length +1));
|
||||||
target = newString;
|
target = newString;
|
||||||
targetLimit = newString+sizeof(char) * 8 * (length +1);
|
targetLimit = newString+sizeof(char) * 8 * (length +1);
|
||||||
ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_JAVA, &cb, &p, &errorCode);
|
ucnv_setFromUCallBack(conv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_JAVA, &cb, &p, &errorCode);
|
||||||
ucnv_fromUnicode(conv,&target,targetLimit, &unichars, (UChar*)(unichars+length),NULL,TRUE,&errorCode);
|
ucnv_fromUnicode(conv,&target,targetLimit, &unichars, (UChar*)(unichars+length),NULL,TRUE,&errorCode);
|
||||||
|
ucnv_close(conv);
|
||||||
*target = '\0';
|
*target = '\0';
|
||||||
return newString;
|
return newString;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user