From d450e55668709b19ecb9e613dd69c3a8a021bb1f Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 18 Jul 2009 16:39:42 +0200 Subject: [PATCH] Interprete metadata integer value of -1 as unset also when setting --- katze/katze-item.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/katze/katze-item.c b/katze/katze-item.c index 30813cfa..d96490cb 100644 --- a/katze/katze-item.c +++ b/katze/katze-item.c @@ -574,6 +574,8 @@ katze_item_get_meta_integer (KatzeItem* item, * Saves the specified integer value in the meta data of * the item under the specified key. * + * A value of -1 is intepreted as unset. + * * Since: 0.1.8 **/ void @@ -584,12 +586,17 @@ katze_item_set_meta_integer (KatzeItem* item, g_return_if_fail (KATZE_IS_ITEM (item)); g_return_if_fail (key != NULL); - katze_item_set_meta_data_value (item, key, - #ifdef G_GINT64_FORMAT - g_strdup_printf ("%" G_GINT64_FORMAT, value)); - #else - g_strdup_printf ("%li", value)); - #endif + if (value == -1) + katze_item_set_meta_data_value (item, key, NULL); + else + { + katze_item_set_meta_data_value (item, key, + #ifdef G_GINT64_FORMAT + g_strdup_printf ("%" G_GINT64_FORMAT, value)); + #else + g_strdup_printf ("%li", value)); + #endif + } } /** -- 2.39.5