storage/FileInfo: add initializing constructor

This commit is contained in:
Max Kellermann
2017-02-11 22:57:38 +01:00
parent 5cdbad7937
commit 0ccaf4a1ff
3 changed files with 16 additions and 24 deletions

View File

@@ -399,11 +399,8 @@ class HttpGetInfoOperation final : public PropfindOperation {
public:
HttpGetInfoOperation(CurlGlobal &curl, const char *uri)
:PropfindOperation(curl, uri, 0) {
info.type = StorageFileInfo::Type::OTHER;
info.size = 0;
info.mtime = 0;
info.device = info.inode = 0;
:PropfindOperation(curl, uri, 0),
info(StorageFileInfo::Type::OTHER) {
}
const StorageFileInfo &Perform() {
@@ -424,7 +421,6 @@ protected:
info.mtime = !IsNegative(r.mtime)
? std::chrono::system_clock::to_time_t(r.mtime)
: 0;
info.device = info.inode = 0;
}
};
@@ -514,14 +510,13 @@ protected:
entries.emplace_front(std::string(name.data, name.size));
auto &info = entries.front().info;
info.type = r.collection
? StorageFileInfo::Type::DIRECTORY
: StorageFileInfo::Type::REGULAR;
info = StorageFileInfo(r.collection
? StorageFileInfo::Type::DIRECTORY
: StorageFileInfo::Type::REGULAR);
info.size = r.length;
info.mtime = !IsNegative(r.mtime)
? std::chrono::system_clock::to_time_t(r.mtime)
: 0;
info.device = info.inode = 0;
}
};