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
e4f265b2
Commit
e4f265b2
authored
Feb 25, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
be more careful with string manipulations, use strncpy as much as possible
git-svn-id:
https://svn.musicpd.org/mpd/trunk@56
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
ca3068d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
decode.c
src/decode.c
+4
-4
player.c
src/player.c
+2
-2
playerData.c
src/playerData.c
+3
-2
No files found.
src/decode.c
View file @
e4f265b2
...
...
@@ -108,14 +108,14 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
while
(
decode_pid
>
0
&&
dc
->
start
)
usleep
(
10
);
if
(
dc
->
start
||
dc
->
error
!=
DECODE_ERROR_NOERROR
)
{
str
cpy
(
pc
->
erroredFile
,
pc
->
file
);
str
ncpy
(
pc
->
erroredFile
,
pc
->
file
,
MAXPATHLEN
);
pc
->
error
=
PLAYER_ERROR_FILE
;
quitDecode
(
pc
,
dc
);
return
-
1
;
}
if
(
initAudio
(
af
)
<
0
)
{
str
cpy
(
pc
->
erroredFile
,
pc
->
file
);
str
ncpy
(
pc
->
erroredFile
,
pc
->
file
,
MAXPATHLEN
);
pc
->
error
=
PLAYER_ERROR_AUDIO
;
quitDecode
(
pc
,
dc
);
return
-
1
;
...
...
@@ -196,7 +196,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
while
(
1
)
{
if
(
dc
->
start
)
{
str
cpy
(
dc
->
file
,
pc
->
file
);
str
ncpy
(
dc
->
file
,
pc
->
file
,
MAXPATHLEN
);
switch
(
pc
->
decodeType
)
{
#ifdef HAVE_MAD
case
DECODE_TYPE_MP3
:
...
...
@@ -239,7 +239,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
/* END OF CHILD */
}
else
if
(
decode_pid
<
0
)
{
str
cpy
(
pc
->
erroredFile
,
pc
->
file
);
str
ncpy
(
pc
->
erroredFile
,
pc
->
file
,
MAXPATHLEN
);
pc
->
error
=
PLAYER_ERROR_SYSTEM
;
return
-
1
;
}
...
...
src/player.c
View file @
e4f265b2
...
...
@@ -140,7 +140,7 @@ int playerPlay(FILE * fp, char * utf8file) {
{
struct
stat
st
;
if
(
stat
(
rmp2amp
(
utf8ToFsCharset
(
utf8file
)),
&
st
)
<
0
)
{
str
cpy
(
pc
->
erroredFile
,
pc
->
file
);
str
ncpy
(
pc
->
erroredFile
,
pc
->
file
,
MAXPATHLEN
);
pc
->
error
=
PLAYER_ERROR_FILENOTFOUND
;
return
0
;
}
...
...
@@ -160,7 +160,7 @@ int playerPlay(FILE * fp, char * utf8file) {
else
if
(
isWave
(
utf8file
))
pc
->
decodeType
=
DECODE_TYPE_AUDIOFILE
;
#endif
else
{
str
cpy
(
pc
->
erroredFile
,
pc
->
file
);
str
ncpy
(
pc
->
erroredFile
,
pc
->
file
,
MAXPATHLEN
);
pc
->
error
=
PLAYER_ERROR_UNKTYPE
;
return
0
;
}
...
...
src/playerData.c
View file @
e4f265b2
...
...
@@ -25,6 +25,7 @@
#include <sys/shm.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
buffered_before_play
;
int
BUFFERED_CHUNKS
;
...
...
@@ -102,7 +103,7 @@ void initPlayerData() {
playerData_pd
->
playerControl
.
queueState
=
PLAYER_QUEUE_BLANK
;
playerData_pd
->
playerControl
.
queueLockState
=
PLAYER_QUEUE_UNLOCKED
;
playerData_pd
->
playerControl
.
seek
=
0
;
playerData_pd
->
playerControl
.
file
[
0
]
=
'\0'
;
memset
(
playerData_pd
->
playerControl
.
file
,
0
,
MAXPATHLEN
)
;
playerData_pd
->
playerControl
.
crossFade
=
crossfade
;
playerData_pd
->
playerControl
.
softwareVolume
=
100
;
playerData_pd
->
playerControl
.
totalPlayTime
=
0
;
...
...
@@ -112,7 +113,7 @@ void initPlayerData() {
playerData_pd
->
decoderControl
.
state
=
DECODE_STATE_STOP
;
playerData_pd
->
decoderControl
.
seek
=
0
;
playerData_pd
->
decoderControl
.
error
=
DECODE_ERROR_NOERROR
;
playerData_pd
->
decoderControl
.
file
[
0
]
=
'\0'
;
memset
(
playerData_pd
->
decoderControl
.
file
,
0
,
MAXPATHLEN
)
;
}
PlayerData
*
getPlayerData
()
{
...
...
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