From 9be82891b01ba2190a97032a2f84b70151bc2358 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 16:16:04 +0100 Subject: TagFile: pass reference instead of pointer --- src/SongUpdate.cxx | 2 +- src/TagFile.cxx | 6 ++---- src/TagFile.hxx | 3 +-- src/command/FileCommands.cxx | 2 +- src/playlist/EmbeddedCuePlaylistPlugin.cxx | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx index 6e5e37a2b..377b2fb7c 100644 --- a/src/SongUpdate.cxx +++ b/src/SongUpdate.cxx @@ -89,7 +89,7 @@ Song::UpdateFile() TagBuilder tag_builder; if (!tag_file_scan(path_fs, - &full_tag_handler, &tag_builder)) + full_tag_handler, &tag_builder)) return false; if (tag_builder.IsEmpty()) diff --git a/src/TagFile.cxx b/src/TagFile.cxx index a2bc9de0a..dc0aa6b64 100644 --- a/src/TagFile.cxx +++ b/src/TagFile.cxx @@ -80,11 +80,9 @@ public: }; bool -tag_file_scan(Path path_fs, - const struct tag_handler *handler, void *handler_ctx) +tag_file_scan(Path path_fs, const tag_handler &handler, void *handler_ctx) { assert(!path_fs.IsNull()); - assert(handler != nullptr); /* check if there's a suffix and a plugin */ @@ -92,7 +90,7 @@ tag_file_scan(Path path_fs, if (suffix == nullptr) return false; - TagFileScan tfs(path_fs, suffix, *handler, handler_ctx); + TagFileScan tfs(path_fs, suffix, handler, handler_ctx); return decoder_plugins_try([&](const DecoderPlugin &plugin){ return tfs.Scan(plugin); }); diff --git a/src/TagFile.hxx b/src/TagFile.hxx index d1dbb3e46..84ac6c259 100644 --- a/src/TagFile.hxx +++ b/src/TagFile.hxx @@ -33,7 +33,6 @@ struct tag_handler; * found) */ bool -tag_file_scan(Path path, - const tag_handler *handler, void *handler_ctx); +tag_file_scan(Path path, const tag_handler &handler, void *handler_ctx); #endif diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index eecc3102f..48037bc72 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -114,7 +114,7 @@ handle_read_comments(Client &client, gcc_unused int argc, char *argv[]) return CommandResult::ERROR; } - if (!tag_file_scan(path_fs, &print_comment_handler, &client)) { + if (!tag_file_scan(path_fs, print_comment_handler, &client)) { command_error(client, ACK_ERROR_NO_EXIST, "Failed to load file"); return CommandResult::ERROR; diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx index 96d83b968..9dfecbf46 100644 --- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx +++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx @@ -103,7 +103,7 @@ embcue_playlist_open_uri(const char *uri, const auto playlist = new EmbeddedCuePlaylist(); - tag_file_scan(path_fs, &embcue_tag_handler, playlist); + tag_file_scan(path_fs, embcue_tag_handler, playlist); if (playlist->cuesheet.empty()) { tag_ape_scan2(path_fs, &embcue_tag_handler, playlist); if (playlist->cuesheet.empty()) -- cgit v1.2.3