summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-08-10 15:14:47 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-08-10 15:14:47 +0000
commit7ecfb60598caa8d6e833ac288bb6b5fd0905b556 (patch)
tree1e1bdc2ab31aed919ad8eba2fb58d6aaef975edb /subreader.c
parentd9eeda02c456ca00d374e28a2bb6471a7dbf3b57 (diff)
downloadmpv-7ecfb60598caa8d6e833ac288bb6b5fd0905b556.tar.bz2
mpv-7ecfb60598caa8d6e833ac288bb6b5fd0905b556.tar.xz
10l
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10556 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/subreader.c b/subreader.c
index 0b47532100..804436f6bd 100644
--- a/subreader.c
+++ b/subreader.c
@@ -1028,8 +1028,9 @@ subtitle* subcp_recode1 (subtitle *sub)
#endif
#ifdef USE_FRIBIDI
-#define ALLOCATE(tp,ln) ((tp *) malloc (sizeof (tp) * (ln)))
+#ifndef max
#define max(a,b) (((a)>(b))?(a):(b))
+#endif
subtitle* sub_fribidi (subtitle *sub, int sub_utf8)
{
FriBidiChar logical[LINE_LEN+1], visual[LINE_LEN+1]; // Hopefully these two won't smash the stack
@@ -1063,6 +1064,7 @@ subtitle* sub_fribidi (subtitle *sub, int sub_utf8)
if(log2vis) {
len = fribidi_remove_bidi_marks (visual, len, NULL, NULL,
NULL);
+ if((op = (char*)malloc(sizeof(char)*(max(2*orig_len,2*len) + 1))) == NULL) {
if((op = ALLOCATE(char,(max(2*orig_len,2*len) + 1))) == NULL) {
mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error allocating mem.\n");
l++;
@@ -1732,7 +1734,7 @@ char** sub_filenames(char* path, char *fname)
if (prio) {
prio += prio;
#ifdef USE_ICONV
- if (i<3) // prefer UTF-8 coded
+ if (sub_cp) // prefer UTF-8 coded
prio++;
#endif
sprintf(tmpresult, "%s%s", j == 0 ? f_dir : path, de->d_name);