Mercurial > mplayer.hg
changeset 24852:35902b734951
Cleanup guess_buffer_cp() a bit, remove tmp variable, break the loop on success.
Requested by ulion.
author | iive |
---|---|
date | Sun, 28 Oct 2007 15:53:08 +0000 |
parents | e36efda34616 |
children | 4e72865ed939 |
files | subreader.c |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/subreader.c Sun Oct 28 14:26:05 2007 +0000 +++ b/subreader.c Sun Oct 28 15:53:08 2007 +0000 @@ -1287,17 +1287,14 @@ mp_msg(MSGT_SUBREADER, MSGL_V, "\n"); for (i = 0; i < langcnt; i++) { - const char *tmp; - if (strcasecmp(languages[i], preferred_language) != 0) continue; analyser = enca_analyser_alloc(languages[i]); encoding = enca_analyse_const(analyser, buffer, buflen); - tmp = enca_charset_name(encoding.charset, ENCA_NAME_STYLE_ICONV); - if (tmp && encoding.charset != ENCA_CS_UNKNOWN) { - detected_sub_cp = tmp; - mp_msg(MSGT_SUBREADER, MSGL_INFO, "ENCA detected charset: %s\n", tmp); + enca_analyser_free(analyser); + if (encoding.charset != ENCA_CS_UNKNOWN) { + detected_sub_cp = enca_charset_name(encoding.charset, ENCA_NAME_STYLE_ICONV); + break; } - enca_analyser_free(analyser); } free(languages); @@ -1305,6 +1302,8 @@ if (!detected_sub_cp) { detected_sub_cp = fallback; mp_msg(MSGT_SUBREADER, MSGL_INFO, "ENCA detection failed: fallback to %s\n", fallback); + }else{ + mp_msg(MSGT_SUBREADER, MSGL_INFO, "ENCA detected charset: %s\n", detected_sub_cp); } return detected_sub_cp;