[gupnp-dlna/wip/new-api: 15/46] Move GUPnPDLNANativeFraction to $(top_srcdir)/libgupnp-dlna.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-dlna/wip/new-api: 15/46] Move GUPnPDLNANativeFraction to $(top_srcdir)/libgupnp-dlna.
- Date: Mon, 14 Jan 2013 10:05:50 +0000 (UTC)
commit fc95a1bf0f89f51bce3e86c33d71c9b0de738669
Author: Krzesimir Nowak <krnowak openismus com>
Date: Thu Nov 29 18:35:23 2012 +0100
Move GUPnPDLNANativeFraction to $(top_srcdir)/libgupnp-dlna.
It is going to be exposed as a opaque boxed type soon.
libgupnp-dlna/Makefile.am | 3 +-
libgupnp-dlna/gupnp-dlna-g-values-private.h | 38 ++++++++++++++++++++
.../native/sets/gupnp-dlna-native-sets-private.h | 9 +----
.../native/sets/gupnp-dlna-native-value-type.c | 24 ++++++------
4 files changed, 54 insertions(+), 20 deletions(-)
---
diff --git a/libgupnp-dlna/Makefile.am b/libgupnp-dlna/Makefile.am
index 2e6d3b8..703f40c 100644
--- a/libgupnp-dlna/Makefile.am
+++ b/libgupnp-dlna/Makefile.am
@@ -150,7 +150,8 @@ dist_noinst_HEADERS += \
gupnp-dlna-profile-loader.h \
gupnp-dlna-profile-guesser-impl.h \
gupnp-dlna-restriction-private.h \
- gupnp-dlna-value-list-private.h
+ gupnp-dlna-value-list-private.h \
+ gupnp-dlna-g-values-private.h
# INTROSPECTION
diff --git a/libgupnp-dlna/gupnp-dlna-g-values-private.h b/libgupnp-dlna/gupnp-dlna-g-values-private.h
new file mode 100644
index 0000000..9963719
--- /dev/null
+++ b/libgupnp-dlna/gupnp-dlna-g-values-private.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Authors: Krzesimir Nowak <krnowak openismus com>
+ *
+ * This library 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.
+ *
+ * This library 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 this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GUPNP_DLNA_G_VALUES_PRIVATE_H__
+#define __GUPNP_DLNA_G_VALUES_PRIVATE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+struct _GUPnPDLNAFraction
+{
+ gint numerator;
+ gint denominator;
+};
+
+G_END_DECLS
+
+#endif /* __GUPNP_DLNA_G_VALUES_PRIVATE_H__ */
diff --git a/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-sets-private.h b/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-sets-private.h
index b858bb0..5d9a1ad 100644
--- a/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-sets-private.h
+++ b/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-sets-private.h
@@ -25,6 +25,7 @@
#include <glib.h>
#include "gupnp-dlna-native-value-type.h"
#include "gupnp-dlna-value-list-private.h"
+#include "gupnp-dlna-g-values-private.h"
#include "gupnp-dlna-native-info-value.h"
#include "gupnp-dlna-restriction-private.h"
@@ -32,16 +33,10 @@ G_BEGIN_DECLS
/* private */
typedef union _GUPnPDLNANativeValueUnion GUPnPDLNANativeValueUnion;
-typedef struct _GUPnPDLNANativeFraction GUPnPDLNANativeFraction;
-
-struct _GUPnPDLNANativeFraction {
- gint numerator;
- gint denominator;
-};
union _GUPnPDLNANativeValueUnion {
gboolean bool_value;
- GUPnPDLNANativeFraction fraction_value;
+ GUPnPDLNAFraction fraction_value;
gint int_value;
gchar *string_value;
};
diff --git a/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-value-type.c b/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-value-type.c
index e301d89..8cbd281 100644
--- a/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-value-type.c
+++ b/libgupnp-dlna/profile-backends/native/sets/gupnp-dlna-native-value-type.c
@@ -88,8 +88,8 @@ get_int (const gchar *raw,
/* TODO: replace it with better implementation */
static void
-equalize_denominators (GUPnPDLNANativeFraction *first,
- GUPnPDLNANativeFraction *second)
+equalize_denominators (GUPnPDLNAFraction *first,
+ GUPnPDLNAFraction *second)
{
gint common;
@@ -104,8 +104,8 @@ equalize_denominators (GUPnPDLNANativeFraction *first,
}
static gboolean
-fraction_equal (GUPnPDLNANativeFraction first,
- GUPnPDLNANativeFraction second)
+fraction_equal (GUPnPDLNAFraction first,
+ GUPnPDLNAFraction second)
{
equalize_denominators (&first, &second);
@@ -113,11 +113,11 @@ fraction_equal (GUPnPDLNANativeFraction first,
}
static gboolean
-fraction_in_range (GUPnPDLNANativeFraction min,
- GUPnPDLNANativeFraction max,
- GUPnPDLNANativeFraction value)
+fraction_in_range (GUPnPDLNAFraction min,
+ GUPnPDLNAFraction max,
+ GUPnPDLNAFraction value)
{
- GUPnPDLNANativeFraction value_dup = value;
+ GUPnPDLNAFraction value_dup = value;
equalize_denominators (&min, &value);
if (min.numerator > value.numerator)
@@ -142,8 +142,8 @@ int_comparison (gint a,
}
static gint
-fraction_comparison (GUPnPDLNANativeFraction a,
- GUPnPDLNANativeFraction b)
+fraction_comparison (GUPnPDLNAFraction a,
+ GUPnPDLNAFraction b)
{
equalize_denominators (&a, &b);
@@ -151,8 +151,8 @@ fraction_comparison (GUPnPDLNANativeFraction a,
}
static gboolean
-fraction_range_valid (GUPnPDLNANativeFraction min,
- GUPnPDLNANativeFraction max)
+fraction_range_valid (GUPnPDLNAFraction min,
+ GUPnPDLNAFraction max)
{
equalize_denominators (&min, &max);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]