Allow '.', ':' and ',' as separators in OGM style chapter timestamps. Accounts for stupid user mistakes.

This commit is contained in:
Moritz Bunkus 2005-03-06 21:43:33 +00:00
parent a66797bffa
commit da6d33e0a7

View File

@ -35,10 +35,8 @@ string default_chapter_country;
/** Is the current char an equal sign? */ /** Is the current char an equal sign? */
#define isequal(s) (*(s) == '=') #define isequal(s) (*(s) == '=')
/** Is the current char a colon? */ /** Is the current char a colon, comman or a dot? */
#define iscolon(s) (*(s) == ':') #define isseparator(s) ((':' == *(s)) || (',' == *(s)) || ('.' == *(s)))
/** Is the current char a dot? */
#define isdot(s) (*(s) == '.')
/** Do we have two consecutive digits? */ /** Do we have two consecutive digits? */
#define istwodigits(s) (isdigit(*(s)) && isdigit(*(s + 1))) #define istwodigits(s) (isdigit(*(s)) && isdigit(*(s + 1)))
/** Do we have three consecutive digits? */ /** Do we have three consecutive digits? */
@ -53,11 +51,11 @@ string default_chapter_country;
istwodigits(s + 7) && \ istwodigits(s + 7) && \
isequal(s + 9) && \ isequal(s + 9) && \
istwodigits(s + 10) && \ istwodigits(s + 10) && \
iscolon(s + 12) && \ isseparator(s + 12) && \
istwodigits(s + 13) && \ istwodigits(s + 13) && \
iscolon(s + 15) && \ isseparator(s + 15) && \
istwodigits(s + 16) && \ istwodigits(s + 16) && \
isdot(s + 18) && \ isseparator(s + 18) && \
isthreedigits(s + 19)) isthreedigits(s + 19))
/** Does \c s point to a valid OGM style chapter name entry? */ /** Does \c s point to a valid OGM style chapter name entry? */
#define ischapternameline(s) ((strlen(s) >= 15) && \ #define ischapternameline(s) ((strlen(s) >= 15) && \