changeset 16918:f5e079f84466

Translated strings might be longer than the originals. One unnecessary dependancy on string length fixed; quadrupled buffer size for matroska case
author ranma
date Sat, 05 Nov 2005 17:25:34 +0000
parents c45409728a9d
children 7c5940a857df
files mplayer.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Sat Nov 05 15:32:50 2005 +0000
+++ b/mplayer.c	Sat Nov 05 17:25:34 2005 +0000
@@ -4147,24 +4147,23 @@
 #ifdef USE_DVDREAD
 	  if (vo_spudec && (demuxer->type != DEMUXER_TYPE_MATROSKA)) {
 	      if (dvdsub_id >= 0) {
-		  char lang[5] = MSGTR_OSDnone;
+		  char lang[3] = "\0\0\0";
 		  int code = 0;
 		  code = dvd_lang_from_sid(stream, dvdsub_id);
 		  if (code) {
 		      lang[0] = code >> 8;
 		      lang[1] = code;
-		      lang[2] = 0;
 		  }
-		  snprintf(osd_text_tmp, 63, MSGTR_OSDSubtitlesLanguage, dvdsub_id, lang);
+		  snprintf(osd_text_tmp, 63, MSGTR_OSDSubtitlesLanguage, dvdsub_id, code ? lang : MSGTR_OSDnone);
 	      }
 	  }
 #endif
 #ifdef HAVE_MATROSKA
     if (demuxer->type == DEMUXER_TYPE_MATROSKA) {
-      char lang[10] = MSGTR_OSDunknown;
+      char lang[40] = MSGTR_OSDunknown;
       if (dvdsub_id >= 0) {
-        demux_mkv_get_sub_lang(demuxer, dvdsub_id, lang, 9);
-        lang[9] = 0;
+        demux_mkv_get_sub_lang(demuxer, dvdsub_id, lang, 39);
+        lang[39] = 0;
 	snprintf(osd_text_tmp, 63, MSGTR_OSDSubtitlesLanguage, dvdsub_id, lang);
       }
     }