summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2008-10-07 18:57:22 +0000
committerChristophe Fergeau <teuf@gnome.org>2008-10-07 18:57:22 +0000
commit5c45b2fde79cec6276708e7068017e55d9c0ff67 (patch)
tree5ea5c13030f0a52e2b2207891a48336e2886f82a
parent51a1f6b442aa07a6d4deb5312331bf1866d43c94 (diff)
downloadlibgpod-tmz-5c45b2fde79cec6276708e7068017e55d9c0ff67.tar.gz
libgpod-tmz-5c45b2fde79cec6276708e7068017e55d9c0ff67.tar.xz
libgpod-tmz-5c45b2fde79cec6276708e7068017e55d9c0ff67.zip
Adjust SysInfoExtended parsing to the plist parser changes
The type of the parsed data for <array> nodes have changed in the plist parser, it's now a GValueArray, the SysInfoExtended parser has to take that into account since the description of the various artwork formats is stored in an <array> element. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2137 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog6
-rw-r--r--src/itdb_sysinfo_extended_parser.c24
2 files changed, 17 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 32159f8..1c52c11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-10-07 Christophe Fergeau <teuf@gnome.org>
+ * src/itdb_sysinfoextended_parser.c: artwork is stored in <array>
+ nodes (which are parsed to a GValueArray), reflect that in the
+ SysInfoExtended parsing code.
+
+2008-10-07 Christophe Fergeau <teuf@gnome.org>
+
* src/itdb_plist.c: fix handling on blank nodes (ie nodes
containing only white spaces), fixes parsing of SysInfoExtended files
as well ;)
diff --git a/src/itdb_sysinfo_extended_parser.c b/src/itdb_sysinfo_extended_parser.c
index a402eef..c00a868 100644
--- a/src/itdb_sysinfo_extended_parser.c
+++ b/src/itdb_sysinfo_extended_parser.c
@@ -450,31 +450,29 @@ static Itdb_ArtworkFormat *g_value_to_image_format (GValue *value)
return img_spec;
}
-static void process_one (gpointer key, gpointer value, gpointer user_data)
-{
- GList **img_formats = user_data;
- Itdb_ArtworkFormat *format;
-
- format = g_value_to_image_format (value);
- if (format != NULL) {
- *img_formats = g_list_prepend (*img_formats, format);
- }
-}
-
static GList *parse_one_formats_list (GHashTable *sysinfo_dict,
const char *key)
{
GValue *to_parse;
GList *formats = NULL;
+ GValueArray *array;
+ gint i;
to_parse = g_hash_table_lookup (sysinfo_dict, key);
if (to_parse == NULL) {
return NULL;
}
- if (!G_VALUE_HOLDS (to_parse, G_TYPE_HASH_TABLE)) {
+ if (!G_VALUE_HOLDS (to_parse, G_TYPE_VALUE_ARRAY)) {
return NULL;
}
- g_hash_table_foreach (g_value_get_boxed (to_parse), process_one, &formats);
+ array = (GValueArray*)g_value_get_boxed (to_parse);
+ for (i = 0; i < array->n_values; i++) {
+ Itdb_ArtworkFormat *format;
+ format = g_value_to_image_format (g_value_array_get_nth (array, i));
+ if (format != NULL) {
+ formats = g_list_prepend (formats, format);
+ }
+ }
g_hash_table_remove (sysinfo_dict, key);
return formats;
}