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
e1c839cd
Commit
e1c839cd
authored
Feb 25, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup logging, need to be careful with SECURE and DEBUG
git-svn-id:
https://svn.musicpd.org/mpd/trunk@58
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
483d8873
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
18 deletions
+26
-18
interface.c
src/interface.c
+18
-4
log.h
src/log.h
+6
-12
playerData.c
src/playerData.c
+2
-2
No files found.
src/interface.c
View file @
e1c839cd
...
...
@@ -156,18 +156,32 @@ void openAInterface(int fd, struct sockaddr * addr) {
SECURE
(
"interface %i: opened from "
,
i
);
switch
(
addr
->
sa_family
)
{
case
AF_INET
:
SECURE
(
"%s
\n
"
,
inet_ntoa
(
{
char
*
host
=
inet_ntoa
(
((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
));
sin_addr
);
if
(
host
)
{
SECURE
(
"%s
\n
"
,
host
);
}
else
{
SECURE
(
"error getting ipv4 address
\n
"
);
}
}
break
;
#ifdef HAVE_IPV6
case
AF_INET6
:
{
char
host
[
INET6_ADDRSTRLEN
+
1
];
memset
(
host
,
0
,
INET6_ADDRSTRLEN
+
1
);
SECURE
(
"%s
\n
"
,
inet_ntop
(
AF_INET6
,(
void
*
)
if
(
inet_ntop
(
AF_INET6
,(
void
*
)
&
(((
struct
sockaddr_in6
*
)
addr
)
->
sin6_addr
),
host
,
INET6_ADDRSTRLEN
));
sin6_addr
),
host
,
INET6_ADDRSTRLEN
))
{
SECURE
(
"%s
\n
"
,
host
);
}
else
{
SECURE
(
"error getting ipv6 address
\n
"
);
}
}
break
;
#endif
...
...
src/log.h
View file @
e1c839cd
...
...
@@ -27,22 +27,16 @@
extern
int
logLevel
;
#define ERROR(x, arg...) do { \
myfprintf(stderr, x , ##arg); \
} while(0);
#define ERROR(x, arg...) myfprintf(stderr, x , ##arg)
#define LOG(x, arg...) do { \
myfprintf(stdout, x , ##arg); \
} while(0);
#define LOG(x, arg...) myfprintf(stdout, x , ##arg)
#define SECURE(x, arg...) do { \
if(logLevel>=LOG_LEVEL_SECURE) myfprintf(stdout, x , ##arg); \
} while(0);
#define SECURE(x, arg...) if(logLevel>=LOG_LEVEL_SECURE) \
myfprintf(stdout, x , ##arg)
#define DEBUG(x, arg...) do { \
if(logLevel>=LOG_LEVEL_DEBUG) myfprintf(stdout, x , ##arg); \
} while(0);
#define DEBUG(x, arg...) if(logLevel>=LOG_LEVEL_DEBUG) \
myfprintf(stdout, x , ##arg)
void
initLog
();
...
...
src/playerData.c
View file @
e1c839cd
...
...
@@ -103,7 +103,7 @@ void initPlayerData() {
playerData_pd
->
playerControl
.
queueState
=
PLAYER_QUEUE_BLANK
;
playerData_pd
->
playerControl
.
queueLockState
=
PLAYER_QUEUE_UNLOCKED
;
playerData_pd
->
playerControl
.
seek
=
0
;
memset
(
playerData_pd
->
playerControl
.
file
,
0
,
MAXPATHLEN
);
memset
(
playerData_pd
->
playerControl
.
file
,
0
,
MAXPATHLEN
+
1
);
playerData_pd
->
playerControl
.
crossFade
=
crossfade
;
playerData_pd
->
playerControl
.
softwareVolume
=
100
;
playerData_pd
->
playerControl
.
totalPlayTime
=
0
;
...
...
@@ -113,7 +113,7 @@ void initPlayerData() {
playerData_pd
->
decoderControl
.
state
=
DECODE_STATE_STOP
;
playerData_pd
->
decoderControl
.
seek
=
0
;
playerData_pd
->
decoderControl
.
error
=
DECODE_ERROR_NOERROR
;
memset
(
playerData_pd
->
decoderControl
.
file
,
0
,
MAXPATHLEN
);
memset
(
playerData_pd
->
decoderControl
.
file
,
0
,
MAXPATHLEN
+
1
);
}
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