2005-10-13 Thomas Vander Stichele <thomas at apestaart dot org>
+ * gst/glib-compat.c: (gst_flags_get_first_value):
+ * gst/glib-compat.h:
+ * gst/gstvalue.c: (gst_value_deserialize_int_helper),
+ (gst_value_compare_double), (gst_value_serialize_flags):
+ GLib 2.6 g_flags_get_first_value has a bug that triggers an
+ infinite loop
+
+2005-10-13 Thomas Vander Stichele <thomas at apestaart dot org>
+
* gst/base/gstbasesink.c: (gst_base_sink_handle_object):
* gst/base/gstbasesrc.c: (gst_base_src_get_range):
fix up debugging
#endif
}
#endif
+
+/* This version is copied from GLib 2.8.
+ * In GLib 2.6, it didn't check for a flag value being NULL, hence it
+ * hits an infinite loop in our flags serialize function
+ */
+GFlagsValue *
+gst_flags_get_first_value (GFlagsClass * flags_class, guint value)
+{
+ g_return_val_if_fail (G_IS_FLAGS_CLASS (flags_class), NULL);
+
+ if (flags_class->n_values) {
+ GFlagsValue *flags_value;
+
+ if (value == 0) {
+ for (flags_value = flags_class->values; flags_value->value_name;
+ flags_value++)
+ if (flags_value->value == 0)
+ return flags_value;
+ } else {
+ for (flags_value = flags_class->values; flags_value->value_name;
+ flags_value++)
+ if (flags_value->value != 0
+ && (flags_value->value & value) == flags_value->value)
+ return flags_value;
+ }
+ }
+
+ return NULL;
+}
* Copyright 2005 David Schleef <ds@schleef.org>
*/
+#include <gst_private.h> /* for g_warning */
#include <glib.h>
#if GLIB_CHECK_VERSION (2, 6, 0)
#include <glib/gstdio.h>
int g_stat (const gchar *filename, struct stat *buf);
#endif
+#include <glib-object.h>
+GFlagsValue*
+gst_flags_get_first_value (GFlagsClass *flags_class,
+ guint value);
G_END_DECLS
#include <ctype.h>
#include "gst_private.h"
+#include "glib-compat.h"
#include <gst/gst.h>
#include <gobject/gvaluecollector.h>
result = g_strdup ("");
flags = g_value_get_flags (value);
while (flags) {
- fl = g_flags_get_first_value (klass, flags);
+ fl = gst_flags_get_first_value (klass, flags);
if (fl != NULL) {
tmp = g_strconcat (result, (first ? "" : "+"), fl->value_name, NULL);
g_free (result);