changeset 3735:8baf42fa69b9

fix a warning (ambiguous 'if else') fix a would be bug (separator) small warning fixes
author pl
date Tue, 25 Dec 2001 16:41:06 +0000
parents e8ca83c5d013
children 689986c2af9b
files subreader.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/subreader.c	Tue Dec 25 16:39:12 2001 +0000
+++ b/subreader.c	Tue Dec 25 16:41:06 2001 +0000
@@ -123,9 +123,13 @@
 	}
 
 	/* read next line */
-	if (state != 99 && !(s = fgets (line, LINE_LEN, fd)))
-	    if (current->start > 0) break; // if it is the last subtitle
-	    else return 0;
+	if (state != 99 && !(s = fgets (line, LINE_LEN, fd))) {
+	    if (current->start > 0) {
+		break; // if it is the last subtitle
+	    } else {
+		return 0;
+	    }
+	}
 	    
     } while (state != 99);
 
@@ -253,7 +257,7 @@
 	char line[LINE_LEN+1];
 	char line2[LINE_LEN+1];
 	int a1,a2,a3,b1,b2,b3;
-	char *p=NULL, *next,*separator;
+	char *p=NULL, *next,separator;
 	int i,len,len2,plen;
 
 	memset(current, '\0', sizeof(subtitle));
@@ -365,7 +369,7 @@
 	current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1;
 	current->end   = 360000*hour2 + 6000*min2 + 100*sec2 + hunsec2;
 	
-	while (tmp=strstr(line2, "\\n")) {
+	while ((tmp=strstr(line2, "\\n")) != NULL) {
 		current->text[num]=(char *)malloc(tmp-line2+1);
 		strncpy (current->text[num], line2, tmp-line2);
 		current->text[num][tmp-line2]='\0';
@@ -432,6 +436,7 @@
 			else return NULL;
 		}
 	}
+	return NULL; // we should have returned before if it's OK
 }
 
 subtitle *previous_aqt_sub = NULL;