[easytag] Use the empty string for empty image descriptions



commit 1ebeb8ec5fe62f9ed5564707dc479eb21158001e
Author: David King <amigadave amigadave com>
Date:   Sun Jan 20 22:29:08 2013 +0000

    Use the empty string for empty image descriptions
    
    Passing NULL to the underlying
    FLAC__metadata_object_picture_set_description() is incorrect according
    to the API reference, and has previously caused some downstream bugs:
    https://bugs.launchpad.net/ubuntu/+source/easytag/+bug/558804 and
    https://bugzilla.redhat.com/show_bug.cgi?id=559828

 src/picture.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/picture.c b/src/picture.c
index d730264..81195d6 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -540,14 +540,14 @@ void Picture_Properties_Button_Clicked (GObject *object)
                 Strip_String(buffer);
                 if (pic->description)
                     g_free(pic->description);
-                if ( g_utf8_strlen(buffer, -1) > 0 )
-                {
-                    pic->description = buffer;
-                }else
-                {
-                    pic->description = 0;
-                    g_free(buffer);
-                }
+
+                /* If the entry was empty, buffer will be the empty string "".
+                 * This can be safely passed to the underlying
+                 * FLAC__metadata_object_picture_set_description(). See
+                 * https://bugs.launchpad.net/ubuntu/+source/easytag/+bug/558804
+                 * and https://bugzilla.redhat.com/show_bug.cgi?id=559828 for
+                 * downstream bugs when 0 was passed instead. */
+                pic->description = buffer;
 
                 // Update value in the PictureEntryView
                 pic_info = Picture_Info(pic);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]