[MPlayer-cvslog] r36698 - trunk/sub/font_load_ft.c

ib subversion at mplayerhq.hu
Wed Jan 22 20:26:30 CET 2014


Author: ib
Date: Wed Jan 22 20:26:30 2014
New Revision: 36698

Log:
Fix handling of option 'subfont-encoding'.

prepare_charset_unicode() is supposed to work without iconv which it
does indeed. So, move the function definition out of the '#ifdef
CONFIG_ICONV' block.

As a result, charset_size can be uninitialized and charmap may be
unused. Fix them both.

Modified:
   trunk/sub/font_load_ft.c

Modified: trunk/sub/font_load_ft.c
==============================================================================
--- trunk/sub/font_load_ft.c	Wed Jan 22 20:22:08 2014	(r36697)
+++ trunk/sub/font_load_ft.c	Wed Jan 22 20:26:30 2014	(r36698)
@@ -795,6 +795,7 @@ static int prepare_charset(char *charmap
 
     return charset_size;
 }
+#endif
 
 static int prepare_charset_unicode(FT_Face face, FT_ULong *charset, FT_ULong *charcodes) {
 #ifdef HAVE_FREETYPE21
@@ -836,7 +837,6 @@ static int prepare_charset_unicode(FT_Fa
 
     return i;
 }
-#endif
 
 static font_desc_t* init_font_desc(void)
 {
@@ -948,9 +948,8 @@ font_desc_t* read_font_desc_ft(const cha
     FT_ULong *my_charset = malloc(MAX_CHARSET_SIZE * sizeof(FT_ULong)); /* characters we want to render; Unicode */
     FT_ULong *my_charcodes = malloc(MAX_CHARSET_SIZE * sizeof(FT_ULong)); /* character codes in 'encoding' */
 
-    char *charmap = "ucs-4";
     int err;
-    int charset_size;
+    int charset_size = -1;
     int i, j;
     int unicode;
 
@@ -1003,19 +1002,17 @@ font_desc_t* read_font_desc_ft(const cha
     }
     desc->face_cnt++;
 
-#ifdef CONFIG_ICONV
     if (unicode)
 	charset_size = prepare_charset_unicode(face, my_charset, my_charcodes);
+#ifdef CONFIG_ICONV
     else
-	charset_size = prepare_charset(charmap, subtitle_font_encoding, my_charset, my_charcodes);
+	charset_size = prepare_charset("ucs-4", subtitle_font_encoding, my_charset, my_charcodes);
+#endif
 
     if (charset_size < 0) {
 	mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_SubFontCharsetFailed);
 	goto err_out;
     }
-#else
-    goto err_out;
-#endif
 
 //    fprintf(stderr, "fg: prepare t = %f\n", GetTimer()-t);
 


More information about the MPlayer-cvslog mailing list