1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-11 17:37:23 +00:00

Clear iconv conversion state also in libass.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26923 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
eugeni 2008-05-29 18:35:21 +00:00
parent d3e1f76cac
commit db616d5222

View File

@ -846,13 +846,19 @@ static char* sub_recode(char* data, size_t size, char* codepage)
char* ip;
char* op;
size_t rc;
int clear = 0;
outbuf = malloc(size);
ip = data;
op = outbuf;
while (ileft) {
rc = iconv(icdsc, &ip, &ileft, &op, &oleft);
while (1) {
if (ileft)
rc = iconv(icdsc, &ip, &ileft, &op, &oleft);
else {// clear the conversion state and leave
clear = 1;
rc = iconv(icdsc, NULL, NULL, &op, &oleft);
}
if (rc == (size_t)(-1)) {
if (errno == E2BIG) {
size_t offset = op - outbuf;
@ -864,7 +870,9 @@ static char* sub_recode(char* data, size_t size, char* codepage)
mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorRecodingFile);
return NULL;
}
}
} else
if (clear)
break;
}
outbuf[osize - oleft - 1] = 0;
}