summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2008-07-29 20:10:13 +0000
committerChristophe Fergeau <teuf@gnome.org>2008-07-29 20:10:13 +0000
commit3d4dcd608dedba63d189cd70261361666acf1395 (patch)
treec4fbfa3215eb1377e1f70ff10296ab1dea5b9c88
parent41157543e001f922623bbf3627c1cf142cb243f5 (diff)
downloadlibgpod-3d4dcd608dedba63d189cd70261361666acf1395.tar.gz
libgpod-3d4dcd608dedba63d189cd70261361666acf1395.tar.xz
libgpod-3d4dcd608dedba63d189cd70261361666acf1395.zip
Use GError in SysInfoExtended parsing
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2067 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog10
-rw-r--r--src/itdb_device.c2
-rw-r--r--src/itdb_sysinfo_extended_parser.c6
-rw-r--r--src/itdb_sysinfo_extended_parser.h3
-rw-r--r--tests/test-sysinfo-extended-parsing.c6
5 files changed, 20 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index daf79aa..08ba91f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2008-07-27 Christophe Fergeau <teuf@gnome.org>
+ * src/itdb_sysinfo_extended_parser.c:
+ * src/itdb_sysinfo_extended_parser.h: add a GError argument to
+ SysInfoExtended parsing functions
+ * src/itdb_device.c: pass NULL GError argument to call to
+ SysInfoExtended functions
+ * tests/test-sysinfo-extended.c: add a GError argument when calling
+ SysInfoExtended parsing functions
+
+2008-07-27 Christophe Fergeau <teuf@gnome.org>
+
* src/itdb_device.c: add itdb_device_error_quark()
* src/itdb_plist.h:
* src/itdb_plist.c: add error handling to XML parsing (using
diff --git a/src/itdb_device.c b/src/itdb_device.c
index 7d7819c..61db852 100644
--- a/src/itdb_device.c
+++ b/src/itdb_device.c
@@ -642,7 +642,7 @@ static void itdb_device_read_sysinfo_extended (Itdb_Device *device)
sysinfo_ex_path = itdb_resolve_path (dev_path, p_sysinfo_ex);
g_free (dev_path);
if (!sysinfo_ex_path) return;
- device->sysinfo_extended = itdb_sysinfo_extended_parse (sysinfo_ex_path);
+ device->sysinfo_extended = itdb_sysinfo_extended_parse (sysinfo_ex_path, NULL);
g_free (sysinfo_ex_path);
if ((device->sysinfo != NULL) && (device->sysinfo_extended != NULL)) {
diff --git a/src/itdb_sysinfo_extended_parser.c b/src/itdb_sysinfo_extended_parser.c
index 324e42d..18b194a 100644
--- a/src/itdb_sysinfo_extended_parser.c
+++ b/src/itdb_sysinfo_extended_parser.c
@@ -460,6 +460,7 @@ static void process_one (gpointer key, gpointer value, gpointer user_data)
*img_formats = g_list_prepend (*img_formats, format);
}
}
+
static GList *parse_one_formats_list (GHashTable *sysinfo_dict,
const char *key)
{
@@ -500,14 +501,15 @@ static SysInfoIpodProperties *g_value_to_ipod_properties (GValue *value)
return props;
}
-SysInfoIpodProperties *itdb_sysinfo_extended_parse (const char *filename)
+SysInfoIpodProperties *itdb_sysinfo_extended_parse (const char *filename,
+ GError **error)
{
GValue *parsed_doc;
SysInfoIpodProperties *props;
g_return_val_if_fail (filename != NULL, NULL);
- parsed_doc = itdb_plist_parse_from_file (filename, NULL);
+ parsed_doc = itdb_plist_parse_from_file (filename, error);
if (parsed_doc == NULL) {
return NULL;
}
diff --git a/src/itdb_sysinfo_extended_parser.h b/src/itdb_sysinfo_extended_parser.h
index 221e0e8..a58fa4f 100644
--- a/src/itdb_sysinfo_extended_parser.h
+++ b/src/itdb_sysinfo_extended_parser.h
@@ -35,7 +35,8 @@ G_BEGIN_DECLS
typedef struct _SysInfoIpodProperties SysInfoIpodProperties;
void itdb_sysinfo_properties_dump (SysInfoIpodProperties *props);
-SysInfoIpodProperties *itdb_sysinfo_extended_parse (const char *filename);
+SysInfoIpodProperties *itdb_sysinfo_extended_parse (const char *filename,
+ GError **error);
void itdb_sysinfo_properties_free (SysInfoIpodProperties *props);
const char *
diff --git a/tests/test-sysinfo-extended-parsing.c b/tests/test-sysinfo-extended-parsing.c
index 86731d1..3c99f99 100644
--- a/tests/test-sysinfo-extended-parsing.c
+++ b/tests/test-sysinfo-extended-parsing.c
@@ -6,14 +6,14 @@
int main (int argc, char **argv)
{
SysInfoIpodProperties *props;
-
+ GError *error = NULL;
if (argc != 2)
return(1);
g_type_init ();
- props = itdb_sysinfo_extended_parse (argv[1]);
+ props = itdb_sysinfo_extended_parse (argv[1], &error);
if (props == NULL) {
- g_print ("Couldn't parse %s\n", argv[1]);
+ g_print ("Couldn't parse %s: %s\n", argv[1], error->message);
}
itdb_sysinfo_properties_dump (props);
itdb_sysinfo_properties_free (props);