diff options
author | Martyn Russell <martyn@lanedo.com> | 2014-10-17 11:16:50 +0100 |
---|---|---|
committer | Martyn Russell <martyn@lanedo.com> | 2014-10-17 11:24:40 +0100 |
commit | dd0391d0a37c387a13dacca7d6f89da9b2924b9b (patch) | |
tree | 79ee72796ed725e9b23a6e6b01c15f76844c4e8f /libmediaart/cache.c | |
parent | e3daca5cacdf5b91212fccb05ccfa87b03e30b8b (diff) | |
download | libmediaart-dd0391d0a37c387a13dacca7d6f89da9b2924b9b.tar.gz |
cache: Fix checks for output variablesremove-mediaartlocal-rebased-on-async-api
Diffstat (limited to 'libmediaart/cache.c')
-rw-r--r-- | libmediaart/cache.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/libmediaart/cache.c b/libmediaart/cache.c index ecbc7a1..fb737e8 100644 --- a/libmediaart/cache.c +++ b/libmediaart/cache.c @@ -284,16 +284,14 @@ media_art_get_file (const gchar *artist, /* http://live.gnome.org/MediaArtStorageSpec */ - if (cache_file) { - *cache_file = NULL; - } - /* Rules: * 1. artist OR title must be non-NULL. * 2. cache_file must be non-NULL */ g_return_val_if_fail (artist != NULL || title != NULL, FALSE); - g_return_val_if_fail (!G_IS_FILE (cache_file), FALSE); + g_return_val_if_fail (cache_file != NULL, FALSE); + + *cache_file = NULL; if (artist) { artist_stripped = media_art_strip_invalid_entities (artist); @@ -341,11 +339,9 @@ media_art_get_file (const gchar *artist, g_free (title_norm); } - if (cache_file) { - filename = g_build_filename (dir, art_filename, NULL); - *cache_file = g_file_new_for_path (filename); - g_free (filename); - } + filename = g_build_filename (dir, art_filename, NULL); + *cache_file = g_file_new_for_path (filename); + g_free (filename); g_free (dir); g_free (art_filename); @@ -380,6 +376,7 @@ media_art_get_path (const gchar *artist, gchar **cache_path) { GFile *cache_file = NULL; + gboolean success; /* Rules: * 1. artist OR title must be non-NULL. @@ -388,12 +385,10 @@ media_art_get_path (const gchar *artist, g_return_val_if_fail (artist != NULL || title != NULL, FALSE); g_return_val_if_fail (cache_path != NULL, FALSE); - media_art_get_file (artist, title, prefix, cache_path ? &cache_file : NULL); - if (cache_path) { - *cache_path = cache_file ? g_file_get_path (cache_file) : NULL; - } + success = media_art_get_file (artist, title, prefix, &cache_file); + *cache_path = cache_file ? g_file_get_path (cache_file) : NULL; - return TRUE; + return success; } /** |