Mercurial > mplayer.hg
comparison subreader.c @ 11838:b4f1df0c1e3a
prevent subreader from segfaulting when sami subs dont have
a <P> at the beginning.
patch by Fabien Tassin <fta+mplayer@sofaraway.org>
author | attila |
---|---|
date | Sat, 24 Jan 2004 12:54:05 +0000 |
parents | e1976281b127 |
children | 9c66ef56b1b1 |
comparison
equal
deleted
inserted
replaced
11837:4e8f8efb6906 | 11838:b4f1df0c1e3a |
---|---|
111 sub_slacktime = strtol (slacktime_s+10, NULL, 0) / 10; | 111 sub_slacktime = strtol (slacktime_s+10, NULL, 0) / 10; |
112 | 112 |
113 s = stristr (s, "Start="); | 113 s = stristr (s, "Start="); |
114 if (s) { | 114 if (s) { |
115 current->start = strtol (s + 6, &s, 0) / 10; | 115 current->start = strtol (s + 6, &s, 0) / 10; |
116 /* eat '>' */ | |
117 for (; *s != '>' && *s != '\0'; s++); | |
118 s++; | |
116 state = 1; continue; | 119 state = 1; continue; |
117 } | 120 } |
118 break; | 121 break; |
119 | 122 |
120 case 1: /* find "<P" */ | 123 case 1: /* find (optionnal) "<P", skip other TAGs */ |
121 if ((s = stristr (s, "<P"))) { s += 2; state = 2; continue; } | 124 for (; *s == ' ' || *s == '\t'; s++); /* strip blanks, if any */ |
122 break; | 125 if (*s == '\0') break; |
126 if (*s != '<') { state = 3; p = text; continue; } /* not a TAG */ | |
127 s++; | |
128 if (*s == 'P' || *s == 'p') { s++; state = 2; continue; } /* found '<P' */ | |
129 for (; *s != '>' && *s != '\0'; s++); /* skip remains of non-<P> TAG */ | |
130 if (s == '\0') | |
131 break; | |
132 s++; | |
133 continue; | |
123 | 134 |
124 case 2: /* find ">" */ | 135 case 2: /* find ">" */ |
125 if ((s = strchr (s, '>'))) { s++; state = 3; p = text; continue; } | 136 if ((s = strchr (s, '>'))) { s++; state = 3; p = text; continue; } |
126 break; | 137 break; |
127 | 138 |