From 09cb5d8f19f37ee7251539c7c8726db09228ac6b Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 18 Oct 2024 11:46:59 -0500 Subject: [PATCH] updated build system --- cmake/versions.cmake | 12 ++--- repertory/librepertory/include/common.hpp | 61 ++++++++--------------- support/src/utils/db/sqlite/db_common.cpp | 9 ++-- support/src/utils/db/sqlite/db_delete.cpp | 9 ++-- support/src/utils/db/sqlite/db_insert.cpp | 15 +++--- support/src/utils/db/sqlite/db_select.cpp | 13 +++-- support/src/utils/db/sqlite/db_update.cpp | 13 +++-- support/src/utils/encrypting_reader.cpp | 4 +- support/src/utils/encryption.cpp | 4 +- support/src/utils/error.cpp | 9 +++- support/src/utils/file_directory.cpp | 2 +- support/src/utils/file_file.cpp | 3 -- support/src/utils/hash.cpp | 4 +- support/src/utils/windows.cpp | 5 +- 14 files changed, 68 insertions(+), 95 deletions(-) diff --git a/cmake/versions.cmake b/cmake/versions.cmake index fb10e730..aefb4bcb 100644 --- a/cmake/versions.cmake +++ b/cmake/versions.cmake @@ -1,15 +1,15 @@ set(BINUTILS_VERSION 2.41) -set(BOOST2_MAJOR_VERSION 1) -set(BOOST2_MINOR_VERSION 76) -set(BOOST2_PATCH_VERSION 0) set(BOOST_MAJOR_VERSION 1) set(BOOST_MINOR_VERSION 85) set(BOOST_PATCH_VERSION 0) +set(BOOST2_MAJOR_VERSION 1) +set(BOOST2_MINOR_VERSION 76) +set(BOOST2_PATCH_VERSION 0) set(CPP_HTTPLIB_VERSION 0.16.3) -set(CURL2_VERSION 8_9_1) set(CURL_VERSION 8.9.1) -set(EXPAT2_VERSION 2_6_2) +set(CURL2_VERSION 8_9_1) set(EXPAT_VERSION 2.6.2) +set(EXPAT2_VERSION 2_6_2) set(GCC_VERSION 14.2.0) set(GTEST_VERSION 1.15.2) set(ICU_VERSION 75-1) @@ -21,7 +21,7 @@ set(OPENSSL_VERSION 3.3.1) set(PKG_CONFIG_VERSION 0.29.2) set(PUGIXML_VERSION 1.14) set(SPDLOG_VERSION 1.14.1) -set(SQLITE2_VERSION 3.46.1) set(SQLITE_VERSION 3460100) +set(SQLITE2_VERSION 3.46.1) set(STDUUID_VERSION 1.2.3) set(ZLIB_VERSION 1.3.1) diff --git a/repertory/librepertory/include/common.hpp b/repertory/librepertory/include/common.hpp index 0cb5f1f3..9e798cba 100644 --- a/repertory/librepertory/include/common.hpp +++ b/repertory/librepertory/include/common.hpp @@ -221,44 +221,25 @@ using WCHAR = wchar_t; #define MAX_PATH 260 -#define STATUS_SUCCESS \ - std::uint32_t { 0U } -#define STATUS_ACCESS_DENIED \ - std::uint32_t { 0xC0000022L } -#define STATUS_DEVICE_BUSY \ - std::uint32_t { 0x80000011L } -#define STATUS_DEVICE_INSUFFICIENT_RESOURCES \ - std::uint32_t { 0xC0000468L } -#define STATUS_DIRECTORY_NOT_EMPTY \ - std::uint32_t { 0xC0000101L } -#define STATUS_FILE_IS_A_DIRECTORY \ - std::uint32_t { 0xC00000BAL } -#define STATUS_FILE_TOO_LARGE \ - std::uint32_t { 0xC0000904L } -#define STATUS_INSUFFICIENT_RESOURCES \ - std::uint32_t { 0xC000009AL } -#define STATUS_INTERNAL_ERROR \ - std::uint32_t { 0xC00000E5L } -#define STATUS_INVALID_ADDRESS \ - std::uint32_t { 0xC0000141L } -#define STATUS_INVALID_HANDLE \ - std::uint32_t { 0xC0000006L } -#define STATUS_INVALID_IMAGE_FORMAT \ - std::uint32_t { 0xC000007BL } -#define STATUS_INVALID_PARAMETER \ - std::uint32_t { 0xC000000DL } -#define STATUS_NO_MEMORY \ - std::uint32_t { 0xC0000017L } -#define STATUS_NOT_IMPLEMENTED \ - std::uint32_t { 0xC0000002L } -#define STATUS_OBJECT_NAME_EXISTS \ - std::uint32_t { 0x40000000L } -#define STATUS_OBJECT_NAME_NOT_FOUND \ - std::uint32_t { 0xC0000034L } -#define STATUS_OBJECT_PATH_INVALID \ - std::uint32_t { 0xC0000039L } -#define STATUS_UNEXPECTED_IO_ERROR \ - std::uint32_t { 0xC00000E9L } +#define STATUS_SUCCESS std::uint32_t{0U} +#define STATUS_ACCESS_DENIED std::uint32_t{0xC0000022L} +#define STATUS_DEVICE_BUSY std::uint32_t{0x80000011L} +#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::uint32_t{0xC0000468L} +#define STATUS_DIRECTORY_NOT_EMPTY std::uint32_t{0xC0000101L} +#define STATUS_FILE_IS_A_DIRECTORY std::uint32_t{0xC00000BAL} +#define STATUS_FILE_TOO_LARGE std::uint32_t{0xC0000904L} +#define STATUS_INSUFFICIENT_RESOURCES std::uint32_t{0xC000009AL} +#define STATUS_INTERNAL_ERROR std::uint32_t{0xC00000E5L} +#define STATUS_INVALID_ADDRESS std::uint32_t{0xC0000141L} +#define STATUS_INVALID_HANDLE std::uint32_t{0xC0000006L} +#define STATUS_INVALID_IMAGE_FORMAT std::uint32_t{0xC000007BL} +#define STATUS_INVALID_PARAMETER std::uint32_t{0xC000000DL} +#define STATUS_NO_MEMORY std::uint32_t{0xC0000017L} +#define STATUS_NOT_IMPLEMENTED std::uint32_t{0xC0000002L} +#define STATUS_OBJECT_NAME_EXISTS std::uint32_t{0x40000000L} +#define STATUS_OBJECT_NAME_NOT_FOUND std::uint32_t{0xC0000034L} +#define STATUS_OBJECT_PATH_INVALID std::uint32_t{0xC0000039L} +#define STATUS_UNEXPECTED_IO_ERROR std::uint32_t{0xC00000E9L} #define CONVERT_STATUS_NOT_IMPLEMENTED(e) \ ((std::uint32_t(e) == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e) @@ -296,8 +277,8 @@ using namespace Fsp; #define INTERFACE_SETUP(name) \ public: \ name(const name &) noexcept = delete; \ - name &operator=(const name &) noexcept = delete; \ - name &operator=(name &&) noexcept = delete; \ + auto operator=(const name &) noexcept -> name & = delete; \ + auto operator=(name &&) noexcept -> name & = delete; \ \ protected: \ name() = default; \ diff --git a/support/src/utils/db/sqlite/db_common.cpp b/support/src/utils/db/sqlite/db_common.cpp index 5caf4872..eba8046c 100644 --- a/support/src/utils/db/sqlite/db_common.cpp +++ b/support/src/utils/db/sqlite/db_common.cpp @@ -27,7 +27,7 @@ #include "utils/error.hpp" namespace repertory::utils::db::sqlite { -void sqlite3_deleter::operator()(sqlite3 *db3) const { +void sqlite_deleter::operator()(sqlite3 *db3) const { REPERTORY_USES_FUNCTION_NAME(); if (db3 == nullptr) { @@ -35,10 +35,6 @@ void sqlite3_deleter::operator()(sqlite3 *db3) const { } utils::error::handle_error(function_name, "closing database handle"); - sqlite3_db_cacheflush(db3); - - std::string err_msg; - execute_sql(*db3, "PRAGMA wal_checkpoint(full);", err_msg); if (not utils::retry_action( [&db3]() -> bool { @@ -57,7 +53,8 @@ void sqlite3_deleter::operator()(sqlite3 *db3) const { return false; }, 60U)) { - utils::error::handle_error(function_name, "failed to close database"); + repertory::utils::error::handle_error(function_name, + "failed to close database"); } } diff --git a/support/src/utils/db/sqlite/db_delete.cpp b/support/src/utils/db/sqlite/db_delete.cpp index e6c85205..b10d27cd 100644 --- a/support/src/utils/db/sqlite/db_delete.cpp +++ b/support/src/utils/db/sqlite/db_delete.cpp @@ -19,15 +19,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "utils/db/sqlite/db_delete.hpp" - #if defined(PROJECT_ENABLE_SQLITE) +#include "utils/db/sqlite/db_delete.hpp" + namespace repertory::utils::db::sqlite { -void db_delete::context::clear() { - // stmt.reset(); - where_data.reset(); -} +void db_delete::context::clear() { where_data.reset(); } auto db_delete::context::db_delete_op_t::dump() const -> std::string { return db_delete{ctx}.dump(); diff --git a/support/src/utils/db/sqlite/db_insert.cpp b/support/src/utils/db/sqlite/db_insert.cpp index 602e74c8..1c9778b3 100644 --- a/support/src/utils/db/sqlite/db_insert.cpp +++ b/support/src/utils/db/sqlite/db_insert.cpp @@ -19,18 +19,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "utils/db/sqlite/db_insert.hpp" - #if defined(PROJECT_ENABLE_SQLITE) -namespace repertory::utils::db::sqlite { -void db_insert::context::clear() { - // stmt.reset(); - values.clear(); -} +#include "utils/db/sqlite/db_insert.hpp" -auto db_insert::column_value(std::string column_name, db_types_t value) - -> db_insert & { +namespace repertory::utils::db::sqlite { +void db_insert::context::clear() { values.clear(); } + +auto db_insert::column_value(std::string column_name, + db_types_t value) -> db_insert & { ctx_->values[column_name] = value; return *this; } diff --git a/support/src/utils/db/sqlite/db_select.cpp b/support/src/utils/db/sqlite/db_select.cpp index 8c1098ae..1ffa4da8 100644 --- a/support/src/utils/db/sqlite/db_select.cpp +++ b/support/src/utils/db/sqlite/db_select.cpp @@ -19,10 +19,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "utils/db/sqlite/db_select.hpp" - #if defined(PROJECT_ENABLE_SQLITE) +#include "utils/db/sqlite/db_select.hpp" + namespace repertory::utils::db::sqlite { void db_select::context::clear() { columns.clear(); @@ -31,7 +31,6 @@ void db_select::context::clear() { limit.reset(); offset.reset(); order_by.reset(); - // stmt.reset(); where_data.reset(); } @@ -73,8 +72,8 @@ auto db_select::column(std::string column_name) -> db_select & { return *this; } -auto db_select::count(std::string column_name, std::string as_column_name) - -> db_select & { +auto db_select::count(std::string column_name, + std::string as_column_name) -> db_select & { ctx_->count_columns[column_name] = as_column_name; return *this; } @@ -210,8 +209,8 @@ auto db_select::offset(std::int32_t value) -> db_select & { return *this; } -auto db_select::order_by(std::string column_name, bool ascending) - -> db_select & { +auto db_select::order_by(std::string column_name, + bool ascending) -> db_select & { ctx_->order_by = {column_name, ascending}; return *this; } diff --git a/support/src/utils/db/sqlite/db_update.cpp b/support/src/utils/db/sqlite/db_update.cpp index 94c6a06e..31efe5ba 100644 --- a/support/src/utils/db/sqlite/db_update.cpp +++ b/support/src/utils/db/sqlite/db_update.cpp @@ -19,16 +19,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "utils/db/sqlite/db_update.hpp" - #if defined(PROJECT_ENABLE_SQLITE) +#include "utils/db/sqlite/db_update.hpp" + namespace repertory::utils::db::sqlite { void db_update::context::clear() { column_values.clear(); limit.reset(); order_by.reset(); - // stmt.reset(); where_data.reset(); } @@ -53,8 +52,8 @@ auto db_update::context::db_update_op_t::order_by(std::string column_name, return *this; } -auto db_update::column_value(std::string column_name, db_types_t value) - -> db_update & { +auto db_update::column_value(std::string column_name, + db_types_t value) -> db_update & { ctx_->column_values[column_name] = value; return *this; } @@ -174,8 +173,8 @@ auto db_update::limit(std::int32_t value) -> db_update & { return *this; } -auto db_update::order_by(std::string column_name, bool ascending) - -> db_update & { +auto db_update::order_by(std::string column_name, + bool ascending) -> db_update & { ctx_->order_by = {column_name, ascending}; return *this; } diff --git a/support/src/utils/encrypting_reader.cpp b/support/src/utils/encrypting_reader.cpp index 1204867a..8dbd2035 100644 --- a/support/src/utils/encrypting_reader.cpp +++ b/support/src/utils/encrypting_reader.cpp @@ -19,6 +19,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST) + #include "utils/encrypting_reader.hpp" #include "utils/collection.hpp" @@ -29,8 +31,6 @@ #include "utils/unix.hpp" #include "utils/windows.hpp" -#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST) - #if !defined(CURL_READFUNC_ABORT) #define CURL_READFUNC_ABORT (-1) #endif // !defined(CURL_READFUNC_ABORT) diff --git a/support/src/utils/encryption.cpp b/support/src/utils/encryption.cpp index d5c0be90..cbac39ac 100644 --- a/support/src/utils/encryption.cpp +++ b/support/src/utils/encryption.cpp @@ -19,13 +19,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST) + #include "utils/encryption.hpp" #include "utils/collection.hpp" #include "utils/encrypting_reader.hpp" -#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST) - namespace repertory::utils::encryption { auto decrypt_file_path(std::string_view encryption_token, std::string &file_path) -> bool { diff --git a/support/src/utils/error.cpp b/support/src/utils/error.cpp index a9f71e4b..04913335 100644 --- a/support/src/utils/error.cpp +++ b/support/src/utils/error.cpp @@ -27,8 +27,13 @@ std::atomic exception_handler{ auto create_error_message(std::vector items) -> std::string { std::stringstream stream{}; - for (auto &&item : items) { - stream << '|' << item; + stream << function_name; + for (std::size_t idx = 0U; idx < items.size(); ++idx) { + if (idx > 0) { + stream << '|'; + } + + stream << item; } return stream.str(); diff --git a/support/src/utils/file_directory.cpp b/support/src/utils/file_directory.cpp index 96562d09..932d5329 100644 --- a/support/src/utils/file_directory.cpp +++ b/support/src/utils/file_directory.cpp @@ -161,7 +161,7 @@ auto directory::create_directory(std::string_view path) const std::string{abs_path} + '|' + std::to_string(res)); } -#else // !defined(_WIN32) +#else // !defined(_WIN32) auto ret{true}; auto paths = utils::string::split(abs_path, utils::path::directory_seperator, false); diff --git a/support/src/utils/file_file.cpp b/support/src/utils/file_file.cpp index 34c54062..e7f2d966 100644 --- a/support/src/utils/file_file.cpp +++ b/support/src/utils/file_file.cpp @@ -25,7 +25,6 @@ #include "utils/common.hpp" #include "utils/error.hpp" #include "utils/path.hpp" -#include namespace { [[nodiscard]] auto get_file_size(std::string_view path, @@ -398,8 +397,6 @@ auto file::sha256() -> std::optional { #endif // defined(PROJECT_ENABLE_LIBSODIUM) auto file::remove() -> bool { - REPERTORY_USES_FUNCTION_NAME(); - close(); return utils::retry_action([this]() -> bool { diff --git a/support/src/utils/hash.cpp b/support/src/utils/hash.cpp index 7b4895c8..9dce122f 100644 --- a/support/src/utils/hash.cpp +++ b/support/src/utils/hash.cpp @@ -19,10 +19,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "utils/hash.hpp" - #if defined(PROJECT_ENABLE_LIBSODIUM) +#include "utils/hash.hpp" + namespace repertory::utils::encryption { auto create_hash_blake2b_256(std::string_view data) -> hash_256_t { return create_hash_blake2b_t( diff --git a/support/src/utils/windows.cpp b/support/src/utils/windows.cpp index 8c02d65b..6935f513 100644 --- a/support/src/utils/windows.cpp +++ b/support/src/utils/windows.cpp @@ -20,6 +20,7 @@ SOFTWARE. */ #if defined(_WIN32) + #include "utils/windows.hpp" #include "utils/com_init_wrapper.hpp" @@ -27,7 +28,7 @@ namespace repertory::utils { void create_console() { - if (AllocConsole() == 0) { + if (::AllocConsole() == 0) { return; } @@ -56,7 +57,7 @@ void create_console() { } void free_console() { - FreeConsole(); + ::FreeConsole(); } auto get_last_error_code() -> DWORD { return ::GetLastError(); }