diff options
author | Max Kellermann <max@duempel.org> | 2013-11-28 18:48:35 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-11-28 18:48:35 +0100 |
commit | af4133e3c92c78cc19ff14b876be6afcab1db091 (patch) | |
tree | da38387995bde630b20f81a717862ae21d19bb48 /src/DatabaseSave.cxx | |
parent | a788b7e747bc21b9aadee45dd028fa6198af794e (diff) | |
download | mpd-af4133e3c92c78cc19ff14b876be6afcab1db091.tar.gz mpd-af4133e3c92c78cc19ff14b876be6afcab1db091.tar.xz mpd-af4133e3c92c78cc19ff14b876be6afcab1db091.zip |
Util/StringUtil: add StringStartsWith()
Replaces GLib's g_str_has_prefix().
Diffstat (limited to 'src/DatabaseSave.cxx')
-rw-r--r-- | src/DatabaseSave.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/DatabaseSave.cxx b/src/DatabaseSave.cxx index 73de3b951..a9ec281ce 100644 --- a/src/DatabaseSave.cxx +++ b/src/DatabaseSave.cxx @@ -27,6 +27,7 @@ #include "tag/Tag.hxx" #include "tag/TagSettings.h" #include "fs/Charset.hxx" +#include "util/StringUtil.hxx" #include "util/Error.hxx" #include "Log.hxx" @@ -81,16 +82,16 @@ db_load_internal(TextFile &file, Directory &music_root, Error &error) while ((line = file.ReadLine()) != nullptr && strcmp(line, DIRECTORY_INFO_END) != 0) { - if (g_str_has_prefix(line, DB_FORMAT_PREFIX)) { + if (StringStartsWith(line, DB_FORMAT_PREFIX)) { format = atoi(line + sizeof(DB_FORMAT_PREFIX) - 1); - } else if (g_str_has_prefix(line, DIRECTORY_MPD_VERSION)) { + } else if (StringStartsWith(line, DIRECTORY_MPD_VERSION)) { if (found_version) { error.Set(db_domain, "Duplicate version line"); return false; } found_version = true; - } else if (g_str_has_prefix(line, DIRECTORY_FS_CHARSET)) { + } else if (StringStartsWith(line, DIRECTORY_FS_CHARSET)) { const char *new_charset; if (found_charset) { @@ -111,7 +112,7 @@ db_load_internal(TextFile &file, Directory &music_root, Error &error) new_charset, old_charset); return false; } - } else if (g_str_has_prefix(line, DB_TAG_PREFIX)) { + } else if (StringStartsWith(line, DB_TAG_PREFIX)) { const char *name = line + sizeof(DB_TAG_PREFIX) - 1; TagType tag = tag_name_parse(name); if (tag == TAG_NUM_OF_ITEM_TYPES) { |