tests: Maintain compatibility with GLib 2.48

That's the minimum version of GLib we require right now.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/514
This commit is contained in:
Nirbheek Chauhan 2020-02-26 17:20:04 +05:30 committed by Nirbheek Chauhan
parent 81d55fb479
commit 0bf31fb1d8

View 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)