Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
a40246d3
Commit
a40246d3
authored
Oct 26, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TagFile: use Path instead of const char *
parent
4a5aad09
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
52 additions
and
32 deletions
+52
-32
DecoderThread.cxx
src/DecoderThread.cxx
+1
-1
SongUpdate.cxx
src/SongUpdate.cxx
+3
-3
TagFile.cxx
src/TagFile.cxx
+7
-5
TagFile.hxx
src/TagFile.hxx
+2
-1
FileCommands.cxx
src/command/FileCommands.cxx
+1
-1
EmbeddedCuePlaylistPlugin.cxx
src/playlist/EmbeddedCuePlaylistPlugin.cxx
+8
-3
ApeLoader.cxx
src/tag/ApeLoader.cxx
+3
-4
ApeLoader.hxx
src/tag/ApeLoader.hxx
+3
-1
ApeReplayGain.cxx
src/tag/ApeReplayGain.cxx
+2
-1
ApeReplayGain.hxx
src/tag/ApeReplayGain.hxx
+2
-1
ApeTag.cxx
src/tag/ApeTag.cxx
+2
-1
ApeTag.hxx
src/tag/ApeTag.hxx
+2
-1
TagId3.cxx
src/tag/TagId3.cxx
+5
-3
TagId3.hxx
src/tag/TagId3.hxx
+6
-3
dump_rva2.cxx
test/dump_rva2.cxx
+2
-1
read_tags.cxx
test/read_tags.cxx
+3
-2
No files found.
src/DecoderThread.cxx
View file @
a40246d3
...
...
@@ -275,7 +275,7 @@ static void
decoder_load_replay_gain
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
ReplayGainInfo
info
;
if
(
replay_gain_ape_read
(
path_fs
,
info
))
if
(
replay_gain_ape_read
(
Path
::
FromFS
(
path_fs
)
,
info
))
decoder_replay_gain
(
decoder
,
&
info
);
}
...
...
src/SongUpdate.cxx
View file @
a40246d3
...
...
@@ -73,7 +73,7 @@ Song::LoadFile(const char *path_utf8, Directory *parent)
* Attempts to load APE or ID3 tags from the specified file.
*/
static
bool
tag_scan_fallback
(
const
char
*
path
,
tag_scan_fallback
(
Path
path
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
return
tag_ape_scan2
(
path
,
handler
,
handler_ctx
)
||
...
...
@@ -94,13 +94,13 @@ Song::UpdateFile()
return
false
;
TagBuilder
tag_builder
;
if
(
!
tag_file_scan
(
path_fs
.
c_str
()
,
if
(
!
tag_file_scan
(
path_fs
,
&
full_tag_handler
,
&
tag_builder
)
||
!
tag_builder
.
IsDefined
())
return
false
;
if
(
tag_builder
.
IsEmpty
())
tag_scan_fallback
(
path_fs
.
c_str
()
,
&
full_tag_handler
,
tag_scan_fallback
(
path_fs
,
&
full_tag_handler
,
&
tag_builder
);
mtime
=
st
.
st_mtime
;
...
...
src/TagFile.cxx
View file @
a40246d3
...
...
@@ -19,6 +19,7 @@
#include "config.h"
#include "TagFile.hxx"
#include "fs/Path.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "DecoderList.hxx"
...
...
@@ -29,15 +30,15 @@
#include <assert.h>
bool
tag_file_scan
(
const
char
*
path_fs
,
tag_file_scan
(
Path
path_fs
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
assert
(
path_fs
!=
nullptr
);
assert
(
!
path_fs
.
IsNull
()
);
assert
(
handler
!=
nullptr
);
/* check if there's a suffix and a plugin */
const
char
*
suffix
=
uri_get_suffix
(
path_fs
);
const
char
*
suffix
=
uri_get_suffix
(
path_fs
.
c_str
()
);
if
(
suffix
==
nullptr
)
return
false
;
...
...
@@ -52,7 +53,7 @@ tag_file_scan(const char *path_fs,
do
{
/* load file tag */
if
(
plugin
->
ScanFile
(
path_fs
,
if
(
plugin
->
ScanFile
(
path_fs
.
c_str
()
,
*
handler
,
handler_ctx
))
break
;
...
...
@@ -61,7 +62,8 @@ tag_file_scan(const char *path_fs,
/* open the InputStream (if not already
open) */
if
(
is
==
nullptr
)
is
=
InputStream
::
Open
(
path_fs
,
mutex
,
cond
,
is
=
InputStream
::
Open
(
path_fs
.
c_str
(),
mutex
,
cond
,
IgnoreError
());
/* now try the stream_tag() method */
...
...
src/TagFile.hxx
View file @
a40246d3
...
...
@@ -22,6 +22,7 @@
#include "check.h"
class
Path
;
struct
tag_handler
;
/**
...
...
@@ -29,7 +30,7 @@ struct tag_handler;
* but does not invoke the special "APE" and "ID3" scanners.
*/
bool
tag_file_scan
(
const
char
*
path_fs
,
tag_file_scan
(
Path
path
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
);
#endif
src/command/FileCommands.cxx
View file @
a40246d3
...
...
@@ -112,7 +112,7 @@ handle_read_comments(Client &client, gcc_unused int argc, char *argv[])
return
CommandResult
::
ERROR
;
}
if
(
!
tag_file_scan
(
path_fs
.
c_str
()
,
&
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
;
...
...
src/playlist/EmbeddedCuePlaylistPlugin.cxx
View file @
a40246d3
...
...
@@ -35,6 +35,7 @@
#include "TagFile.hxx"
#include "cue/CueParser.hxx"
#include "fs/Traits.hxx"
#include "fs/AllocatedPath.hxx"
#include "util/ASCII.hxx"
#include <assert.h>
...
...
@@ -98,13 +99,17 @@ embcue_playlist_open_uri(const char *uri,
/* only local files supported */
return
NULL
;
const
auto
path_fs
=
AllocatedPath
::
FromUTF8
(
uri
);
if
(
path_fs
.
IsNull
())
return
nullptr
;
const
auto
playlist
=
new
EmbeddedCuePlaylist
();
tag_file_scan
(
uri
,
&
embcue_tag_handler
,
playlist
);
tag_file_scan
(
path_fs
,
&
embcue_tag_handler
,
playlist
);
if
(
playlist
->
cuesheet
.
empty
())
{
tag_ape_scan2
(
uri
,
&
embcue_tag_handler
,
playlist
);
tag_ape_scan2
(
path_fs
,
&
embcue_tag_handler
,
playlist
);
if
(
playlist
->
cuesheet
.
empty
())
tag_id3_scan
(
uri
,
&
embcue_tag_handler
,
playlist
);
tag_id3_scan
(
path_fs
,
&
embcue_tag_handler
,
playlist
);
}
if
(
playlist
->
cuesheet
.
empty
())
{
...
...
src/tag/ApeLoader.cxx
View file @
a40246d3
...
...
@@ -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
;
...
...
src/tag/ApeLoader.hxx
View file @
a40246d3
...
...
@@ -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
src/tag/ApeReplayGain.cxx
View file @
a40246d3
...
...
@@ -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
;
...
...
src/tag/ApeReplayGain.hxx
View file @
a40246d3
...
...
@@ -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
src/tag/ApeTag.cxx
View file @
a40246d3
...
...
@@ -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
;
...
...
src/tag/ApeTag.hxx
View file @
a40246d3
...
...
@@ -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
src/tag/TagId3.cxx
View file @
a40246d3
...
...
@@ -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
=
fo
pen
(
path_fs
,
"rb"
);
FILE
*
file
=
FO
pen
(
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
;
...
...
src/tag/TagId3.hxx
View file @
a40246d3
...
...
@@ -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
)
{
...
...
test/dump_rva2.cxx
View file @
a40246d3
...
...
@@ -23,6 +23,7 @@
#include "ReplayGainInfo.hxx"
#include "ConfigGlobal.hxx"
#include "util/Error.hxx"
#include "fs/Path.hxx"
#include <id3tag.h>
...
...
@@ -56,7 +57,7 @@ int main(int argc, char **argv)
const
char
*
path
=
argv
[
1
];
Error
error
;
struct
id3_tag
*
tag
=
tag_id3_load
(
path
,
error
);
struct
id3_tag
*
tag
=
tag_id3_load
(
Path
::
FromFS
(
path
)
,
error
);
if
(
tag
==
NULL
)
{
if
(
error
.
IsDefined
())
g_printerr
(
"%s
\n
"
,
error
.
GetMessage
());
...
...
test/read_tags.cxx
View file @
a40246d3
...
...
@@ -28,6 +28,7 @@
#include "tag/TagId3.hxx"
#include "tag/ApeTag.hxx"
#include "util/Error.hxx"
#include "fs/Path.hxx"
#include "thread/Cond.hxx"
#include "Log.hxx"
...
...
@@ -221,9 +222,9 @@ int main(int argc, char **argv)
}
if
(
empty
)
{
tag_ape_scan2
(
path
,
&
print_handler
,
NULL
);
tag_ape_scan2
(
Path
::
FromFS
(
path
)
,
&
print_handler
,
NULL
);
if
(
empty
)
tag_id3_scan
(
path
,
&
print_handler
,
NULL
);
tag_id3_scan
(
Path
::
FromFS
(
path
)
,
&
print_handler
,
NULL
);
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment