aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-26 15:14:54 +0200
committerMax Kellermann <max@duempel.org>2013-10-26 15:38:29 +0200
commita40246d3123d4bd0d1be638cd7f7b91274d8f23d (patch)
treed1384fdce2b186c00b4697d5475c97bf4dbc4b41 /src/tag
parent4a5aad0948eb782ec6b74a1f038c0e5635c1bb9b (diff)
downloadmpd-a40246d3123d4bd0d1be638cd7f7b91274d8f23d.tar.gz
mpd-a40246d3123d4bd0d1be638cd7f7b91274d8f23d.tar.xz
mpd-a40246d3123d4bd0d1be638cd7f7b91274d8f23d.zip
TagFile: use Path instead of const char *
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/ApeLoader.cxx7
-rw-r--r--src/tag/ApeLoader.hxx4
-rw-r--r--src/tag/ApeReplayGain.cxx3
-rw-r--r--src/tag/ApeReplayGain.hxx3
-rw-r--r--src/tag/ApeTag.cxx3
-rw-r--r--src/tag/ApeTag.hxx3
-rw-r--r--src/tag/TagId3.cxx8
-rw-r--r--src/tag/TagId3.hxx9
8 files changed, 25 insertions, 15 deletions
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 <glib.h>
@@ -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 <stddef.h>
+class Path;
+
typedef std::function<bool(unsigned long flags, const char *key,
const char *value,
size_t value_length)> ApeTagCallback;
@@ -38,6 +40,6 @@ typedef std::function<bool(unsigned long flags, const char *key,
* present
*/
bool
-tag_ape_scan(const char *path_fs, ApeTagCallback callback);
+tag_ape_scan(Path path_fs, ApeTagCallback callback);
#endif
diff --git a/src/tag/ApeReplayGain.cxx b/src/tag/ApeReplayGain.cxx
index 12919690e..cc65fb79d 100644
--- a/src/tag/ApeReplayGain.cxx
+++ b/src/tag/ApeReplayGain.cxx
@@ -22,6 +22,7 @@
#include "ApeLoader.hxx"
#include "ReplayGainInfo.hxx"
#include "util/ASCII.hxx"
+#include "fs/Path.hxx"
#include <string.h>
#include <stdlib.h>
@@ -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 <string>
@@ -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 <glib.h>
#include <id3tag.h>
@@ -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)
{