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
4beba26c
Commit
4beba26c
authored
Oct 09, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: make the job id unsigned
Since the return value cannot be -1 anymore, we can make it unsigned.
parent
f1022bcc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
command.c
src/command.c
+1
-1
database.c
src/database.c
+1
-1
update.c
src/update.c
+7
-5
update.h
src/update.h
+4
-2
No files found.
src/command.c
View file @
4beba26c
...
@@ -807,7 +807,7 @@ static int handleUpdate(struct client *client,
...
@@ -807,7 +807,7 @@ static int handleUpdate(struct client *client,
mpd_unused
int
argc
,
char
*
argv
[])
mpd_unused
int
argc
,
char
*
argv
[])
{
{
char
*
path
=
NULL
;
char
*
path
=
NULL
;
int
ret
;
unsigned
ret
;
assert
(
argc
<=
2
);
assert
(
argc
<=
2
);
if
(
argc
==
2
&&
!
(
path
=
sanitizePathDup
(
argv
[
1
])))
{
if
(
argc
==
2
&&
!
(
path
=
sanitizePathDup
(
argv
[
1
])))
{
...
...
src/database.c
View file @
4beba26c
...
@@ -41,7 +41,7 @@ static time_t directory_dbModTime;
...
@@ -41,7 +41,7 @@ static time_t directory_dbModTime;
void
void
db_init
(
void
)
db_init
(
void
)
{
{
int
ret
;
unsigned
ret
;
music_root
=
directory_new
(
""
,
NULL
);
music_root
=
directory_new
(
""
,
NULL
);
...
...
src/update.c
View file @
4beba26c
...
@@ -48,15 +48,16 @@ static size_t update_paths_nr;
...
@@ -48,15 +48,16 @@ static size_t update_paths_nr;
static
pthread_t
update_thr
;
static
pthread_t
update_thr
;
static
const
int
update_task_id_max
=
1
<<
15
;
static
const
unsigned
update_task_id_max
=
1
<<
15
;
static
int
update_task_id
;
static
unsigned
update_task_id
;
static
struct
song
*
delete
;
static
struct
song
*
delete
;
static
struct
condition
delete_cond
;
static
struct
condition
delete_cond
;
int
isUpdatingDB
(
void
)
unsigned
isUpdatingDB
(
void
)
{
{
return
(
progress
!=
UPDATE_PROGRESS_IDLE
)
?
update_task_id
:
0
;
return
(
progress
!=
UPDATE_PROGRESS_IDLE
)
?
update_task_id
:
0
;
}
}
...
@@ -428,12 +429,13 @@ static void spawn_update_task(char *path)
...
@@ -428,12 +429,13 @@ static void spawn_update_task(char *path)
DEBUG
(
"spawned thread for update job id %i
\n
"
,
update_task_id
);
DEBUG
(
"spawned thread for update job id %i
\n
"
,
update_task_id
);
}
}
int
directory_update_init
(
char
*
path
)
unsigned
directory_update_init
(
char
*
path
)
{
{
assert
(
pthread_equal
(
pthread_self
(),
main_task
));
assert
(
pthread_equal
(
pthread_self
(),
main_task
));
if
(
progress
!=
UPDATE_PROGRESS_IDLE
)
{
if
(
progress
!=
UPDATE_PROGRESS_IDLE
)
{
int
next_task_id
;
unsigned
next_task_id
;
if
(
!
path
)
if
(
!
path
)
return
0
;
return
0
;
...
...
src/update.h
View file @
4beba26c
...
@@ -20,14 +20,16 @@
...
@@ -20,14 +20,16 @@
#ifndef UPDATE_H
#ifndef UPDATE_H
#define UPDATE_H
#define UPDATE_H
int
isUpdatingDB
(
void
);
unsigned
isUpdatingDB
(
void
);
/*
/*
* returns the positive update job ID on success,
* returns the positive update job ID on success,
* returns 0 if busy
* returns 0 if busy
* @path will be freed by this function and should not be reused
* @path will be freed by this function and should not be reused
*/
*/
int
directory_update_init
(
char
*
path
);
unsigned
directory_update_init
(
char
*
path
);
void
reap_update_task
(
void
);
void
reap_update_task
(
void
);
...
...
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