changeset 270:7d544020e398

no more garbage! (fixed by laaz)
author gabucino
date Sun, 01 Apr 2001 19:35:18 +0000
parents f5a7323af43f
children 38d30f6f1423
files subreader.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/subreader.c	Sun Apr 01 17:50:40 2001 +0000
+++ b/subreader.c	Sun Apr 01 19:35:18 2001 +0000
@@ -61,9 +61,9 @@
 
     next=p, i=0;
     while ((next =sub_readtext (next, &(current->text[i])))) {
-        if (current->text[i]==ERR || current->text[i]==ERR) {return ERR;}
+        if (current->text[i]==ERR) {return ERR;}
 	i++;
-	if (i>SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");return ERR;}
+	if (i>SUB_MAX_TEXT) { printf ("Too many lines in a subtitle\n");current->lines=i;return;}
     }
     current->lines=i+1;
 
@@ -92,6 +92,7 @@
 	    current->text[current->lines-1]=(char *)malloc (len+1);
 	    if (!current->text[current->lines-1]) return ERR;
 	    strncpy (current->text[current->lines-1], q, len);
+	    current->text[current->lines-1][len]='\0';
 	    if (!*p || *p=='\r' || *p=='\n') break;
 	    while (*p++!=']');
 	}
@@ -120,7 +121,7 @@
 	    if (len) {
 		current->text[i]=(char *)malloc (len+1);
 		if (!current->text[i]) return ERR;
-		strncpy (current->text[i], line, len);
+		strncpy (current->text[i], line, len); current->text[i][len]='\0';
 		i++;
 	    } else {
 		break;