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