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
cece6c00
Commit
cece6c00
authored
Feb 22, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shout: bool return values instead of int
Return true/false instead of 0/-1.
parent
f0554d9a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
27 deletions
+28
-27
shout_plugin.c
src/output/shout_plugin.c
+28
-27
No files found.
src/output/shout_plugin.c
View file @
cece6c00
...
...
@@ -252,42 +252,46 @@ static void *my_shout_init_driver(struct audio_output *audio_output,
return
sd
;
}
static
int
handle_shout_error
(
struct
shout_data
*
sd
,
int
err
)
static
bool
handle_shout_error
(
struct
shout_data
*
sd
,
int
err
)
{
switch
(
err
)
{
case
SHOUTERR_SUCCESS
:
break
;
case
SHOUTERR_UNCONNECTED
:
case
SHOUTERR_SOCKET
:
g_warning
(
"Lost shout connection to %s:%i: %s
\n
"
,
shout_get_host
(
sd
->
shout_conn
),
shout_get_port
(
sd
->
shout_conn
),
shout_get_error
(
sd
->
shout_conn
));
return
-
1
;
return
false
;
default:
g_warning
(
"shout: connection to %s:%i error: %s
\n
"
,
shout_get_host
(
sd
->
shout_conn
),
shout_get_port
(
sd
->
shout_conn
),
shout_get_error
(
sd
->
shout_conn
));
return
-
1
;
return
false
;
}
return
0
;
return
true
;
}
static
int
write_page
(
struct
shout_data
*
sd
)
static
bool
write_page
(
struct
shout_data
*
sd
)
{
int
err
;
if
(
sd
->
buf
.
len
==
0
)
return
0
;
return
true
;
shout_sync
(
sd
->
shout_conn
);
err
=
shout_send
(
sd
->
shout_conn
,
sd
->
buf
.
data
,
sd
->
buf
.
len
);
if
(
handle_shout_error
(
sd
,
err
)
<
0
)
return
-
1
;
if
(
!
handle_shout_error
(
sd
,
err
)
)
return
false
;
return
0
;
return
true
;
}
static
void
close_shout_conn
(
struct
shout_data
*
sd
)
...
...
@@ -332,7 +336,8 @@ static void my_shout_close_device(void *data)
close_shout_conn
(
sd
);
}
static
int
shout_connect
(
struct
shout_data
*
sd
)
static
bool
shout_connect
(
struct
shout_data
*
sd
)
{
int
state
;
...
...
@@ -340,35 +345,37 @@ static int shout_connect(struct shout_data *sd)
switch
(
state
)
{
case
SHOUTERR_SUCCESS
:
case
SHOUTERR_CONNECTED
:
return
0
;
return
true
;
default:
g_warning
(
"problem opening connection to shout server %s:%i: %s
\n
"
,
shout_get_host
(
sd
->
shout_conn
),
shout_get_port
(
sd
->
shout_conn
),
shout_get_error
(
sd
->
shout_conn
));
return
-
1
;
return
false
;
}
}
static
int
open_shout_conn
(
void
*
data
)
static
bool
open_shout_conn
(
void
*
data
)
{
struct
shout_data
*
sd
=
(
struct
shout_data
*
)
data
;
int
status
;
bool
ret
;
status
=
shout_connect
(
sd
);
if
(
status
!=
0
)
return
status
;
ret
=
shout_connect
(
sd
);
if
(
!
ret
)
return
false
;
sd
->
buf
.
len
=
0
;
if
(
sd
->
encoder
->
init_encoder_func
(
sd
)
<
0
)
{
shout_close
(
sd
->
shout_conn
);
return
-
1
;
return
false
;
}
write_page
(
sd
);
return
0
;
return
true
;
}
static
bool
...
...
@@ -377,10 +384,7 @@ my_shout_open_device(void *data,
{
struct
shout_data
*
sd
=
(
struct
shout_data
*
)
data
;
if
(
open_shout_conn
(
sd
)
<
0
)
return
false
;
return
true
;
return
open_shout_conn
(
sd
);
}
static
bool
...
...
@@ -393,10 +397,7 @@ my_shout_play(void *data, const char *chunk, size_t size)
if
(
sd
->
encoder
->
encode_func
(
sd
,
chunk
,
size
))
return
false
;
if
(
write_page
(
sd
)
<
0
)
return
false
;
return
true
;
return
write_page
(
sd
);
}
static
bool
...
...
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