changeset 36631:715567f3387f

subreader: remove misleading return types.
author reimar
date Sat, 25 Jan 2014 16:54:56 +0000
parents 70f30c9c35c1
children 43575335eab4
files sub/subreader.c sub/subreader.h
diffstat 2 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/sub/subreader.c	Sat Jan 25 16:54:55 2014 +0000
+++ b/sub/subreader.c	Sat Jan 25 16:54:56 2014 +0000
@@ -1202,12 +1202,12 @@
 	}
 }
 
-subtitle* subcp_recode (subtitle *sub)
+void subcp_recode (subtitle *sub)
 {
 	int l=sub->lines;
 	size_t ileft, oleft;
 	char *op, *ip, *ot;
-	if(icdsc == (iconv_t)(-1)) return sub;
+	if(icdsc == (iconv_t)(-1)) return;
 
 	while (l){
 		ip = sub->text[--l];
@@ -1234,7 +1234,7 @@
 		free (sub->text[l]);
 		sub->text[l] = ot;
 	}
-	return sub;
+	return;
 }
 #endif
 
@@ -1261,7 +1261,7 @@
  * @param sub_utf8 whether the subtitle is encoded in UTF-8
  * @param from first new subtitle, all lines before this are assumed to be already converted
  */
-static subtitle* sub_fribidi (subtitle *sub, int av_unused sub_utf8, int av_unused from)
+static int sub_fribidi (subtitle *sub, int av_unused sub_utf8, int av_unused from)
 {
 #ifdef CONFIG_FRIBIDI
   FriBidiChar logical[LINE_LEN+1], visual[LINE_LEN+1]; // Hopefully these two won't smash the stack
@@ -1270,7 +1270,7 @@
   int l=sub->lines;
   int char_set_num;
   if (!flip_hebrew)
-    return sub;
+    return 1;
   fribidi_set_mirroring(1);
   fribidi_set_reorder_nsm(0);
 
@@ -1305,10 +1305,10 @@
       sub->text[l] = NULL;
     }
     sub->lines = 0;
-    return ERR;
+    return 0;
   }
 #endif
-  return sub;
+  return 1;
 }
 
 static void adjust_subs_time(subtitle* sub, float subtime, float fps, int block,
@@ -1526,10 +1526,9 @@
         sub=srp->read(fd,sub,utf16);
         if(!sub) break;   // EOF
 #ifdef CONFIG_ICONV
-	if ((sub!=ERR) && sub_utf8 == 2 && utf16 == 0) sub=subcp_recode(sub);
+	if ((sub!=ERR) && sub_utf8 == 2 && utf16 == 0) subcp_recode(sub);
 #endif
-	if (sub!=ERR) sub=sub_fribidi(sub,sub_utf8,0);
-	if ( sub == ERR )
+	if ( sub == ERR || !sub_fribidi(sub,sub_utf8,0))
 	 {
 #ifdef CONFIG_ICONV
           subcp_close();
@@ -2584,7 +2583,7 @@
     free(sub->text[sub->lines]);
   }
   if (strip_markup)
-  sub = sub_fribidi(sub, sub_utf8, orig_lines);
+    sub_fribidi(sub, sub_utf8, orig_lines);
 }
 
 #define MP_NOPTS_VALUE (-1LL<<63)
--- a/sub/subreader.h	Sat Jan 25 16:54:55 2014 +0000
+++ b/sub/subreader.h	Sat Jan 25 16:54:56 2014 +0000
@@ -93,7 +93,7 @@
 typedef int (*open_vob_func)(const char *, const char * const, int, void *);
 
 sub_data* sub_read_file (const char *filename, float pts);
-subtitle* subcp_recode (subtitle *sub);
+void subcp_recode (subtitle *sub);
 // enca_fd is the file enca uses to determine the codepage.
 // setting to NULL disables enca.
 struct stream;