From a40246d3123d4bd0d1be638cd7f7b91274d8f23d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 26 Oct 2013 15:14:54 +0200 Subject: TagFile: use Path instead of const char * --- src/tag/ApeLoader.cxx | 7 +++---- src/tag/ApeLoader.hxx | 4 +++- src/tag/ApeReplayGain.cxx | 3 ++- src/tag/ApeReplayGain.hxx | 3 ++- src/tag/ApeTag.cxx | 3 ++- src/tag/ApeTag.hxx | 3 ++- src/tag/TagId3.cxx | 8 +++++--- src/tag/TagId3.hxx | 9 ++++++--- 8 files changed, 25 insertions(+), 15 deletions(-) (limited to 'src/tag') diff --git a/src/tag/ApeLoader.cxx b/src/tag/ApeLoader.cxx index 19f4d06d4..8251efe10 100644 --- a/src/tag/ApeLoader.cxx +++ b/src/tag/ApeLoader.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "ApeLoader.hxx" #include "system/ByteOrder.hxx" +#include "fs/FileSystem.hxx" #include @@ -102,11 +103,9 @@ ape_scan_internal(FILE *fp, ApeTagCallback callback) } bool -tag_ape_scan(const char *path_fs, ApeTagCallback callback) +tag_ape_scan(Path path_fs, ApeTagCallback callback) { - FILE *fp; - - fp = fopen(path_fs, "rb"); + FILE *fp = FOpen(path_fs, "rb"); if (fp == nullptr) return false; diff --git a/src/tag/ApeLoader.hxx b/src/tag/ApeLoader.hxx index a32ab840c..915c363b4 100644 --- a/src/tag/ApeLoader.hxx +++ b/src/tag/ApeLoader.hxx @@ -26,6 +26,8 @@ #include +class Path; + typedef std::function ApeTagCallback; @@ -38,6 +40,6 @@ typedef std::function #include @@ -59,7 +60,7 @@ replay_gain_ape_callback(unsigned long flags, const char *key, } bool -replay_gain_ape_read(const char *path_fs, ReplayGainInfo &info) +replay_gain_ape_read(Path path_fs, ReplayGainInfo &info) { bool found = false; diff --git a/src/tag/ApeReplayGain.hxx b/src/tag/ApeReplayGain.hxx index f40523550..865add6f1 100644 --- a/src/tag/ApeReplayGain.hxx +++ b/src/tag/ApeReplayGain.hxx @@ -22,9 +22,10 @@ #include "check.h" +class Path; struct ReplayGainInfo; bool -replay_gain_ape_read(const char *path_fs, ReplayGainInfo &info); +replay_gain_ape_read(Path path_fs, ReplayGainInfo &info); #endif diff --git a/src/tag/ApeTag.cxx b/src/tag/ApeTag.cxx index fa2e744c4..1ba645369 100644 --- a/src/tag/ApeTag.cxx +++ b/src/tag/ApeTag.cxx @@ -23,6 +23,7 @@ #include "Tag.hxx" #include "TagTable.hxx" #include "TagHandler.hxx" +#include "fs/Path.hxx" #include @@ -88,7 +89,7 @@ tag_ape_import_item(unsigned long flags, } bool -tag_ape_scan2(const char *path_fs, +tag_ape_scan2(Path path_fs, const struct tag_handler *handler, void *handler_ctx) { bool recognized = false; diff --git a/src/tag/ApeTag.hxx b/src/tag/ApeTag.hxx index 1a7143314..e35edc381 100644 --- a/src/tag/ApeTag.hxx +++ b/src/tag/ApeTag.hxx @@ -22,6 +22,7 @@ #include "TagTable.hxx" +class Path; struct tag_handler; extern const struct tag_table ape_tags[]; @@ -32,7 +33,7 @@ extern const struct tag_table ape_tags[]; * @param path_fs the path of the file in filesystem encoding */ bool -tag_ape_scan2(const char *path_fs, +tag_ape_scan2(Path path_fs, const struct tag_handler *handler, void *handler_ctx); #endif diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx index 63df529d3..df70a95e5 100644 --- a/src/tag/TagId3.cxx +++ b/src/tag/TagId3.cxx @@ -29,6 +29,8 @@ #include "ConfigGlobal.hxx" #include "Riff.hxx" #include "Aiff.hxx" +#include "fs/Path.hxx" +#include "fs/FileSystem.hxx" #include #include @@ -539,9 +541,9 @@ tag_id3_riff_aiff_load(FILE *file) } struct id3_tag * -tag_id3_load(const char *path_fs, Error &error) +tag_id3_load(Path path_fs, Error &error) { - FILE *file = fopen(path_fs, "rb"); + FILE *file = FOpen(path_fs, "rb"); if (file == nullptr) { error.FormatErrno("Failed to open file %s", path_fs); return nullptr; @@ -559,7 +561,7 @@ tag_id3_load(const char *path_fs, Error &error) } bool -tag_id3_scan(const char *path_fs, +tag_id3_scan(Path path_fs, const struct tag_handler *handler, void *handler_ctx) { Error error; diff --git a/src/tag/TagId3.hxx b/src/tag/TagId3.hxx index e453ffb55..44d890337 100644 --- a/src/tag/TagId3.hxx +++ b/src/tag/TagId3.hxx @@ -23,6 +23,7 @@ #include "check.h" #include "Compiler.h" +class Path; struct tag_handler; struct Tag; struct id3_tag; @@ -31,7 +32,7 @@ class Error; #ifdef HAVE_ID3TAG bool -tag_id3_scan(const char *path_fs, +tag_id3_scan(Path path_fs, const struct tag_handler *handler, void *handler_ctx); Tag * @@ -45,7 +46,7 @@ tag_id3_import(struct id3_tag *); * Error will be set) */ struct id3_tag * -tag_id3_load(const char *path_fs, Error &error); +tag_id3_load(Path path_fs, Error &error); /** * Import all tags from the provided id3_tag *tag @@ -57,8 +58,10 @@ scan_id3_tag(struct id3_tag *tag, #else +#include "fs/Path.hxx" + static inline bool -tag_id3_scan(gcc_unused const char *path_fs, +tag_id3_scan(gcc_unused Path path_fs, gcc_unused const struct tag_handler *handler, gcc_unused void *handler_ctx) { -- cgit v1.2.3