Commit 9be82891 authored by Max Kellermann's avatar Max Kellermann

TagFile: pass reference instead of pointer

parent c97685fe
...@@ -89,7 +89,7 @@ Song::UpdateFile() ...@@ -89,7 +89,7 @@ Song::UpdateFile()
TagBuilder tag_builder; TagBuilder tag_builder;
if (!tag_file_scan(path_fs, if (!tag_file_scan(path_fs,
&full_tag_handler, &tag_builder)) full_tag_handler, &tag_builder))
return false; return false;
if (tag_builder.IsEmpty()) if (tag_builder.IsEmpty())
......
...@@ -80,11 +80,9 @@ public: ...@@ -80,11 +80,9 @@ public:
}; };
bool bool
tag_file_scan(Path path_fs, tag_file_scan(Path path_fs, const tag_handler &handler, void *handler_ctx)
const struct tag_handler *handler, void *handler_ctx)
{ {
assert(!path_fs.IsNull()); assert(!path_fs.IsNull());
assert(handler != nullptr);
/* check if there's a suffix and a plugin */ /* check if there's a suffix and a plugin */
...@@ -92,7 +90,7 @@ tag_file_scan(Path path_fs, ...@@ -92,7 +90,7 @@ tag_file_scan(Path path_fs,
if (suffix == nullptr) if (suffix == nullptr)
return false; 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 decoder_plugins_try([&](const DecoderPlugin &plugin){
return tfs.Scan(plugin); return tfs.Scan(plugin);
}); });
......
...@@ -33,7 +33,6 @@ struct tag_handler; ...@@ -33,7 +33,6 @@ struct tag_handler;
* found) * found)
*/ */
bool bool
tag_file_scan(Path path, tag_file_scan(Path path, const tag_handler &handler, void *handler_ctx);
const tag_handler *handler, void *handler_ctx);
#endif #endif
...@@ -114,7 +114,7 @@ handle_read_comments(Client &client, gcc_unused int argc, char *argv[]) ...@@ -114,7 +114,7 @@ handle_read_comments(Client &client, gcc_unused int argc, char *argv[])
return CommandResult::ERROR; 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, command_error(client, ACK_ERROR_NO_EXIST,
"Failed to load file"); "Failed to load file");
return CommandResult::ERROR; return CommandResult::ERROR;
......
...@@ -103,7 +103,7 @@ embcue_playlist_open_uri(const char *uri, ...@@ -103,7 +103,7 @@ embcue_playlist_open_uri(const char *uri,
const auto playlist = new EmbeddedCuePlaylist(); 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()) { if (playlist->cuesheet.empty()) {
tag_ape_scan2(path_fs, &embcue_tag_handler, playlist); tag_ape_scan2(path_fs, &embcue_tag_handler, playlist);
if (playlist->cuesheet.empty()) if (playlist->cuesheet.empty())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment