diff options
author | Max Kellermann <max@duempel.org> | 2013-10-17 22:47:09 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-17 22:47:09 +0200 |
commit | 7fec2b02d419ab1de5589fb34d4fad90e9998aab (patch) | |
tree | a69e1f46c54aa0e3c3f2f1e1098bc2dc78df97a2 /src/DatabaseSave.cxx | |
parent | 608a98c873b94826a98b8dbdf17aa02320de8776 (diff) | |
download | mpd-7fec2b02d419ab1de5589fb34d4fad90e9998aab.tar.gz mpd-7fec2b02d419ab1de5589fb34d4fad90e9998aab.tar.xz mpd-7fec2b02d419ab1de5589fb34d4fad90e9998aab.zip |
fs/Charset: GetFSCharset() returns "utf-8" by default
If fs_charset is empty, i.e. we're using the default "utf-8",
GetFSCharset() should return exactly that instead of an empty
std::string.
Diffstat (limited to '')
-rw-r--r-- | src/DatabaseSave.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/DatabaseSave.cxx b/src/DatabaseSave.cxx index 67df236ef..b7077b413 100644 --- a/src/DatabaseSave.cxx +++ b/src/DatabaseSave.cxx @@ -56,8 +56,7 @@ db_save_internal(FILE *fp, const Directory *music_root) fprintf(fp, "%s\n", DIRECTORY_INFO_BEGIN); fprintf(fp, DB_FORMAT_PREFIX "%u\n", DB_FORMAT); fprintf(fp, "%s%s\n", DIRECTORY_MPD_VERSION, VERSION); - fprintf(fp, "%s%s\n", DIRECTORY_FS_CHARSET, - GetFSCharset().c_str()); + fprintf(fp, "%s%s\n", DIRECTORY_FS_CHARSET, GetFSCharset()); for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) if (!ignore_tag_items[i]) @@ -110,14 +109,14 @@ db_load_internal(TextFile &file, Directory *music_root, Error &error) found_charset = true; new_charset = line + sizeof(DIRECTORY_FS_CHARSET) - 1; - const std::string &old_charset = GetFSCharset(); - if (!old_charset.empty() - && strcmp(new_charset, old_charset.c_str())) { + const char *const old_charset = GetFSCharset(); + if (*old_charset != 0 + && strcmp(new_charset, old_charset) != 0) { error.Format(db_domain, "Existing database has charset " "\"%s\" instead of \"%s\"; " "discarding database file", - new_charset, old_charset.c_str()); + new_charset, old_charset); return false; } } else if (g_str_has_prefix(line, DB_TAG_PREFIX)) { |