aboutsummaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-07 23:41:06 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 23:41:06 +0100
commitbe081929f4523376db2df52903230d3b20dc54e9 (patch)
treee48e32ba99511d8d326ff3e7195d1c0e35b661fc /src/storage
parentb0b086d47302867291f2241880b54429f0347691 (diff)
downloadmpd-be081929f4523376db2df52903230d3b20dc54e9.tar.gz
mpd-be081929f4523376db2df52903230d3b20dc54e9.tar.xz
mpd-be081929f4523376db2df52903230d3b20dc54e9.zip
storage/local: remove utf8 path from constructor
Build the UTF-8 version of the path automatically in the constructor.
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/plugins/LocalStorage.cxx13
-rw-r--r--src/storage/plugins/LocalStorage.hxx2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/storage/plugins/LocalStorage.cxx b/src/storage/plugins/LocalStorage.cxx
index 5020a8fd6..2bf430b2e 100644
--- a/src/storage/plugins/LocalStorage.cxx
+++ b/src/storage/plugins/LocalStorage.cxx
@@ -50,12 +50,15 @@ public:
};
class LocalStorage final : public Storage {
- const std::string base_utf8;
const AllocatedPath base_fs;
+ const std::string base_utf8;
public:
- LocalStorage(const char *_base_utf8, Path _base_fs)
- :base_utf8(_base_utf8), base_fs(_base_fs) {}
+ explicit LocalStorage(Path _base_fs)
+ :base_fs(_base_fs), base_utf8(base_fs.ToUTF8()) {
+ assert(!base_fs.IsNull());
+ assert(!base_utf8.empty());
+ }
/* virtual methods from class Storage */
virtual bool GetInfo(const char *uri_utf8, bool follow, FileInfo &info,
@@ -203,7 +206,7 @@ LocalDirectoryReader::GetInfo(bool follow, FileInfo &info, Error &error)
}
Storage *
-CreateLocalStorage(const char *base_utf8, Path base_fs)
+CreateLocalStorage(Path base_fs)
{
- return new LocalStorage(base_utf8, base_fs);
+ return new LocalStorage(base_fs);
}
diff --git a/src/storage/plugins/LocalStorage.hxx b/src/storage/plugins/LocalStorage.hxx
index cad2d1e58..e80fd8276 100644
--- a/src/storage/plugins/LocalStorage.hxx
+++ b/src/storage/plugins/LocalStorage.hxx
@@ -28,6 +28,6 @@ class Path;
gcc_malloc gcc_nonnull_all
Storage *
-CreateLocalStorage(const char *base_utf8, Path base_fs);
+CreateLocalStorage(Path base_fs);
#endif