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
b4430839
Commit
b4430839
authored
Sep 13, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
database: generate GError when database is disabled
parent
412cf974
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
command.c
src/command.c
+6
-0
database.c
src/database.c
+8
-5
db_error.h
src/db_error.h
+6
-0
No files found.
src/command.c
View file @
b4430839
...
@@ -395,6 +395,12 @@ print_error(struct client *client, GError *error)
...
@@ -395,6 +395,12 @@ print_error(struct client *client, GError *error)
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
else
if
(
error
->
domain
==
db_quark
())
{
}
else
if
(
error
->
domain
==
db_quark
())
{
switch
((
enum
db_error
)
error
->
code
)
{
switch
((
enum
db_error
)
error
->
code
)
{
case
DB_DISABLED
:
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"%s"
,
error
->
message
);
g_error_free
(
error
);
return
COMMAND_RETURN_ERROR
;
case
DB_NOT_FOUND
:
case
DB_NOT_FOUND
:
g_error_free
(
error
);
g_error_free
(
error
);
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"Not found"
);
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"Not found"
);
...
...
src/database.c
View file @
b4430839
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "directory.h"
#include "directory.h"
#include "stats.h"
#include "stats.h"
#include "conf.h"
#include "conf.h"
#include "glib_compat.h"
#include <glib.h>
#include <glib.h>
...
@@ -112,12 +113,14 @@ db_walk(const char *uri,
...
@@ -112,12 +113,14 @@ db_walk(const char *uri,
const
struct
db_visitor
*
visitor
,
void
*
ctx
,
const
struct
db_visitor
*
visitor
,
void
*
ctx
,
GError
**
error_r
)
GError
**
error_r
)
{
{
struct
directory
*
directory
;
if
(
db
==
NULL
)
{
g_set_error_literal
(
error_r
,
db_quark
(),
DB_DISABLED
,
if
(
db
==
NULL
)
"No database"
);
return
-
1
;
return
false
;
}
if
((
directory
=
db_get_directory
(
uri
))
==
NULL
)
{
struct
directory
*
directory
=
db_get_directory
(
uri
);
if
(
directory
==
NULL
)
{
struct
song
*
song
;
struct
song
*
song
;
if
(
visitor
->
song
!=
NULL
&&
if
(
visitor
->
song
!=
NULL
&&
(
song
=
db_get_song
(
uri
))
!=
NULL
)
(
song
=
db_get_song
(
uri
))
!=
NULL
)
...
...
src/db_error.h
View file @
b4430839
...
@@ -23,6 +23,12 @@
...
@@ -23,6 +23,12 @@
#include <glib.h>
#include <glib.h>
enum
db_error
{
enum
db_error
{
/**
* The database is disabled, i.e. none is configured in this
* MPD instance.
*/
DB_DISABLED
,
DB_NOT_FOUND
,
DB_NOT_FOUND
,
};
};
...
...
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