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
6a953394
Commit
6a953394
authored
Jan 08, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SongSticker: use Song references
parent
c152a88f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
31 deletions
+26
-31
SongSticker.cxx
src/SongSticker.cxx
+15
-20
SongSticker.hxx
src/SongSticker.hxx
+5
-5
UpdateRemove.cxx
src/UpdateRemove.cxx
+1
-1
StickerCommands.cxx
src/command/StickerCommands.cxx
+5
-5
No files found.
src/SongSticker.cxx
View file @
6a953394
...
...
@@ -29,53 +29,48 @@
#include <string.h>
std
::
string
sticker_song_get_value
(
const
Song
*
song
,
const
char
*
name
)
sticker_song_get_value
(
const
Song
&
song
,
const
char
*
name
)
{
assert
(
song
!=
nullptr
);
assert
(
song
->
IsInDatabase
());
assert
(
song
.
IsInDatabase
());
const
auto
uri
=
song
->
GetURI
();
const
auto
uri
=
song
.
GetURI
();
return
sticker_load_value
(
"song"
,
uri
.
c_str
(),
name
);
}
bool
sticker_song_set_value
(
const
Song
*
song
,
sticker_song_set_value
(
const
Song
&
song
,
const
char
*
name
,
const
char
*
value
)
{
assert
(
song
!=
nullptr
);
assert
(
song
->
IsInDatabase
());
assert
(
song
.
IsInDatabase
());
const
auto
uri
=
song
->
GetURI
();
const
auto
uri
=
song
.
GetURI
();
return
sticker_store_value
(
"song"
,
uri
.
c_str
(),
name
,
value
);
}
bool
sticker_song_delete
(
const
Song
*
song
)
sticker_song_delete
(
const
Song
&
song
)
{
assert
(
song
!=
nullptr
);
assert
(
song
->
IsInDatabase
());
assert
(
song
.
IsInDatabase
());
const
auto
uri
=
song
->
GetURI
();
const
auto
uri
=
song
.
GetURI
();
return
sticker_delete
(
"song"
,
uri
.
c_str
());
}
bool
sticker_song_delete_value
(
const
Song
*
song
,
const
char
*
name
)
sticker_song_delete_value
(
const
Song
&
song
,
const
char
*
name
)
{
assert
(
song
!=
nullptr
);
assert
(
song
->
IsInDatabase
());
assert
(
song
.
IsInDatabase
());
const
auto
uri
=
song
->
GetURI
();
const
auto
uri
=
song
.
GetURI
();
return
sticker_delete_value
(
"song"
,
uri
.
c_str
(),
name
);
}
struct
sticker
*
sticker_song_get
(
const
Song
*
song
)
sticker_song_get
(
const
Song
&
song
)
{
assert
(
song
!=
nullptr
);
assert
(
song
->
IsInDatabase
());
assert
(
song
.
IsInDatabase
());
const
auto
uri
=
song
->
GetURI
();
const
auto
uri
=
song
.
GetURI
();
return
sticker_load
(
"song"
,
uri
.
c_str
());
}
...
...
src/SongSticker.hxx
View file @
6a953394
...
...
@@ -34,28 +34,28 @@ struct sticker;
*/
gcc_pure
std
::
string
sticker_song_get_value
(
const
Song
*
song
,
const
char
*
name
);
sticker_song_get_value
(
const
Song
&
song
,
const
char
*
name
);
/**
* Sets a sticker value in the specified song. Overwrites existing
* values.
*/
bool
sticker_song_set_value
(
const
Song
*
song
,
sticker_song_set_value
(
const
Song
&
song
,
const
char
*
name
,
const
char
*
value
);
/**
* Deletes a sticker from the database. All values are deleted.
*/
bool
sticker_song_delete
(
const
Song
*
song
);
sticker_song_delete
(
const
Song
&
song
);
/**
* Deletes a sticker value. Does nothing if the sticker did not
* exist.
*/
bool
sticker_song_delete_value
(
const
Song
*
song
,
const
char
*
name
);
sticker_song_delete_value
(
const
Song
&
song
,
const
char
*
name
);
/**
* Loads the sticker for the specified song.
...
...
@@ -64,7 +64,7 @@ sticker_song_delete_value(const Song *song, const char *name);
* @return a sticker object, or NULL on error or if there is no sticker
*/
sticker
*
sticker_song_get
(
const
Song
*
song
);
sticker_song_get
(
const
Song
&
song
);
/**
* Finds stickers with the specified name below the specified
...
...
src/UpdateRemove.cxx
View file @
6a953394
...
...
@@ -57,7 +57,7 @@ song_remove_event(void)
#ifdef ENABLE_SQLITE
/* if the song has a sticker, remove it */
if
(
sticker_enabled
())
sticker_song_delete
(
removed_song
);
sticker_song_delete
(
*
removed_song
);
#endif
instance
->
DeleteSong
(
*
removed_song
);
...
...
src/command/StickerCommands.cxx
View file @
6a953394
...
...
@@ -63,7 +63,7 @@ handle_sticker_song(Client &client, int argc, char *argv[])
if
(
song
==
nullptr
)
return
print_error
(
client
,
error
);
const
auto
value
=
sticker_song_get_value
(
song
,
argv
[
4
]);
const
auto
value
=
sticker_song_get_value
(
*
song
,
argv
[
4
]);
db
->
ReturnSong
(
song
);
if
(
value
.
empty
())
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
...
...
@@ -80,7 +80,7 @@ handle_sticker_song(Client &client, int argc, char *argv[])
if
(
song
==
nullptr
)
return
print_error
(
client
,
error
);
sticker
*
sticker
=
sticker_song_get
(
song
);
sticker
*
sticker
=
sticker_song_get
(
*
song
);
db
->
ReturnSong
(
song
);
if
(
sticker
)
{
sticker_print
(
client
,
*
sticker
);
...
...
@@ -94,7 +94,7 @@ handle_sticker_song(Client &client, int argc, char *argv[])
if
(
song
==
nullptr
)
return
print_error
(
client
,
error
);
bool
ret
=
sticker_song_set_value
(
song
,
argv
[
4
],
argv
[
5
]);
bool
ret
=
sticker_song_set_value
(
*
song
,
argv
[
4
],
argv
[
5
]);
db
->
ReturnSong
(
song
);
if
(
!
ret
)
{
command_error
(
client
,
ACK_ERROR_SYSTEM
,
...
...
@@ -111,8 +111,8 @@ handle_sticker_song(Client &client, int argc, char *argv[])
return
print_error
(
client
,
error
);
bool
ret
=
argc
==
4
?
sticker_song_delete
(
song
)
:
sticker_song_delete_value
(
song
,
argv
[
4
]);
?
sticker_song_delete
(
*
song
)
:
sticker_song_delete_value
(
*
song
,
argv
[
4
]);
db
->
ReturnSong
(
song
);
if
(
!
ret
)
{
command_error
(
client
,
ACK_ERROR_SYSTEM
,
...
...
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