TagFile: use Path instead of const char *
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user