song: a few tweaks

master
Andrzej Rybczak 14 years ago
parent 8abae236bb
commit ddeec3aea0
  1. 10
      src/song.cpp
  2. 2
      src/song.h

@ -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;

Loading…
Cancel
Save