aboutsummaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/db/Configured.cxx23
-rw-r--r--src/db/Configured.hxx2
-rw-r--r--src/db/Count.cxx2
-rw-r--r--src/db/Count.hxx2
-rw-r--r--src/db/DatabaseError.cxx2
-rw-r--r--src/db/DatabaseError.hxx2
-rw-r--r--src/db/DatabaseGlue.cxx10
-rw-r--r--src/db/DatabaseGlue.hxx8
-rw-r--r--src/db/DatabaseListener.hxx2
-rw-r--r--src/db/DatabaseLock.cxx2
-rw-r--r--src/db/DatabaseLock.hxx2
-rw-r--r--src/db/DatabasePlaylist.cxx2
-rw-r--r--src/db/DatabasePlaylist.hxx2
-rw-r--r--src/db/DatabasePlugin.hxx6
-rw-r--r--src/db/DatabasePrint.cxx31
-rw-r--r--src/db/DatabasePrint.hxx8
-rw-r--r--src/db/DatabaseQueue.cxx2
-rw-r--r--src/db/DatabaseQueue.hxx2
-rw-r--r--src/db/DatabaseSong.cxx2
-rw-r--r--src/db/DatabaseSong.hxx2
-rw-r--r--src/db/Helpers.cxx6
-rw-r--r--src/db/Helpers.hxx2
-rw-r--r--src/db/Interface.hxx2
-rw-r--r--src/db/LightDirectory.hxx2
-rw-r--r--src/db/LightSong.cxx2
-rw-r--r--src/db/LightSong.hxx2
-rw-r--r--src/db/PlaylistInfo.hxx2
-rw-r--r--src/db/PlaylistVector.cxx2
-rw-r--r--src/db/PlaylistVector.hxx2
-rw-r--r--src/db/Registry.cxx6
-rw-r--r--src/db/Registry.hxx2
-rw-r--r--src/db/Selection.cxx2
-rw-r--r--src/db/Selection.hxx2
-rw-r--r--src/db/Stats.hxx2
-rw-r--r--src/db/UniqueTags.cxx2
-rw-r--r--src/db/UniqueTags.hxx2
-rw-r--r--src/db/Uri.hxx2
-rw-r--r--src/db/Visitor.hxx2
-rw-r--r--src/db/plugins/LazyDatabase.cxx2
-rw-r--r--src/db/plugins/LazyDatabase.hxx2
-rw-r--r--src/db/plugins/ProxyDatabasePlugin.cxx24
-rw-r--r--src/db/plugins/ProxyDatabasePlugin.hxx2
-rw-r--r--src/db/plugins/simple/DatabaseSave.cxx2
-rw-r--r--src/db/plugins/simple/DatabaseSave.hxx2
-rw-r--r--src/db/plugins/simple/Directory.cxx2
-rw-r--r--src/db/plugins/simple/Directory.hxx2
-rw-r--r--src/db/plugins/simple/DirectorySave.cxx2
-rw-r--r--src/db/plugins/simple/DirectorySave.hxx2
-rw-r--r--src/db/plugins/simple/Mount.cxx2
-rw-r--r--src/db/plugins/simple/Mount.hxx2
-rw-r--r--src/db/plugins/simple/PrefixedLightSong.hxx2
-rw-r--r--src/db/plugins/simple/SimpleDatabasePlugin.cxx74
-rw-r--r--src/db/plugins/simple/SimpleDatabasePlugin.hxx10
-rw-r--r--src/db/plugins/simple/Song.cxx2
-rw-r--r--src/db/plugins/simple/Song.hxx6
-rw-r--r--src/db/plugins/simple/SongSort.cxx2
-rw-r--r--src/db/plugins/simple/SongSort.hxx2
-rw-r--r--src/db/plugins/upnp/ContentDirectoryService.cxx2
-rw-r--r--src/db/plugins/upnp/Directory.cxx62
-rw-r--r--src/db/plugins/upnp/Directory.hxx2
-rw-r--r--src/db/plugins/upnp/Object.cxx2
-rw-r--r--src/db/plugins/upnp/Object.hxx29
-rw-r--r--src/db/plugins/upnp/Tags.cxx2
-rw-r--r--src/db/plugins/upnp/Tags.hxx2
-rw-r--r--src/db/plugins/upnp/UpnpDatabasePlugin.cxx38
-rw-r--r--src/db/plugins/upnp/UpnpDatabasePlugin.hxx2
-rw-r--r--src/db/update/Archive.cxx6
-rw-r--r--src/db/update/Container.cxx11
-rw-r--r--src/db/update/Editor.cxx2
-rw-r--r--src/db/update/Editor.hxx2
-rw-r--r--src/db/update/ExcludeList.cxx46
-rw-r--r--src/db/update/ExcludeList.hxx2
-rw-r--r--src/db/update/InotifyDomain.cxx2
-rw-r--r--src/db/update/InotifyDomain.hxx2
-rw-r--r--src/db/update/InotifyQueue.cxx2
-rw-r--r--src/db/update/InotifyQueue.hxx2
-rw-r--r--src/db/update/InotifySource.cxx12
-rw-r--r--src/db/update/InotifySource.hxx13
-rw-r--r--src/db/update/InotifyUpdate.cxx17
-rw-r--r--src/db/update/InotifyUpdate.hxx4
-rw-r--r--src/db/update/Queue.cxx2
-rw-r--r--src/db/update/Queue.hxx2
-rw-r--r--src/db/update/Remove.cxx2
-rw-r--r--src/db/update/Remove.hxx2
-rw-r--r--src/db/update/Service.cxx2
-rw-r--r--src/db/update/Service.hxx2
-rw-r--r--src/db/update/UpdateDomain.cxx2
-rw-r--r--src/db/update/UpdateDomain.hxx2
-rw-r--r--src/db/update/UpdateIO.cxx12
-rw-r--r--src/db/update/UpdateIO.hxx8
-rw-r--r--src/db/update/UpdateSong.cxx6
-rw-r--r--src/db/update/Walk.cxx26
-rw-r--r--src/db/update/Walk.hxx28
93 files changed, 363 insertions, 299 deletions
diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx
index 625300d75..c71195769 100644
--- a/src/db/Configured.cxx
+++ b/src/db/Configured.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,8 @@
#include "Configured.hxx"
#include "DatabaseGlue.hxx"
#include "config/ConfigGlobal.hxx"
-#include "config/ConfigData.hxx"
+#include "config/Param.hxx"
+#include "config/Block.hxx"
#include "config/ConfigError.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/StandardDirectory.hxx"
@@ -32,8 +33,8 @@ Database *
CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener,
Error &error)
{
- const struct config_param *param = config_get_param(CONF_DATABASE);
- const struct config_param *path = config_get_param(CONF_DB_FILE);
+ const auto *param = config_get_block(ConfigBlockOption::DATABASE);
+ const auto *path = config_get_param(ConfigOption::DB_FILE);
if (param != nullptr && path != nullptr) {
error.Format(config_domain,
@@ -42,10 +43,10 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener,
return nullptr;
}
- struct config_param *allocated = nullptr;
+ ConfigBlock *allocated = nullptr;
if (param == nullptr && path != nullptr) {
- allocated = new config_param("database", path->line);
+ allocated = new ConfigBlock(path->line);
allocated->AddBlockParam("path", path->value.c_str(),
path->line);
param = allocated;
@@ -58,10 +59,14 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener,
if (cache_dir.IsNull())
return nullptr;
- const auto db_file = AllocatedPath::Build(cache_dir, "mpd.db");
+ const auto db_file = AllocatedPath::Build(cache_dir,
+ PATH_LITERAL("mpd.db"));
+ const auto db_file_utf8 = db_file.ToUTF8();
+ if (db_file_utf8.empty())
+ return nullptr;
- allocated = new config_param("database");
- allocated->AddBlockParam("path", db_file.c_str(), -1);
+ allocated = new ConfigBlock();
+ allocated->AddBlockParam("path", db_file_utf8.c_str(), -1);
param = allocated;
}
diff --git a/src/db/Configured.hxx b/src/db/Configured.hxx
index 5d25b701c..aed2c2bf4 100644
--- a/src/db/Configured.hxx
+++ b/src/db/Configured.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Count.cxx b/src/db/Count.cxx
index e5e244a6a..3e974deca 100644
--- a/src/db/Count.cxx
+++ b/src/db/Count.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Count.hxx b/src/db/Count.hxx
index d22a3210d..d9f28cb03 100644
--- a/src/db/Count.hxx
+++ b/src/db/Count.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabaseError.cxx b/src/db/DatabaseError.cxx
index e0cbdd6a3..cf1993de2 100644
--- a/src/db/DatabaseError.cxx
+++ b/src/db/DatabaseError.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabaseError.hxx b/src/db/DatabaseError.hxx
index c71bbdfff..542548c73 100644
--- a/src/db/DatabaseError.hxx
+++ b/src/db/DatabaseError.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabaseGlue.cxx b/src/db/DatabaseGlue.cxx
index ade5c95f3..193b672e9 100644
--- a/src/db/DatabaseGlue.cxx
+++ b/src/db/DatabaseGlue.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,17 +22,17 @@
#include "Registry.hxx"
#include "DatabaseError.hxx"
#include "util/Error.hxx"
-#include "config/ConfigData.hxx"
+#include "config/Block.hxx"
#include "DatabasePlugin.hxx"
#include <string.h>
Database *
DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener,
- const config_param &param, Error &error)
+ const ConfigBlock &block, Error &error)
{
const char *plugin_name =
- param.GetBlockValue("plugin", "simple");
+ block.GetBlockValue("plugin", "simple");
const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name);
if (plugin == nullptr) {
@@ -41,5 +41,5 @@ DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener,
return nullptr;
}
- return plugin->create(loop, listener, param, error);
+ return plugin->create(loop, listener, block, error);
}
diff --git a/src/db/DatabaseGlue.hxx b/src/db/DatabaseGlue.hxx
index 70b50def3..95401d54a 100644
--- a/src/db/DatabaseGlue.hxx
+++ b/src/db/DatabaseGlue.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,7 +22,7 @@
#include "Compiler.h"
-struct config_param;
+struct ConfigBlock;
class EventLoop;
class DatabaseListener;
class Database;
@@ -31,10 +31,10 @@ class Error;
/**
* Initialize the database library.
*
- * @param param the database configuration block
+ * @param block the database configuration block
*/
Database *
DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener,
- const config_param &param, Error &error);
+ const ConfigBlock &block, Error &error);
#endif
diff --git a/src/db/DatabaseListener.hxx b/src/db/DatabaseListener.hxx
index 8b410c2f5..5af3bff90 100644
--- a/src/db/DatabaseListener.hxx
+++ b/src/db/DatabaseListener.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabaseLock.cxx b/src/db/DatabaseLock.cxx
index c0b5e4844..ab4628722 100644
--- a/src/db/DatabaseLock.cxx
+++ b/src/db/DatabaseLock.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabaseLock.hxx b/src/db/DatabaseLock.hxx
index 9d0b0c152..786c97899 100644
--- a/src/db/DatabaseLock.hxx
+++ b/src/db/DatabaseLock.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabasePlaylist.cxx b/src/db/DatabasePlaylist.cxx
index f1cfdc874..d1e042c6a 100644
--- a/src/db/DatabasePlaylist.cxx
+++ b/src/db/DatabasePlaylist.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabasePlaylist.hxx b/src/db/DatabasePlaylist.hxx
index 9dc3526bb..333a36dc2 100644
--- a/src/db/DatabasePlaylist.hxx
+++ b/src/db/DatabasePlaylist.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabasePlugin.hxx b/src/db/DatabasePlugin.hxx
index 831101786..116aa59d2 100644
--- a/src/db/DatabasePlugin.hxx
+++ b/src/db/DatabasePlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
#ifndef MPD_DATABASE_PLUGIN_HXX
#define MPD_DATABASE_PLUGIN_HXX
-struct config_param;
+struct ConfigBlock;
class Error;
class EventLoop;
class DatabaseListener;
@@ -47,7 +47,7 @@ struct DatabasePlugin {
* Allocates and configures a database.
*/
Database *(*create)(EventLoop &loop, DatabaseListener &listener,
- const config_param &param,
+ const ConfigBlock &block,
Error &error);
constexpr bool RequireStorage() const {
diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx
index 498aedf97..33a4c65fe 100644
--- a/src/db/DatabasePrint.cxx
+++ b/src/db/DatabasePrint.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -147,27 +147,50 @@ PrintPlaylistFull(Client &client, bool base,
bool
db_selection_print(Client &client, const DatabaseSelection &selection,
- bool full, bool base, Error &error)
+ bool full, bool base,
+ unsigned window_start, unsigned window_end,
+ Error &error)
{
const Database *db = client.GetDatabase(error);
if (db == nullptr)
return false;
+ unsigned i = 0;
+
using namespace std::placeholders;
const auto d = selection.filter == nullptr
? std::bind(full ? PrintDirectoryFull : PrintDirectoryBrief,
std::ref(client), base, _1)
: VisitDirectory();
- const auto s = std::bind(full ? PrintSongFull : PrintSongBrief,
- std::ref(client), base, _1);
+ VisitSong s = std::bind(full ? PrintSongFull : PrintSongBrief,
+ std::ref(client), base, _1);
const auto p = selection.filter == nullptr
? std::bind(full ? PrintPlaylistFull : PrintPlaylistBrief,
std::ref(client), base, _1, _2)
: VisitPlaylist();
+ if (window_start > 0 ||
+ window_end < (unsigned)std::numeric_limits<int>::max())
+ s = [s, window_start, window_end, &i](const LightSong &song,
+ Error &error2){
+ const bool in_window = i >= window_start && i < window_end;
+ ++i;
+ return !in_window || s(song, error2);
+ };
+
return db->Visit(selection, d, s, p, error);
}
+bool
+db_selection_print(Client &client, const DatabaseSelection &selection,
+ bool full, bool base,
+ Error &error)
+{
+ return db_selection_print(client, selection, full, base,
+ 0, std::numeric_limits<int>::max(),
+ error);
+}
+
static bool
PrintSongURIVisitor(Client &client, const LightSong &song)
{
diff --git a/src/db/DatabasePrint.hxx b/src/db/DatabasePrint.hxx
index 2ab5e703d..1c228a507 100644
--- a/src/db/DatabasePrint.hxx
+++ b/src/db/DatabasePrint.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -38,6 +38,12 @@ db_selection_print(Client &client, const DatabaseSelection &selection,
bool full, bool base, Error &error);
bool
+db_selection_print(Client &client, const DatabaseSelection &selection,
+ bool full, bool base,
+ unsigned window_start, unsigned window_end,
+ Error &error);
+
+bool
PrintUniqueTags(Client &client, unsigned type, uint32_t group_mask,
const SongFilter *filter,
Error &error);
diff --git a/src/db/DatabaseQueue.cxx b/src/db/DatabaseQueue.cxx
index 490678188..c605e0878 100644
--- a/src/db/DatabaseQueue.cxx
+++ b/src/db/DatabaseQueue.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabaseQueue.hxx b/src/db/DatabaseQueue.hxx
index e653f973c..e9ec7bde2 100644
--- a/src/db/DatabaseQueue.hxx
+++ b/src/db/DatabaseQueue.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabaseSong.cxx b/src/db/DatabaseSong.cxx
index dd27aa8b3..d2475841b 100644
--- a/src/db/DatabaseSong.cxx
+++ b/src/db/DatabaseSong.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/DatabaseSong.hxx b/src/db/DatabaseSong.hxx
index 4daaf4047..c83f9562a 100644
--- a/src/db/DatabaseSong.hxx
+++ b/src/db/DatabaseSong.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Helpers.cxx b/src/db/Helpers.cxx
index add4bb98e..d4c29f405 100644
--- a/src/db/Helpers.cxx
+++ b/src/db/Helpers.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -46,7 +46,7 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
for (const auto &item : tag) {
switch (item.type) {
case TAG_ARTIST:
-#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
+#if CLANG_OR_GCC_VERSION(4,8)
artists.emplace(item.value);
#else
artists.insert(item.value);
@@ -54,7 +54,7 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
break;
case TAG_ALBUM:
-#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
+#if CLANG_OR_GCC_VERSION(4,8)
albums.emplace(item.value);
#else
albums.insert(item.value);
diff --git a/src/db/Helpers.hxx b/src/db/Helpers.hxx
index 651bac0e0..5fcab2d7f 100644
--- a/src/db/Helpers.hxx
+++ b/src/db/Helpers.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Interface.hxx b/src/db/Interface.hxx
index 152928c79..b951a9c22 100644
--- a/src/db/Interface.hxx
+++ b/src/db/Interface.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/LightDirectory.hxx b/src/db/LightDirectory.hxx
index d134151a4..ad5d34590 100644
--- a/src/db/LightDirectory.hxx
+++ b/src/db/LightDirectory.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/LightSong.cxx b/src/db/LightSong.cxx
index 5cdebc133..9202b1b30 100644
--- a/src/db/LightSong.cxx
+++ b/src/db/LightSong.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/LightSong.hxx b/src/db/LightSong.hxx
index bbd449fbe..3c289cce0 100644
--- a/src/db/LightSong.hxx
+++ b/src/db/LightSong.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/PlaylistInfo.hxx b/src/db/PlaylistInfo.hxx
index baa6cc361..f319cbcb6 100644
--- a/src/db/PlaylistInfo.hxx
+++ b/src/db/PlaylistInfo.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/PlaylistVector.cxx b/src/db/PlaylistVector.cxx
index 82a3519d9..1fffbc375 100644
--- a/src/db/PlaylistVector.cxx
+++ b/src/db/PlaylistVector.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/PlaylistVector.hxx b/src/db/PlaylistVector.hxx
index accd4fd42..7cb192dc0 100644
--- a/src/db/PlaylistVector.hxx
+++ b/src/db/PlaylistVector.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Registry.cxx b/src/db/Registry.cxx
index 5681a9b82..dc7807774 100644
--- a/src/db/Registry.cxx
+++ b/src/db/Registry.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -28,10 +28,10 @@
const DatabasePlugin *const database_plugins[] = {
&simple_db_plugin,
-#ifdef HAVE_LIBMPDCLIENT
+#ifdef ENABLE_LIBMPDCLIENT
&proxy_db_plugin,
#endif
-#ifdef HAVE_LIBUPNP
+#ifdef ENABLE_UPNP
&upnp_db_plugin,
#endif
nullptr
diff --git a/src/db/Registry.hxx b/src/db/Registry.hxx
index 050842e21..9f672f25e 100644
--- a/src/db/Registry.hxx
+++ b/src/db/Registry.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Selection.cxx b/src/db/Selection.cxx
index a886916cb..4a4016485 100644
--- a/src/db/Selection.cxx
+++ b/src/db/Selection.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Selection.hxx b/src/db/Selection.hxx
index 9802603fc..7216f5017 100644
--- a/src/db/Selection.hxx
+++ b/src/db/Selection.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Stats.hxx b/src/db/Stats.hxx
index 131a5dc47..c16dcc9c6 100644
--- a/src/db/Stats.hxx
+++ b/src/db/Stats.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/UniqueTags.cxx b/src/db/UniqueTags.cxx
index 589dc936d..4c01fdf69 100644
--- a/src/db/UniqueTags.cxx
+++ b/src/db/UniqueTags.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/UniqueTags.hxx b/src/db/UniqueTags.hxx
index 61004fc56..b44afe464 100644
--- a/src/db/UniqueTags.hxx
+++ b/src/db/UniqueTags.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Uri.hxx b/src/db/Uri.hxx
index 04960ba80..12acabe4a 100644
--- a/src/db/Uri.hxx
+++ b/src/db/Uri.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/Visitor.hxx b/src/db/Visitor.hxx
index c524f1722..1f6008117 100644
--- a/src/db/Visitor.hxx
+++ b/src/db/Visitor.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/LazyDatabase.cxx b/src/db/plugins/LazyDatabase.cxx
index bc52395c5..8c4901735 100644
--- a/src/db/plugins/LazyDatabase.cxx
+++ b/src/db/plugins/LazyDatabase.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/LazyDatabase.hxx b/src/db/plugins/LazyDatabase.hxx
index 38b3fdc2a..88bbcf170 100644
--- a/src/db/plugins/LazyDatabase.hxx
+++ b/src/db/plugins/LazyDatabase.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx
index 5fd224bb5..67c651e83 100644
--- a/src/db/plugins/ProxyDatabasePlugin.cxx
+++ b/src/db/plugins/ProxyDatabasePlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -30,7 +30,7 @@
#include "db/Stats.hxx"
#include "SongFilter.hxx"
#include "Compiler.h"
-#include "config/ConfigData.hxx"
+#include "config/Block.hxx"
#include "tag/TagBuilder.hxx"
#include "tag/Tag.hxx"
#include "util/Error.hxx"
@@ -71,6 +71,7 @@ class ProxyDatabase final : public Database, SocketMonitor, IdleMonitor {
std::string host;
unsigned port;
+ bool keepalive;
struct mpd_connection *connection;
@@ -96,7 +97,7 @@ public:
listener(_listener) {}
static Database *Create(EventLoop &loop, DatabaseListener &listener,
- const config_param &param,
+ const ConfigBlock &block,
Error &error);
virtual bool Open(Error &error) override;
@@ -128,7 +129,7 @@ public:
}
private:
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
bool Connect(Error &error);
bool CheckConnection(Error &error);
@@ -320,10 +321,10 @@ SendConstraints(mpd_connection *connection, const DatabaseSelection &selection)
Database *
ProxyDatabase::Create(EventLoop &loop, DatabaseListener &listener,
- const config_param &param, Error &error)
+ const ConfigBlock &block, Error &error)
{
ProxyDatabase *db = new ProxyDatabase(loop, listener);
- if (!db->Configure(param, error)) {
+ if (!db->Configure(block, error)) {
delete db;
db = nullptr;
}
@@ -332,10 +333,11 @@ ProxyDatabase::Create(EventLoop &loop, DatabaseListener &listener,
}
bool
-ProxyDatabase::Configure(const config_param &param, gcc_unused Error &error)
+ProxyDatabase::Configure(const ConfigBlock &block, gcc_unused Error &error)
{
- host = param.GetBlockValue("host", "");
- port = param.GetBlockValue("port", 0u);
+ host = block.GetBlockValue("host", "");
+ port = block.GetBlockValue("port", 0u);
+ keepalive = block.GetBlockValue("keepalive", false);
return true;
}
@@ -376,6 +378,10 @@ ProxyDatabase::Connect(Error &error)
return false;
}
+#if LIBMPDCLIENT_CHECK_VERSION(2, 10, 0)
+ mpd_connection_set_keepalive(connection, keepalive);
+#endif
+
idle_received = unsigned(-1);
is_idle = false;
diff --git a/src/db/plugins/ProxyDatabasePlugin.hxx b/src/db/plugins/ProxyDatabasePlugin.hxx
index 699d374b5..590e5f5d2 100644
--- a/src/db/plugins/ProxyDatabasePlugin.hxx
+++ b/src/db/plugins/ProxyDatabasePlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/DatabaseSave.cxx b/src/db/plugins/simple/DatabaseSave.cxx
index c766843b6..36e310bc9 100644
--- a/src/db/plugins/simple/DatabaseSave.cxx
+++ b/src/db/plugins/simple/DatabaseSave.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/DatabaseSave.hxx b/src/db/plugins/simple/DatabaseSave.hxx
index bb7f57115..5a8a60a92 100644
--- a/src/db/plugins/simple/DatabaseSave.hxx
+++ b/src/db/plugins/simple/DatabaseSave.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/Directory.cxx b/src/db/plugins/simple/Directory.cxx
index 218652b03..b795ee713 100644
--- a/src/db/plugins/simple/Directory.cxx
+++ b/src/db/plugins/simple/Directory.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/Directory.hxx b/src/db/plugins/simple/Directory.hxx
index acef62143..115030a8c 100644
--- a/src/db/plugins/simple/Directory.hxx
+++ b/src/db/plugins/simple/Directory.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/DirectorySave.cxx b/src/db/plugins/simple/DirectorySave.cxx
index e1650cbe8..5a7eb6da6 100644
--- a/src/db/plugins/simple/DirectorySave.cxx
+++ b/src/db/plugins/simple/DirectorySave.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/DirectorySave.hxx b/src/db/plugins/simple/DirectorySave.hxx
index f464f9946..3948db02b 100644
--- a/src/db/plugins/simple/DirectorySave.hxx
+++ b/src/db/plugins/simple/DirectorySave.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/Mount.cxx b/src/db/plugins/simple/Mount.cxx
index 96c7bbb5c..8898a6e9c 100644
--- a/src/db/plugins/simple/Mount.cxx
+++ b/src/db/plugins/simple/Mount.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/Mount.hxx b/src/db/plugins/simple/Mount.hxx
index a4690114c..ece644b8a 100644
--- a/src/db/plugins/simple/Mount.hxx
+++ b/src/db/plugins/simple/Mount.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/PrefixedLightSong.hxx b/src/db/plugins/simple/PrefixedLightSong.hxx
index 3664de001..16da747e3 100644
--- a/src/db/plugins/simple/PrefixedLightSong.hxx
+++ b/src/db/plugins/simple/PrefixedLightSong.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx
index d6ad5e91f..27965c0eb 100644
--- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx
+++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -34,14 +34,15 @@
#include "fs/io/TextFile.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "fs/io/FileOutputStream.hxx"
-#include "config/ConfigData.hxx"
+#include "fs/FileInfo.hxx"
+#include "config/Block.hxx"
#include "fs/FileSystem.hxx"
#include "util/CharUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
#include "fs/io/GzipOutputStream.hxx"
#endif
@@ -52,21 +53,21 @@ static constexpr Domain simple_db_domain("simple_db");
inline SimpleDatabase::SimpleDatabase()
:Database(simple_db_plugin),
path(AllocatedPath::Null()),
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
compress(true),
#endif
cache_path(AllocatedPath::Null()),
prefixed_light_song(nullptr) {}
inline SimpleDatabase::SimpleDatabase(AllocatedPath &&_path,
-#ifndef HAVE_ZLIB
+#ifndef ENABLE_ZLIB
gcc_unused
#endif
bool _compress)
:Database(simple_db_plugin),
path(std::move(_path)),
path_utf8(path.ToUTF8()),
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
compress(_compress),
#endif
cache_path(AllocatedPath::Null()),
@@ -76,10 +77,10 @@ inline SimpleDatabase::SimpleDatabase(AllocatedPath &&_path,
Database *
SimpleDatabase::Create(gcc_unused EventLoop &loop,
gcc_unused DatabaseListener &listener,
- const config_param &param, Error &error)
+ const ConfigBlock &block, Error &error)
{
SimpleDatabase *db = new SimpleDatabase();
- if (!db->Configure(param, error)) {
+ if (!db->Configure(block, error)) {
delete db;
db = nullptr;
}
@@ -88,9 +89,9 @@ SimpleDatabase::Create(gcc_unused EventLoop &loop,
}
bool
-SimpleDatabase::Configure(const config_param &param, Error &error)
+SimpleDatabase::Configure(const ConfigBlock &block, Error &error)
{
- path = param.GetBlockPath("path", error);
+ path = block.GetBlockPath("path", error);
if (path.IsNull()) {
if (!error.IsDefined())
error.Set(simple_db_domain,
@@ -100,12 +101,12 @@ SimpleDatabase::Configure(const config_param &param, Error &error)
path_utf8 = path.ToUTF8();
- cache_path = param.GetBlockPath("cache_directory", error);
+ cache_path = block.GetBlockPath("cache_directory", error);
if (path.IsNull() && error.IsDefined())
return false;
-#ifdef HAVE_ZLIB
- compress = param.GetBlockValue("compress", compress);
+#ifdef ENABLE_ZLIB
+ compress = block.GetBlockValue("compress", compress);
#endif
return true;
@@ -117,22 +118,20 @@ SimpleDatabase::Check(Error &error) const
assert(!path.IsNull());
/* Check if the file exists */
- if (!CheckAccess(path)) {
+ if (!PathExists(path)) {
/* If the file doesn't exist, we can't check if we can write
* it, so we are going to try to get the directory path, and
* see if we can write a file in that */
const auto dirPath = path.GetDirectoryName();
/* Check that the parent part of the path is a directory */
- struct stat st;
- if (!StatFile(dirPath, st)) {
- error.FormatErrno("Couldn't stat parent directory of db file "
- "\"%s\"",
- path_utf8.c_str());
+ FileInfo fi;
+ if (!GetFileInfo(dirPath, fi, error)) {
+ error.AddPrefix("On parent directory of db file: ");
return false;
}
- if (!S_ISDIR(st.st_mode)) {
+ if (!fi.IsDirectory()) {
error.Format(simple_db_domain,
"Couldn't create db file \"%s\" because the "
"parent path is not a directory",
@@ -154,14 +153,11 @@ SimpleDatabase::Check(Error &error) const
}
/* Path exists, now check if it's a regular file */
- struct stat st;
- if (!StatFile(path, st)) {
- error.FormatErrno("Couldn't stat db file \"%s\"",
- path_utf8.c_str());
+ FileInfo fi;
+ if (!GetFileInfo(path, fi, error))
return false;
- }
- if (!S_ISREG(st.st_mode)) {
+ if (!fi.IsRegular()) {
error.Format(simple_db_domain,
"db file \"%s\" is not a regular file",
path_utf8.c_str());
@@ -193,9 +189,9 @@ SimpleDatabase::Load(Error &error)
if (!db_load_internal(file, *root, error) || !file.Check(error))
return false;
- struct stat st;
- if (StatFile(path, st))
- mtime = st.st_mtime;
+ FileInfo fi;
+ if (GetFileInfo(path, fi))
+ mtime = fi.GetModificationTime();
return true;
}
@@ -389,7 +385,7 @@ SimpleDatabase::Save(Error &error)
OutputStream *os = &fos;
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
GzipOutputStream *gzip = nullptr;
if (compress) {
gzip = new GzipOutputStream(*os, error);
@@ -407,13 +403,13 @@ SimpleDatabase::Save(Error &error)
db_save_internal(bos, *root);
if (!bos.Flush(error)) {
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
delete gzip;
#endif
return false;
}
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
if (gzip != nullptr) {
bool success = gzip->Flush(error);
delete gzip;
@@ -425,9 +421,9 @@ SimpleDatabase::Save(Error &error)
if (!fos.Commit(error))
return false;
- struct stat st;
- if (StatFile(path, st))
- mtime = st.st_mtime;
+ FileInfo fi;
+ if (GetFileInfo(path, fi))
+ mtime = fi.GetModificationTime();
return true;
}
@@ -487,11 +483,15 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri,
std::string name(storage_uri);
std::replace_if(name.begin(), name.end(), IsUnsafeChar, '_');
-#ifndef HAVE_ZLIB
+ const auto name_fs = AllocatedPath::FromUTF8(name.c_str(), error);
+ if (name_fs.IsNull())
+ return false;
+
+#ifndef ENABLE_ZLIB
constexpr bool compress = false;
#endif
auto db = new SimpleDatabase(AllocatedPath::Build(cache_path,
- name.c_str()),
+ name_fs.c_str()),
compress);
if (!db->Open(error)) {
delete db;
diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.hxx b/src/db/plugins/simple/SimpleDatabasePlugin.hxx
index d82225f8c..fc720ecf8 100644
--- a/src/db/plugins/simple/SimpleDatabasePlugin.hxx
+++ b/src/db/plugins/simple/SimpleDatabasePlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,7 @@
#include <cassert>
-struct config_param;
+struct ConfigBlock;
struct Directory;
struct DatabasePlugin;
class EventLoop;
@@ -39,7 +39,7 @@ class SimpleDatabase : public Database {
AllocatedPath path;
std::string path_utf8;
-#ifdef HAVE_ZLIB
+#ifdef ENABLE_ZLIB
bool compress;
#endif
@@ -73,7 +73,7 @@ class SimpleDatabase : public Database {
public:
static Database *Create(EventLoop &loop, DatabaseListener &listener,
- const config_param &param,
+ const ConfigBlock &block,
Error &error);
gcc_pure
@@ -134,7 +134,7 @@ public:
}
private:
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
gcc_pure
bool Check(Error &error) const;
diff --git a/src/db/plugins/simple/Song.cxx b/src/db/plugins/simple/Song.cxx
index fbfc2ec19..b2515a2d5 100644
--- a/src/db/plugins/simple/Song.cxx
+++ b/src/db/plugins/simple/Song.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/Song.hxx b/src/db/plugins/simple/Song.hxx
index 9f3a4a3ef..c83bbace0 100644
--- a/src/db/plugins/simple/Song.hxx
+++ b/src/db/plugins/simple/Song.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,7 @@
#ifndef MPD_SONG_HXX
#define MPD_SONG_HXX
+#include "check.h"
#include "Chrono.hxx"
#include "tag/Tag.hxx"
#include "Compiler.h"
@@ -109,7 +110,10 @@ struct Song {
void Free();
bool UpdateFile(Storage &storage);
+
+#ifdef ENABLE_ARCHIVE
bool UpdateFileInArchive(const Storage &storage);
+#endif
/**
* Returns the URI of the song in UTF-8 encoding, including its
diff --git a/src/db/plugins/simple/SongSort.cxx b/src/db/plugins/simple/SongSort.cxx
index 4b7144937..70299a2d4 100644
--- a/src/db/plugins/simple/SongSort.cxx
+++ b/src/db/plugins/simple/SongSort.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/simple/SongSort.hxx b/src/db/plugins/simple/SongSort.hxx
index 2a0c4383b..0a75c9fda 100644
--- a/src/db/plugins/simple/SongSort.hxx
+++ b/src/db/plugins/simple/SongSort.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/upnp/ContentDirectoryService.cxx b/src/db/plugins/upnp/ContentDirectoryService.cxx
index 88d4bd644..d98559c7b 100644
--- a/src/db/plugins/upnp/ContentDirectoryService.cxx
+++ b/src/db/plugins/upnp/ContentDirectoryService.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/upnp/Directory.cxx b/src/db/plugins/upnp/Directory.cxx
index e94a1a997..894a53c6a 100644
--- a/src/db/plugins/upnp/Directory.cxx
+++ b/src/db/plugins/upnp/Directory.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -89,18 +89,18 @@ ParseDuration(const char *duration)
* this. Twonky returns directory names (titles) like 'Artist/Album'.
*/
gcc_pure
-static std::string
-titleToPathElt(std::string &&s)
+static std::string &&
+TitleToPathSegment(std::string &&s)
{
std::replace(s.begin(), s.end(), '/', '_');
- return s;
+ return std::move(s);
}
/**
* An XML parser which builds directory contents from DIDL lite input.
*/
class UPnPDirParser final : public CommonExpatParser {
- UPnPDirContent &m_dir;
+ UPnPDirContent &directory;
enum {
NONE,
@@ -120,22 +120,22 @@ class UPnPDirParser final : public CommonExpatParser {
*/
std::string value;
- UPnPDirObject m_tobj;
+ UPnPDirObject object;
TagBuilder tag;
public:
- UPnPDirParser(UPnPDirContent& dir)
- :m_dir(dir),
+ UPnPDirParser(UPnPDirContent &_directory)
+ :directory(_directory),
state(NONE),
tag_type(TAG_NUM_OF_ITEM_TYPES)
{
- m_tobj.clear();
+ object.Clear();
}
protected:
virtual void StartElement(const XML_Char *name, const XML_Char **attrs)
{
- if (m_tobj.type != UPnPDirObject::Type::UNKNOWN &&
+ if (object.type != UPnPDirObject::Type::UNKNOWN &&
tag_type == TAG_NUM_OF_ITEM_TYPES) {
tag_type = tag_table_lookup(upnp_tags, name);
if (tag_type != TAG_NUM_OF_ITEM_TYPES)
@@ -147,31 +147,31 @@ protected:
switch (name[0]) {
case 'c':
if (!strcmp(name, "container")) {
- m_tobj.clear();
- m_tobj.type = UPnPDirObject::Type::CONTAINER;
+ object.Clear();
+ object.type = UPnPDirObject::Type::CONTAINER;
const char *id = GetAttribute(attrs, "id");
if (id != nullptr)
- m_tobj.m_id = id;
+ object.id = id;
const char *pid = GetAttribute(attrs, "parentID");
if (pid != nullptr)
- m_tobj.m_pid = pid;
+ object.parent_id = pid;
}
break;
case 'i':
if (!strcmp(name, "item")) {
- m_tobj.clear();
- m_tobj.type = UPnPDirObject::Type::ITEM;
+ object.Clear();
+ object.type = UPnPDirObject::Type::ITEM;
const char *id = GetAttribute(attrs, "id");
if (id != nullptr)
- m_tobj.m_id = id;
+ object.id = id;
const char *pid = GetAttribute(attrs, "parentID");
if (pid != nullptr)
- m_tobj.m_pid = pid;
+ object.parent_id = pid;
}
break;
@@ -197,25 +197,15 @@ protected:
}
}
- bool checkobjok() {
- if (m_tobj.m_id.empty() || m_tobj.m_pid.empty() ||
- m_tobj.name.empty() ||
- (m_tobj.type == UPnPDirObject::Type::ITEM &&
- m_tobj.item_class == UPnPDirObject::ItemClass::UNKNOWN))
- return false;
-
- return true;
- }
-
virtual void EndElement(const XML_Char *name)
{
if (tag_type != TAG_NUM_OF_ITEM_TYPES) {
- assert(m_tobj.type != UPnPDirObject::Type::UNKNOWN);
+ assert(object.type != UPnPDirObject::Type::UNKNOWN);
tag.AddItem(tag_type, value.c_str());
if (tag_type == TAG_TITLE)
- m_tobj.name = titleToPathElt(std::move(value));
+ object.name = TitleToPathSegment(std::move(value));
value.clear();
tag_type = TAG_NUM_OF_ITEM_TYPES;
@@ -223,9 +213,9 @@ protected:
}
if ((!strcmp(name, "container") || !strcmp(name, "item")) &&
- checkobjok()) {
- tag.Commit(m_tobj.tag);
- m_dir.objects.emplace_back(std::move(m_tobj));
+ object.Check()) {
+ tag.Commit(object.tag);
+ directory.objects.emplace_back(std::move(object));
}
state = NONE;
@@ -234,7 +224,7 @@ protected:
virtual void CharacterData(const XML_Char *s, int len)
{
if (tag_type != TAG_NUM_OF_ITEM_TYPES) {
- assert(m_tobj.type != UPnPDirObject::Type::UNKNOWN);
+ assert(object.type != UPnPDirObject::Type::UNKNOWN);
value.append(s, len);
return;
@@ -245,11 +235,11 @@ protected:
break;
case RES:
- m_tobj.url.assign(s, len);
+ object.url.assign(s, len);
break;
case CLASS:
- m_tobj.item_class = ParseItemClass(s, len);
+ object.item_class = ParseItemClass(s, len);
break;
}
}
diff --git a/src/db/plugins/upnp/Directory.hxx b/src/db/plugins/upnp/Directory.hxx
index 433979900..639f2bcbe 100644
--- a/src/db/plugins/upnp/Directory.hxx
+++ b/src/db/plugins/upnp/Directory.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/upnp/Object.cxx b/src/db/plugins/upnp/Object.cxx
index 703fb0be4..0b5c4be88 100644
--- a/src/db/plugins/upnp/Object.cxx
+++ b/src/db/plugins/upnp/Object.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/upnp/Object.hxx b/src/db/plugins/upnp/Object.hxx
index 16a66c774..aced04b27 100644
--- a/src/db/plugins/upnp/Object.hxx
+++ b/src/db/plugins/upnp/Object.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,7 @@
#define MPD_UPNP_OBJECT_HXX
#include "tag/Tag.hxx"
+#include "Compiler.h"
#include <string>
@@ -50,8 +51,16 @@ public:
PLAYLIST,
};
- std::string m_id; // ObjectId
- std::string m_pid; // Parent ObjectId
+ /**
+ * ObjectId
+ */
+ std::string id;
+
+ /**
+ * Parent's ObjectId
+ */
+ std::string parent_id;
+
std::string url;
/**
@@ -71,15 +80,21 @@ public:
UPnPDirObject &operator=(UPnPDirObject &&) = default;
- void clear()
- {
- m_id.clear();
- m_pid.clear();
+ void Clear() {
+ id.clear();
+ parent_id.clear();
url.clear();
type = Type::UNKNOWN;
item_class = ItemClass::UNKNOWN;
tag.Clear();
}
+
+ gcc_pure
+ bool Check() const {
+ return !id.empty() && !parent_id.empty() && !name.empty() &&
+ (type != UPnPDirObject::Type::ITEM ||
+ item_class != UPnPDirObject::ItemClass::UNKNOWN);
+ }
};
#endif /* _UPNPDIRCONTENT_H_X_INCLUDED_ */
diff --git a/src/db/plugins/upnp/Tags.cxx b/src/db/plugins/upnp/Tags.cxx
index fd65df4d0..89d1b53c5 100644
--- a/src/db/plugins/upnp/Tags.cxx
+++ b/src/db/plugins/upnp/Tags.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/upnp/Tags.hxx b/src/db/plugins/upnp/Tags.hxx
index ec6d18478..8f85ce4b0 100644
--- a/src/db/plugins/upnp/Tags.hxx
+++ b/src/db/plugins/upnp/Tags.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
index 9970cdcf3..9d2d00eb6 100644
--- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -33,7 +33,7 @@
#include "db/LightDirectory.hxx"
#include "db/LightSong.hxx"
#include "db/Stats.hxx"
-#include "config/ConfigData.hxx"
+#include "config/Block.hxx"
#include "tag/TagBuilder.hxx"
#include "tag/TagTable.hxx"
#include "util/Error.hxx"
@@ -78,7 +78,7 @@ public:
UpnpDatabase():Database(upnp_db_plugin) {}
static Database *Create(EventLoop &loop, DatabaseListener &listener,
- const config_param &param,
+ const ConfigBlock &block,
Error &error);
virtual bool Open(Error &error) override;
@@ -106,7 +106,7 @@ public:
}
protected:
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
private:
bool VisitServer(const ContentDirectoryService &server,
@@ -158,10 +158,10 @@ private:
Database *
UpnpDatabase::Create(gcc_unused EventLoop &loop,
gcc_unused DatabaseListener &listener,
- const config_param &param, Error &error)
+ const ConfigBlock &block, Error &error)
{
UpnpDatabase *db = new UpnpDatabase();
- if (!db->Configure(param, error)) {
+ if (!db->Configure(block, error)) {
delete db;
return nullptr;
}
@@ -173,7 +173,7 @@ UpnpDatabase::Create(gcc_unused EventLoop &loop,
}
inline bool
-UpnpDatabase::Configure(const config_param &, Error &)
+UpnpDatabase::Configure(const ConfigBlock &, Error &)
{
return true;
}
@@ -222,7 +222,7 @@ UpnpDatabase::GetSong(const char *uri, Error &error) const
}
ContentDirectoryService server;
- if (!discovery->getServer(vpath.front().c_str(), server, error))
+ if (!discovery->GetServer(vpath.front().c_str(), server, error))
return nullptr;
vpath.pop_front();
@@ -414,7 +414,7 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server,
// So we return synthetic and ugly paths based on the object id,
// which we later have to detect.
const std::string path = songPath(server.getFriendlyName(),
- dirent.m_id);
+ dirent.id);
if (!visitSong(std::move(dirent), path.c_str(),
selection, visit_song,
error))
@@ -449,13 +449,13 @@ UpnpDatabase::BuildPath(const ContentDirectoryService &server,
std::string &path,
Error &error) const
{
- const char *pid = idirent.m_id.c_str();
+ const char *pid = idirent.id.c_str();
path.clear();
UPnPDirObject dirent;
while (strcmp(pid, rootid) != 0) {
if (!ReadNode(server, pid, dirent, error))
return false;
- pid = dirent.m_pid.c_str();
+ pid = dirent.parent_id.c_str();
if (path.empty())
path = dirent.name;
@@ -511,7 +511,7 @@ UpnpDatabase::Namei(const ContentDirectoryService &server,
return false;
}
- objid = std::move(child->m_id);
+ objid = std::move(child->id);
}
}
@@ -623,7 +623,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
}
std::string path = songPath(server.getFriendlyName(),
- dirent.m_id);
+ dirent.id);
if (!visitSong(std::move(dirent), path.c_str(),
selection,
visit_song, error))
@@ -642,7 +642,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
recursion (1-deep) here, which will handle the "add dir"
case. */
if (selection.recursive && selection.filter)
- return SearchSongs(server, tdirent.m_id.c_str(), selection,
+ return SearchSongs(server, tdirent.id.c_str(), selection,
visit_song, error);
const char *const base_uri = selection.uri.empty()
@@ -660,7 +660,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
and loop here, but it's not useful as mpd will only return
data to the client when we're done anyway. */
UPnPDirContent dirbuf;
- if (!server.readDir(handle, tdirent.m_id.c_str(), dirbuf,
+ if (!server.readDir(handle, tdirent.id.c_str(), dirbuf,
error))
return false;
@@ -689,7 +689,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
auto vpath = stringToTokens(selection.uri, "/", true);
if (vpath.empty()) {
std::vector<ContentDirectoryService> servers;
- if (!discovery->getDirServices(servers, error))
+ if (!discovery->GetDirectories(servers, error))
return false;
for (const auto &server : servers) {
@@ -714,7 +714,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
vpath.pop_front();
ContentDirectoryService server;
- if (!discovery->getServer(servername.c_str(), server, error))
+ if (!discovery->GetServer(servername.c_str(), server, error))
return false;
return VisitServer(server, vpath, selection,
@@ -733,7 +733,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
return true;
std::vector<ContentDirectoryService> servers;
- if (!discovery->getDirServices(servers, error))
+ if (!discovery->GetDirectories(servers, error))
return false;
std::set<std::string> values;
@@ -749,7 +749,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
const char *value = dirent.tag.GetValue(tag);
if (value != nullptr) {
-#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
+#if CLANG_OR_GCC_VERSION(4,8)
values.emplace(value);
#else
values.insert(value);
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.hxx b/src/db/plugins/upnp/UpnpDatabasePlugin.hxx
index 0228405cd..f03cde75d 100644
--- a/src/db/plugins/upnp/UpnpDatabasePlugin.hxx
+++ b/src/db/plugins/upnp/UpnpDatabasePlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/Archive.cxx b/src/db/update/Archive.cxx
index fc8f1fcbf..e818ab279 100644
--- a/src/db/update/Archive.cxx
+++ b/src/db/update/Archive.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -104,7 +104,7 @@ class UpdateArchiveVisitor final : public ArchiveVisitor {
*/
void
UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
- const FileInfo &info,
+ const StorageFileInfo &info,
const ArchivePlugin &plugin)
{
db_lock();
@@ -156,7 +156,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
bool
UpdateWalk::UpdateArchiveFile(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info)
+ const StorageFileInfo &info)
{
const ArchivePlugin *plugin = archive_plugin_from_suffix(suffix);
if (plugin == nullptr)
diff --git a/src/db/update/Container.cxx b/src/db/update/Container.cxx
index 1c420fa99..93ba5ff20 100644
--- a/src/db/update/Container.cxx
+++ b/src/db/update/Container.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -36,7 +36,7 @@
Directory *
UpdateWalk::MakeDirectoryIfModified(Directory &parent, const char *name,
- const FileInfo &info)
+ const StorageFileInfo &info)
{
Directory *directory = parent.FindChild(name);
@@ -69,7 +69,7 @@ SupportsContainerSuffix(const DecoderPlugin &plugin, const char *suffix)
bool
UpdateWalk::UpdateContainerFile(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info)
+ const StorageFileInfo &info)
{
const DecoderPlugin *_plugin = decoder_plugins_find([suffix](const DecoderPlugin &plugin){
return SupportsContainerSuffix(plugin, suffix);
@@ -106,8 +106,11 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
// shouldn't be necessary but it's there..
song->mtime = info.mtime;
+ const auto vtrack_fs = AllocatedPath::FromUTF8(vtrack);
+ // TODO: check vtrack_fs.IsNull()
+
const auto child_path_fs = AllocatedPath::Build(pathname,
- vtrack);
+ vtrack_fs);
plugin.ScanFile(child_path_fs,
add_tag_handler, &tag_builder);
diff --git a/src/db/update/Editor.cxx b/src/db/update/Editor.cxx
index 4136ccdad..2ca17f8cb 100644
--- a/src/db/update/Editor.cxx
+++ b/src/db/update/Editor.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/Editor.hxx b/src/db/update/Editor.hxx
index 58e23ed7a..cefb6c07f 100644
--- a/src/db/update/Editor.hxx
+++ b/src/db/update/Editor.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/ExcludeList.cxx b/src/db/update/ExcludeList.cxx
index cf92ac8f7..631d45206 100644
--- a/src/db/update/ExcludeList.cxx
+++ b/src/db/update/ExcludeList.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -25,36 +25,46 @@
#include "config.h"
#include "ExcludeList.hxx"
#include "fs/Path.hxx"
-#include "fs/FileSystem.hxx"
+#include "fs/NarrowPath.hxx"
+#include "fs/io/TextFile.hxx"
#include "util/StringUtil.hxx"
-#include "util/Domain.hxx"
+#include "util/Error.hxx"
#include "Log.hxx"
#include <assert.h>
#include <string.h>
#include <errno.h>
-static constexpr Domain exclude_list_domain("exclude_list");
+#ifdef HAVE_GLIB
+
+gcc_pure
+static bool
+IsFileNotFound(const Error &error)
+{
+#ifdef WIN32
+ return error.IsDomain(win32_domain) &&
+ error.GetCode() == ERROR_FILE_NOT_FOUND;
+#else
+ return error.IsDomain(errno_domain) && error.GetCode() == ENOENT;
+#endif
+}
+
+#endif
bool
ExcludeList::LoadFile(Path path_fs)
{
#ifdef HAVE_GLIB
- FILE *file = FOpen(path_fs, FOpenMode::ReadText);
- if (file == nullptr) {
- const int e = errno;
- if (e != ENOENT) {
- const auto path_utf8 = path_fs.ToUTF8();
- FormatErrno(exclude_list_domain,
- "Failed to open %s",
- path_utf8.c_str());
- }
-
+ Error error;
+ TextFile file(path_fs, error);
+ if (file.HasFailed()) {
+ if (!IsFileNotFound(error))
+ LogError(error);
return false;
}
- char line[1024];
- while (fgets(line, sizeof(line), file) != nullptr) {
+ char *line;
+ while ((line = file.ReadLine()) != nullptr) {
char *p = strchr(line, '#');
if (p != nullptr)
*p = 0;
@@ -63,8 +73,6 @@ ExcludeList::LoadFile(Path path_fs)
if (*p != 0)
patterns.emplace_front(p);
}
-
- fclose(file);
#else
// TODO: implement
(void)path_fs;
@@ -82,7 +90,7 @@ ExcludeList::Check(Path name_fs) const
#ifdef HAVE_GLIB
for (const auto &i : patterns)
- if (i.Check(name_fs.c_str()))
+ if (i.Check(NarrowPath(name_fs).c_str()))
return true;
#else
// TODO: implement
diff --git a/src/db/update/ExcludeList.hxx b/src/db/update/ExcludeList.hxx
index ef6c4d53e..ae196a7b2 100644
--- a/src/db/update/ExcludeList.hxx
+++ b/src/db/update/ExcludeList.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/InotifyDomain.cxx b/src/db/update/InotifyDomain.cxx
index 4a3ab2d79..18557a5ce 100644
--- a/src/db/update/InotifyDomain.cxx
+++ b/src/db/update/InotifyDomain.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/InotifyDomain.hxx b/src/db/update/InotifyDomain.hxx
index ad6202361..219ee7e4f 100644
--- a/src/db/update/InotifyDomain.hxx
+++ b/src/db/update/InotifyDomain.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/InotifyQueue.cxx b/src/db/update/InotifyQueue.cxx
index 013200f98..4b5269427 100644
--- a/src/db/update/InotifyQueue.cxx
+++ b/src/db/update/InotifyQueue.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/InotifyQueue.hxx b/src/db/update/InotifyQueue.hxx
index a9abc2969..dab7c7e8c 100644
--- a/src/db/update/InotifyQueue.hxx
+++ b/src/db/update/InotifyQueue.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/InotifySource.cxx b/src/db/update/InotifySource.cxx
index 233504ad6..b084dd60a 100644
--- a/src/db/update/InotifySource.cxx
+++ b/src/db/update/InotifySource.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
#include "InotifySource.hxx"
#include "InotifyDomain.hxx"
#include "util/Error.hxx"
-#include "system/fd_util.h"
+#include "system/FileDescriptor.hxx"
#include "system/FatalError.hxx"
#include "Log.hxx"
@@ -72,8 +72,8 @@ InotifySource::OnSocketReady(gcc_unused unsigned flags)
inline
InotifySource::InotifySource(EventLoop &_loop,
mpd_inotify_callback_t _callback, void *_ctx,
- int _fd)
- :SocketMonitor(_fd, _loop),
+ FileDescriptor _fd)
+ :SocketMonitor(_fd.Get(), _loop),
callback(_callback), callback_ctx(_ctx)
{
ScheduleRead();
@@ -85,8 +85,8 @@ InotifySource::Create(EventLoop &loop,
mpd_inotify_callback_t callback, void *callback_ctx,
Error &error)
{
- int fd = inotify_init_cloexec();
- if (fd < 0) {
+ FileDescriptor fd;
+ if (!fd.CreateInotify()) {
error.SetErrno("inotify_init() has failed");
return nullptr;
}
diff --git a/src/db/update/InotifySource.hxx b/src/db/update/InotifySource.hxx
index 2557680a0..34d84c2dd 100644
--- a/src/db/update/InotifySource.hxx
+++ b/src/db/update/InotifySource.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@
#include "Compiler.h"
class Error;
+class FileDescriptor;
typedef void (*mpd_inotify_callback_t)(int wd, unsigned mask,
const char *name, void *ctx);
@@ -33,7 +34,8 @@ class InotifySource final : private SocketMonitor {
void *callback_ctx;
InotifySource(EventLoop &_loop,
- mpd_inotify_callback_t callback, void *ctx, int fd);
+ mpd_inotify_callback_t callback, void *ctx,
+ FileDescriptor fd);
public:
~InotifySource() {
@@ -41,10 +43,11 @@ public:
}
/**
- * Creates a new inotify source and registers it in the GLib main
- * loop.
+ * Creates a new inotify source and registers it in the
+ * #EventLoop.
*
- * @param a callback invoked for events received from the kernel
+ * @param callback a callback invoked for events received from
+ * the kernel
*/
static InotifySource *Create(EventLoop &_loop,
mpd_inotify_callback_t callback,
diff --git a/src/db/update/InotifyUpdate.cxx b/src/db/update/InotifyUpdate.cxx
index 26bdddf8d..f699b7f78 100644
--- a/src/db/update/InotifyUpdate.cxx
+++ b/src/db/update/InotifyUpdate.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -24,7 +24,7 @@
#include "InotifyDomain.hxx"
#include "storage/StorageInterface.hxx"
#include "fs/AllocatedPath.hxx"
-#include "fs/FileSystem.hxx"
+#include "fs/FileInfo.hxx"
#include "util/Error.hxx"
#include "Log.hxx"
@@ -179,7 +179,6 @@ recursive_watch_subdirectories(WatchDirectory *directory,
}
while ((ent = readdir(dir))) {
- struct stat st;
int ret;
if (skip_path(ent->d_name))
@@ -187,15 +186,15 @@ recursive_watch_subdirectories(WatchDirectory *directory,
const auto child_path_fs =
AllocatedPath::Build(path_fs, ent->d_name);
- ret = StatFile(child_path_fs, st);
- if (ret < 0) {
- FormatErrno(inotify_domain,
- "Failed to stat %s",
- child_path_fs.c_str());
+
+ FileInfo fi;
+ if (!GetFileInfo(child_path_fs, fi, error)) {
+ LogError(error);
+ error.Clear();
continue;
}
- if (!S_ISDIR(st.st_mode))
+ if (!fi.IsDirectory())
continue;
ret = inotify_source->Add(child_path_fs.c_str(), IN_MASK,
diff --git a/src/db/update/InotifyUpdate.hxx b/src/db/update/InotifyUpdate.hxx
index 0f78db71f..82b6cdf04 100644
--- a/src/db/update/InotifyUpdate.hxx
+++ b/src/db/update/InotifyUpdate.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,6 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update,
unsigned max_depth);
void
-mpd_inotify_finish(void);
+mpd_inotify_finish();
#endif
diff --git a/src/db/update/Queue.cxx b/src/db/update/Queue.cxx
index 6d6d80131..870207fc6 100644
--- a/src/db/update/Queue.cxx
+++ b/src/db/update/Queue.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/Queue.hxx b/src/db/update/Queue.hxx
index 9064ea481..6c0a5733d 100644
--- a/src/db/update/Queue.hxx
+++ b/src/db/update/Queue.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/Remove.cxx b/src/db/update/Remove.cxx
index dfada05b2..0f1cbde1c 100644
--- a/src/db/update/Remove.cxx
+++ b/src/db/update/Remove.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/Remove.hxx b/src/db/update/Remove.hxx
index ce6d77d47..5ebfb884b 100644
--- a/src/db/update/Remove.hxx
+++ b/src/db/update/Remove.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/Service.cxx b/src/db/update/Service.cxx
index e8a1f6b02..e14dbdc6c 100644
--- a/src/db/update/Service.cxx
+++ b/src/db/update/Service.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/Service.hxx b/src/db/update/Service.hxx
index feaeaebc5..7dd198a7f 100644
--- a/src/db/update/Service.hxx
+++ b/src/db/update/Service.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/UpdateDomain.cxx b/src/db/update/UpdateDomain.cxx
index 80ad4fd22..68fcbe81c 100644
--- a/src/db/update/UpdateDomain.cxx
+++ b/src/db/update/UpdateDomain.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/UpdateDomain.hxx b/src/db/update/UpdateDomain.hxx
index a6e994390..8669d24b4 100644
--- a/src/db/update/UpdateDomain.hxx
+++ b/src/db/update/UpdateDomain.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/db/update/UpdateIO.cxx b/src/db/update/UpdateIO.cxx
index 9e43d1289..1a0f318c3 100644
--- a/src/db/update/UpdateIO.cxx
+++ b/src/db/update/UpdateIO.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -33,7 +33,7 @@
#include <unistd.h>
bool
-GetInfo(Storage &storage, const char *uri_utf8, FileInfo &info)
+GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info)
{
Error error;
bool success = storage.GetInfo(uri_utf8, true, info, error);
@@ -43,7 +43,7 @@ GetInfo(Storage &storage, const char *uri_utf8, FileInfo &info)
}
bool
-GetInfo(StorageDirectoryReader &reader, FileInfo &info)
+GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info)
{
Error error;
bool success = reader.GetInfo(true, info, error);
@@ -55,7 +55,7 @@ GetInfo(StorageDirectoryReader &reader, FileInfo &info)
bool
DirectoryExists(Storage &storage, const Directory &directory)
{
- FileInfo info;
+ StorageFileInfo info;
if (!storage.GetInfo(directory.GetPath(), true, info, IgnoreError()))
return false;
@@ -67,7 +67,7 @@ DirectoryExists(Storage &storage, const Directory &directory)
static bool
GetDirectoryChildInfo(Storage &storage, const Directory &directory,
- const char *name_utf8, FileInfo &info, Error &error)
+ const char *name_utf8, StorageFileInfo &info, Error &error)
{
const auto uri_utf8 = PathTraitsUTF8::Build(directory.GetPath(),
name_utf8);
@@ -78,7 +78,7 @@ bool
directory_child_is_regular(Storage &storage, const Directory &directory,
const char *name_utf8)
{
- FileInfo info;
+ StorageFileInfo info;
return GetDirectoryChildInfo(storage, directory, name_utf8, info,
IgnoreError()) &&
info.IsRegular();
diff --git a/src/db/update/UpdateIO.hxx b/src/db/update/UpdateIO.hxx
index 2dbb4ae83..0223cb62c 100644
--- a/src/db/update/UpdateIO.hxx
+++ b/src/db/update/UpdateIO.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -24,7 +24,7 @@
#include "Compiler.h"
struct Directory;
-struct FileInfo;
+struct StorageFileInfo;
class Storage;
class StorageDirectoryReader;
@@ -33,14 +33,14 @@ class StorageDirectoryReader;
* returning them.
*/
bool
-GetInfo(Storage &storage, const char *uri_utf8, FileInfo &info);
+GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info);
/**
* Wrapper for LocalDirectoryReader::GetInfo() that logs errors
* instead of returning them.
*/
bool
-GetInfo(StorageDirectoryReader &reader, FileInfo &info);
+GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info);
gcc_pure
bool
diff --git a/src/db/update/UpdateSong.cxx b/src/db/update/UpdateSong.cxx
index 005bf8992..e6ed5643a 100644
--- a/src/db/update/UpdateSong.cxx
+++ b/src/db/update/UpdateSong.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -33,7 +33,7 @@
inline void
UpdateWalk::UpdateSongFile2(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info)
+ const StorageFileInfo &info)
{
db_lock();
Song *song = directory.FindSong(name);
@@ -93,7 +93,7 @@ UpdateWalk::UpdateSongFile2(Directory &directory,
bool
UpdateWalk::UpdateSongFile(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info)
+ const StorageFileInfo &info)
{
if (!decoder_plugins_supports_suffix(suffix))
return false;
diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx
index 9fdb5bbdf..af039ee48 100644
--- a/src/db/update/Walk.cxx
+++ b/src/db/update/Walk.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -57,17 +57,17 @@ UpdateWalk::UpdateWalk(EventLoop &_loop, DatabaseListener &_listener,
{
#ifndef WIN32
follow_inside_symlinks =
- config_get_bool(CONF_FOLLOW_INSIDE_SYMLINKS,
+ config_get_bool(ConfigOption::FOLLOW_INSIDE_SYMLINKS,
DEFAULT_FOLLOW_INSIDE_SYMLINKS);
follow_outside_symlinks =
- config_get_bool(CONF_FOLLOW_OUTSIDE_SYMLINKS,
+ config_get_bool(ConfigOption::FOLLOW_OUTSIDE_SYMLINKS,
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS);
#endif
}
static void
-directory_set_stat(Directory &dir, const FileInfo &info)
+directory_set_stat(Directory &dir, const StorageFileInfo &info)
{
dir.inode = info.inode;
dir.device = info.device;
@@ -140,7 +140,7 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory)
static bool
update_directory_stat(Storage &storage, Directory &directory)
{
- FileInfo info;
+ StorageFileInfo info;
if (!GetInfo(storage, directory.GetPath(), info))
return false;
@@ -190,7 +190,7 @@ FindAncestorLoop(Storage &storage, Directory *parent,
inline bool
UpdateWalk::UpdatePlaylistFile(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info)
+ const StorageFileInfo &info)
{
if (!playlist_suffix_supported(suffix))
return false;
@@ -206,7 +206,7 @@ UpdateWalk::UpdatePlaylistFile(Directory &directory,
inline bool
UpdateWalk::UpdateRegularFile(Directory &directory,
- const char *name, const FileInfo &info)
+ const char *name, const StorageFileInfo &info)
{
const char *suffix = uri_get_suffix(name);
if (suffix == nullptr)
@@ -219,7 +219,7 @@ UpdateWalk::UpdateRegularFile(Directory &directory,
void
UpdateWalk::UpdateDirectoryChild(Directory &directory,
- const char *name, const FileInfo &info)
+ const char *name, const StorageFileInfo &info)
{
assert(strchr(name, '/') == nullptr);
@@ -327,7 +327,7 @@ UpdateWalk::SkipSymlink(const Directory *directory,
}
bool
-UpdateWalk::UpdateDirectory(Directory &directory, const FileInfo &info)
+UpdateWalk::UpdateDirectory(Directory &directory, const StorageFileInfo &info)
{
assert(info.IsDirectory());
@@ -370,7 +370,7 @@ UpdateWalk::UpdateDirectory(Directory &directory, const FileInfo &info)
continue;
}
- FileInfo info2;
+ StorageFileInfo info2;
if (!GetInfo(*reader, info2)) {
modified |= editor.DeleteNameIn(directory, name_utf8);
continue;
@@ -400,7 +400,7 @@ UpdateWalk::DirectoryMakeChildChecked(Directory &parent,
return directory;
}
- FileInfo info;
+ StorageFileInfo info;
if (!GetInfo(storage, uri_utf8, info) ||
FindAncestorLoop(storage, &parent, info.inode, info.device))
return nullptr;
@@ -462,7 +462,7 @@ UpdateWalk::UpdateUri(Directory &root, const char *uri)
return;
}
- FileInfo info;
+ StorageFileInfo info;
if (!GetInfo(storage, uri, info)) {
modified |= editor.DeleteNameIn(*parent, name);
return;
@@ -480,7 +480,7 @@ UpdateWalk::Walk(Directory &root, const char *path, bool discard)
if (path != nullptr && !isRootDirectory(path)) {
UpdateUri(root, path);
} else {
- FileInfo info;
+ StorageFileInfo info;
if (!GetInfo(storage, "", info))
return false;
diff --git a/src/db/update/Walk.hxx b/src/db/update/Walk.hxx
index a4c518813..d9fe7c84c 100644
--- a/src/db/update/Walk.hxx
+++ b/src/db/update/Walk.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -27,7 +27,7 @@
#include <sys/stat.h>
struct stat;
-struct FileInfo;
+struct StorageFileInfo;
struct Directory;
struct ArchivePlugin;
class Storage;
@@ -89,15 +89,15 @@ private:
void UpdateSongFile2(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info);
+ const StorageFileInfo &info);
bool UpdateSongFile(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info);
+ const StorageFileInfo &info);
bool UpdateContainerFile(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info);
+ const StorageFileInfo &info);
#ifdef ENABLE_ARCHIVE
@@ -105,10 +105,10 @@ private:
bool UpdateArchiveFile(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info);
+ const StorageFileInfo &info);
void UpdateArchiveFile(Directory &directory, const char *name,
- const FileInfo &info,
+ const StorageFileInfo &info,
const ArchivePlugin &plugin);
@@ -116,22 +116,24 @@ private:
bool UpdateArchiveFile(gcc_unused Directory &directory,
gcc_unused const char *name,
gcc_unused const char *suffix,
- gcc_unused const FileInfo &info) {
+ gcc_unused const StorageFileInfo &info) {
return false;
}
#endif
bool UpdatePlaylistFile(Directory &directory,
const char *name, const char *suffix,
- const FileInfo &info);
+ const StorageFileInfo &info);
bool UpdateRegularFile(Directory &directory,
- const char *name, const FileInfo &info);
+ const char *name, const StorageFileInfo &info);
void UpdateDirectoryChild(Directory &directory,
- const char *name, const FileInfo &info);
+ const char *name,
+ const StorageFileInfo &info);
- bool UpdateDirectory(Directory &directory, const FileInfo &info);
+ bool UpdateDirectory(Directory &directory,
+ const StorageFileInfo &info);
/**
* Create the specified directory object if it does not exist
@@ -142,7 +144,7 @@ private:
* The caller must lock the database.
*/
Directory *MakeDirectoryIfModified(Directory &parent, const char *name,
- const FileInfo &info);
+ const StorageFileInfo &info);
Directory *DirectoryMakeChildChecked(Directory &parent,
const char *uri_utf8,