diff options
author | Martyn Russell <martyn@lanedo.com> | 2014-02-07 16:11:28 +0000 |
---|---|---|
committer | Martyn Russell <martyn@lanedo.com> | 2014-02-07 16:34:09 +0000 |
commit | 4d3a06eb14b302c827b3af97b40c869aba0650be (patch) | |
tree | 067f7569efd278d1f3217098fa79040e17c88090 /libmediaart | |
parent | 12d8d77900295a2c0e856eb71bfc7ed262b9a3b6 (diff) | |
download | libmediaart-4d3a06eb14b302c827b3af97b40c869aba0650be.tar.gz |
cache: Improve _strip_invalid_entites() API
Add more information to documentation.
Add a check on the input string to make sure we avoid crashes.
Add test case
Diffstat (limited to 'libmediaart')
-rw-r--r-- | libmediaart/cache.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libmediaart/cache.c b/libmediaart/cache.c index 774e2cf..2e29bae 100644 --- a/libmediaart/cache.c +++ b/libmediaart/cache.c @@ -94,7 +94,13 @@ media_art_strip_find_next_block (const gchar *original, * This functions is used internally by media_art_get_file() and * media_art_get_path(). You will not normally need to call it yourself. * - * Returns: copy of original but then stripped + * This function provides the following features: + * 1. Invalid characters include: ()[]<>{}_!@#$^&*+=|\/"'?~; + * 2. Text inside brackets of (), {}, [] and <> pairs are removed. + * 3. Multiples of space characters are removed. + * + * Returns: @original stripped of invalid characters which must be + * freed. On error or if @original is empty, %NULL is returned. * * Since: 0.2.0 */ @@ -118,6 +124,8 @@ media_art_strip_invalid_entities (const gchar *original) { 0, 0 } }; + g_return_val_if_fail (original != NULL, NULL); + str_no_blocks = g_string_new (""); p = original; |