From 3d4dcd608dedba63d189cd70261361666acf1395 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 29 Jul 2008 20:10:13 +0000 Subject: Use GError in SysInfoExtended parsing git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2067 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- ChangeLog | 10 ++++++++++ src/itdb_device.c | 2 +- src/itdb_sysinfo_extended_parser.c | 6 ++++-- src/itdb_sysinfo_extended_parser.h | 3 ++- tests/test-sysinfo-extended-parsing.c | 6 +++--- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index daf79aa..08ba91f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-07-27 Christophe Fergeau + + * 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 * src/itdb_device.c: add itdb_device_error_quark() 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); -- cgit