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
9ceb8a71
Commit
9ceb8a71
authored
Jan 02, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sticker: convert to C++
parent
8331de42
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
61 additions
and
66 deletions
+61
-66
Makefile.am
Makefile.am
+3
-6
AllCommands.cxx
src/AllCommands.cxx
+3
-3
Main.cxx
src/Main.cxx
+2
-4
OtherCommands.cxx
src/OtherCommands.cxx
+1
-1
SongSticker.cxx
src/SongSticker.cxx
+12
-13
SongSticker.hxx
src/SongSticker.hxx
+3
-4
StickerCommands.cxx
src/StickerCommands.cxx
+3
-3
StickerDatabase.cxx
src/StickerDatabase.cxx
+19
-16
StickerDatabase.hxx
src/StickerDatabase.hxx
+3
-5
StickerPrint.cxx
src/StickerPrint.cxx
+7
-4
StickerPrint.hxx
src/StickerPrint.hxx
+3
-3
UpdateRemove.cxx
src/UpdateRemove.cxx
+2
-4
No files found.
Makefile.am
View file @
9ceb8a71
...
...
@@ -162,12 +162,9 @@ mpd_headers = \
src/sig_handlers.h
\
src/TimePrint.cxx src/TimePrint.hxx
\
src/song.h
\
src/song_sticker.h
\
src/song_sort.c src/song_sort.h
\
src/socket_util.h
\
src/stats.h
\
src/sticker.h
\
src/sticker_print.h
\
src/tag.h
\
src/tag_internal.h
\
src/tag_pool.h
\
...
...
@@ -366,9 +363,9 @@ endif
if
ENABLE_SQLITE
src_mpd_SOURCES
+=
\
src/StickerCommands.cxx src/StickerCommands.hxx
\
src/
sticker.c
\
src/
sticker_print.c
\
src/
song_sticker.c
src/
StickerDatabase.cxx src/StickerDatabase.hxx
\
src/
StickerPrint.cxx src/StickerPrint.hxx
\
src/
SongSticker.cxx src/SongSticker.hxx
endif
# Generic utility library
...
...
src/AllCommands.cxx
View file @
9ceb8a71
...
...
@@ -29,7 +29,6 @@ extern "C" {
#include "PlaylistCommands.hxx"
#include "DatabaseCommands.hxx"
#include "OutputCommands.hxx"
#include "StickerCommands.hxx"
#include "MessageCommands.hxx"
#include "OtherCommands.hxx"
#include "permission.h"
...
...
@@ -39,11 +38,12 @@ extern "C" {
#include "protocol/result.h"
#include "tokenizer.h"
#include "client.h"
}
#ifdef ENABLE_SQLITE
#include "sticker.h"
#include "StickerCommands.hxx"
#include "StickerDatabase.hxx"
#endif
}
#include <assert.h>
#include <string.h>
...
...
src/Main.cxx
View file @
9ceb8a71
...
...
@@ -63,16 +63,14 @@ extern "C" {
#include "InotifyUpdate.hxx"
#endif
extern
"C"
{
#ifdef ENABLE_SQLITE
#include "
sticker.h
"
#include "
StickerDatabase.hxx
"
#endif
extern
"C"
{
#ifdef ENABLE_ARCHIVE
#include "archive_list.h"
#endif
}
#include <glib.h>
...
...
src/OtherCommands.cxx
View file @
9ceb8a71
...
...
@@ -50,7 +50,7 @@ extern "C" {
}
#ifdef ENABLE_SQLITE
#include "
sticker.h
"
#include "
StickerDatabase.hxx
"
#endif
#include <assert.h>
...
...
src/
song_sticker.c
→
src/
SongSticker.cxx
View file @
9ceb8a71
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,10 +18,10 @@
*/
#include "config.h"
#include "song_sticker.h"
#include "SongSticker.hxx"
#include "StickerDatabase.hxx"
#include "song.h"
#include "directory.h"
#include "sticker.h"
#include <glib.h>
...
...
@@ -121,7 +121,8 @@ struct sticker_song_find_data {
static
void
sticker_song_find_cb
(
const
char
*
uri
,
const
char
*
value
,
gpointer
user_data
)
{
struct
sticker_song_find_data
*
data
=
user_data
;
struct
sticker_song_find_data
*
data
=
(
struct
sticker_song_find_data
*
)
user_data
;
struct
song
*
song
;
if
(
memcmp
(
uri
,
data
->
base_uri
,
data
->
base_uri_length
)
!=
0
)
...
...
@@ -140,14 +141,12 @@ sticker_song_find(struct directory *directory, const char *name,
gpointer
user_data
),
gpointer
user_data
)
{
struct
sticker_song_find_data
data
=
{
.
directory
=
directory
,
.
func
=
func
,
.
user_data
=
user_data
,
};
char
*
allocated
;
bool
success
;
struct
sticker_song_find_data
data
;
data
.
directory
=
directory
;
data
.
func
=
func
;
data
.
user_data
=
user_data
;
char
*
allocated
;
data
.
base_uri
=
directory_get_path
(
directory
);
if
(
*
data
.
base_uri
!=
0
)
/* append slash to base_uri */
...
...
@@ -159,8 +158,8 @@ sticker_song_find(struct directory *directory, const char *name,
data
.
base_uri_length
=
strlen
(
data
.
base_uri
);
success
=
sticker_find
(
"song"
,
data
.
base_uri
,
name
,
sticker_song_find_cb
,
&
data
);
bool
success
=
sticker_find
(
"song"
,
data
.
base_uri
,
name
,
sticker_song_find_cb
,
&
data
);
g_free
(
allocated
);
return
success
;
...
...
src/
song_sticker.h
→
src/
SongSticker.hxx
View file @
9ceb8a71
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,10 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef
SONG_STICKER_H
#define
SONG_STICKER_H
#ifndef
MPD_SONG_STICKER_HXX
#define
MPD_SONG_STICKER_HXX
#include <stdbool.h>
#include <glib.h>
struct
song
;
...
...
src/StickerCommands.cxx
View file @
9ceb8a71
...
...
@@ -21,12 +21,12 @@
#include "StickerCommands.hxx"
#include "SongPrint.hxx"
#include "DatabaseLock.hxx"
#include "SongSticker.hxx"
#include "StickerPrint.hxx"
#include "StickerDatabase.hxx"
extern
"C"
{
#include "protocol/result.h"
#include "sticker.h"
#include "sticker_print.h"
#include "song_sticker.h"
#include "database.h"
}
...
...
src/
sticker.c
→
src/
StickerDatabase.cxx
View file @
9ceb8a71
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,8 +18,11 @@
*/
#include "config.h"
#include "sticker.h"
#include "StickerDatabase.hxx"
extern
"C"
{
#include "idle.h"
}
#include <glib.h>
#include <sqlite3.h>
...
...
@@ -47,19 +50,19 @@ enum sticker_sql {
};
static
const
char
*
const
sticker_sql
[]
=
{
[
STICKER_SQL_GET
]
=
//
[STICKER_SQL_GET] =
"SELECT value FROM sticker WHERE type=? AND uri=? AND name=?"
,
[
STICKER_SQL_LIST
]
=
//
[STICKER_SQL_LIST] =
"SELECT name,value FROM sticker WHERE type=? AND uri=?"
,
[
STICKER_SQL_UPDATE
]
=
//
[STICKER_SQL_UPDATE] =
"UPDATE sticker SET value=? WHERE type=? AND uri=? AND name=?"
,
[
STICKER_SQL_INSERT
]
=
//
[STICKER_SQL_INSERT] =
"INSERT INTO sticker(type,uri,name,value) VALUES(?, ?, ?, ?)"
,
[
STICKER_SQL_DELETE
]
=
//
[STICKER_SQL_DELETE] =
"DELETE FROM sticker WHERE type=? AND uri=?"
,
[
STICKER_SQL_DELETE_VALUE
]
=
//
[STICKER_SQL_DELETE_VALUE] =
"DELETE FROM sticker WHERE type=? AND uri=? AND name=?"
,
[
STICKER_SQL_FIND
]
=
//
[STICKER_SQL_FIND] =
"SELECT uri,value FROM sticker WHERE type=? AND uri LIKE (? || '%') AND name=?"
,
};
...
...
@@ -541,7 +544,7 @@ sticker_free(struct sticker *sticker)
const
char
*
sticker_get_value
(
const
struct
sticker
*
sticker
,
const
char
*
name
)
{
return
g_hash_table_lookup
(
sticker
->
table
,
name
);
return
(
const
char
*
)
g_hash_table_lookup
(
sticker
->
table
,
name
);
}
struct
sticker_foreach_data
{
...
...
@@ -553,9 +556,10 @@ struct sticker_foreach_data {
static
void
sticker_foreach_func
(
gpointer
key
,
gpointer
value
,
gpointer
user_data
)
{
struct
sticker_foreach_data
*
data
=
user_data
;
struct
sticker_foreach_data
*
data
=
(
struct
sticker_foreach_data
*
)
user_data
;
data
->
func
(
key
,
value
,
data
->
user_data
);
data
->
func
(
(
const
char
*
)
key
,
(
const
char
*
)
value
,
data
->
user_data
);
}
void
...
...
@@ -564,10 +568,9 @@ sticker_foreach(const struct sticker *sticker,
gpointer
user_data
),
gpointer
user_data
)
{
struct
sticker_foreach_data
data
=
{
.
func
=
func
,
.
user_data
=
user_data
,
};
struct
sticker_foreach_data
data
;
data
.
func
=
func
;
data
.
user_data
=
user_data
;
g_hash_table_foreach
(
sticker
->
table
,
sticker_foreach_func
,
&
data
);
}
...
...
src/
sticker.h
→
src/
StickerDatabase.hxx
View file @
9ceb8a71
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -39,13 +39,11 @@
*
*/
#ifndef
STICKER_H
#define
STICKER_H
#ifndef
MPD_STICKER_DATABASE_HXX
#define
MPD_STICKER_DATABASE_HXX
#include "gerror.h"
#include <stdbool.h>
struct
sticker
;
/**
...
...
src/
sticker_print.c
→
src/
StickerPrint.cxx
View file @
9ceb8a71
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,9 +18,12 @@
*/
#include "config.h"
#include "sticker_print.h"
#include "sticker.h"
#include "StickerPrint.hxx"
#include "StickerDatabase.hxx"
extern
"C"
{
#include "client.h"
}
void
sticker_print_value
(
struct
client
*
client
,
...
...
@@ -32,7 +35,7 @@ sticker_print_value(struct client *client,
static
void
print_sticker_cb
(
const
char
*
name
,
const
char
*
value
,
void
*
data
)
{
struct
client
*
client
=
data
;
struct
client
*
client
=
(
struct
client
*
)
data
;
sticker_print_value
(
client
,
name
,
value
);
}
...
...
src/
sticker_print.h
→
src/
StickerPrint.hxx
View file @
9ceb8a71
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_STICKER_PRINT_H
#define MPD_STICKER_PRINT_H
#ifndef MPD_STICKER_PRINT_H
XX
#define MPD_STICKER_PRINT_H
XX
struct
sticker
;
struct
client
;
...
...
src/UpdateRemove.cxx
View file @
9ceb8a71
...
...
@@ -29,10 +29,8 @@ extern "C" {
#include "Main.hxx"
#ifdef ENABLE_SQLITE
extern
"C"
{
#include "sticker.h"
#include "song_sticker.h"
}
#include "StickerDatabase.hxx"
#include "SongSticker.hxx"
#endif
#include <glib.h>
...
...
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