- Add Clang 8 and GCC 9 to CI
- Switch clang-tidy to Clang 9 - Fix compiler and clang-tidy warnings produced by the previous points
This commit is contained in:
parent
12ce925213
commit
efac089c76
@ -45,6 +45,8 @@ references:
|
||||
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main
|
||||
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main
|
||||
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main
|
||||
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-8 main
|
||||
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-8 main
|
||||
EOF
|
||||
sudo chmod o-w /etc/apt/sources.list.d/clang.list
|
||||
|
||||
@ -57,8 +59,8 @@ references:
|
||||
# They aren't set automatically unfortunately
|
||||
sudo ln -s /usr/bin/$CC /usr/bin/clang
|
||||
sudo ln -s /usr/bin/$CXX /usr/bin/clang++
|
||||
sudo ln -s /usr/bin/clang-tidy-7 /usr/bin/clang-tidy
|
||||
sudo ln -s /usr/bin/run-clang-tidy-7.py /usr/bin/run-clang-tidy.py
|
||||
sudo ln -s /usr/bin/clang-tidy-8 /usr/bin/clang-tidy
|
||||
sudo ln -s /usr/bin/run-clang-tidy-8.py /usr/bin/run-clang-tidy.py
|
||||
|
||||
# Need a c++14 compliant STL for clang
|
||||
sudo apt-get install -y g++-5
|
||||
@ -299,6 +301,30 @@ jobs:
|
||||
GTEST_ARGS: ""
|
||||
CMAKE_FLAGS: ""
|
||||
RUN_TESTS: true
|
||||
gcc_9_debug:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: gcc-9
|
||||
CXX: g++-9
|
||||
BUILD_TOOLSET: gcc
|
||||
APT_COMPILER_PACKAGE: "g++-9"
|
||||
CXXFLAGS: ""
|
||||
BUILD_TYPE: "Debug"
|
||||
GTEST_ARGS: ""
|
||||
CMAKE_FLAGS: ""
|
||||
RUN_TESTS: true
|
||||
gcc_9_release:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: gcc-9
|
||||
CXX: g++-9
|
||||
BUILD_TOOLSET: gcc
|
||||
APT_COMPILER_PACKAGE: "g++-9"
|
||||
CXXFLAGS: ""
|
||||
BUILD_TYPE: "Release"
|
||||
GTEST_ARGS: ""
|
||||
CMAKE_FLAGS: ""
|
||||
RUN_TESTS: true
|
||||
clang_4_debug:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
@ -395,13 +421,37 @@ jobs:
|
||||
GTEST_ARGS: ""
|
||||
CMAKE_FLAGS: ""
|
||||
RUN_TESTS: true
|
||||
clang_8_debug:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: clang-8
|
||||
CXX: clang++-8
|
||||
BUILD_TOOLSET: clang
|
||||
APT_COMPILER_PACKAGE: clang-8
|
||||
CXXFLAGS: ""
|
||||
BUILD_TYPE: "Debug"
|
||||
GTEST_ARGS: ""
|
||||
CMAKE_FLAGS: ""
|
||||
RUN_TESTS: true
|
||||
clang_8_release:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: clang-8
|
||||
CXX: clang++-8
|
||||
BUILD_TOOLSET: clang
|
||||
APT_COMPILER_PACKAGE: clang-8
|
||||
CXXFLAGS: ""
|
||||
BUILD_TYPE: "Release"
|
||||
GTEST_ARGS: ""
|
||||
CMAKE_FLAGS: ""
|
||||
RUN_TESTS: true
|
||||
clang_werror:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: clang-7
|
||||
CXX: clang++-7
|
||||
CC: clang-8
|
||||
CXX: clang++-8
|
||||
BUILD_TOOLSET: clang
|
||||
APT_COMPILER_PACKAGE: clang-7
|
||||
APT_COMPILER_PACKAGE: clang-8
|
||||
CXXFLAGS: ""
|
||||
BUILD_TYPE: "Release"
|
||||
GTEST_ARGS: ""
|
||||
@ -410,10 +460,10 @@ jobs:
|
||||
gcc_werror:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: gcc-8
|
||||
CXX: g++-8
|
||||
CC: gcc-9
|
||||
CXX: g++-9
|
||||
BUILD_TOOLSET: gcc
|
||||
APT_COMPILER_PACKAGE: "g++-8"
|
||||
APT_COMPILER_PACKAGE: "g++-9"
|
||||
CXXFLAGS: ""
|
||||
BUILD_TYPE: "Release"
|
||||
GTEST_ARGS: ""
|
||||
@ -422,10 +472,10 @@ jobs:
|
||||
no_compatibility:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: clang-7
|
||||
CXX: clang++-7
|
||||
CC: clang-8
|
||||
CXX: clang++-8
|
||||
BUILD_TOOLSET: clang
|
||||
APT_COMPILER_PACKAGE: clang-7
|
||||
APT_COMPILER_PACKAGE: clang-8
|
||||
CXXFLAGS: "-DCRYFS_NO_COMPATIBILITY"
|
||||
BUILD_TYPE: "Debug"
|
||||
GTEST_ARGS: ""
|
||||
@ -434,10 +484,10 @@ jobs:
|
||||
address_sanitizer:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: clang-7
|
||||
CXX: clang++-7
|
||||
CC: clang-8
|
||||
CXX: clang++-8
|
||||
BUILD_TOOLSET: clang
|
||||
APT_COMPILER_PACKAGE: clang-7
|
||||
APT_COMPILER_PACKAGE: clang-8
|
||||
CXXFLAGS: "-O2 -fsanitize=address -fno-omit-frame-pointer -fno-common -fsanitize-address-use-after-scope"
|
||||
BUILD_TYPE: "Debug"
|
||||
ASAN_OPTIONS: "detect_leaks=1 check_initialization_order=1 detect_stack_use_after_return=1 detect_invalid_pointer_pairs=1 atexit=1"
|
||||
@ -448,10 +498,10 @@ jobs:
|
||||
ub_sanitizer:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: clang-7
|
||||
CXX: clang++-7
|
||||
CC: clang-8
|
||||
CXX: clang++-8
|
||||
BUILD_TOOLSET: clang
|
||||
APT_COMPILER_PACKAGE: clang-7
|
||||
APT_COMPILER_PACKAGE: clang-8
|
||||
CXXFLAGS: "-O2 -fno-sanitize-recover=undefined,nullability,implicit-conversion,unsigned-integer-overflow -fno-omit-frame-pointer -fno-common"
|
||||
BUILD_TYPE: "Debug"
|
||||
GTEST_ARGS: ""
|
||||
@ -460,10 +510,10 @@ jobs:
|
||||
thread_sanitizer:
|
||||
<<: *job_definition
|
||||
environment:
|
||||
CC: clang-7
|
||||
CXX: clang++-7
|
||||
CC: clang-8
|
||||
CXX: clang++-8
|
||||
BUILD_TOOLSET: clang
|
||||
APT_COMPILER_PACKAGE: clang-7
|
||||
APT_COMPILER_PACKAGE: clang-8
|
||||
OMP_NUM_THREADS: "1"
|
||||
CXXFLAGS: "-O2 -fsanitize=thread -fno-omit-frame-pointer"
|
||||
BUILD_TYPE: "Debug"
|
||||
@ -496,10 +546,10 @@ jobs:
|
||||
- store_artifacts:
|
||||
path: /tmp/clang-tidy-fixes
|
||||
environment:
|
||||
CC: clang-7
|
||||
CXX: clang++-7
|
||||
CC: clang-8
|
||||
CXX: clang++-8
|
||||
BUILD_TOOLSET: clang
|
||||
APT_COMPILER_PACKAGE: "clang-7 clang-tidy-7"
|
||||
APT_COMPILER_PACKAGE: "clang-8 clang-tidy-8"
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
@ -522,6 +572,10 @@ workflows:
|
||||
<<: *enable_for_tags
|
||||
- gcc_8_release:
|
||||
<<: *enable_for_tags
|
||||
- gcc_9_debug:
|
||||
<<: *enable_for_tags
|
||||
- gcc_9_release:
|
||||
<<: *enable_for_tags
|
||||
- clang_4_debug:
|
||||
<<: *enable_for_tags
|
||||
- clang_4_release:
|
||||
@ -538,6 +592,10 @@ workflows:
|
||||
<<: *enable_for_tags
|
||||
- clang_7_release:
|
||||
<<: *enable_for_tags
|
||||
- clang_8_debug:
|
||||
<<: *enable_for_tags
|
||||
- clang_8_release:
|
||||
<<: *enable_for_tags
|
||||
- clang_werror:
|
||||
<<: *enable_for_tags
|
||||
- gcc_werror:
|
||||
|
@ -25,8 +25,13 @@ Checks: |
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-type-vararg,
|
||||
-cppcoreguidelines-avoid-goto,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-clang-analyzer-optin.cplusplus.VirtualCall,
|
||||
-clang-analyzer-cplusplus.NewDeleteLeaks,
|
||||
-misc-macro-parentheses,
|
||||
-misc-non-private-member-variables-in-classes,
|
||||
-misc-unused-raii
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '/src/|/test/'
|
||||
|
@ -215,7 +215,7 @@ namespace blobstore {
|
||||
if (endIndex > beginIndex) {
|
||||
onBacktrackFromSubtree(newNode.get());
|
||||
}
|
||||
return std::move(newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
uint32_t LeafTraverser::_maxLeavesForTreeDepth(uint8_t depth) const {
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
_removeFromQueue(found->second);
|
||||
auto value = found->second.release();
|
||||
_entries.erase(found);
|
||||
return std::move(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
boost::optional<Value> pop() {
|
||||
@ -83,7 +83,7 @@ private:
|
||||
}
|
||||
void init(const Key *key_, Value value_) {
|
||||
key = key_;
|
||||
new(__value) Value(std::move(value_));
|
||||
new(__value.data()) Value(std::move(value_));
|
||||
}
|
||||
Value release() {
|
||||
Value value = std::move(*_value());
|
||||
@ -98,9 +98,9 @@ private:
|
||||
const Key *key;
|
||||
private:
|
||||
Value *_value() {
|
||||
return reinterpret_cast<Value*>(__value);
|
||||
return reinterpret_cast<Value*>(__value.data());
|
||||
}
|
||||
alignas(Value) char __value[sizeof(Value)];
|
||||
alignas(Value) std::array<char, sizeof(Value)> __value;
|
||||
DISALLOW_COPY_AND_ASSIGN(Entry);
|
||||
};
|
||||
|
||||
|
@ -29,6 +29,6 @@ namespace cpputils {
|
||||
};
|
||||
Data result(size);
|
||||
std::memcpy(result.data(), data.dataOffset(sizeof(size)), size);
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ boost::optional<Data> CFB_Cipher<BlockCipher, KeySize>::decrypt(const CryptoPP::
|
||||
// TODO Shouldn't we pass in ciphertextSize instead of plaintext.size() here as last argument (and also in the if above)?
|
||||
decryption.ProcessData(static_cast<CryptoPP::byte*>(plaintext.data()), ciphertextData, plaintext.size());
|
||||
}
|
||||
return std::move(plaintext);
|
||||
return plaintext;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ boost::optional<Data> GCM_Cipher<BlockCipher, KeySize>::decrypt(const CryptoPP::
|
||||
CryptoPP::AuthenticatedDecryptionFilter::DEFAULT_FLAGS, TAG_SIZE
|
||||
)
|
||||
);
|
||||
return std::move(plaintext);
|
||||
return plaintext;
|
||||
} catch (const CryptoPP::HashVerificationFilter::HashVerificationFailed &e) {
|
||||
return boost::none;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace cpputils {
|
||||
Data result(plaintextSize(ciphertextSize));
|
||||
_xor(static_cast<CryptoPP::byte *>(result.data()), ciphertext + sizeof(uint64_t), plaintextSize(ciphertextSize), encKey.value ^ iv);
|
||||
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
static constexpr const char *NAME = "FakeAuthenticatedCipher";
|
||||
@ -101,7 +101,7 @@ namespace cpputils {
|
||||
static uint64_t _checksum(const CryptoPP::byte *data, FakeKey encKey, std::size_t size) {
|
||||
uint64_t checksum = 34343435 * encKey.value; // some init value
|
||||
|
||||
for (unsigned int i = 0; i < size; ++i) {
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
checksum ^= (static_cast<uint64_t>(data[i]) << (56 - 8 * (i%8)));
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
FixedSizeData(): _data() {}
|
||||
template<size_t _SIZE> friend class FixedSizeData;
|
||||
|
||||
unsigned char _data[BINARY_LENGTH];
|
||||
std::array<unsigned char, BINARY_LENGTH> _data;
|
||||
};
|
||||
|
||||
template<size_t SIZE> bool operator==(const FixedSizeData<SIZE> &lhs, const FixedSizeData<SIZE> &rhs);
|
||||
@ -51,7 +51,7 @@ template<size_t SIZE> constexpr size_t FixedSizeData<SIZE>::STRING_LENGTH;
|
||||
template<size_t SIZE>
|
||||
FixedSizeData<SIZE> FixedSizeData<SIZE>::Null() {
|
||||
FixedSizeData<SIZE> result;
|
||||
std::memset(result._data, 0, BINARY_LENGTH);
|
||||
std::memset(result._data.data(), 0, BINARY_LENGTH);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ FixedSizeData<SIZE> FixedSizeData<SIZE>::FromString(const std::string &data) {
|
||||
{
|
||||
CryptoPP::StringSource _1(data, true,
|
||||
new CryptoPP::HexDecoder(
|
||||
new CryptoPP::ArraySink(result._data, BINARY_LENGTH)
|
||||
new CryptoPP::ArraySink(result._data.data(), BINARY_LENGTH)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -72,7 +72,7 @@ FixedSizeData<SIZE> FixedSizeData<SIZE>::FromString(const std::string &data) {
|
||||
template<size_t SIZE>
|
||||
std::string FixedSizeData<SIZE>::ToString() const {
|
||||
std::string result;
|
||||
CryptoPP::ArraySource(_data, BINARY_LENGTH, true,
|
||||
CryptoPP::ArraySource(_data.data(), BINARY_LENGTH, true,
|
||||
new CryptoPP::HexEncoder(
|
||||
new CryptoPP::StringSink(result)
|
||||
)
|
||||
@ -83,7 +83,7 @@ std::string FixedSizeData<SIZE>::ToString() const {
|
||||
|
||||
template<size_t SIZE>
|
||||
const unsigned char *FixedSizeData<SIZE>::data() const {
|
||||
return _data;
|
||||
return _data.data();
|
||||
}
|
||||
|
||||
template<size_t SIZE>
|
||||
@ -93,13 +93,13 @@ unsigned char *FixedSizeData<SIZE>::data() {
|
||||
|
||||
template<size_t SIZE>
|
||||
void FixedSizeData<SIZE>::ToBinary(void *target) const {
|
||||
std::memcpy(target, _data, BINARY_LENGTH);
|
||||
std::memcpy(target, _data.data(), BINARY_LENGTH);
|
||||
}
|
||||
|
||||
template<size_t SIZE>
|
||||
FixedSizeData<SIZE> FixedSizeData<SIZE>::FromBinary(const void *source) {
|
||||
FixedSizeData<SIZE> result;
|
||||
std::memcpy(result._data, source, BINARY_LENGTH);
|
||||
std::memcpy(result._data.data(), source, BINARY_LENGTH);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ template<size_t SIZE> template<size_t size>
|
||||
FixedSizeData<size> FixedSizeData<SIZE>::take() const {
|
||||
static_assert(size <= SIZE, "Out of bounds");
|
||||
FixedSizeData<size> result;
|
||||
std::memcpy(result._data, _data, size);
|
||||
std::memcpy(result._data.data(), _data.data(), size);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ template<size_t SIZE> template<size_t size>
|
||||
FixedSizeData<SIZE-size> FixedSizeData<SIZE>::drop() const {
|
||||
static_assert(size <= SIZE, "Out of bounds");
|
||||
FixedSizeData<SIZE-size> result;
|
||||
std::memcpy(result._data, _data+size, SIZE-size);
|
||||
std::memcpy(result._data.data(), _data.data()+size, SIZE-size);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ unsigned int IOStreamConsole::ask(const string &question, const vector<string> &
|
||||
throw std::invalid_argument("options should have at least one entry");
|
||||
}
|
||||
_output << question << "\n";
|
||||
for (unsigned int i = 0; i < options.size(); ++i) {
|
||||
for (size_t i = 0; i < options.size(); ++i) {
|
||||
_output << " [" << (i+1) << "] " << options[i] << "\n";
|
||||
}
|
||||
int choice = _askForChoice("Your choice [1-" + std::to_string(options.size()) + "]: ", _parseUIntWithMinMax(1, options.size()));
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <cstdio>
|
||||
#include <stdexcept>
|
||||
#include <cerrno>
|
||||
#include <array>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
@ -44,9 +45,9 @@ namespace cpputils {
|
||||
|
||||
string getOutput() {
|
||||
string output;
|
||||
char buffer[1024];
|
||||
while (fgets(buffer, sizeof(buffer), _subprocess) != nullptr) {
|
||||
output += buffer;
|
||||
std::array<char, 1024> buffer{};
|
||||
while (fgets(buffer.data(), buffer.size(), _subprocess) != nullptr) {
|
||||
output += buffer.data();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
@ -5,15 +5,16 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <array>
|
||||
#include <cpp-utils/system/stat.h>
|
||||
|
||||
namespace cpputils {
|
||||
|
||||
int set_filetime(const char *filepath, timespec lastAccessTime, timespec lastModificationTime) {
|
||||
struct timeval casted_times[2];
|
||||
std::array<struct timeval, 2> casted_times{};
|
||||
TIMESPEC_TO_TIMEVAL(&casted_times[0], &lastAccessTime);
|
||||
TIMESPEC_TO_TIMEVAL(&casted_times[1], &lastModificationTime);
|
||||
int retval = ::utimes(filepath, casted_times);
|
||||
int retval = ::utimes(filepath, casted_times.data());
|
||||
if (0 == retval) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -71,11 +71,11 @@ int pthread_getname_np_gcompat(pthread_t thread, char *name, size_t len) {
|
||||
#endif
|
||||
|
||||
std::string get_thread_name(pthread_t thread) {
|
||||
char name[MAX_NAME_LEN];
|
||||
std::array<char, MAX_NAME_LEN> name{};
|
||||
#if defined(__GLIBC__) || defined(__APPLE__)
|
||||
int result = pthread_getname_np(thread, name, MAX_NAME_LEN);
|
||||
int result = pthread_getname_np(thread, name.data(), MAX_NAME_LEN);
|
||||
#else
|
||||
int result = pthread_getname_np_gcompat(thread, name, MAX_NAME_LEN);
|
||||
int result = pthread_getname_np_gcompat(thread, name.data(), MAX_NAME_LEN);
|
||||
#endif
|
||||
if (0 != result) {
|
||||
throw std::runtime_error("Error getting thread name with pthread_getname_np. Code: " + std::to_string(result));
|
||||
@ -83,7 +83,7 @@ std::string get_thread_name(pthread_t thread) {
|
||||
// pthread_getname_np returns a null terminated string with maximum 16 bytes.
|
||||
// but just to be safe against a buggy implementation, let's set the last byte to zero.
|
||||
name[MAX_NAME_LEN - 1] = '\0';
|
||||
return name;
|
||||
return name.data();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ namespace cryfs_cli {
|
||||
return false;
|
||||
}
|
||||
|
||||
int Cli::main(int argc, const char *argv[], unique_ref<HttpClient> httpClient, std::function<void()> onMounted) {
|
||||
int Cli::main(int argc, const char **argv, unique_ref<HttpClient> httpClient, std::function<void()> onMounted) {
|
||||
cpputils::showBacktraceOnCrash();
|
||||
cpputils::set_thread_name("cryfs");
|
||||
|
||||
|
@ -18,7 +18,7 @@ namespace cryfs_cli {
|
||||
class Cli final {
|
||||
public:
|
||||
Cli(cpputils::RandomGenerator &keyGenerator, const cpputils::SCryptSettings& scryptSettings, std::shared_ptr<cpputils::Console> console);
|
||||
int main(int argc, const char *argv[], cpputils::unique_ref<cpputils::HttpClient> httpClient, std::function<void()> onMounted);
|
||||
int main(int argc, const char **argv, cpputils::unique_ref<cpputils::HttpClient> httpClient, std::function<void()> onMounted);
|
||||
|
||||
private:
|
||||
void _checkForUpdates(cpputils::unique_ref<cpputils::HttpClient> httpClient);
|
||||
|
@ -20,11 +20,11 @@ using boost::optional;
|
||||
using boost::none;
|
||||
using namespace cpputils::logging;
|
||||
|
||||
Parser::Parser(int argc, const char *argv[])
|
||||
Parser::Parser(int argc, const char **argv)
|
||||
:_options(_argsToVector(argc, argv)) {
|
||||
}
|
||||
|
||||
vector<string> Parser::_argsToVector(int argc, const char *argv[]) {
|
||||
vector<string> Parser::_argsToVector(int argc, const char **argv) {
|
||||
vector<string> result;
|
||||
for(int i = 0; i < argc; ++i) {
|
||||
result.push_back(argv[i]);
|
||||
|
@ -10,12 +10,12 @@ namespace cryfs_cli {
|
||||
namespace program_options {
|
||||
class Parser final {
|
||||
public:
|
||||
Parser(int argc, const char *argv[]);
|
||||
Parser(int argc, const char **argv);
|
||||
|
||||
ProgramOptions parse(const std::vector<std::string> &supportedCiphers) const;
|
||||
|
||||
private:
|
||||
static std::vector<std::string> _argsToVector(int argc, const char *argv[]);
|
||||
static std::vector<std::string> _argsToVector(int argc, const char **argv);
|
||||
static std::vector<const char*> _to_const_char_vector(const std::vector<std::string> &options);
|
||||
static void _addAllowedOptions(boost::program_options::options_description *desc);
|
||||
static void _addPositionalOptionForBaseDir(boost::program_options::options_description *desc,
|
||||
|
@ -18,7 +18,7 @@ void _showVersion() {
|
||||
}
|
||||
}
|
||||
|
||||
void Cli::main(int argc, const char* argv[]) {
|
||||
void Cli::main(int argc, const char **argv) {
|
||||
_showVersion();
|
||||
ProgramOptions options = Parser(argc, argv).parse();
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace cryfs_unmount {
|
||||
|
||||
class Cli final {
|
||||
public:
|
||||
void main(int argc, const char* argv[]);
|
||||
void main(int argc, const char **argv);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ using std::endl;
|
||||
using std::string;
|
||||
using namespace cpputils::logging;
|
||||
|
||||
Parser::Parser(int argc, const char *argv[])
|
||||
Parser::Parser(int argc, const char **argv)
|
||||
:_options(_argsToVector(argc, argv)) {
|
||||
}
|
||||
|
||||
vector<string> Parser::_argsToVector(int argc, const char *argv[]) {
|
||||
vector<string> Parser::_argsToVector(int argc, const char **argv) {
|
||||
vector<string> result;
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
result.push_back(argv[i]);
|
||||
|
@ -10,12 +10,12 @@ namespace cryfs_unmount {
|
||||
namespace program_options {
|
||||
class Parser final {
|
||||
public:
|
||||
Parser(int argc, const char *argv[]);
|
||||
Parser(int argc, const char **argv);
|
||||
|
||||
ProgramOptions parse() const;
|
||||
|
||||
private:
|
||||
static std::vector<std::string> _argsToVector(int argc, const char *argv[]);
|
||||
static std::vector<std::string> _argsToVector(int argc, const char **argv);
|
||||
static std::vector<const char*> _to_const_char_vector(const std::vector<std::string> &options);
|
||||
static void _addAllowedOptions(boost::program_options::options_description *desc);
|
||||
static void _addPositionalOptionForBaseDir(boost::program_options::options_description *desc,
|
||||
|
@ -29,7 +29,7 @@ namespace cryfs {
|
||||
bool askAgain = true;
|
||||
while(askAgain) {
|
||||
_console->print("\n");
|
||||
int cipherIndex = _console->ask("Which block cipher do you want to use?", ciphers);
|
||||
unsigned int cipherIndex = _console->ask("Which block cipher do you want to use?", ciphers);
|
||||
cipherName = ciphers[cipherIndex];
|
||||
askAgain = !_showWarningForCipherAndReturnIfOk(cipherName);
|
||||
};
|
||||
@ -54,7 +54,7 @@ namespace cryfs {
|
||||
|
||||
uint32_t CryConfigConsole::_askBlocksizeBytes() const {
|
||||
vector<string> sizes = {"4KB", "8KB", "16KB", "32KB", "64KB", "512KB", "1MB", "4MB"};
|
||||
int index = _console->ask("Which block size do you want to use?", sizes);
|
||||
unsigned int index = _console->ask("Which block size do you want to use?", sizes);
|
||||
switch(index) {
|
||||
case 0: return 4*1024;
|
||||
case 1: return 8*1024;
|
||||
|
@ -49,7 +49,7 @@ optional<CryConfigFile> CryConfigFile::load(bf::path path, CryKeyProvider* keyPr
|
||||
configFile.save();
|
||||
}
|
||||
//TODO For newer compilers, this works without std::move
|
||||
return std::move(configFile);
|
||||
return configFile;
|
||||
}
|
||||
|
||||
CryConfigFile CryConfigFile::create(bf::path path, CryConfig config, CryKeyProvider* keyProvider) {
|
||||
|
@ -28,6 +28,7 @@ unique_ref<SymlinkBlob> SymlinkBlob::InitializeSymlink(unique_ref<Blob> blob, co
|
||||
}
|
||||
|
||||
bf::path SymlinkBlob::_readTargetFromBlob(const FsBlobView &blob) {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays)
|
||||
auto targetStr = std::make_unique<char[]>(blob.size() + 1); // +1 because of the nullbyte
|
||||
blob.read(targetStr.get(), 0, blob.size());
|
||||
targetStr[blob.size()] = '\0';
|
||||
|
@ -175,7 +175,7 @@ vector<DirEntry>::iterator DirEntryList::_findFirst(const BlockId &hint, std::fu
|
||||
return _entries.end();
|
||||
}
|
||||
double startpos_percent = static_cast<double>(*static_cast<const unsigned char*>(hint.data().data())) / std::numeric_limits<unsigned char>::max();
|
||||
auto iter = _entries.begin() + static_cast<int>(startpos_percent * (_entries.size()-1));
|
||||
auto iter = _entries.begin() + static_cast<int>(startpos_percent * static_cast<double>(_entries.size()-1));
|
||||
ASSERT(iter >= _entries.begin() && iter < _entries.end(), "Startpos out of range");
|
||||
while(iter != _entries.begin() && pred(*iter)) {
|
||||
--iter;
|
||||
|
@ -72,8 +72,8 @@ TYPED_TEST_P(FsppOpenFileTest_Timestamps, truncate_nonempty_to_nonempty_grow) {
|
||||
TYPED_TEST_P(FsppOpenFileTest_Timestamps, read_inbounds) {
|
||||
auto openFile = this->CreateAndOpenFileWithSize("/myfile", fspp::num_bytes_t(10));
|
||||
auto operation = [&openFile] () {
|
||||
char buffer[5];
|
||||
openFile->read(buffer, fspp::num_bytes_t(5), fspp::num_bytes_t(0));
|
||||
std::array<char, 5> buffer{};
|
||||
openFile->read(buffer.data(), fspp::num_bytes_t(5), fspp::num_bytes_t(0));
|
||||
};
|
||||
this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS(*openFile, operation, {this->ExpectUpdatesAccessTimestamp, this->ExpectDoesntUpdateModificationTimestamp, this->ExpectDoesntUpdateMetadataTimestamp});
|
||||
}
|
||||
@ -81,8 +81,8 @@ TYPED_TEST_P(FsppOpenFileTest_Timestamps, read_inbounds) {
|
||||
TYPED_TEST_P(FsppOpenFileTest_Timestamps, read_outofbounds) {
|
||||
auto openFile = this->CreateAndOpenFileWithSize("/myfile", fspp::num_bytes_t(0));
|
||||
auto operation = [&openFile] () {
|
||||
char buffer[5];
|
||||
openFile->read(buffer, fspp::num_bytes_t(5), fspp::num_bytes_t(2));
|
||||
std::array<char, 5> buffer{};
|
||||
openFile->read(buffer.data(), fspp::num_bytes_t(5), fspp::num_bytes_t(2));
|
||||
};
|
||||
this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS(*openFile, operation, {this->ExpectUpdatesAccessTimestamp, this->ExpectDoesntUpdateModificationTimestamp, this->ExpectDoesntUpdateMetadataTimestamp});
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ int fusepp_ftruncate(const char *path, int64_t size, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->ftruncate(bf::path(path), size, fileinfo);
|
||||
}
|
||||
|
||||
int fusepp_utimens(const char *path, const timespec times[2]) {
|
||||
return FUSE_OBJ->utimens(bf::path(path), times);
|
||||
int fusepp_utimens(const char *path, const timespec times[2]) { // NOLINT(cppcoreguidelines-avoid-c-arrays)
|
||||
return FUSE_OBJ->utimens(bf::path(path), {times[0], times[1]});
|
||||
}
|
||||
|
||||
int fusepp_open(const char *path, fuse_file_info *fileinfo) {
|
||||
@ -751,7 +751,7 @@ int Fuse::ftruncate(const bf::path &path, int64_t size, fuse_file_info *fileinfo
|
||||
}
|
||||
}
|
||||
|
||||
int Fuse::utimens(const bf::path &path, const timespec times[2]) {
|
||||
int Fuse::utimens(const bf::path &path, const std::array<timespec, 2> times) {
|
||||
ThreadNameForDebugging _threadName("utimens");
|
||||
#ifdef FSPP_LOG
|
||||
LOG(DEBUG, "utimens({}, _)", path);
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
int chown(const boost::filesystem::path &path, ::uid_t uid, ::gid_t gid);
|
||||
int truncate(const boost::filesystem::path &path, int64_t size);
|
||||
int ftruncate(const boost::filesystem::path &path, int64_t size, fuse_file_info *fileinfo);
|
||||
int utimens(const boost::filesystem::path &path, const timespec times[2]);
|
||||
int utimens(const boost::filesystem::path &path, const std::array<timespec, 2> times);
|
||||
int open(const boost::filesystem::path &path, fuse_file_info *fileinfo);
|
||||
int release(const boost::filesystem::path &path, fuse_file_info *fileinfo);
|
||||
int read(const boost::filesystem::path &path, char *buf, size_t size, int64_t offset, fuse_file_info *fileinfo);
|
||||
|
@ -165,7 +165,7 @@ cpputils::unique_ref<ResourceRef> ParallelAccessStore<Resource, ResourceRef, Key
|
||||
auto resourceRef = createResourceRef(found->second.getReference());
|
||||
resourceRef->init(this, key);
|
||||
onExists(resourceRef.get());
|
||||
return std::move(resourceRef);
|
||||
return resourceRef;
|
||||
}
|
||||
};
|
||||
|
||||
@ -190,7 +190,7 @@ boost::optional<cpputils::unique_ref<ResourceRef>> ParallelAccessStore<Resource,
|
||||
} else {
|
||||
auto resourceRef = createResourceRef(found->second.getReference());
|
||||
resourceRef->init(this, key);
|
||||
return std::move(resourceRef);
|
||||
return resourceRef;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ TEST_P(DataTreeTest_ResizeByTraversing_P, DataStaysIntact) {
|
||||
if (traversalBeginIndex < oldNumberOfLeaves) {
|
||||
// Traversal wrote over part of the pre-existing data, we can only check the data before it.
|
||||
if (traversalBeginIndex != 0) {
|
||||
data.EXPECT_DATA_CORRECT(nodeStore->load(blockId).get().get(), traversalBeginIndex - 1);
|
||||
data.EXPECT_DATA_CORRECT(nodeStore->load(blockId).get().get(), static_cast<int>(traversalBeginIndex - 1));
|
||||
}
|
||||
} else {
|
||||
// Here, traversal was entirely outside the preexisting data, we can check all preexisting data.
|
||||
|
@ -67,7 +67,7 @@ private:
|
||||
case SizePolicy::Full:
|
||||
return _dataNodeStore->layout().maxBytesPerLeaf();
|
||||
case SizePolicy::Random:
|
||||
return mod(_dataNodeStore->layout().maxBytesPerLeaf() - childIndex, _dataNodeStore->layout().maxBytesPerLeaf());
|
||||
return mod(static_cast<int>(_dataNodeStore->layout().maxBytesPerLeaf() - childIndex), static_cast<int>(_dataNodeStore->layout().maxBytesPerLeaf()));
|
||||
case SizePolicy::Unchanged:
|
||||
return leaf->numBytes();
|
||||
default:
|
||||
|
@ -21,7 +21,7 @@ TEST_F(CacheTest_PushAndPop, PopNonExistingEntry_NonEmptyCache) {
|
||||
|
||||
TEST_F(CacheTest_PushAndPop, PopNonExistingEntry_FullCache) {
|
||||
//Add a lot of even numbered keys
|
||||
for (unsigned int i = 0; i < MAX_ENTRIES; ++i) {
|
||||
for (int i = 0; i < static_cast<int>(MAX_ENTRIES); ++i) {
|
||||
push(2*i, 2*i);
|
||||
}
|
||||
//Request an odd numbered key
|
||||
@ -43,35 +43,35 @@ TEST_F(CacheTest_PushAndPop, MultipleEntries) {
|
||||
}
|
||||
|
||||
TEST_F(CacheTest_PushAndPop, FullCache) {
|
||||
for(unsigned int i = 0; i < MAX_ENTRIES; ++i) {
|
||||
for(int i = 0; i < static_cast<int>(MAX_ENTRIES); ++i) {
|
||||
push(i, 2*i);
|
||||
}
|
||||
for(unsigned int i = 0; i < MAX_ENTRIES; ++i) {
|
||||
EXPECT_EQ(static_cast<signed int>(2*i), pop(i).value());
|
||||
for(int i = 0; i < static_cast<int>(MAX_ENTRIES); ++i) {
|
||||
EXPECT_EQ(2*i, pop(i).value());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(CacheTest_PushAndPop, FullCache_PushNonOrdered_PopOrdered) {
|
||||
for(unsigned int i = 1; i < MAX_ENTRIES; i += 2) {
|
||||
for(int i = 1; i < static_cast<int>(MAX_ENTRIES); i += 2) {
|
||||
push(i, 2*i);
|
||||
}
|
||||
for(unsigned int i = 0; i < MAX_ENTRIES; i += 2) {
|
||||
for(int i = 0; i < static_cast<int>(MAX_ENTRIES); i += 2) {
|
||||
push(i, 2*i);
|
||||
}
|
||||
for(unsigned int i = 0; i < MAX_ENTRIES; ++i) {
|
||||
EXPECT_EQ(static_cast<signed int>(2*i), pop(i).value());
|
||||
for(int i = 0; i < static_cast<int>(MAX_ENTRIES); ++i) {
|
||||
EXPECT_EQ(2*i, pop(i).value());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(CacheTest_PushAndPop, FullCache_PushOrdered_PopNonOrdered) {
|
||||
for(unsigned int i = 0; i < MAX_ENTRIES; ++i) {
|
||||
for(int i = 0; i < static_cast<int>(MAX_ENTRIES); ++i) {
|
||||
push(i, 2*i);
|
||||
}
|
||||
for(unsigned int i = 1; i < MAX_ENTRIES; i += 2) {
|
||||
EXPECT_EQ(static_cast<signed int>(2*i), pop(i).value());
|
||||
for(int i = 1; i < static_cast<int>(MAX_ENTRIES); i += 2) {
|
||||
EXPECT_EQ(2*i, pop(i).value());
|
||||
}
|
||||
for(unsigned int i = 0; i < MAX_ENTRIES; i += 2) {
|
||||
EXPECT_EQ(static_cast<signed int>(2*i), pop(i).value());
|
||||
for(int i = 0; i < static_cast<int>(MAX_ENTRIES); i += 2) {
|
||||
EXPECT_EQ(2*i, pop(i).value());
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,27 +95,27 @@ TEST_F(CacheTest_PushAndPop, FullCache_PushNonOrdered_PopNonOrdered) {
|
||||
for(int i = roundDownToEven(MAX_ENTRIES - 1); i >= 0; i -= 2) {
|
||||
push(i, 2*i);
|
||||
}
|
||||
for(unsigned int i = 1; i < MAX_ENTRIES; i += 2) {
|
||||
for(int i = 1; i < static_cast<int>(MAX_ENTRIES); i += 2) {
|
||||
push(i, 2*i);
|
||||
}
|
||||
for(int i = roundDownToOdd(MAX_ENTRIES-1); i >= 0; i -= 2) {
|
||||
EXPECT_EQ(static_cast<signed int>(2*i), pop(i).value());
|
||||
EXPECT_EQ(2*i, pop(i).value());
|
||||
}
|
||||
for(unsigned int i = 0; i < MAX_ENTRIES; i += 2) {
|
||||
EXPECT_EQ(static_cast<signed int>(2*i), pop(i).value());
|
||||
for(int i = 0; i < static_cast<int>(MAX_ENTRIES); i += 2) {
|
||||
EXPECT_EQ(2*i, pop(i).value());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(CacheTest_PushAndPop, MoreThanFullCache) {
|
||||
for(unsigned int i = 0; i < MAX_ENTRIES + 2; ++i) {
|
||||
for(int i = 0; i < static_cast<int>(MAX_ENTRIES + 2); ++i) {
|
||||
push(i, 2*i);
|
||||
}
|
||||
//Check that the oldest two elements got deleted automatically
|
||||
EXPECT_EQ(boost::none, pop(0));
|
||||
EXPECT_EQ(boost::none, pop(1));
|
||||
//Check the other elements are still there
|
||||
for(unsigned int i = 2; i < MAX_ENTRIES + 2; ++i) {
|
||||
EXPECT_EQ(static_cast<signed int>(2*i), pop(i).value());
|
||||
for(int i = 2; i < static_cast<int>(MAX_ENTRIES + 2); ++i) {
|
||||
EXPECT_EQ(2*i, pop(i).value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
void handle_exit_signal(char* argv[]) {
|
||||
void handle_exit_signal(char **argv) {
|
||||
const std::string kind = argv[1];
|
||||
if (kind == "exception") {
|
||||
throw std::logic_error(argv[2]);
|
||||
@ -18,7 +18,7 @@ void handle_exit_signal(char* argv[]) {
|
||||
DWORD code = std::atoll(argv[2]);
|
||||
::RaiseException(code, EXCEPTION_NONCONTINUABLE, 0, NULL);
|
||||
#else
|
||||
int code = std::strtol(argv[2], nullptr, 10);
|
||||
int code = static_cast<int>(std::strtol(argv[2], nullptr, 10));
|
||||
::raise(code);
|
||||
#endif
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
std::cout << argv[1];
|
||||
|
||||
int exit_status = std::strtol(argv[2], nullptr, 10);
|
||||
int exit_status = static_cast<int>(std::strtol(argv[2], nullptr, 10));
|
||||
return exit_status;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ public:
|
||||
void EXPECT_VECTOR_EQ(std::initializer_list<std::string> expected, const std::vector<std::string> &actual) {
|
||||
std::vector<std::string> expectedVec(expected);
|
||||
ASSERT_EQ(expectedVec.size(), actual.size());
|
||||
for(unsigned int i = 0; i < expectedVec.size(); ++i) {
|
||||
for(size_t i = 0; i < expectedVec.size(); ++i) {
|
||||
EXPECT_EQ(expectedVec[i], actual[i]);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
cpputils::unique_ref<cpputils::HttpClient> _httpClient() {
|
||||
cpputils::unique_ref<cpputils::FakeHttpClient> httpClient = cpputils::make_unique_ref<cpputils::FakeHttpClient>();
|
||||
httpClient->addWebsite("https://www.cryfs.org/version_info.json", "{\"version_info\":{\"current\":\"0.8.5\"}}");
|
||||
return std::move(httpClient);
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
int run(const std::vector<std::string>& args, std::function<void()> onMounted) {
|
||||
|
@ -20,6 +20,6 @@ TEST_P(FuseReadFileDescriptorTest, FileDescriptorIsCorrect) {
|
||||
EXPECT_CALL(*fsimpl, read(Eq(GetParam()), _, _, _))
|
||||
.Times(1).WillOnce(ReturnSuccessfulRead);
|
||||
|
||||
char buf[1];
|
||||
ReadFile(FILENAME, buf, fspp::num_bytes_t(1), fspp::num_bytes_t(0));
|
||||
std::array<char, 1> buf{};
|
||||
ReadFile(FILENAME, buf.data(), fspp::num_bytes_t(1), fspp::num_bytes_t(0));
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ constexpr fspp::num_bytes_t FuseReadOverflowTest::OFFSET;
|
||||
|
||||
|
||||
TEST_F(FuseReadOverflowTest, ReadMoreThanFileSizeFromBeginning) {
|
||||
char buf[READSIZE.value()];
|
||||
auto retval = ReadFileReturnError(FILENAME, buf, READSIZE, fspp::num_bytes_t(0));
|
||||
std::array<char, READSIZE.value()> buf{};
|
||||
auto retval = ReadFileReturnError(FILENAME, buf.data(), READSIZE, fspp::num_bytes_t(0));
|
||||
EXPECT_EQ(FILESIZE, retval.read_bytes);
|
||||
}
|
||||
|
||||
TEST_F(FuseReadOverflowTest, ReadMoreThanFileSizeFromMiddle) {
|
||||
char buf[READSIZE.value()];
|
||||
auto retval = ReadFileReturnError(FILENAME, buf, READSIZE, OFFSET);
|
||||
std::array<char, READSIZE.value()> buf{};
|
||||
auto retval = ReadFileReturnError(FILENAME, buf.data(), READSIZE, OFFSET);
|
||||
EXPECT_EQ(FILESIZE-OFFSET, retval.read_bytes);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void FuseReadDirTest::closeDir(DIR *dir) {
|
||||
|
||||
Action<vector<fspp::Dir::Entry>*(const char*)> FuseReadDirTest::ReturnDirEntries(vector<std::string> entries) {
|
||||
vector<fspp::Dir::Entry> *direntries = new vector<fspp::Dir::Entry>(entries.size(), fspp::Dir::Entry(fspp::Dir::EntryType::FILE, ""));
|
||||
for(unsigned int i = 0; i < entries.size(); ++i) {
|
||||
for(size_t i = 0; i < entries.size(); ++i) {
|
||||
(*direntries)[i].name = entries[i];
|
||||
}
|
||||
return Return(direntries);
|
||||
|
@ -5,18 +5,18 @@ using ::testing::Return;
|
||||
using ::testing::WithParamInterface;
|
||||
using ::testing::Values;
|
||||
|
||||
class FuseUtimensTimeParameterTest: public FuseUtimensTest, public WithParamInterface<const timespec*> {
|
||||
class FuseUtimensTimeParameterTest: public FuseUtimensTest, public WithParamInterface<std::array<timespec, 2>> {
|
||||
};
|
||||
const timespec TIMEVAL1[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const timespec TIMEVAL2[2] = {FuseUtimensTest::makeTimespec(1000,0), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const timespec TIMEVAL3[2] = {FuseUtimensTest::makeTimespec(0,1000), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const timespec TIMEVAL4[2] = {FuseUtimensTest::makeTimespec(1000,1000), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const timespec TIMEVAL5[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const timespec TIMEVAL6[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(1000,0)};
|
||||
const timespec TIMEVAL7[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,1000)};
|
||||
const timespec TIMEVAL8[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(1000,1000)};
|
||||
const timespec TIMEVAL9[2] = {FuseUtimensTest::makeTimespec(1417196126,123000), FuseUtimensTest::makeTimespec(1417109713,321000)}; // current timestamp and the day before as of writing this test case
|
||||
const timespec TIMEVAL10[2] = {FuseUtimensTest::makeTimespec(UINT64_C(1024)*1024*1024*1024,999000), FuseUtimensTest::makeTimespec(UINT64_C(2*1024)*1024*1024*1024,321000)}; // needs 64bit for timestamp representation
|
||||
const std::array<timespec, 2> TIMEVAL1 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const std::array<timespec, 2> TIMEVAL2 = {FuseUtimensTest::makeTimespec(1000,0), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const std::array<timespec, 2> TIMEVAL3 = {FuseUtimensTest::makeTimespec(0,1000), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const std::array<timespec, 2> TIMEVAL4 = {FuseUtimensTest::makeTimespec(1000,1000), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const std::array<timespec, 2> TIMEVAL5 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,0)};
|
||||
const std::array<timespec, 2> TIMEVAL6 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(1000,0)};
|
||||
const std::array<timespec, 2> TIMEVAL7 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,1000)};
|
||||
const std::array<timespec, 2> TIMEVAL8 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(1000,1000)};
|
||||
const std::array<timespec, 2> TIMEVAL9 = {FuseUtimensTest::makeTimespec(1417196126,123000), FuseUtimensTest::makeTimespec(1417109713,321000)}; // current timestamp and the day before as of writing this test case
|
||||
const std::array<timespec, 2> TIMEVAL10 = {FuseUtimensTest::makeTimespec(UINT64_C(1024)*1024*1024*1024,999000), FuseUtimensTest::makeTimespec(UINT64_C(2*1024)*1024*1024*1024,321000)}; // needs 64bit for timestamp representation
|
||||
INSTANTIATE_TEST_CASE_P(FuseUtimensTimeParameterTest, FuseUtimensTimeParameterTest,
|
||||
Values(TIMEVAL1, TIMEVAL2, TIMEVAL3, TIMEVAL4, TIMEVAL5, TIMEVAL6, TIMEVAL7, TIMEVAL8, TIMEVAL9, TIMEVAL10));
|
||||
|
||||
|
@ -21,6 +21,6 @@ TEST_P(FuseWriteFileDescriptorTest, FileDescriptorIsCorrect) {
|
||||
EXPECT_CALL(*fsimpl, write(Eq(GetParam()), _, _, _))
|
||||
.Times(1).WillOnce(Return());
|
||||
|
||||
char buf[1];
|
||||
WriteFile(FILENAME, buf, fspp::num_bytes_t(1), fspp::num_bytes_t(0));
|
||||
std::array<char, 1> buf{};
|
||||
WriteFile(FILENAME, buf.data(), fspp::num_bytes_t(1), fspp::num_bytes_t(0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user