mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
gst/: remove GLib 2.6 compatibility code
Original commit message from CVS: * gst/glib-compat-private.h: * gst/glib-compat.c: * gst/glib-compat.h: * gst/gstvalue.c: (gst_value_serialize_flags): remove GLib 2.6 compatibility code
This commit is contained in:
parent
7e1530dda1
commit
5855b0ef94
5 changed files with 10 additions and 131 deletions
|
@ -1,3 +1,11 @@
|
|||
2006-06-13 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/glib-compat-private.h:
|
||||
* gst/glib-compat.c:
|
||||
* gst/glib-compat.h:
|
||||
* gst/gstvalue.c: (gst_value_serialize_flags):
|
||||
remove GLib 2.6 compatibility code
|
||||
|
||||
2006-06-12 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/parse/Makefile.am:
|
||||
|
|
|
@ -11,17 +11,7 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
/* copies */
|
||||
#if !GLIB_CHECK_VERSION (2, 8, 0)
|
||||
int g_mkdir_with_parents (const gchar *pathname, int mode);
|
||||
#endif
|
||||
|
||||
/* adaptations */
|
||||
#include <glib-object.h>
|
||||
GFlagsValue*
|
||||
gst_flags_get_first_value (GFlagsClass *flags_class,
|
||||
guint value);
|
||||
|
||||
GObject*
|
||||
g_value_dup_gst_object (const GValue *value);
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -5,26 +5,6 @@
|
|||
* Copyright 2005 David Schleef <ds@schleef.org>
|
||||
*/
|
||||
|
||||
/* gfileutils.c - File utility functions
|
||||
*
|
||||
* Copyright 2000 Red Hat, Inc.
|
||||
*
|
||||
* GLib is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* GLib is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with GLib; see the file COPYING.LIB. If not,
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
@ -41,98 +21,8 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#if 0
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#ifndef G_OS_WIN32
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#endif /* G_OS_WIN32 */
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#define G_DIR_SEPARATOR '\\'
|
||||
#define G_DIR_SEPARATOR_S "\\"
|
||||
#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/')
|
||||
#define G_SEARCHPATH_SEPARATOR ';'
|
||||
#define G_SEARCHPATH_SEPARATOR_S ";"
|
||||
#else
|
||||
#define G_DIR_SEPARATOR '/'
|
||||
#define G_DIR_SEPARATOR_S "/"
|
||||
#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR)
|
||||
#define G_SEARCHPATH_SEPARATOR ':'
|
||||
#define G_SEARCHPATH_SEPARATOR_S ":"
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* gst_flags_get_first_value:
|
||||
* @flags_class: a #GFlagsClass
|
||||
* @value: the value
|
||||
*
|
||||
* Returns the first GFlagsValue which is set in value.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Returns: the first GFlagsValue which is set in value, or NULL if none is set.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/* Adapted from g_value_dup_object to use gst_object_ref */
|
||||
#include "gstobject.h"
|
||||
/**
|
||||
* g_value_dup_gst_object:
|
||||
* @value: the #GstObject value to dup
|
||||
*
|
||||
* Get the contents of a G_TYPE_OBJECT derived GValue, increasing its reference count.
|
||||
* This function exists because of unsafe reference counting in old glib versions.
|
||||
*
|
||||
* Returns: object content of value, should be unreferenced with gst_object_unref()
|
||||
* when no longer needed.
|
||||
*/
|
||||
GObject *
|
||||
g_value_dup_gst_object (const GValue * value)
|
||||
{
|
||||
GObject *o;
|
||||
|
||||
g_return_val_if_fail (G_VALUE_HOLDS_OBJECT (value), NULL);
|
||||
|
||||
o = value->data[0].v_pointer;
|
||||
if (!o)
|
||||
return NULL;
|
||||
g_return_val_if_fail (GST_IS_OBJECT (o), NULL);
|
||||
return gst_object_ref (o);
|
||||
}
|
||||
|
|
|
@ -32,15 +32,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* added in GLib 2.8 */
|
||||
#if !GLIB_CHECK_VERSION (2, 8, 0)
|
||||
#if __GNUC__ >= 4
|
||||
#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
|
||||
#else
|
||||
#define G_GNUC_NULL_TERMINATED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_GLIB_COMPAT_H__ */
|
||||
|
|
|
@ -1923,14 +1923,14 @@ gst_value_serialize_flags (const GValue * value)
|
|||
|
||||
/* if no flags are set, try to serialize to the _NONE string */
|
||||
if (!flags) {
|
||||
fl = gst_flags_get_first_value (klass, flags);
|
||||
fl = g_flags_get_first_value (klass, flags);
|
||||
return g_strdup (fl->value_name);
|
||||
}
|
||||
|
||||
/* some flags are set, so serialize one by one */
|
||||
result = g_strdup ("");
|
||||
while (flags) {
|
||||
fl = gst_flags_get_first_value (klass, flags);
|
||||
fl = g_flags_get_first_value (klass, flags);
|
||||
if (fl != NULL) {
|
||||
tmp = g_strconcat (result, (first ? "" : "+"), fl->value_name, NULL);
|
||||
g_free (result);
|
||||
|
|
Loading…
Reference in a new issue