From 31ec52a844c6130861db8f1fe4060e830f13b2aa Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 19 Feb 2005 14:32:56 +0000 Subject: [PATCH] More verbose warning: tell the user what exactly is wrong with an entry. Empty "text" fields are nothing to worry about. split() actually discards an empty field at the end of a string. --- src/extract/xtr_textsubs.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/extract/xtr_textsubs.cpp b/src/extract/xtr_textsubs.cpp index 6d6d197c4..091d08f02 100644 --- a/src/extract/xtr_textsubs.cpp +++ b/src/extract/xtr_textsubs.cpp @@ -205,16 +205,20 @@ xtr_ssa_c::handle_block(KaxBlock &block, // 0: ReadOrder, 1: Layer, 2: Style, 3: Name, 4: MarginL, 5: MarginR, // 6: MarginV, 7: Effect, 8: Text fields = split(s, ",", 9); - if (9 != fields.size()) { - mxwarn("Invalid format for a SSA line ('%s'). This entry will be " - "skipped.\n", s); + if (9 < fields.size()) { + mxwarn("Invalid format for a SSA line ('%s') at timecode " FMT_TIMECODE + ": Too many fields found (%d instead of 9). This entry will be " + "skipped.\n", s, ARG_TIMECODE_NS(timecode), fields.size()); return; } + while (9 != fields.size()) + fields.push_back(""); // Convert the ReadOrder entry so that we can re-order the entries later. if (!parse_int(fields[0], num)) { - mxwarn("Invalid format for a SSA line ('%s'). This entry will be " - "skipped.\n", s); + mxwarn("Invalid format for a SSA line ('%s') at timecode " FMT_TIMECODE + ": The first field is not an integer. This entry will be " + "skipped.\n", s, ARG_TIMECODE_NS(timecode)); return; }