Commit fcfdeac1 authored by Max Kellermann's avatar Max Kellermann

test/test_translate_song: use std::to_string()

parent 97f67065
...@@ -157,11 +157,8 @@ ToString(const Tag &tag) ...@@ -157,11 +157,8 @@ ToString(const Tag &tag)
{ {
std::string result; std::string result;
if (!tag.duration.IsNegative()) { if (!tag.duration.IsNegative())
char buffer[64]; result.append(std::to_string(tag.duration.ToMS()));
sprintf(buffer, "%d", tag.duration.ToMS());
result.append(buffer);
}
for (const auto &item : tag) { for (const auto &item : tag) {
result.push_back('|'); result.push_back('|');
...@@ -179,27 +176,18 @@ ToString(const DetachedSong &song) ...@@ -179,27 +176,18 @@ ToString(const DetachedSong &song)
std::string result = song.GetURI(); std::string result = song.GetURI();
result.push_back('|'); result.push_back('|');
char buffer[64]; if (!IsNegative(song.GetLastModified()))
result.append(std::to_string(std::chrono::system_clock::to_time_t(song.GetLastModified())));
if (!IsNegative(song.GetLastModified())) {
sprintf(buffer, "%lu",
(unsigned long)std::chrono::system_clock::to_time_t(song.GetLastModified()));
result.append(buffer);
}
result.push_back('|'); result.push_back('|');
if (song.GetStartTime().IsPositive()) { if (song.GetStartTime().IsPositive())
sprintf(buffer, "%u", song.GetStartTime().ToMS()); result.append(std::to_string(song.GetStartTime().ToMS()));
result.append(buffer);
}
result.push_back('-'); result.push_back('-');
if (song.GetEndTime().IsPositive()) { if (song.GetEndTime().IsPositive())
sprintf(buffer, "%u", song.GetEndTime().ToMS()); result.append(std::to_string(song.GetEndTime().ToMS()));
result.append(buffer);
}
result.push_back('|'); result.push_back('|');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment