From 09551a3f94b21cde61cbb4bbd41406d58363c948 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 21 Aug 2005 17:59:18 +0000 Subject: [PATCH] Better error message. --- src/merge/mkvmerge.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/merge/mkvmerge.cpp b/src/merge/mkvmerge.cpp index beec9dbca..43595eb41 100644 --- a/src/merge/mkvmerge.cpp +++ b/src/merge/mkvmerge.cpp @@ -370,13 +370,17 @@ identify(const string &filename) { int64_t parse_number_with_unit(const string &s, const string &subject, - const string &argument) { + const string &argument, + string display_s = "") { string unit; int64_t value, multiplier, unit_length; + if (display_s == "") + display_s = s; + if (s.length() < 3) mxerror(_("'%s' is not a valid %s in '%s %s'.\n"), - s.c_str(), subject.c_str(), argument.c_str(), s.c_str()); + s.c_str(), subject.c_str(), argument.c_str(), display_s.c_str()); unit = s.substr(s.length() - 2, 2); @@ -392,11 +396,12 @@ parse_number_with_unit(const string &s, unit_length = 1; else mxerror(_("'%s' does not contain a valid unit ('s', 'ms', 'us' or 'ns') " - "in '%s %s'.\n"), s.c_str(), argument.c_str(), s.c_str()); + "in '%s %s'.\n"), s.c_str(), argument.c_str(), + display_s.c_str()); if (!parse_int(s.substr(0, s.length() - unit_length), value)) mxerror(_("'%s' does not contain a valid number in front of the unit in " - "'%s %s'.\n"), s.c_str(), argument.c_str(), s.c_str()); + "'%s %s'.\n"), s.c_str(), argument.c_str(), display_s.c_str()); value *= multiplier; return value; @@ -814,7 +819,7 @@ parse_delay(const string &s, if (!parse_int(parts[0], delay.id)) mxerror(_("Invalid track ID specified in '--delay %s'.\n"), s.c_str()); - delay.delay = parse_number_with_unit(parts[1], "delay", "--delay"); + delay.delay = parse_number_with_unit(parts[1], "delay", "--delay", s); ti.packet_delays.push_back(delay); }