Fixes for MSVC
This commit is contained in:
parent
ddc95903fe
commit
1b577d000c
@ -24,6 +24,10 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
set(CMAKE_BUILD_TYPE Release CACHE INTERNAL "CMAKE_BUILD_TYPE")
|
set(CMAKE_BUILD_TYPE Release CACHE INTERNAL "CMAKE_BUILD_TYPE")
|
||||||
endif(NOT CMAKE_BUILD_TYPE)
|
endif(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
# The MSVC version on AppVeyor CI needs this
|
||||||
|
if(MSVC)
|
||||||
|
add_definitions(/bigobj)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(vendor)
|
add_subdirectory(vendor)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
@ -132,7 +132,7 @@ void Cache<Key, Value, MAX_ENTRIES>::_deleteOldEntriesParallel() {
|
|||||||
template<class Key, class Value, uint32_t MAX_ENTRIES>
|
template<class Key, class Value, uint32_t MAX_ENTRIES>
|
||||||
void Cache<Key, Value, MAX_ENTRIES>::_deleteMatchingEntriesAtBeginningParallel(std::function<bool (const CacheEntry<Key, Value> &)> matches) {
|
void Cache<Key, Value, MAX_ENTRIES>::_deleteMatchingEntriesAtBeginningParallel(std::function<bool (const CacheEntry<Key, Value> &)> matches) {
|
||||||
// Twice the number of cores, so we use full CPU even if half the threads are doing I/O
|
// Twice the number of cores, so we use full CPU even if half the threads are doing I/O
|
||||||
unsigned int numThreads = 2 * std::max(1u, std::thread::hardware_concurrency());
|
unsigned int numThreads = 2 * (std::max)(1u, std::thread::hardware_concurrency());
|
||||||
std::vector<std::future<void>> waitHandles;
|
std::vector<std::future<void>> waitHandles;
|
||||||
for (unsigned int i = 0; i < numThreads; ++i) {
|
for (unsigned int i = 0; i < numThreads; ++i) {
|
||||||
waitHandles.push_back(std::async(std::launch::async, [this, matches] {
|
waitHandles.push_back(std::async(std::launch::async, [this, matches] {
|
||||||
|
@ -57,7 +57,7 @@ namespace cpputils {
|
|||||||
_dataAddedCv.wait(lock, [this] {
|
_dataAddedCv.wait(lock, [this] {
|
||||||
return _buffer.size() > 0;
|
return _buffer.size() > 0;
|
||||||
});
|
});
|
||||||
size_t gettableBytes = std::min(_buffer.size(), numBytes);
|
size_t gettableBytes = (std::min)(_buffer.size(), numBytes);
|
||||||
_buffer.get(target, gettableBytes);
|
_buffer.get(target, gettableBytes);
|
||||||
_dataGottenCv.notify_all();
|
_dataGottenCv.notify_all();
|
||||||
return gettableBytes;
|
return gettableBytes;
|
||||||
|
@ -54,8 +54,8 @@ public:
|
|||||||
using underlying_type = UnderlyingType;
|
using underlying_type = UnderlyingType;
|
||||||
using concrete_type = ConcreteType;
|
using concrete_type = ConcreteType;
|
||||||
|
|
||||||
constexpr IdValueType(IdValueType&& rhs) noexcept(noexcept(UnderlyingType(std::move(rhs.value_)))) = default;
|
constexpr IdValueType(IdValueType&& rhs) noexcept(noexcept(UnderlyingType(std::move(std::declval<UnderlyingType>())))) = default;
|
||||||
constexpr IdValueType(const IdValueType& rhs) noexcept(noexcept(UnderlyingType(rhs.value_))) = default;
|
constexpr IdValueType(const IdValueType& rhs) noexcept(noexcept(UnderlyingType(std::declval<UnderlyingType>()))) = default;
|
||||||
constexpr IdValueType& operator=(IdValueType&& rhs) noexcept(noexcept(*std::declval<UnderlyingType*>() = std::move(rhs.value_))) {
|
constexpr IdValueType& operator=(IdValueType&& rhs) noexcept(noexcept(*std::declval<UnderlyingType*>() = std::move(rhs.value_))) {
|
||||||
value_ = std::move(rhs.value_);
|
value_ = std::move(rhs.value_);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -11,6 +11,7 @@ namespace bf = boost::filesystem;
|
|||||||
using namespace cryfs::program_options;
|
using namespace cryfs::program_options;
|
||||||
using cryfs::CryConfigConsole;
|
using cryfs::CryConfigConsole;
|
||||||
using cryfs::CryfsException;
|
using cryfs::CryfsException;
|
||||||
|
using cryfs::ErrorCode;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
|
@ -28,10 +28,10 @@ unique_ref<SymlinkBlob> SymlinkBlob::InitializeSymlink(unique_ref<Blob> blob, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
bf::path SymlinkBlob::_readTargetFromBlob(const FsBlobView &blob) {
|
bf::path SymlinkBlob::_readTargetFromBlob(const FsBlobView &blob) {
|
||||||
char targetStr[blob.size() + 1]; // +1 because of the nullbyte
|
auto targetStr = std::make_unique<char[]>(blob.size() + 1); // +1 because of the nullbyte
|
||||||
blob.read(targetStr, 0, blob.size());
|
blob.read(targetStr.get(), 0, blob.size());
|
||||||
targetStr[blob.size()] = '\0';
|
targetStr[blob.size()] = '\0';
|
||||||
return targetStr;
|
return targetStr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bf::path &SymlinkBlob::target() const {
|
const bf::path &SymlinkBlob::target() const {
|
||||||
|
@ -235,8 +235,8 @@ bool DirEntryList::updateAccessTimestampForChild(const blockstore::BlockId &bloc
|
|||||||
const timespec lastModificationTime = found->lastModificationTime();
|
const timespec lastModificationTime = found->lastModificationTime();
|
||||||
const timespec now = cpputils::time::now();
|
const timespec now = cpputils::time::now();
|
||||||
const timespec yesterday {
|
const timespec yesterday {
|
||||||
.tv_sec = now.tv_sec - 60*60*24,
|
/*.tv_sec = */ now.tv_sec - 60*60*24,
|
||||||
.tv_nsec = now.tv_nsec
|
/*.tv_nsec = */ now.tv_nsec
|
||||||
};
|
};
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (lastAccessTime < lastModificationTime || lastAccessTime < yesterday) {
|
if (lastAccessTime < lastModificationTime || lastAccessTime < yesterday) {
|
||||||
|
@ -114,8 +114,8 @@ LocalStateMetadata LocalStateMetadata::_deserialize(istream& stream) {
|
|||||||
string encryptionKeyDigest = pt.get<string>("encryptionKey.hash");
|
string encryptionKeyDigest = pt.get<string>("encryptionKey.hash");
|
||||||
|
|
||||||
return LocalStateMetadata(myClientId, Hash{
|
return LocalStateMetadata(myClientId, Hash{
|
||||||
.digest = cpputils::hash::Digest::FromString(encryptionKeyDigest),
|
/*.digest = */ cpputils::hash::Digest::FromString(encryptionKeyDigest),
|
||||||
.salt = cpputils::hash::Salt::FromString(encryptionKeySalt)
|
/*.salt = */ cpputils::hash::Salt::FromString(encryptionKeySalt)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user