tests: Maintain compatibility with GLib 2.48
authorNirbheek Chauhan <nirbheek@centricular.com>
Wed, 26 Feb 2020 11:50:04 +0000 (17:20 +0530)
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>
Wed, 26 Feb 2020 19:22:32 +0000 (19:22 +0000)
That's the minimum version of GLib we require right now.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/514

tests/misc/netclock-replay.c

index e405902223be3367d99d2aa31d35663b103f67c4..be8123349ff5969737671143bc3969611c5b21bf 100644 (file)
@@ -48,6 +48,24 @@ static GOptionEntry entries[] = {
   {NULL,}
 };
 
+/* g_ascii_string_to_unsigned is available since 2.54. Get rid of this wrapper
+ * when we bump the version in 1.18 */
+#if !GLIB_CHECK_VERSION(2,54,0)
+#define g_ascii_string_to_unsigned parse_ascii_string_to_unsigned
+static gboolean
+parse_ascii_string_to_unsigned (const gchar * str, guint base, guint64 min,
+    guint64 max, guint64 * out_num, GError ** error)
+{
+  gchar *endptr = NULL;
+  *out_num = g_ascii_strtoull (str, &endptr, base);
+  if (errno)
+    return FALSE;
+  if (endptr == str)
+    return FALSE;
+  return TRUE;
+}
+#endif
+
 static gboolean
 parse_time_values (const gchar * line, GstClockTime * local_1,
     GstClockTime * remote_1, GstClockTime * remote_2, GstClockTime * local_2)