[MPlayer-cvslog] r37763 - trunk/libass/ass_utils.c

reimar subversion at mplayerhq.hu
Sat Feb 20 13:10:37 CET 2016


Author: reimar
Date: Sat Feb 20 13:10:37 2016
New Revision: 37763

Log:
ass_utils: pick first enca match.

This is consistent with non-ass enca
handling and avoids a possible memleak.

Modified:
   trunk/libass/ass_utils.c

Modified: trunk/libass/ass_utils.c
==============================================================================
--- trunk/libass/ass_utils.c	Sat Feb 20 13:02:18 2016	(r37762)
+++ trunk/libass/ass_utils.c	Sat Feb 20 13:10:37 2016	(r37763)
@@ -250,11 +250,12 @@ void *ass_guess_buffer_cp(ASS_Library *l
         analyser = enca_analyser_alloc(languages[i]);
         encoding = enca_analyse_const(analyser, buffer, buflen);
         tmp = enca_charset_name(encoding.charset, ENCA_NAME_STYLE_ICONV);
+        enca_analyser_free(analyser);
         if (tmp && encoding.charset != ENCA_CS_UNKNOWN) {
             detected_sub_cp = strdup(tmp);
             ass_msg(library, MSGL_INFO, "ENCA detected charset: %s", tmp);
+            break;
         }
-        enca_analyser_free(analyser);
     }
 
     free(languages);


More information about the MPlayer-cvslog mailing list