changeset 1220:a0c249bcc4ff

allow writing of empty keywords/comment
author nadvornik
date Tue, 23 Dec 2008 22:42:57 +0000
parents 86fcbd0fcb7b
children 584eae03d747
files src/bar_info.c src/metadata.c src/metadata.h
diffstat 3 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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);
--- 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);