diff options
author | Denis Krjuchkov <denis@crazydev.net> | 2013-01-28 00:07:31 +0600 |
---|---|---|
committer | Denis Krjuchkov <denis@crazydev.net> | 2013-01-28 00:13:46 +0600 |
commit | 943064bb5148884339ccaf60e276191bc4d9abd9 (patch) | |
tree | feef3d0752e1b35c37a3f80411580db2a5534705 /src/DatabaseSave.cxx | |
parent | 7149a8ae4f7df43440f71348789585e53aa039d8 (diff) | |
download | mpd-943064bb5148884339ccaf60e276191bc4d9abd9.tar.gz mpd-943064bb5148884339ccaf60e276191bc4d9abd9.tar.xz mpd-943064bb5148884339ccaf60e276191bc4d9abd9.zip |
Path: convert remaining funcs to methods, keep fs_charset as std::string
Diffstat (limited to 'src/DatabaseSave.cxx')
-rw-r--r-- | src/DatabaseSave.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/DatabaseSave.cxx b/src/DatabaseSave.cxx index 2c46f4a5b..dc87c8ddb 100644 --- a/src/DatabaseSave.cxx +++ b/src/DatabaseSave.cxx @@ -62,7 +62,8 @@ 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, path_get_fs_charset()); + fprintf(fp, "%s%s\n", DIRECTORY_FS_CHARSET, + Path::GetFSCharset().c_str()); for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) if (!ignore_tag_items[i]) @@ -106,7 +107,7 @@ db_load_internal(TextFile &file, Directory *music_root, GError **error) found_version = true; } else if (g_str_has_prefix(line, DIRECTORY_FS_CHARSET)) { - const char *new_charset, *old_charset; + const char *new_charset; if (found_charset) { g_set_error(error, db_quark(), 0, @@ -117,14 +118,14 @@ db_load_internal(TextFile &file, Directory *music_root, GError **error) found_charset = true; new_charset = line + sizeof(DIRECTORY_FS_CHARSET) - 1; - old_charset = path_get_fs_charset(); - if (old_charset != NULL - && strcmp(new_charset, old_charset)) { + const std::string &old_charset = Path::GetFSCharset(); + if (!old_charset.empty() + && strcmp(new_charset, old_charset.c_str())) { g_set_error(error, db_quark(), 0, "Existing database has charset " "\"%s\" instead of \"%s\"; " "discarding database file", - new_charset, old_charset); + new_charset, old_charset.c_str()); return false; } } else if (g_str_has_prefix(line, DB_TAG_PREFIX)) { |