summaryrefslogtreecommitdiffstats
path: root/sub/subreader.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub/subreader.c')
-rw-r--r--sub/subreader.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sub/subreader.c b/sub/subreader.c
index 18b2e53bf7..275c8abba9 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -820,6 +820,7 @@ static subtitle *sub_read_line_aqt(stream_t *st,subtitle *current,
int utf16 = args->utf16;
char line[LINE_LEN+1];
+retry:
while (1) {
// try to locate next subtitle
if (!stream_read_line (st, line, LINE_LEN, utf16))
@@ -829,6 +830,7 @@ static subtitle *sub_read_line_aqt(stream_t *st,subtitle *current,
}
#ifdef CONFIG_SORTSUB
+ if (!previous_sub_end)
previous_sub_end = (current->start) ? current->start - 1 : 0;
#else
if (previous_aqt_sub != NULL)
@@ -851,13 +853,11 @@ static subtitle *sub_read_line_aqt(stream_t *st,subtitle *current,
return ERR;
if (!strlen(current->text[0]) && !strlen(current->text[1])) {
-#ifdef CONFIG_SORTSUB
- previous_sub_end = 0;
-#else
+#ifndef CONFIG_SORTSUB
// void subtitle -> end of previous marked and exit
previous_aqt_sub = NULL;
#endif
- return NULL;
+ goto retry;
}
return current;
@@ -875,6 +875,7 @@ static subtitle *sub_read_line_subrip09(stream_t *st,subtitle *current,
int a1,a2,a3;
int len;
+retry:
while (1) {
// try to locate next subtitle
if (!stream_read_line (st, line, LINE_LEN, utf16))
@@ -886,6 +887,7 @@ static subtitle *sub_read_line_subrip09(stream_t *st,subtitle *current,
current->start = a1*360000+a2*6000+a3*100;
#ifdef CONFIG_SORTSUB
+ if (!previous_sub_end)
previous_sub_end = (current->start) ? current->start - 1 : 0;
#else
if (previous_subrip09_sub != NULL)
@@ -903,13 +905,11 @@ static subtitle *sub_read_line_subrip09(stream_t *st,subtitle *current,
return ERR;
if (!strlen(current->text[0]) && current->lines <= 1) {
-#ifdef CONFIG_SORTSUB
- previous_sub_end = 0;
-#else
+#ifndef CONFIG_SORTSUB
// void subtitle -> end of previous marked and exit
previous_subrip09_sub = NULL;
#endif
- return NULL;
+ goto retry;
}
return current;