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
b7d2d4cf
Commit
b7d2d4cf
authored
Sep 13, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
database: don't allow uri==NULL
Add nonnull attributes and fix all callers.
parent
a6c797ee
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
10 deletions
+34
-10
command.c
src/command.c
+6
-6
database.h
src/database.h
+5
-0
dbUtils.h
src/dbUtils.h
+5
-2
db_print.c
src/db_print.c
+1
-1
db_print.h
src/db_print.h
+8
-0
locate.h
src/locate.h
+8
-0
stats.c
src/stats.c
+1
-1
No files found.
src/command.c
View file @
b7d2d4cf
...
@@ -963,7 +963,7 @@ handle_find(struct client *client, int argc, char *argv[])
...
@@ -963,7 +963,7 @@ handle_find(struct client *client, int argc, char *argv[])
}
}
GError
*
error
=
NULL
;
GError
*
error
=
NULL
;
enum
command_return
ret
=
findSongsIn
(
client
,
NULL
,
list
,
&
error
)
enum
command_return
ret
=
findSongsIn
(
client
,
""
,
list
,
&
error
)
?
COMMAND_RETURN_OK
?
COMMAND_RETURN_OK
:
print_error
(
client
,
error
);
:
print_error
(
client
,
error
);
...
@@ -987,7 +987,7 @@ handle_findadd(struct client *client, int argc, char *argv[])
...
@@ -987,7 +987,7 @@ handle_findadd(struct client *client, int argc, char *argv[])
GError
*
error
=
NULL
;
GError
*
error
=
NULL
;
enum
command_return
ret
=
enum
command_return
ret
=
findAddIn
(
client
->
player_control
,
NULL
,
list
,
&
error
)
findAddIn
(
client
->
player_control
,
""
,
list
,
&
error
)
?
COMMAND_RETURN_OK
?
COMMAND_RETURN_OK
:
print_error
(
client
,
error
);
:
print_error
(
client
,
error
);
...
@@ -1011,7 +1011,7 @@ handle_search(struct client *client, int argc, char *argv[])
...
@@ -1011,7 +1011,7 @@ handle_search(struct client *client, int argc, char *argv[])
}
}
GError
*
error
=
NULL
;
GError
*
error
=
NULL
;
enum
command_return
ret
=
searchForSongsIn
(
client
,
NULL
,
list
,
&
error
)
enum
command_return
ret
=
searchForSongsIn
(
client
,
""
,
list
,
&
error
)
?
COMMAND_RETURN_OK
?
COMMAND_RETURN_OK
:
print_error
(
client
,
error
);
:
print_error
(
client
,
error
);
...
@@ -1036,7 +1036,7 @@ handle_count(struct client *client, int argc, char *argv[])
...
@@ -1036,7 +1036,7 @@ handle_count(struct client *client, int argc, char *argv[])
GError
*
error
=
NULL
;
GError
*
error
=
NULL
;
enum
command_return
ret
=
enum
command_return
ret
=
searchStatsForSongsIn
(
client
,
NULL
,
list
,
&
error
)
searchStatsForSongsIn
(
client
,
""
,
list
,
&
error
)
?
COMMAND_RETURN_OK
?
COMMAND_RETURN_OK
:
print_error
(
client
,
error
);
:
print_error
(
client
,
error
);
...
@@ -1266,7 +1266,7 @@ handle_prioid(struct client *client, int argc, char *argv[])
...
@@ -1266,7 +1266,7 @@ handle_prioid(struct client *client, int argc, char *argv[])
static
enum
command_return
static
enum
command_return
handle_listall
(
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
handle_listall
(
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
{
c
har
*
directory
=
NULL
;
c
onst
char
*
directory
=
""
;
if
(
argc
==
2
)
if
(
argc
==
2
)
directory
=
argv
[
1
];
directory
=
argv
[
1
];
...
@@ -1537,7 +1537,7 @@ handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -1537,7 +1537,7 @@ handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
static
enum
command_return
static
enum
command_return
handle_listallinfo
(
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
handle_listallinfo
(
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
{
c
har
*
directory
=
NULL
;
c
onst
char
*
directory
=
""
;
if
(
argc
==
2
)
if
(
argc
==
2
)
directory
=
argv
[
1
];
directory
=
argv
[
1
];
...
...
src/database.h
View file @
b7d2d4cf
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#ifndef MPD_DATABASE_H
#ifndef MPD_DATABASE_H
#define MPD_DATABASE_H
#define MPD_DATABASE_H
#include "gcc.h"
#include <glib.h>
#include <glib.h>
#include <sys/time.h>
#include <sys/time.h>
...
@@ -47,12 +49,15 @@ db_finish(void);
...
@@ -47,12 +49,15 @@ db_finish(void);
struct
directory
*
struct
directory
*
db_get_root
(
void
);
db_get_root
(
void
);
gcc_nonnull
(
1
)
struct
directory
*
struct
directory
*
db_get_directory
(
const
char
*
name
);
db_get_directory
(
const
char
*
name
);
gcc_nonnull
(
1
)
struct
song
*
struct
song
*
db_get_song
(
const
char
*
file
);
db_get_song
(
const
char
*
file
);
gcc_nonnull
(
1
,
2
)
bool
bool
db_walk
(
const
char
*
uri
,
db_walk
(
const
char
*
uri
,
const
struct
db_visitor
*
visitor
,
void
*
ctx
,
const
struct
db_visitor
*
visitor
,
void
*
ctx
,
...
...
src/dbUtils.h
View file @
b7d2d4cf
...
@@ -20,23 +20,26 @@
...
@@ -20,23 +20,26 @@
#ifndef MPD_DB_UTILS_H
#ifndef MPD_DB_UTILS_H
#define MPD_DB_UTILS_H
#define MPD_DB_UTILS_H
#include "gcc.h"
#include <glib.h>
#include <glib.h>
#include <stdbool.h>
#include <stdbool.h>
struct
locate_item_list
;
struct
locate_item_list
;
struct
player_control
;
struct
player_control
;
gcc_nonnull
(
1
,
2
)
bool
bool
addAllIn
(
struct
player_control
*
pc
,
const
char
*
uri
,
GError
**
error_r
);
addAllIn
(
struct
player_control
*
pc
,
const
char
*
uri
,
GError
**
error_r
);
gcc_nonnull
(
1
,
2
)
bool
bool
addAllInToStoredPlaylist
(
const
char
*
uri_utf8
,
const
char
*
path_utf8
,
addAllInToStoredPlaylist
(
const
char
*
uri_utf8
,
const
char
*
path_utf8
,
GError
**
error_r
);
GError
**
error_r
);
gcc_nonnull
(
1
,
2
,
3
)
bool
bool
findAddIn
(
struct
player_control
*
pc
,
const
char
*
name
,
findAddIn
(
struct
player_control
*
pc
,
const
char
*
name
,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
);
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
);
unsigned
long
sumSongTimesIn
(
const
char
*
name
);
#endif
#endif
src/db_print.c
View file @
b7d2d4cf
...
@@ -286,7 +286,7 @@ listAllUniqueTags(struct client *client, int type,
...
@@ -286,7 +286,7 @@ listAllUniqueTags(struct client *client, int type,
data
.
set
=
strset_new
();
data
.
set
=
strset_new
();
}
}
if
(
!
db_walk
(
NULL
,
&
unique_tags_visitor
,
&
data
,
error_r
))
{
if
(
!
db_walk
(
""
,
&
unique_tags_visitor
,
&
data
,
error_r
))
{
freeListCommandItem
(
item
);
freeListCommandItem
(
item
);
return
false
;
return
false
;
}
}
...
...
src/db_print.h
View file @
b7d2d4cf
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#ifndef MPD_DB_PRINT_H
#ifndef MPD_DB_PRINT_H
#define MPD_DB_PRINT_H
#define MPD_DB_PRINT_H
#include "gcc.h"
#include <glib.h>
#include <glib.h>
#include <stdbool.h>
#include <stdbool.h>
...
@@ -27,28 +29,34 @@ struct client;
...
@@ -27,28 +29,34 @@ struct client;
struct
locate_item_list
;
struct
locate_item_list
;
struct
db_visitor
;
struct
db_visitor
;
gcc_nonnull
(
1
,
2
)
bool
bool
printAllIn
(
struct
client
*
client
,
const
char
*
uri_utf8
,
GError
**
error_r
);
printAllIn
(
struct
client
*
client
,
const
char
*
uri_utf8
,
GError
**
error_r
);
gcc_nonnull
(
1
,
2
)
bool
bool
printInfoForAllIn
(
struct
client
*
client
,
const
char
*
uri_utf8
,
printInfoForAllIn
(
struct
client
*
client
,
const
char
*
uri_utf8
,
GError
**
error_r
);
GError
**
error_r
);
gcc_nonnull
(
1
,
2
,
3
)
bool
bool
searchForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
searchForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
const
struct
locate_item_list
*
criteria
,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
);
GError
**
error_r
);
gcc_nonnull
(
1
,
2
,
3
)
bool
bool
findSongsIn
(
struct
client
*
client
,
const
char
*
name
,
findSongsIn
(
struct
client
*
client
,
const
char
*
name
,
const
struct
locate_item_list
*
criteria
,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
);
GError
**
error_r
);
gcc_nonnull
(
1
,
2
,
3
)
bool
bool
searchStatsForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
searchStatsForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
const
struct
locate_item_list
*
criteria
,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
);
GError
**
error_r
);
gcc_nonnull
(
1
,
3
)
bool
bool
listAllUniqueTags
(
struct
client
*
client
,
int
type
,
listAllUniqueTags
(
struct
client
*
client
,
int
type
,
const
struct
locate_item_list
*
criteria
,
const
struct
locate_item_list
*
criteria
,
...
...
src/locate.h
View file @
b7d2d4cf
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#ifndef MPD_LOCATE_H
#ifndef MPD_LOCATE_H
#define MPD_LOCATE_H
#define MPD_LOCATE_H
#include "gcc.h"
#include <stdint.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdbool.h>
...
@@ -57,6 +59,7 @@ struct locate_item_list *
...
@@ -57,6 +59,7 @@ struct locate_item_list *
locate_item_list_new
(
unsigned
length
);
locate_item_list_new
(
unsigned
length
);
/* return number of items or -1 on error */
/* return number of items or -1 on error */
gcc_nonnull
(
1
)
struct
locate_item_list
*
struct
locate_item_list
*
locate_item_list_parse
(
char
*
argv
[],
int
argc
);
locate_item_list_parse
(
char
*
argv
[],
int
argc
);
...
@@ -64,19 +67,24 @@ locate_item_list_parse(char *argv[], int argc);
...
@@ -64,19 +67,24 @@ locate_item_list_parse(char *argv[], int argc);
* Duplicate the struct locate_item_list object and convert all
* Duplicate the struct locate_item_list object and convert all
* needles with g_utf8_casefold().
* needles with g_utf8_casefold().
*/
*/
gcc_nonnull
(
1
)
struct
locate_item_list
*
struct
locate_item_list
*
locate_item_list_casefold
(
const
struct
locate_item_list
*
list
);
locate_item_list_casefold
(
const
struct
locate_item_list
*
list
);
gcc_nonnull
(
1
)
void
void
locate_item_list_free
(
struct
locate_item_list
*
list
);
locate_item_list_free
(
struct
locate_item_list
*
list
);
gcc_nonnull
(
1
)
void
void
locate_item_free
(
struct
locate_item
*
item
);
locate_item_free
(
struct
locate_item
*
item
);
gcc_nonnull
(
1
,
2
)
bool
bool
locate_song_search
(
const
struct
song
*
song
,
locate_song_search
(
const
struct
song
*
song
,
const
struct
locate_item_list
*
criteria
);
const
struct
locate_item_list
*
criteria
);
gcc_nonnull
(
1
,
2
)
bool
bool
locate_song_match
(
const
struct
song
*
song
,
locate_song_match
(
const
struct
song
*
song
,
const
struct
locate_item_list
*
criteria
);
const
struct
locate_item_list
*
criteria
);
...
...
src/stats.c
View file @
b7d2d4cf
...
@@ -98,7 +98,7 @@ void stats_update(void)
...
@@ -98,7 +98,7 @@ void stats_update(void)
data
.
artists
=
strset_new
();
data
.
artists
=
strset_new
();
data
.
albums
=
strset_new
();
data
.
albums
=
strset_new
();
db_walk
(
NULL
,
&
collect_stats_visitor
,
&
data
,
NULL
);
db_walk
(
""
,
&
collect_stats_visitor
,
&
data
,
NULL
);
stats
.
artist_count
=
strset_size
(
data
.
artists
);
stats
.
artist_count
=
strset_size
(
data
.
artists
);
stats
.
album_count
=
strset_size
(
data
.
albums
);
stats
.
album_count
=
strset_size
(
data
.
albums
);
...
...
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