use standard snprintf() instead of GLib g_snprintf()
This commit is contained in:
parent
26d92c80ed
commit
fccba1af2a
@ -91,10 +91,11 @@ mpd_despotify_tag_from_track(struct ds_track *track)
|
|||||||
if (!track->has_meta_data)
|
if (!track->has_meta_data)
|
||||||
return tag;
|
return tag;
|
||||||
|
|
||||||
g_snprintf(tracknum, sizeof(tracknum), "%d", track->tracknumber);
|
snprintf(tracknum, sizeof(tracknum), "%d", track->tracknumber);
|
||||||
g_snprintf(date, sizeof(date), "%d", track->year);
|
snprintf(date, sizeof(date), "%d", track->year);
|
||||||
g_snprintf(comment, sizeof(comment), "Bitrate %d Kbps, %sgeo restricted",
|
snprintf(comment, sizeof(comment), "Bitrate %d Kbps, %sgeo restricted",
|
||||||
track->file_bitrate / 1000, track->geo_restricted ? "" : "not ");
|
track->file_bitrate / 1000,
|
||||||
|
track->geo_restricted ? "" : "not ");
|
||||||
tag->AddItem(TAG_TITLE, track->title);
|
tag->AddItem(TAG_TITLE, track->title);
|
||||||
tag->AddItem(TAG_ARTIST, track->artist->name);
|
tag->AddItem(TAG_ARTIST, track->artist->name);
|
||||||
tag->AddItem(TAG_TRACK, tracknum);
|
tag->AddItem(TAG_TRACK, tracknum);
|
||||||
|
@ -131,18 +131,18 @@ HttpdClient::SendResponse()
|
|||||||
assert(state == RESPONSE);
|
assert(state == RESPONSE);
|
||||||
|
|
||||||
if (dlna_streaming_requested) {
|
if (dlna_streaming_requested) {
|
||||||
g_snprintf(buffer, sizeof(buffer),
|
snprintf(buffer, sizeof(buffer),
|
||||||
"HTTP/1.1 206 OK\r\n"
|
"HTTP/1.1 206 OK\r\n"
|
||||||
"Content-Type: %s\r\n"
|
"Content-Type: %s\r\n"
|
||||||
"Content-Length: 10000\r\n"
|
"Content-Length: 10000\r\n"
|
||||||
"Content-RangeX: 0-1000000/1000000\r\n"
|
"Content-RangeX: 0-1000000/1000000\r\n"
|
||||||
"transferMode.dlna.org: Streaming\r\n"
|
"transferMode.dlna.org: Streaming\r\n"
|
||||||
"Accept-Ranges: bytes\r\n"
|
"Accept-Ranges: bytes\r\n"
|
||||||
"Connection: close\r\n"
|
"Connection: close\r\n"
|
||||||
"realTimeInfo.dlna.org: DLNA.ORG_TLAG=*\r\n"
|
"realTimeInfo.dlna.org: DLNA.ORG_TLAG=*\r\n"
|
||||||
"contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0\r\n"
|
"contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0\r\n"
|
||||||
"\r\n",
|
"\r\n",
|
||||||
httpd->content_type);
|
httpd->content_type);
|
||||||
|
|
||||||
} else if (metadata_requested) {
|
} else if (metadata_requested) {
|
||||||
gchar *metadata_header;
|
gchar *metadata_header;
|
||||||
@ -158,14 +158,14 @@ HttpdClient::SendResponse()
|
|||||||
g_free(metadata_header);
|
g_free(metadata_header);
|
||||||
|
|
||||||
} else { /* revert to a normal HTTP request */
|
} else { /* revert to a normal HTTP request */
|
||||||
g_snprintf(buffer, sizeof(buffer),
|
snprintf(buffer, sizeof(buffer),
|
||||||
"HTTP/1.1 200 OK\r\n"
|
"HTTP/1.1 200 OK\r\n"
|
||||||
"Content-Type: %s\r\n"
|
"Content-Type: %s\r\n"
|
||||||
"Connection: close\r\n"
|
"Connection: close\r\n"
|
||||||
"Pragma: no-cache\r\n"
|
"Pragma: no-cache\r\n"
|
||||||
"Cache-Control: no-cache, no-store\r\n"
|
"Cache-Control: no-cache, no-store\r\n"
|
||||||
"\r\n",
|
"\r\n",
|
||||||
httpd->content_type);
|
httpd->content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t nbytes = SocketMonitor::Write(buffer, strlen(buffer));
|
ssize_t nbytes = SocketMonitor::Write(buffer, strlen(buffer));
|
||||||
|
@ -42,7 +42,7 @@ add_song(std::forward_list<SongPointer> &songs, struct ds_track *track)
|
|||||||
char *ds_uri;
|
char *ds_uri;
|
||||||
|
|
||||||
/* Create a spt://... URI for MPD */
|
/* 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;
|
ds_uri = uri + strlen(dsp_scheme) + 3;
|
||||||
|
|
||||||
if (despotify_track_to_uri(track, ds_uri) != ds_uri) {
|
if (despotify_track_to_uri(track, ds_uri) != ds_uri) {
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#endif /* G_OS_WIN32 */
|
#endif /* G_OS_WIN32 */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
const Domain resolver_domain("resolver");
|
const Domain resolver_domain("resolver");
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ resolve_host_port(const char *host_port, unsigned default_port,
|
|||||||
|
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
if (port == NULL && default_port != 0) {
|
if (port == NULL && default_port != 0) {
|
||||||
g_snprintf(buffer, sizeof(buffer), "%u", default_port);
|
snprintf(buffer, sizeof(buffer), "%u", default_port);
|
||||||
port = buffer;
|
port = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user