Skip to content

Commit

Permalink
allow writing of empty keywords/comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Dec 23, 2008
1 parent b077c46 commit 3111499
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/bar_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static void bar_info_write(BarInfoData *bd)
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);
Expand Down
14 changes: 7 additions & 7 deletions src/metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,15 +586,15 @@ static gint metadata_xmp_read(FileData *fd, GList **keywords, gchar **comment)
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)
{
Expand All @@ -607,8 +607,8 @@ gint metadata_write(FileData *fd, GList *keywords, const gchar *comment)

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));
}
}

Expand Down Expand Up @@ -730,7 +730,7 @@ void metadata_set(FileData *fd, GList *new_keywords, gchar *new_comment, gboolea
}
}

metadata_write(fd, keywords_list, comment);
metadata_write(fd, &keywords_list, &comment);

string_list_free(keywords);
g_free(comment);
Expand Down
2 changes: 1 addition & 1 deletion src/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gboolean metadata_write_queue_confirm(void);



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);

Expand Down

0 comments on commit 3111499

Please sign in to comment.