[totem/gnome-3-0] chapters: Permit invalid timestamp formats as previously output by Totem
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/gnome-3-0] chapters: Permit invalid timestamp formats as previously output by Totem
- Date: Thu, 14 Apr 2011 20:01:14 +0000 (UTC)
commit be3d1413b7984b7e9da23e991e63aa68e1b6aeca
Author: Philip Withnall <philip tecnocode co uk>
Date: Thu Apr 14 20:57:43 2011 +0100
chapters: Permit invalid timestamp formats as previously output by Totem
Allow timestamps which consist only of the floating-point number of seconds
to be successfully parsed by the CMML parser, even if that number of seconds
is >= 60.0. This means Totem no longer falls over on the CMML files it was
previously outputting.
Closes: bgo#647513
src/plugins/chapters/totem-cmml-parser.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/chapters/totem-cmml-parser.c b/src/plugins/chapters/totem-cmml-parser.c
index 59e9ada..3b7447f 100644
--- a/src/plugins/chapters/totem-cmml-parser.c
+++ b/src/plugins/chapters/totem-cmml-parser.c
@@ -314,7 +314,14 @@ totem_cmml_parse_npt (const gchar *str)
return -1;
if (G_UNLIKELY (m > 59 || m < 0))
return -1;
- if (G_UNLIKELY (s >= 60.0 || s < 0.0))
+
+ /* We break slightly with the specifications here and allow seconds-only values greater than 60 seconds.
+ * (i.e. we allow "90" to be successfully parsed as 1.5 minutes and returned as 90 seconds, rather than
+ * returning an error because it's > 60). This is because Totem previously (incorrectly) wrote out timestamps
+ * in this (seconds only, potentially > 60) format; so for compatibility with CMML files written by older
+ * versions of Totem, we have to allow such formats.
+ * However, if either h or m is non-zero, we error out as before. */
+ if (G_UNLIKELY ((h != 0 || m != 0) && (s >= 60.0 || s < 0.0)))
return -1;
return (h * 3600.0) + (m * 60.0) + s;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]