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
3e8047e5
Commit
3e8047e5
authored
Jan 02, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Directory: rename struct directory to Directory
parent
440ac51c
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
180 additions
and
184 deletions
+180
-184
DatabaseGlue.cxx
src/DatabaseGlue.cxx
+3
-3
DatabasePrint.cxx
src/DatabasePrint.cxx
+4
-4
DatabaseSave.cxx
src/DatabaseSave.cxx
+2
-2
DatabaseSave.hxx
src/DatabaseSave.hxx
+3
-3
DatabaseSimple.hxx
src/DatabaseSimple.hxx
+3
-3
DatabaseVisitor.hxx
src/DatabaseVisitor.hxx
+3
-3
Directory.cxx
src/Directory.cxx
+34
-34
Directory.hxx
src/Directory.hxx
+20
-20
DirectorySave.cxx
src/DirectorySave.cxx
+7
-7
DirectorySave.hxx
src/DirectorySave.hxx
+3
-3
Mapper.cxx
src/Mapper.cxx
+2
-2
Mapper.hxx
src/Mapper.hxx
+3
-3
Song.cxx
src/Song.cxx
+5
-5
SongSave.cxx
src/SongSave.cxx
+1
-1
SongSave.hxx
src/SongSave.hxx
+2
-2
SongSticker.cxx
src/SongSticker.cxx
+2
-2
SongSticker.hxx
src/SongSticker.hxx
+2
-2
SongUpdate.cxx
src/SongUpdate.cxx
+1
-1
StickerCommands.cxx
src/StickerCommands.cxx
+1
-2
UpdateArchive.cxx
src/UpdateArchive.cxx
+5
-5
UpdateArchive.hxx
src/UpdateArchive.hxx
+3
-3
UpdateContainer.cxx
src/UpdateContainer.cxx
+5
-6
UpdateContainer.hxx
src/UpdateContainer.hxx
+2
-2
UpdateDatabase.cxx
src/UpdateDatabase.cxx
+6
-6
UpdateDatabase.hxx
src/UpdateDatabase.hxx
+4
-4
UpdateIO.cxx
src/UpdateIO.cxx
+5
-5
UpdateIO.hxx
src/UpdateIO.hxx
+6
-6
UpdateSong.cxx
src/UpdateSong.cxx
+2
-2
UpdateSong.hxx
src/UpdateSong.hxx
+2
-2
UpdateWalk.cxx
src/UpdateWalk.cxx
+21
-22
ProxyDatabasePlugin.cxx
src/db/ProxyDatabasePlugin.cxx
+3
-4
SimpleDatabasePlugin.cxx
src/db/SimpleDatabasePlugin.cxx
+4
-4
SimpleDatabasePlugin.hxx
src/db/SimpleDatabasePlugin.hxx
+4
-4
song.h
src/song.h
+4
-4
DumpDatabase.cxx
test/DumpDatabase.cxx
+2
-2
TestQueuePriority.cxx
test/TestQueuePriority.cxx
+1
-1
No files found.
src/DatabaseGlue.cxx
View file @
3e8047e5
...
...
@@ -109,7 +109,7 @@ db_is_simple(void)
return
is_simple
;
}
struct
d
irectory
*
D
irectory
*
db_get_root
(
void
)
{
assert
(
db
!=
NULL
);
...
...
@@ -118,13 +118,13 @@ db_get_root(void)
return
((
SimpleDatabase
*
)
db
)
->
GetRoot
();
}
struct
d
irectory
*
D
irectory
*
db_get_directory
(
const
char
*
name
)
{
if
(
db
==
NULL
)
return
NULL
;
struct
d
irectory
*
music_root
=
db_get_root
();
D
irectory
*
music_root
=
db_get_root
();
if
(
name
==
NULL
)
return
music_root
;
...
...
src/DatabasePrint.cxx
View file @
3e8047e5
...
...
@@ -38,7 +38,7 @@ extern "C" {
#include <functional>
static
bool
PrintDirectory
(
struct
client
*
client
,
const
d
irectory
&
directory
)
PrintDirectory
(
struct
client
*
client
,
const
D
irectory
&
directory
)
{
if
(
!
directory
.
IsRoot
())
client_printf
(
client
,
"directory: %s
\n
"
,
directory
.
GetPath
());
...
...
@@ -48,7 +48,7 @@ PrintDirectory(struct client *client, const directory &directory)
static
void
print_playlist_in_directory
(
struct
client
*
client
,
const
d
irectory
&
directory
,
const
D
irectory
&
directory
,
const
char
*
name_utf8
)
{
if
(
directory
.
IsRoot
())
...
...
@@ -89,7 +89,7 @@ PrintSongFull(struct client *client, song &song)
static
bool
PrintPlaylistBrief
(
struct
client
*
client
,
const
PlaylistInfo
&
playlist
,
const
d
irectory
&
directory
)
const
D
irectory
&
directory
)
{
print_playlist_in_directory
(
client
,
directory
,
playlist
.
name
.
c_str
());
return
true
;
...
...
@@ -98,7 +98,7 @@ PrintPlaylistBrief(struct client *client,
static
bool
PrintPlaylistFull
(
struct
client
*
client
,
const
PlaylistInfo
&
playlist
,
const
d
irectory
&
directory
)
const
D
irectory
&
directory
)
{
print_playlist_in_directory
(
client
,
directory
,
playlist
.
name
.
c_str
());
...
...
src/DatabaseSave.cxx
View file @
3e8047e5
...
...
@@ -58,7 +58,7 @@ db_quark(void)
}
void
db_save_internal
(
FILE
*
fp
,
const
struct
d
irectory
*
music_root
)
db_save_internal
(
FILE
*
fp
,
const
D
irectory
*
music_root
)
{
assert
(
music_root
!=
NULL
);
...
...
@@ -77,7 +77,7 @@ db_save_internal(FILE *fp, const struct directory *music_root)
}
bool
db_load_internal
(
FILE
*
fp
,
struct
d
irectory
*
music_root
,
GError
**
error
)
db_load_internal
(
FILE
*
fp
,
D
irectory
*
music_root
,
GError
**
error
)
{
GString
*
buffer
=
g_string_sized_new
(
1024
);
char
*
line
;
...
...
src/DatabaseSave.hxx
View file @
3e8047e5
...
...
@@ -24,12 +24,12 @@
#include <stdio.h>
struct
d
irectory
;
struct
D
irectory
;
void
db_save_internal
(
FILE
*
file
,
const
struct
d
irectory
*
root
);
db_save_internal
(
FILE
*
file
,
const
D
irectory
*
root
);
bool
db_load_internal
(
FILE
*
file
,
struct
d
irectory
*
root
,
GError
**
error
);
db_load_internal
(
FILE
*
file
,
D
irectory
*
root
,
GError
**
error
);
#endif
src/DatabaseSimple.hxx
View file @
3e8047e5
...
...
@@ -28,7 +28,7 @@
#include <stdbool.h>
struct
config_param
;
struct
d
irectory
;
struct
D
irectory
;
struct
db_selection
;
struct
db_visitor
;
...
...
@@ -47,7 +47,7 @@ db_is_simple(void);
* May only be used if db_is_simple() returns true.
*/
gcc_pure
struct
d
irectory
*
D
irectory
*
db_get_root
(
void
);
/**
...
...
@@ -55,7 +55,7 @@ db_get_root(void);
*/
gcc_nonnull
(
1
)
gcc_pure
struct
d
irectory
*
D
irectory
*
db_get_directory
(
const
char
*
name
);
/**
...
...
src/DatabaseVisitor.hxx
View file @
3e8047e5
...
...
@@ -24,13 +24,13 @@
#include <functional>
struct
d
irectory
;
struct
D
irectory
;
struct
song
;
struct
PlaylistInfo
;
typedef
std
::
function
<
bool
(
const
d
irectory
&
,
GError
**
)
>
VisitDirectory
;
typedef
std
::
function
<
bool
(
const
D
irectory
&
,
GError
**
)
>
VisitDirectory
;
typedef
std
::
function
<
bool
(
struct
song
&
,
GError
**
)
>
VisitSong
;
typedef
std
::
function
<
bool
(
const
PlaylistInfo
&
,
const
d
irectory
&
,
typedef
std
::
function
<
bool
(
const
PlaylistInfo
&
,
const
D
irectory
&
,
GError
**
)
>
VisitPlaylist
;
typedef
std
::
function
<
bool
(
const
char
*
,
GError
**
)
>
VisitString
;
...
...
src/Directory.cxx
View file @
3e8047e5
...
...
@@ -36,16 +36,16 @@ extern "C" {
#include <string.h>
#include <stdlib.h>
static
d
irectory
*
static
D
irectory
*
directory_allocate
(
const
char
*
path
)
{
assert
(
path
!=
NULL
);
const
size_t
path_size
=
strlen
(
path
)
+
1
;
d
irectory
*
directory
=
(
struct
d
irectory
*
)
g_malloc0
(
sizeof
(
*
directory
)
-
sizeof
(
directory
->
path
)
+
path_size
);
D
irectory
*
directory
=
(
D
irectory
*
)
g_malloc0
(
sizeof
(
*
directory
)
-
sizeof
(
directory
->
path
)
+
path_size
);
INIT_LIST_HEAD
(
&
directory
->
children
);
INIT_LIST_HEAD
(
&
directory
->
songs
);
INIT_LIST_HEAD
(
&
directory
->
playlists
);
...
...
@@ -55,13 +55,13 @@ directory_allocate(const char *path)
return
directory
;
}
struct
d
irectory
*
directory
::
NewGeneric
(
const
char
*
path
,
struct
d
irectory
*
parent
)
D
irectory
*
Directory
::
NewGeneric
(
const
char
*
path
,
D
irectory
*
parent
)
{
assert
(
path
!=
NULL
);
assert
((
*
path
==
0
)
==
(
parent
==
NULL
));
d
irectory
*
directory
=
directory_allocate
(
path
);
D
irectory
*
directory
=
directory_allocate
(
path
);
directory
->
parent
=
parent
;
...
...
@@ -69,7 +69,7 @@ directory::NewGeneric(const char *path, struct directory *parent)
}
void
d
irectory
::
Free
()
D
irectory
::
Free
()
{
playlist_vector_deinit
(
&
playlists
);
...
...
@@ -77,7 +77,7 @@ directory::Free()
directory_for_each_song_safe
(
song
,
ns
,
this
)
song_free
(
song
);
struct
d
irectory
*
child
,
*
n
;
D
irectory
*
child
,
*
n
;
directory_for_each_child_safe
(
child
,
n
,
this
)
child
->
Free
();
...
...
@@ -85,7 +85,7 @@ directory::Free()
}
void
d
irectory
::
Delete
()
D
irectory
::
Delete
()
{
assert
(
holding_db_lock
());
assert
(
parent
!=
nullptr
);
...
...
@@ -95,7 +95,7 @@ directory::Delete()
}
const
char
*
d
irectory
::
GetName
()
const
D
irectory
::
GetName
()
const
{
assert
(
!
IsRoot
());
assert
(
path
!=
nullptr
);
...
...
@@ -108,8 +108,8 @@ directory::GetName() const
:
path
;
}
struct
d
irectory
*
d
irectory
::
CreateChild
(
const
char
*
name_utf8
)
D
irectory
*
D
irectory
::
CreateChild
(
const
char
*
name_utf8
)
{
assert
(
holding_db_lock
());
assert
(
name_utf8
!=
NULL
);
...
...
@@ -126,19 +126,19 @@ directory::CreateChild(const char *name_utf8)
path_utf8
=
allocated
;
}
d
irectory
*
child
=
NewGeneric
(
path_utf8
,
this
);
D
irectory
*
child
=
NewGeneric
(
path_utf8
,
this
);
g_free
(
allocated
);
list_add_tail
(
&
child
->
siblings
,
&
children
);
return
child
;
}
const
d
irectory
*
d
irectory
::
FindChild
(
const
char
*
name
)
const
const
D
irectory
*
D
irectory
::
FindChild
(
const
char
*
name
)
const
{
assert
(
holding_db_lock
());
const
struct
d
irectory
*
child
;
const
D
irectory
*
child
;
directory_for_each_child
(
child
,
this
)
if
(
strcmp
(
child
->
GetName
(),
name
)
==
0
)
return
child
;
...
...
@@ -147,11 +147,11 @@ directory::FindChild(const char *name) const
}
void
d
irectory
::
PruneEmpty
()
D
irectory
::
PruneEmpty
()
{
assert
(
holding_db_lock
());
struct
d
irectory
*
child
,
*
n
;
D
irectory
*
child
,
*
n
;
directory_for_each_child_safe
(
child
,
n
,
this
)
{
child
->
PruneEmpty
();
...
...
@@ -160,8 +160,8 @@ directory::PruneEmpty()
}
}
struct
d
irectory
*
d
irectory
::
LookupDirectory
(
const
char
*
uri
)
D
irectory
*
D
irectory
::
LookupDirectory
(
const
char
*
uri
)
{
assert
(
holding_db_lock
());
assert
(
uri
!=
NULL
);
...
...
@@ -171,7 +171,7 @@ directory::LookupDirectory(const char *uri)
char
*
duplicated
=
g_strdup
(
uri
),
*
name
=
duplicated
;
struct
d
irectory
*
d
=
this
;
D
irectory
*
d
=
this
;
while
(
1
)
{
char
*
slash
=
strchr
(
name
,
'/'
);
if
(
slash
==
name
)
{
...
...
@@ -195,7 +195,7 @@ directory::LookupDirectory(const char *uri)
}
void
d
irectory
::
AddSong
(
struct
song
*
song
)
D
irectory
::
AddSong
(
struct
song
*
song
)
{
assert
(
holding_db_lock
());
assert
(
song
!=
NULL
);
...
...
@@ -205,7 +205,7 @@ directory::AddSong(struct song *song)
}
void
d
irectory
::
RemoveSong
(
struct
song
*
song
)
D
irectory
::
RemoveSong
(
struct
song
*
song
)
{
assert
(
holding_db_lock
());
assert
(
song
!=
NULL
);
...
...
@@ -215,7 +215,7 @@ directory::RemoveSong(struct song *song)
}
const
song
*
d
irectory
::
FindSong
(
const
char
*
name_utf8
)
const
D
irectory
::
FindSong
(
const
char
*
name_utf8
)
const
{
assert
(
holding_db_lock
());
assert
(
name_utf8
!=
NULL
);
...
...
@@ -232,7 +232,7 @@ directory::FindSong(const char *name_utf8) const
}
struct
song
*
d
irectory
::
LookupSong
(
const
char
*
uri
)
D
irectory
::
LookupSong
(
const
char
*
uri
)
{
char
*
duplicated
,
*
base
;
...
...
@@ -242,7 +242,7 @@ directory::LookupSong(const char *uri)
duplicated
=
g_strdup
(
uri
);
base
=
strrchr
(
duplicated
,
'/'
);
struct
d
irectory
*
d
=
this
;
D
irectory
*
d
=
this
;
if
(
base
!=
NULL
)
{
*
base
++
=
0
;
d
=
d
->
LookupDirectory
(
duplicated
);
...
...
@@ -265,26 +265,26 @@ static int
directory_cmp
(
G_GNUC_UNUSED
void
*
priv
,
struct
list_head
*
_a
,
struct
list_head
*
_b
)
{
const
struct
directory
*
a
=
(
const
struct
d
irectory
*
)
_a
;
const
struct
directory
*
b
=
(
const
struct
d
irectory
*
)
_b
;
const
Directory
*
a
=
(
const
D
irectory
*
)
_a
;
const
Directory
*
b
=
(
const
D
irectory
*
)
_b
;
return
g_utf8_collate
(
a
->
path
,
b
->
path
);
}
void
d
irectory
::
Sort
()
D
irectory
::
Sort
()
{
assert
(
holding_db_lock
());
list_sort
(
NULL
,
&
children
,
directory_cmp
);
song_list_sort
(
&
songs
);
struct
d
irectory
*
child
;
D
irectory
*
child
;
directory_for_each_child
(
child
,
this
)
child
->
Sort
();
}
bool
d
irectory
::
Walk
(
bool
recursive
,
const
SongFilter
*
filter
,
D
irectory
::
Walk
(
bool
recursive
,
const
SongFilter
*
filter
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
VisitPlaylist
visit_playlist
,
GError
**
error_r
)
const
...
...
@@ -306,7 +306,7 @@ directory::Walk(bool recursive, const SongFilter *filter,
return
false
;
}
struct
d
irectory
*
child
;
D
irectory
*
child
;
directory_for_each_child
(
child
,
this
)
{
if
(
visit_directory
&&
!
visit_directory
(
*
child
,
error_r
))
...
...
src/Directory.hxx
View file @
3e8047e5
...
...
@@ -54,7 +54,7 @@ struct song;
struct
db_visitor
;
class
SongFilter
;
struct
d
irectory
{
struct
D
irectory
{
/**
* Pointers to the siblings of this directory within the
* parent directory. It is unused (undefined) in the root
...
...
@@ -83,7 +83,7 @@ struct directory {
struct
list_head
playlists
;
struct
d
irectory
*
parent
;
D
irectory
*
parent
;
time_t
mtime
;
ino_t
inode
;
dev_t
device
;
...
...
@@ -91,53 +91,53 @@ struct directory {
char
path
[
sizeof
(
long
)];
/**
* Generic constructor for #
d
irectory object.
* Generic constructor for #
D
irectory object.
*/
gcc_malloc
static
directory
*
NewGeneric
(
const
char
*
path_utf8
,
d
irectory
*
parent
);
static
Directory
*
NewGeneric
(
const
char
*
path_utf8
,
D
irectory
*
parent
);
/**
* Create a new root #
d
irectory object.
* Create a new root #
D
irectory object.
*/
gcc_malloc
static
d
irectory
*
NewRoot
()
{
static
D
irectory
*
NewRoot
()
{
return
NewGeneric
(
""
,
nullptr
);
}
/**
* Free this #
d
irectory object (and the whole object tree within it),
* Free this #
D
irectory object (and the whole object tree within it),
* assuming it was already removed from the parent.
*/
void
Free
();
/**
* Remove this #
d
irectory object from its parent and free it. This
* must not be called with the root
d
irectory.
* Remove this #
D
irectory object from its parent and free it. This
* must not be called with the root
D
irectory.
*
* Caller must lock the #db_mutex.
*/
void
Delete
();
/**
* Create a new #
d
irectory object as a child of the given one.
* Create a new #
D
irectory object as a child of the given one.
*
* Caller must lock the #db_mutex.
*
* @param name_utf8 the UTF-8 encoded name of the new sub directory
*/
gcc_malloc
d
irectory
*
CreateChild
(
const
char
*
name_utf8
);
D
irectory
*
CreateChild
(
const
char
*
name_utf8
);
/**
* Caller must lock the #db_mutex.
*/
gcc_pure
const
d
irectory
*
FindChild
(
const
char
*
name
)
const
;
const
D
irectory
*
FindChild
(
const
char
*
name
)
const
;
gcc_pure
d
irectory
*
FindChild
(
const
char
*
name
)
{
const
d
irectory
*
cthis
=
this
;
return
const_cast
<
d
irectory
*>
(
cthis
->
FindChild
(
name
));
D
irectory
*
FindChild
(
const
char
*
name
)
{
const
D
irectory
*
cthis
=
this
;
return
const_cast
<
D
irectory
*>
(
cthis
->
FindChild
(
name
));
}
/**
...
...
@@ -146,8 +146,8 @@ struct directory {
*
* Caller must lock the #db_mutex.
*/
struct
d
irectory
*
MakeChild
(
const
char
*
name_utf8
)
{
struct
d
irectory
*
child
=
FindChild
(
name_utf8
);
D
irectory
*
MakeChild
(
const
char
*
name_utf8
)
{
D
irectory
*
child
=
FindChild
(
name_utf8
);
if
(
child
==
nullptr
)
child
=
CreateChild
(
name_utf8
);
return
child
;
...
...
@@ -157,10 +157,10 @@ struct directory {
* Looks up a directory by its relative URI.
*
* @param uri the relative URI
* @return the
d
irectory, or NULL if none was found
* @return the
D
irectory, or NULL if none was found
*/
gcc_pure
d
irectory
*
LookupDirectory
(
const
char
*
uri
);
D
irectory
*
LookupDirectory
(
const
char
*
uri
);
gcc_pure
bool
IsEmpty
()
const
{
...
...
@@ -198,7 +198,7 @@ struct directory {
gcc_pure
song
*
FindSong
(
const
char
*
name_utf8
)
{
const
d
irectory
*
cthis
=
this
;
const
D
irectory
*
cthis
=
this
;
return
const_cast
<
song
*>
(
cthis
->
FindSong
(
name_utf8
));
}
...
...
src/DirectorySave.cxx
View file @
3e8047e5
...
...
@@ -46,7 +46,7 @@ directory_quark(void)
}
void
directory_save
(
FILE
*
fp
,
const
struct
d
irectory
*
directory
)
directory_save
(
FILE
*
fp
,
const
D
irectory
*
directory
)
{
if
(
!
directory
->
IsRoot
())
{
fprintf
(
fp
,
DIRECTORY_MTIME
"%lu
\n
"
,
...
...
@@ -55,7 +55,7 @@ directory_save(FILE *fp, const struct directory *directory)
fprintf
(
fp
,
"%s%s
\n
"
,
DIRECTORY_BEGIN
,
directory
->
GetPath
());
}
struct
d
irectory
*
cur
;
D
irectory
*
cur
;
directory_for_each_child
(
cur
,
directory
)
{
char
*
base
=
g_path_get_basename
(
cur
->
path
);
...
...
@@ -78,8 +78,8 @@ directory_save(FILE *fp, const struct directory *directory)
fprintf
(
fp
,
DIRECTORY_END
"%s
\n
"
,
directory
->
GetPath
());
}
static
struct
d
irectory
*
directory_load_subdir
(
FILE
*
fp
,
struct
d
irectory
*
parent
,
const
char
*
name
,
static
D
irectory
*
directory_load_subdir
(
FILE
*
fp
,
D
irectory
*
parent
,
const
char
*
name
,
GString
*
buffer
,
GError
**
error_r
)
{
const
char
*
line
;
...
...
@@ -91,7 +91,7 @@ directory_load_subdir(FILE *fp, struct directory *parent, const char *name,
return
NULL
;
}
struct
d
irectory
*
directory
=
parent
->
CreateChild
(
name
);
D
irectory
*
directory
=
parent
->
CreateChild
(
name
);
line
=
read_text_line
(
fp
,
buffer
);
if
(
line
==
NULL
)
{
...
...
@@ -132,7 +132,7 @@ directory_load_subdir(FILE *fp, struct directory *parent, const char *name,
}
bool
directory_load
(
FILE
*
fp
,
struct
d
irectory
*
directory
,
directory_load
(
FILE
*
fp
,
D
irectory
*
directory
,
GString
*
buffer
,
GError
**
error
)
{
const
char
*
line
;
...
...
@@ -140,7 +140,7 @@ directory_load(FILE *fp, struct directory *directory,
while
((
line
=
read_text_line
(
fp
,
buffer
))
!=
NULL
&&
!
g_str_has_prefix
(
line
,
DIRECTORY_END
))
{
if
(
g_str_has_prefix
(
line
,
DIRECTORY_DIR
))
{
struct
d
irectory
*
subdir
=
D
irectory
*
subdir
=
directory_load_subdir
(
fp
,
directory
,
line
+
sizeof
(
DIRECTORY_DIR
)
-
1
,
buffer
,
error
);
...
...
src/DirectorySave.hxx
View file @
3e8047e5
...
...
@@ -24,13 +24,13 @@
#include <stdio.h>
struct
d
irectory
;
struct
D
irectory
;
void
directory_save
(
FILE
*
fp
,
const
struct
d
irectory
*
directory
);
directory_save
(
FILE
*
fp
,
const
D
irectory
*
directory
);
bool
directory_load
(
FILE
*
fp
,
struct
d
irectory
*
directory
,
directory_load
(
FILE
*
fp
,
D
irectory
*
directory
,
GString
*
buffer
,
GError
**
error
);
#endif
src/Mapper.cxx
View file @
3e8047e5
...
...
@@ -181,7 +181,7 @@ map_uri_fs(const char *uri)
}
char
*
map_directory_fs
(
const
struct
d
irectory
*
directory
)
map_directory_fs
(
const
D
irectory
*
directory
)
{
assert
(
music_dir_utf8
!=
NULL
);
assert
(
music_dir_fs
!=
NULL
);
...
...
@@ -193,7 +193,7 @@ map_directory_fs(const struct directory *directory)
}
char
*
map_directory_child_fs
(
const
struct
d
irectory
*
directory
,
const
char
*
name
)
map_directory_child_fs
(
const
D
irectory
*
directory
,
const
char
*
name
)
{
assert
(
music_dir_utf8
!=
NULL
);
assert
(
music_dir_fs
!=
NULL
);
...
...
src/Mapper.hxx
View file @
3e8047e5
...
...
@@ -29,7 +29,7 @@
#define PLAYLIST_FILE_SUFFIX ".m3u"
struct
d
irectory
;
struct
D
irectory
;
struct
song
;
void
mapper_init
(
const
char
*
_music_dir
,
const
char
*
_playlist_dir
);
...
...
@@ -87,7 +87,7 @@ map_uri_fs(const char *uri);
*/
gcc_malloc
char
*
map_directory_fs
(
const
struct
d
irectory
*
directory
);
map_directory_fs
(
const
D
irectory
*
directory
);
/**
* Determines the file system path of a directory's child (may be a
...
...
@@ -99,7 +99,7 @@ map_directory_fs(const struct directory *directory);
*/
gcc_malloc
char
*
map_directory_child_fs
(
const
struct
d
irectory
*
directory
,
const
char
*
name
);
map_directory_child_fs
(
const
D
irectory
*
directory
,
const
char
*
name
);
/**
* Determines the file system path of a song. This must not be a
...
...
src/Song.cxx
View file @
3e8047e5
...
...
@@ -29,10 +29,10 @@ extern "C" {
#include <assert.h>
struct
d
irectory
detached_root
;
D
irectory
detached_root
;
static
struct
song
*
song_alloc
(
const
char
*
uri
,
struct
d
irectory
*
parent
)
song_alloc
(
const
char
*
uri
,
D
irectory
*
parent
)
{
size_t
uri_length
;
...
...
@@ -59,7 +59,7 @@ song_remote_new(const char *uri)
}
struct
song
*
song_file_new
(
const
char
*
path
,
struct
d
irectory
*
parent
)
song_file_new
(
const
char
*
path
,
D
irectory
*
parent
)
{
assert
((
parent
==
nullptr
)
==
(
*
path
==
'/'
));
...
...
@@ -117,14 +117,14 @@ song_free(struct song *song)
gcc_pure
static
inline
bool
directory_equals
(
const
struct
directory
&
a
,
const
struct
d
irectory
&
b
)
directory_equals
(
const
Directory
&
a
,
const
D
irectory
&
b
)
{
return
strcmp
(
a
.
path
,
b
.
path
)
==
0
;
}
gcc_pure
static
inline
bool
directory_is_same
(
const
struct
directory
*
a
,
const
struct
d
irectory
*
b
)
directory_is_same
(
const
Directory
*
a
,
const
D
irectory
*
b
)
{
return
a
==
b
||
(
a
!=
nullptr
&&
b
!=
nullptr
&&
...
...
src/SongSave.cxx
View file @
3e8047e5
...
...
@@ -63,7 +63,7 @@ song_save(FILE *fp, const struct song *song)
}
struct
song
*
song_load
(
FILE
*
fp
,
struct
d
irectory
*
parent
,
const
char
*
uri
,
song_load
(
FILE
*
fp
,
D
irectory
*
parent
,
const
char
*
uri
,
GString
*
buffer
,
GError
**
error_r
)
{
struct
song
*
song
=
parent
!=
NULL
...
...
src/SongSave.hxx
View file @
3e8047e5
...
...
@@ -27,7 +27,7 @@
#define SONG_BEGIN "song_begin: "
struct
song
;
struct
d
irectory
;
struct
D
irectory
;
void
song_save
(
FILE
*
fp
,
const
struct
song
*
song
);
...
...
@@ -41,7 +41,7 @@ song_save(FILE *fp, const struct song *song);
* @return true on success, false on error
*/
struct
song
*
song_load
(
FILE
*
fp
,
struct
d
irectory
*
parent
,
const
char
*
uri
,
song_load
(
FILE
*
fp
,
D
irectory
*
parent
,
const
char
*
uri
,
GString
*
buffer
,
GError
**
error_r
);
#endif
src/SongSticker.cxx
View file @
3e8047e5
...
...
@@ -109,7 +109,7 @@ sticker_song_get(const struct song *song)
}
struct
sticker_song_find_data
{
struct
d
irectory
*
directory
;
D
irectory
*
directory
;
const
char
*
base_uri
;
size_t
base_uri_length
;
...
...
@@ -134,7 +134,7 @@ sticker_song_find_cb(const char *uri, const char *value, gpointer user_data)
}
bool
sticker_song_find
(
struct
d
irectory
*
directory
,
const
char
*
name
,
sticker_song_find
(
D
irectory
*
directory
,
const
char
*
name
,
void
(
*
func
)(
struct
song
*
song
,
const
char
*
value
,
gpointer
user_data
),
gpointer
user_data
)
...
...
src/SongSticker.hxx
View file @
3e8047e5
...
...
@@ -23,7 +23,7 @@
#include <glib.h>
struct
song
;
struct
d
irectory
;
struct
D
irectory
;
struct
sticker
;
/**
...
...
@@ -75,7 +75,7 @@ sticker_song_get(const struct song *song);
* failure
*/
bool
sticker_song_find
(
struct
d
irectory
*
directory
,
const
char
*
name
,
sticker_song_find
(
D
irectory
*
directory
,
const
char
*
name
,
void
(
*
func
)(
struct
song
*
song
,
const
char
*
value
,
gpointer
user_data
),
gpointer
user_data
);
...
...
src/SongUpdate.cxx
View file @
3e8047e5
...
...
@@ -45,7 +45,7 @@ extern "C" {
#include <stdio.h>
struct
song
*
song_file_load
(
const
char
*
path
,
struct
d
irectory
*
parent
)
song_file_load
(
const
char
*
path
,
D
irectory
*
parent
)
{
struct
song
*
song
;
bool
ret
;
...
...
src/StickerCommands.cxx
View file @
3e8047e5
...
...
@@ -127,7 +127,6 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
/* find song dir key */
}
else
if
(
argc
==
5
&&
strcmp
(
argv
[
1
],
"find"
)
==
0
)
{
/* "sticker find song a/directory name" */
struct
directory
*
directory
;
bool
success
;
struct
sticker_song_find_data
data
=
{
client
,
...
...
@@ -135,7 +134,7 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
};
db_lock
();
directory
=
db_get_directory
(
argv
[
3
]);
Directory
*
directory
=
db_get_directory
(
argv
[
3
]);
if
(
directory
==
NULL
)
{
db_unlock
();
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
...
...
src/UpdateArchive.cxx
View file @
3e8047e5
...
...
@@ -35,14 +35,14 @@ extern "C" {
#include <string.h>
static
void
update_archive_tree
(
struct
d
irectory
*
directory
,
char
*
name
)
update_archive_tree
(
D
irectory
*
directory
,
char
*
name
)
{
char
*
tmp
=
strchr
(
name
,
'/'
);
if
(
tmp
)
{
*
tmp
=
0
;
//add dir is not there already
db_lock
();
struct
d
irectory
*
subdir
=
D
irectory
*
subdir
=
directory
->
MakeChild
(
name
);
subdir
->
device
=
DEVICE_INARCHIVE
;
db_unlock
();
...
...
@@ -82,12 +82,12 @@ update_archive_tree(struct directory *directory, char *name)
* @param plugin the archive plugin which fits this archive type
*/
static
void
update_archive_file2
(
struct
d
irectory
*
parent
,
const
char
*
name
,
update_archive_file2
(
D
irectory
*
parent
,
const
char
*
name
,
const
struct
stat
*
st
,
const
struct
archive_plugin
*
plugin
)
{
db_lock
();
d
irectory
*
directory
=
parent
->
FindChild
(
name
);
D
irectory
*
directory
=
parent
->
FindChild
(
name
);
db_unlock
();
if
(
directory
!=
NULL
&&
directory
->
mtime
==
st
->
st_mtime
&&
...
...
@@ -136,7 +136,7 @@ update_archive_file2(struct directory *parent, const char *name,
}
bool
update_archive_file
(
struct
d
irectory
*
directory
,
update_archive_file
(
D
irectory
*
directory
,
const
char
*
name
,
const
char
*
suffix
,
const
struct
stat
*
st
)
{
...
...
src/UpdateArchive.hxx
View file @
3e8047e5
...
...
@@ -25,13 +25,13 @@
#include <sys/stat.h>
struct
d
irectory
;
struct
D
irectory
;
struct
archive_plugin
;
#ifdef ENABLE_ARCHIVE
bool
update_archive_file
(
struct
d
irectory
*
directory
,
update_archive_file
(
D
irectory
*
directory
,
const
char
*
name
,
const
char
*
suffix
,
const
struct
stat
*
st
);
...
...
@@ -40,7 +40,7 @@ update_archive_file(struct directory *directory,
#include <glib.h>
static
inline
bool
update_archive_file
(
gcc_unused
struct
d
irectory
*
directory
,
update_archive_file
(
gcc_unused
D
irectory
*
directory
,
gcc_unused
const
char
*
name
,
gcc_unused
const
char
*
suffix
,
gcc_unused
const
struct
stat
*
st
)
...
...
src/UpdateContainer.cxx
View file @
3e8047e5
...
...
@@ -42,11 +42,11 @@ extern "C" {
*
* The caller must lock the database.
*/
static
struct
d
irectory
*
make_directory_if_modified
(
struct
d
irectory
*
parent
,
const
char
*
name
,
static
D
irectory
*
make_directory_if_modified
(
D
irectory
*
parent
,
const
char
*
name
,
const
struct
stat
*
st
)
{
d
irectory
*
directory
=
parent
->
FindChild
(
name
);
D
irectory
*
directory
=
parent
->
FindChild
(
name
);
// directory exists already
if
(
directory
!=
NULL
)
{
...
...
@@ -66,7 +66,7 @@ make_directory_if_modified(struct directory *parent, const char *name,
}
bool
update_container_file
(
struct
d
irectory
*
directory
,
update_container_file
(
D
irectory
*
directory
,
const
char
*
name
,
const
struct
stat
*
st
,
const
struct
decoder_plugin
*
plugin
)
...
...
@@ -75,8 +75,7 @@ update_container_file(struct directory *directory,
return
false
;
db_lock
();
struct
directory
*
contdir
=
make_directory_if_modified
(
directory
,
name
,
st
);
Directory
*
contdir
=
make_directory_if_modified
(
directory
,
name
,
st
);
if
(
contdir
==
NULL
)
{
/* not modified */
db_unlock
();
...
...
src/UpdateContainer.hxx
View file @
3e8047e5
...
...
@@ -24,11 +24,11 @@
#include <sys/stat.h>
struct
d
irectory
;
struct
D
irectory
;
struct
decoder_plugin
;
bool
update_container_file
(
struct
d
irectory
*
directory
,
update_container_file
(
D
irectory
*
directory
,
const
char
*
name
,
const
struct
stat
*
st
,
const
struct
decoder_plugin
*
plugin
);
...
...
src/UpdateDatabase.cxx
View file @
3e8047e5
...
...
@@ -29,7 +29,7 @@
#include <assert.h>
void
delete_song
(
struct
d
irectory
*
dir
,
struct
song
*
del
)
delete_song
(
D
irectory
*
dir
,
struct
song
*
del
)
{
assert
(
del
->
parent
==
dir
);
...
...
@@ -54,9 +54,9 @@ delete_song(struct directory *dir, struct song *del)
* Caller must lock the #db_mutex.
*/
static
void
clear_directory
(
struct
d
irectory
*
directory
)
clear_directory
(
D
irectory
*
directory
)
{
struct
d
irectory
*
child
,
*
n
;
D
irectory
*
child
,
*
n
;
directory_for_each_child_safe
(
child
,
n
,
directory
)
delete_directory
(
child
);
...
...
@@ -68,7 +68,7 @@ clear_directory(struct directory *directory)
}
void
delete_directory
(
struct
d
irectory
*
directory
)
delete_directory
(
D
irectory
*
directory
)
{
assert
(
directory
->
parent
!=
NULL
);
...
...
@@ -78,12 +78,12 @@ delete_directory(struct directory *directory)
}
bool
delete_name_in
(
struct
d
irectory
*
parent
,
const
char
*
name
)
delete_name_in
(
D
irectory
*
parent
,
const
char
*
name
)
{
bool
modified
=
false
;
db_lock
();
d
irectory
*
directory
=
parent
->
FindChild
(
name
);
D
irectory
*
directory
=
parent
->
FindChild
(
name
);
if
(
directory
!=
NULL
)
{
delete_directory
(
directory
);
...
...
src/UpdateDatabase.hxx
View file @
3e8047e5
...
...
@@ -22,14 +22,14 @@
#include "check.h"
struct
d
irectory
;
struct
D
irectory
;
struct
song
;
/**
* Caller must lock the #db_mutex.
*/
void
delete_song
(
struct
d
irectory
*
parent
,
struct
song
*
song
);
delete_song
(
D
irectory
*
parent
,
struct
song
*
song
);
/**
* Recursively free a directory and all its contents.
...
...
@@ -37,7 +37,7 @@ delete_song(struct directory *parent, struct song *song);
* Caller must lock the #db_mutex.
*/
void
delete_directory
(
struct
d
irectory
*
directory
);
delete_directory
(
D
irectory
*
directory
);
/**
* Caller must NOT lock the #db_mutex.
...
...
@@ -45,6 +45,6 @@ delete_directory(struct directory *directory);
* @return true if the database was modified
*/
bool
delete_name_in
(
struct
d
irectory
*
parent
,
const
char
*
name
);
delete_name_in
(
D
irectory
*
parent
,
const
char
*
name
);
#endif
src/UpdateIO.cxx
View file @
3e8047e5
...
...
@@ -29,7 +29,7 @@
#include <unistd.h>
int
stat_directory
(
const
struct
d
irectory
*
directory
,
struct
stat
*
st
)
stat_directory
(
const
D
irectory
*
directory
,
struct
stat
*
st
)
{
char
*
path_fs
=
map_directory_fs
(
directory
);
if
(
path_fs
==
NULL
)
...
...
@@ -44,7 +44,7 @@ stat_directory(const struct directory *directory, struct stat *st)
}
int
stat_directory_child
(
const
struct
d
irectory
*
parent
,
const
char
*
name
,
stat_directory_child
(
const
D
irectory
*
parent
,
const
char
*
name
,
struct
stat
*
st
)
{
char
*
path_fs
=
map_directory_child_fs
(
parent
,
name
);
...
...
@@ -60,7 +60,7 @@ stat_directory_child(const struct directory *parent, const char *name,
}
bool
directory_exists
(
const
struct
d
irectory
*
directory
)
directory_exists
(
const
D
irectory
*
directory
)
{
char
*
path_fs
=
map_directory_fs
(
directory
);
if
(
path_fs
==
NULL
)
...
...
@@ -79,7 +79,7 @@ directory_exists(const struct directory *directory)
}
bool
directory_child_is_regular
(
const
struct
d
irectory
*
directory
,
directory_child_is_regular
(
const
D
irectory
*
directory
,
const
char
*
name_utf8
)
{
char
*
path_fs
=
map_directory_child_fs
(
directory
,
name_utf8
);
...
...
@@ -94,7 +94,7 @@ directory_child_is_regular(const struct directory *directory,
}
bool
directory_child_access
(
const
struct
d
irectory
*
directory
,
directory_child_access
(
const
D
irectory
*
directory
,
const
char
*
name
,
int
mode
)
{
#ifdef WIN32
...
...
src/UpdateIO.hxx
View file @
3e8047e5
...
...
@@ -24,27 +24,27 @@
#include <sys/stat.h>
struct
d
irectory
;
struct
D
irectory
;
int
stat_directory
(
const
struct
d
irectory
*
directory
,
struct
stat
*
st
);
stat_directory
(
const
D
irectory
*
directory
,
struct
stat
*
st
);
int
stat_directory_child
(
const
struct
d
irectory
*
parent
,
const
char
*
name
,
stat_directory_child
(
const
D
irectory
*
parent
,
const
char
*
name
,
struct
stat
*
st
);
bool
directory_exists
(
const
struct
d
irectory
*
directory
);
directory_exists
(
const
D
irectory
*
directory
);
bool
directory_child_is_regular
(
const
struct
d
irectory
*
directory
,
directory_child_is_regular
(
const
D
irectory
*
directory
,
const
char
*
name_utf8
);
/**
* Checks if the given permissions on the mapped file are given.
*/
bool
directory_child_access
(
const
struct
d
irectory
*
directory
,
directory_child_access
(
const
D
irectory
*
directory
,
const
char
*
name
,
int
mode
);
#endif
src/UpdateSong.cxx
View file @
3e8047e5
...
...
@@ -37,7 +37,7 @@ extern "C" {
#include <unistd.h>
static
void
update_song_file2
(
struct
d
irectory
*
directory
,
update_song_file2
(
D
irectory
*
directory
,
const
char
*
name
,
const
struct
stat
*
st
,
const
struct
decoder_plugin
*
plugin
)
{
...
...
@@ -101,7 +101,7 @@ update_song_file2(struct directory *directory,
}
bool
update_song_file
(
struct
d
irectory
*
directory
,
update_song_file
(
D
irectory
*
directory
,
const
char
*
name
,
const
char
*
suffix
,
const
struct
stat
*
st
)
{
...
...
src/UpdateSong.hxx
View file @
3e8047e5
...
...
@@ -24,10 +24,10 @@
#include <sys/stat.h>
struct
d
irectory
;
struct
D
irectory
;
bool
update_song_file
(
struct
d
irectory
*
directory
,
update_song_file
(
D
irectory
*
directory
,
const
char
*
name
,
const
char
*
suffix
,
const
struct
stat
*
st
);
...
...
src/UpdateWalk.cxx
View file @
3e8047e5
...
...
@@ -87,7 +87,7 @@ update_walk_global_finish(void)
}
static
void
directory_set_stat
(
struct
d
irectory
*
dir
,
const
struct
stat
*
st
)
directory_set_stat
(
D
irectory
*
dir
,
const
struct
stat
*
st
)
{
dir
->
inode
=
st
->
st_ino
;
dir
->
device
=
st
->
st_dev
;
...
...
@@ -95,12 +95,11 @@ directory_set_stat(struct directory *dir, const struct stat *st)
}
static
void
remove_excluded_from_directory
(
struct
directory
*
directory
,
GSList
*
exclude_list
)
remove_excluded_from_directory
(
Directory
*
directory
,
GSList
*
exclude_list
)
{
db_lock
();
struct
d
irectory
*
child
,
*
n
;
D
irectory
*
child
,
*
n
;
directory_for_each_child_safe
(
child
,
n
,
directory
)
{
char
*
name_fs
=
utf8_to_fs_charset
(
child
->
GetName
());
...
...
@@ -129,9 +128,9 @@ remove_excluded_from_directory(struct directory *directory,
}
static
void
purge_deleted_from_directory
(
struct
d
irectory
*
directory
)
purge_deleted_from_directory
(
D
irectory
*
directory
)
{
struct
d
irectory
*
child
,
*
n
;
D
irectory
*
child
,
*
n
;
directory_for_each_child_safe
(
child
,
n
,
directory
)
{
if
(
directory_exists
(
child
))
continue
;
...
...
@@ -172,7 +171,7 @@ purge_deleted_from_directory(struct directory *directory)
#ifndef G_OS_WIN32
static
int
update_directory_stat
(
struct
d
irectory
*
directory
)
update_directory_stat
(
D
irectory
*
directory
)
{
struct
stat
st
;
if
(
stat_directory
(
directory
,
&
st
)
<
0
)
...
...
@@ -184,7 +183,7 @@ update_directory_stat(struct directory *directory)
#endif
static
int
find_inode_ancestor
(
struct
d
irectory
*
parent
,
ino_t
inode
,
dev_t
device
)
find_inode_ancestor
(
D
irectory
*
parent
,
ino_t
inode
,
dev_t
device
)
{
#ifndef G_OS_WIN32
while
(
parent
)
{
...
...
@@ -208,7 +207,7 @@ find_inode_ancestor(struct directory *parent, ino_t inode, dev_t device)
}
static
bool
update_playlist_file2
(
struct
d
irectory
*
directory
,
update_playlist_file2
(
D
irectory
*
directory
,
const
char
*
name
,
const
char
*
suffix
,
const
struct
stat
*
st
)
{
...
...
@@ -226,7 +225,7 @@ update_playlist_file2(struct directory *directory,
}
static
bool
update_regular_file
(
struct
d
irectory
*
directory
,
update_regular_file
(
D
irectory
*
directory
,
const
char
*
name
,
const
struct
stat
*
st
)
{
const
char
*
suffix
=
uri_get_suffix
(
name
);
...
...
@@ -239,10 +238,10 @@ update_regular_file(struct directory *directory,
}
static
bool
update_directory
(
struct
d
irectory
*
directory
,
const
struct
stat
*
st
);
update_directory
(
D
irectory
*
directory
,
const
struct
stat
*
st
);
static
void
update_directory_child
(
struct
d
irectory
*
directory
,
update_directory_child
(
D
irectory
*
directory
,
const
char
*
name
,
const
struct
stat
*
st
)
{
assert
(
strchr
(
name
,
'/'
)
==
NULL
);
...
...
@@ -254,7 +253,7 @@ update_directory_child(struct directory *directory,
return
;
db_lock
();
struct
d
irectory
*
subdir
=
directory
->
MakeChild
(
name
);
D
irectory
*
subdir
=
directory
->
MakeChild
(
name
);
db_unlock
();
assert
(
directory
==
subdir
->
parent
);
...
...
@@ -280,7 +279,7 @@ static bool skip_path(const char *path)
G_GNUC_PURE
static
bool
skip_symlink
(
const
struct
d
irectory
*
directory
,
const
char
*
utf8_name
)
skip_symlink
(
const
D
irectory
*
directory
,
const
char
*
utf8_name
)
{
#ifndef WIN32
char
*
path_fs
=
map_directory_child_fs
(
directory
,
utf8_name
);
...
...
@@ -353,7 +352,7 @@ skip_symlink(const struct directory *directory, const char *utf8_name)
}
static
bool
update_directory
(
struct
d
irectory
*
directory
,
const
struct
stat
*
st
)
update_directory
(
D
irectory
*
directory
,
const
struct
stat
*
st
)
{
assert
(
S_ISDIR
(
st
->
st_mode
));
...
...
@@ -418,11 +417,11 @@ update_directory(struct directory *directory, const struct stat *st)
return
true
;
}
static
struct
d
irectory
*
directory_make_child_checked
(
struct
d
irectory
*
parent
,
const
char
*
name_utf8
)
static
D
irectory
*
directory_make_child_checked
(
D
irectory
*
parent
,
const
char
*
name_utf8
)
{
db_lock
();
d
irectory
*
directory
=
parent
->
FindChild
(
name_utf8
);
D
irectory
*
directory
=
parent
->
FindChild
(
name_utf8
);
db_unlock
();
if
(
directory
!=
NULL
)
...
...
@@ -450,10 +449,10 @@ directory_make_child_checked(struct directory *parent, const char *name_utf8)
return
directory
;
}
static
struct
d
irectory
*
static
D
irectory
*
directory_make_uri_parent_checked
(
const
char
*
uri
)
{
struct
d
irectory
*
directory
=
db_get_root
();
D
irectory
*
directory
=
db_get_root
();
char
*
duplicated
=
g_strdup
(
uri
);
char
*
name_utf8
=
duplicated
,
*
slash
;
...
...
@@ -477,7 +476,7 @@ directory_make_uri_parent_checked(const char *uri)
static
void
update_uri
(
const
char
*
uri
)
{
struct
d
irectory
*
parent
=
directory_make_uri_parent_checked
(
uri
);
D
irectory
*
parent
=
directory_make_uri_parent_checked
(
uri
);
if
(
parent
==
NULL
)
return
;
...
...
@@ -502,7 +501,7 @@ update_walk(const char *path, bool discard)
if
(
path
!=
NULL
&&
!
isRootDirectory
(
path
))
{
update_uri
(
path
);
}
else
{
struct
d
irectory
*
directory
=
db_get_root
();
D
irectory
*
directory
=
db_get_root
();
struct
stat
st
;
if
(
stat_directory
(
directory
,
&
st
)
==
0
)
...
...
src/db/ProxyDatabasePlugin.cxx
View file @
3e8047e5
...
...
@@ -45,7 +45,7 @@ class ProxyDatabase : public Database {
unsigned
port
;
struct
mpd_connection
*
connection
;
struct
d
irectory
*
root
;
D
irectory
*
root
;
public
:
static
Database
*
Create
(
const
struct
config_param
*
param
,
...
...
@@ -168,7 +168,7 @@ ProxyDatabase::Open(GError **error_r)
return
false
;
}
root
=
d
irectory
::
NewRoot
();
root
=
D
irectory
::
NewRoot
();
return
true
;
}
...
...
@@ -240,8 +240,7 @@ Visit(struct mpd_connection *connection,
const
char
*
path
=
mpd_directory_get_path
(
directory
);
if
(
visit_directory
)
{
struct
directory
*
d
=
directory
::
NewGeneric
(
path
,
&
detached_root
);
Directory
*
d
=
Directory
::
NewGeneric
(
path
,
&
detached_root
);
bool
success
=
visit_directory
(
*
d
,
error_r
);
d
->
Free
();
if
(
!
success
)
...
...
src/db/SimpleDatabasePlugin.cxx
View file @
3e8047e5
...
...
@@ -180,7 +180,7 @@ SimpleDatabase::Load(GError **error_r)
bool
SimpleDatabase
::
Open
(
GError
**
error_r
)
{
root
=
d
irectory
::
NewRoot
();
root
=
D
irectory
::
NewRoot
();
mtime
=
0
;
#ifndef NDEBUG
...
...
@@ -197,7 +197,7 @@ SimpleDatabase::Open(GError **error_r)
if
(
!
Check
(
error_r
))
return
false
;
root
=
d
irectory
::
NewRoot
();
root
=
D
irectory
::
NewRoot
();
}
return
true
;
...
...
@@ -243,7 +243,7 @@ SimpleDatabase::ReturnSong(gcc_unused struct song *song) const
}
G_GNUC_PURE
const
struct
d
irectory
*
const
D
irectory
*
SimpleDatabase
::
LookupDirectory
(
const
char
*
uri
)
const
{
assert
(
root
!=
NULL
);
...
...
@@ -262,7 +262,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
{
ScopeDatabaseLock
protect
;
const
d
irectory
*
directory
=
root
->
LookupDirectory
(
selection
.
uri
);
const
D
irectory
*
directory
=
root
->
LookupDirectory
(
selection
.
uri
);
if
(
directory
==
NULL
)
{
if
(
visit_song
)
{
song
*
song
=
root
->
LookupSong
(
selection
.
uri
);
...
...
src/db/SimpleDatabasePlugin.hxx
View file @
3e8047e5
...
...
@@ -28,12 +28,12 @@
#include <time.h>
struct
d
irectory
;
struct
D
irectory
;
class
SimpleDatabase
:
public
Database
{
std
::
string
path
;
struct
d
irectory
*
root
;
D
irectory
*
root
;
time_t
mtime
;
...
...
@@ -43,7 +43,7 @@ class SimpleDatabase : public Database {
public
:
gcc_pure
struct
d
irectory
*
GetRoot
()
{
D
irectory
*
GetRoot
()
{
assert
(
root
!=
NULL
);
return
root
;
...
...
@@ -90,7 +90,7 @@ protected:
bool
Load
(
GError
**
error_r
);
gcc_pure
const
struct
d
irectory
*
LookupDirectory
(
const
char
*
uri
)
const
;
const
D
irectory
*
LookupDirectory
(
const
char
*
uri
)
const
;
};
extern
const
DatabasePlugin
simple_db_plugin
;
...
...
src/song.h
View file @
3e8047e5
...
...
@@ -43,7 +43,7 @@ struct song {
struct
list_head
siblings
;
struct
tag
*
tag
;
struct
d
irectory
*
parent
;
struct
D
irectory
*
parent
;
time_t
mtime
;
/**
...
...
@@ -64,7 +64,7 @@ struct song {
* A dummy #directory instance that is used for "detached" song
* copies.
*/
extern
struct
d
irectory
detached_root
;
extern
struct
D
irectory
detached_root
;
G_BEGIN_DECLS
...
...
@@ -74,7 +74,7 @@ song_remote_new(const char *uri);
/** allocate a new song with a local file name */
struct
song
*
song_file_new
(
const
char
*
path
,
struct
d
irectory
*
parent
);
song_file_new
(
const
char
*
path
,
struct
D
irectory
*
parent
);
/**
* allocate a new song structure with a local file name and attempt to
...
...
@@ -82,7 +82,7 @@ song_file_new(const char *path, struct directory *parent);
* data, NULL is returned.
*/
struct
song
*
song_file_load
(
const
char
*
path
,
struct
d
irectory
*
parent
);
song_file_load
(
const
char
*
path
,
struct
D
irectory
*
parent
);
/**
* Replaces the URI of a song object. The given song object is
...
...
test/DumpDatabase.cxx
View file @
3e8047e5
...
...
@@ -48,7 +48,7 @@ my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
}
static
bool
DumpDirectory
(
const
d
irectory
&
directory
,
GError
**
)
DumpDirectory
(
const
D
irectory
&
directory
,
GError
**
)
{
cout
<<
"D "
<<
directory
.
path
<<
endl
;
return
true
;
...
...
@@ -63,7 +63,7 @@ DumpSong(song &song, GError **)
static
bool
DumpPlaylist
(
const
PlaylistInfo
&
playlist
,
const
d
irectory
&
directory
,
GError
**
)
const
D
irectory
&
directory
,
GError
**
)
{
cout
<<
"P "
<<
directory
.
path
<<
"/"
<<
playlist
.
name
.
c_str
()
<<
endl
;
return
true
;
...
...
test/TestQueuePriority.cxx
View file @
3e8047e5
...
...
@@ -5,7 +5,7 @@ extern "C" {
#include "song.h"
#include "Directory.hxx"
struct
d
irectory
detached_root
;
D
irectory
detached_root
;
struct
song
*
song_dup_detached
(
const
struct
song
*
src
)
...
...
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