From fccba1af2aae9a90f117b3ae2232f5b60a7e9f63 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 5 Sep 2013 09:21:53 +0200 Subject: use standard snprintf() instead of GLib g_snprintf() --- src/DespotifyUtils.cxx | 9 +++---- src/output/HttpdClient.cxx | 40 ++++++++++++++++---------------- src/playlist/DespotifyPlaylistPlugin.cxx | 2 +- src/system/Resolver.cxx | 3 ++- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/DespotifyUtils.cxx b/src/DespotifyUtils.cxx index 058626dfc..863036464 100644 --- a/src/DespotifyUtils.cxx +++ b/src/DespotifyUtils.cxx @@ -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); diff --git a/src/output/HttpdClient.cxx b/src/output/HttpdClient.cxx index 9ed7805dc..e776d526b 100644 --- a/src/output/HttpdClient.cxx +++ b/src/output/HttpdClient.cxx @@ -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)); diff --git a/src/playlist/DespotifyPlaylistPlugin.cxx b/src/playlist/DespotifyPlaylistPlugin.cxx index 99724292e..5759a10c0 100644 --- a/src/playlist/DespotifyPlaylistPlugin.cxx +++ b/src/playlist/DespotifyPlaylistPlugin.cxx @@ -42,7 +42,7 @@ add_song(std::forward_list &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) { diff --git a/src/system/Resolver.cxx b/src/system/Resolver.cxx index b7fa80c38..51a5b1ed7 100644 --- a/src/system/Resolver.cxx +++ b/src/system/Resolver.cxx @@ -33,6 +33,7 @@ #endif /* G_OS_WIN32 */ #include +#include 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; } -- cgit v1.2.3