# HG changeset patch # User nadvornik # Date 1230072177 0 # Node ID a0c249bcc4ff8a6f52ca4917b25fea78d4952db1 # Parent 86fcbd0fcb7b9c0d238001e30a28d54d31718bce allow writing of empty keywords/comment diff -r 86fcbd0fcb7b -r a0c249bcc4ff src/bar_info.c --- a/src/bar_info.c Tue Dec 23 20:53:44 2008 +0000 +++ b/src/bar_info.c Tue Dec 23 22:42:57 2008 +0000 @@ -403,7 +403,7 @@ list = keyword_list_pull(bd->keyword_view); comment = comment_pull(bd->comment_view); - metadata_write(bd->fd, list, comment); + metadata_write(bd->fd, &list, &comment); string_list_free(list); g_free(comment); diff -r 86fcbd0fcb7b -r a0c249bcc4ff src/metadata.c --- a/src/metadata.c Tue Dec 23 20:53:44 2008 +0000 +++ b/src/metadata.c Tue Dec 23 22:42:57 2008 +0000 @@ -586,15 +586,15 @@ return (comment && *comment) || (keywords && *keywords); } -gint metadata_write(FileData *fd, GList *keywords, const gchar *comment) +gint metadata_write(FileData *fd, GList **keywords, gchar **comment) { gint success = TRUE; - gint write_comment = (comment && comment[0]); + gint write_comment = (comment && *comment); if (!fd) return FALSE; - if (write_comment) success = success && metadata_write_string(fd, COMMENT_KEY, comment); - if (keywords) success = success && metadata_write_list(fd, KEYWORD_KEY, string_list_copy(keywords)); + if (write_comment) success = success && metadata_write_string(fd, COMMENT_KEY, *comment); + if (keywords) success = success && metadata_write_list(fd, KEYWORD_KEY, string_list_copy(*keywords)); if (options->metadata.sync_grouped_files) { @@ -607,8 +607,8 @@ if (filter_file_class(sfd->extension, FORMAT_CLASS_META)) continue; - if (write_comment) success = success && metadata_write_string(sfd, COMMENT_KEY, comment); - if (keywords) success = success && metadata_write_list(sfd, KEYWORD_KEY, string_list_copy(keywords)); + if (write_comment) success = success && metadata_write_string(sfd, COMMENT_KEY, *comment); + if (keywords) success = success && metadata_write_list(sfd, KEYWORD_KEY, string_list_copy(*keywords)); } } @@ -730,7 +730,7 @@ } } - metadata_write(fd, keywords_list, comment); + metadata_write(fd, &keywords_list, &comment); string_list_free(keywords); g_free(comment); diff -r 86fcbd0fcb7b -r a0c249bcc4ff src/metadata.h --- a/src/metadata.h Tue Dec 23 20:53:44 2008 +0000 +++ b/src/metadata.h Tue Dec 23 22:42:57 2008 +0000 @@ -20,7 +20,7 @@ -gint metadata_write(FileData *fd, GList *keywords, const gchar *comment); +gint metadata_write(FileData *fd, GList **keywords, gchar **comment); gint metadata_read(FileData *fd, GList **keywords, gchar **comment);