use std chr functions

The ones in std have overloads for const char/char.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2020-04-30 19:25:55 -07:00
committed by Max Kellermann
parent 99afe8e6d1
commit e4dad42ca1
34 changed files with 71 additions and 77 deletions

View File

@@ -25,7 +25,8 @@
#include "util/StringStrip.hxx"
#include "util/RuntimeError.hxx"
#include <string.h>
#include <cstring>
#include <stdlib.h>
void
@@ -49,8 +50,8 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name)
const char *value;
while ((line = file.ReadLine()) != nullptr &&
strcmp(line, "playlist_end") != 0) {
colon = strchr(line, ':');
std::strcmp(line, "playlist_end") != 0) {
colon = std::strchr(line, ':');
if (colon == nullptr || colon == line)
throw FormatRuntimeError("unknown line in db: %s",
line);
@@ -58,7 +59,7 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name)
*colon++ = 0;
value = StripLeft(colon);
if (strcmp(line, "mtime") == 0)
if (std::strcmp(line, "mtime") == 0)
pm.mtime = std::chrono::system_clock::from_time_t(strtol(value, nullptr, 10));
else
throw FormatRuntimeError("unknown line in db: %s",