commit 3fae61944af3c4aa2bce4e94f5699232066f81f0
Author: Christophe Fergeau <t...@gnome.org>
Date:   Tue Jul 19 22:42:51 2011 +0200

    optionally provide g_int64_{hash,equal}
    
    These functions appeared in glib 2.22, but libgpod only depends
    on glib 2.16, so check if these functions are available before
    using them, and provide a fallback implementation if they are not
    available.
    Bug reported by Eric Lassauge

 configure.ac        |   12 ++++++++++++
 src/itdb_itunesdb.c |   14 ++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a6f7c9c..66cc889 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,18 @@ dnl sqlite3 is needed for newer ipod models (nano5g), and 
libplist is needed
 dnl by libgpod sqlite code
 PKG_CHECK_MODULES(LIBGPOD, glib-2.0 >= 2.16.0 gobject-2.0 sqlite3 libplist >= 
1.0 gmodule-2.0)
 
+dnl ***************************************************
+dnl g_gint64_hash and g_gint64_equal are only available
+dnl starting from glib 2.22.
+dnl ***************************************************
+saved_CFLAGS="$CFLAGS"
+saved_LIBS="$LIBS"
+CFLAGS="$LIBGPOD_CFLAGS $CFLAGS"
+LIBS="$LIBGPOD_LIBS $LIBS"
+AC_CHECK_FUNCS([g_int64_hash g_int64_equal])
+CFLAGS="$saved_CFLAGS"
+LIBS="$saved_LIBS"
+
 dnl **************************************************
 dnl * sgutils is necessary to get the xml device file
 dnl * from older ipods
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index 78d087f..34d5b80 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -1132,6 +1132,20 @@ static gint64 playcounts_plist_get_gint64 (GHashTable 
*track_dict,
     return 0;
 }
 
+#ifndef HAVE_G_INT64_EQUAL
+static gboolean g_int64_equal (gconstpointer v1, gconstpointer v2)
+{
+  return *((const gint64*) v1) == *((const gint64*) v2);
+}
+#endif
+
+#ifndef HAVE_G_INT64_HASH
+static guint g_int64_hash (gconstpointer v)
+{
+  return (guint) *(const gint64*) v;
+}
+#endif
+
 /* called by playcounts_init */
 static gboolean playcounts_plist_read (FImport *fimp, GValue *plist_data)
 {

------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to