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
fccba1af
Commit
fccba1af
authored
Sep 05, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use standard snprintf() instead of GLib g_snprintf()
parent
26d92c80
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
26 deletions
+28
-26
DespotifyUtils.cxx
src/DespotifyUtils.cxx
+5
-4
HttpdClient.cxx
src/output/HttpdClient.cxx
+20
-20
DespotifyPlaylistPlugin.cxx
src/playlist/DespotifyPlaylistPlugin.cxx
+1
-1
Resolver.cxx
src/system/Resolver.cxx
+2
-1
No files found.
src/DespotifyUtils.cxx
View file @
fccba1af
...
...
@@ -91,10 +91,11 @@ mpd_despotify_tag_from_track(struct ds_track *track)
if
(
!
track
->
has_meta_data
)
return
tag
;
g_snprintf
(
tracknum
,
sizeof
(
tracknum
),
"%d"
,
track
->
tracknumber
);
g_snprintf
(
date
,
sizeof
(
date
),
"%d"
,
track
->
year
);
g_snprintf
(
comment
,
sizeof
(
comment
),
"Bitrate %d Kbps, %sgeo restricted"
,
track
->
file_bitrate
/
1000
,
track
->
geo_restricted
?
""
:
"not "
);
snprintf
(
tracknum
,
sizeof
(
tracknum
),
"%d"
,
track
->
tracknumber
);
snprintf
(
date
,
sizeof
(
date
),
"%d"
,
track
->
year
);
snprintf
(
comment
,
sizeof
(
comment
),
"Bitrate %d Kbps, %sgeo restricted"
,
track
->
file_bitrate
/
1000
,
track
->
geo_restricted
?
""
:
"not "
);
tag
->
AddItem
(
TAG_TITLE
,
track
->
title
);
tag
->
AddItem
(
TAG_ARTIST
,
track
->
artist
->
name
);
tag
->
AddItem
(
TAG_TRACK
,
tracknum
);
...
...
src/output/HttpdClient.cxx
View file @
fccba1af
...
...
@@ -131,18 +131,18 @@ HttpdClient::SendResponse()
assert
(
state
==
RESPONSE
);
if
(
dlna_streaming_requested
)
{
g_
snprintf
(
buffer
,
sizeof
(
buffer
),
"HTTP/1.1 206 OK
\r\n
"
"Content-Type: %s
\r\n
"
"Content-Length: 10000
\r\n
"
"Content-RangeX: 0-1000000/1000000
\r\n
"
"transferMode.dlna.org: Streaming
\r\n
"
"Accept-Ranges: bytes
\r\n
"
"Connection: close
\r\n
"
"realTimeInfo.dlna.org: DLNA.ORG_TLAG=*
\r\n
"
"contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0
\r\n
"
"
\r\n
"
,
httpd
->
content_type
);
snprintf
(
buffer
,
sizeof
(
buffer
),
"HTTP/1.1 206 OK
\r\n
"
"Content-Type: %s
\r\n
"
"Content-Length: 10000
\r\n
"
"Content-RangeX: 0-1000000/1000000
\r\n
"
"transferMode.dlna.org: Streaming
\r\n
"
"Accept-Ranges: bytes
\r\n
"
"Connection: close
\r\n
"
"realTimeInfo.dlna.org: DLNA.ORG_TLAG=*
\r\n
"
"contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0
\r\n
"
"
\r\n
"
,
httpd
->
content_type
);
}
else
if
(
metadata_requested
)
{
gchar
*
metadata_header
;
...
...
@@ -158,14 +158,14 @@ HttpdClient::SendResponse()
g_free
(
metadata_header
);
}
else
{
/* revert to a normal HTTP request */
g_
snprintf
(
buffer
,
sizeof
(
buffer
),
"HTTP/1.1 200 OK
\r\n
"
"Content-Type: %s
\r\n
"
"Connection: close
\r\n
"
"Pragma: no-cache
\r\n
"
"Cache-Control: no-cache, no-store
\r\n
"
"
\r\n
"
,
httpd
->
content_type
);
snprintf
(
buffer
,
sizeof
(
buffer
),
"HTTP/1.1 200 OK
\r\n
"
"Content-Type: %s
\r\n
"
"Connection: close
\r\n
"
"Pragma: no-cache
\r\n
"
"Cache-Control: no-cache, no-store
\r\n
"
"
\r\n
"
,
httpd
->
content_type
);
}
ssize_t
nbytes
=
SocketMonitor
::
Write
(
buffer
,
strlen
(
buffer
));
...
...
src/playlist/DespotifyPlaylistPlugin.cxx
View file @
fccba1af
...
...
@@ -42,7 +42,7 @@ add_song(std::forward_list<SongPointer> &songs, struct ds_track *track)
char
*
ds_uri
;
/* Create a spt://... URI for MPD */
g_
snprintf
(
uri
,
sizeof
(
uri
),
"%s://"
,
dsp_scheme
);
snprintf
(
uri
,
sizeof
(
uri
),
"%s://"
,
dsp_scheme
);
ds_uri
=
uri
+
strlen
(
dsp_scheme
)
+
3
;
if
(
despotify_track_to_uri
(
track
,
ds_uri
)
!=
ds_uri
)
{
...
...
src/system/Resolver.cxx
View file @
fccba1af
...
...
@@ -33,6 +33,7 @@
#endif
/* G_OS_WIN32 */
#include <string.h>
#include <stdio.h>
const
Domain
resolver_domain
(
"resolver"
);
...
...
@@ -118,7 +119,7 @@ resolve_host_port(const char *host_port, unsigned default_port,
char
buffer
[
32
];
if
(
port
==
NULL
&&
default_port
!=
0
)
{
g_
snprintf
(
buffer
,
sizeof
(
buffer
),
"%u"
,
default_port
);
snprintf
(
buffer
,
sizeof
(
buffer
),
"%u"
,
default_port
);
port
=
buffer
;
}
...
...
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