diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2012-08-28 22:42:43 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2012-08-29 01:25:36 +0200 |
commit | ddeec3aea0fad204fe3fbc62f2f13e0804a93f00 (patch) | |
tree | 7f4450a3f4c6aa712fc23a51c92e3d54ba9ceaa5 | |
parent | 8abae236bb694cb8bdd2006c335868d76d1cbc99 (diff) |
song: a few tweaks
-rw-r--r-- | src/song.cpp | 10 | ||||
-rw-r--r-- | src/song.h | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/song.cpp b/src/song.cpp index 2b00d317..b07f4c4b 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -199,12 +199,10 @@ std::string Song::getPriority(unsigned idx) const assert(pimpl); if (idx > 0) return ""; - char buf[10]; - snprintf(buf, sizeof(buf), "%d", getPrio()); - return buf; + return unsignedIntTo<std::string>::apply(getPrio()); } -std::string MPD::Song::getTags(GetFunction f, const std::string tag_separator) const +std::string MPD::Song::getTags(GetFunction f, const std::string &tag_separator) const { assert(pimpl); unsigned idx = 0; @@ -287,7 +285,7 @@ std::string Song::ShowTime(unsigned length) length -= minutes*60; int seconds = length; - char buf[10]; + char buf[32]; if (hours > 0) snprintf(buf, sizeof(buf), "%d:%02d:%02d", hours, minutes, seconds); else @@ -307,7 +305,7 @@ bool MPD::Song::isFormatOk(const std::string &type, const std::string &fmt) } if (braces) { - std::cerr << type << ": number of opening and closing braces does not equal!\n"; + std::cerr << type << ": number of opening and closing braces does not equal\n"; return false; } @@ -54,7 +54,7 @@ struct Song std::string getLength(unsigned idx = 0) const; std::string getPriority(unsigned idx = 0) const; - std::string getTags(GetFunction f, const std::string tag_separator = ", ") const; + std::string getTags(GetFunction f, const std::string &tag_separator = ", ") const; unsigned getHash() const; unsigned getDuration() const; |