diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 06c54873d..f7a20b58b 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -4,22 +4,9 @@ project(cortex-server C CXX) include(CheckIncludeFileCXX) -check_include_file_cxx(any HAS_ANY) -check_include_file_cxx(string_view HAS_STRING_VIEW) -check_include_file_cxx(coroutine HAS_COROUTINE) -if(HAS_ANY - AND HAS_STRING_VIEW - AND HAS_COROUTINE) - set(CMAKE_CXX_STANDARD 20) -elseif(HAS_ANY AND HAS_STRING_VIEW) - set(CMAKE_CXX_STANDARD 17) -else() - set(CMAKE_CXX_STANDARD 14) -endif() - +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(OPENSSL_USE_STATIC_LIBS TRUE) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Add CORTEX_CQA option diff --git a/engine/cli/CMakeLists.txt b/engine/cli/CMakeLists.txt index 10be1d31c..4163042d0 100644 --- a/engine/cli/CMakeLists.txt +++ b/engine/cli/CMakeLists.txt @@ -2,22 +2,9 @@ project(cortex C CXX) include(CheckIncludeFileCXX) -check_include_file_cxx(any HAS_ANY) -check_include_file_cxx(string_view HAS_STRING_VIEW) -check_include_file_cxx(coroutine HAS_COROUTINE) -if(HAS_ANY - AND HAS_STRING_VIEW - AND HAS_COROUTINE) - set(CMAKE_CXX_STANDARD 20) -elseif(HAS_ANY AND HAS_STRING_VIEW) - set(CMAKE_CXX_STANDARD 17) -else() - set(CMAKE_CXX_STANDARD 14) -endif() - +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(OPENSSL_USE_STATIC_LIBS TRUE) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) if(MSVC) diff --git a/engine/cli/commands/engine_update_cmd.cc b/engine/cli/commands/engine_update_cmd.cc index 08a24419c..f39b08af0 100644 --- a/engine/cli/commands/engine_update_cmd.cc +++ b/engine/cli/commands/engine_update_cmd.cc @@ -45,7 +45,7 @@ bool EngineUpdateCmd::Exec(const std::string& host, int port, try { Json::Value json = json_helper::ParseJsonString(update_result.error()); std::cout << json["message"].asString() << std::endl; - } catch (const std::exception& e) { + } catch (const std::exception&) { CTL_ERR(update_result.error()); } diff --git a/engine/config/gguf_parser.cc b/engine/config/gguf_parser.cc index 81424ba1f..7e32f1f23 100644 --- a/engine/config/gguf_parser.cc +++ b/engine/config/gguf_parser.cc @@ -86,7 +86,7 @@ void GGUFHandler::OpenFile(const std::string& file_path) { #endif } -void GGUFHandler::CheckOffset(int offset) const { +void GGUFHandler::CheckOffset(size_t offset) const { if (offset > file_size_) throw std::runtime_error("Unexpected EOF"); } diff --git a/engine/config/gguf_parser.h b/engine/config/gguf_parser.h index f7e28f4b5..3dfefe1b0 100644 --- a/engine/config/gguf_parser.h +++ b/engine/config/gguf_parser.h @@ -46,7 +46,7 @@ class GGUFHandler { size_t ReadArray(std::size_t offset, const std::string& key); void ModelConfigFromMetadata(); void OpenFile(const std::string& file_path); - void CheckOffset(int offset) const; + void CheckOffset(size_t offset) const; uint8_t* data_; size_t file_size_; diff --git a/engine/config/yaml_config.cc b/engine/config/yaml_config.cc index 8d5060615..9650ffdcc 100644 --- a/engine/config/yaml_config.cc +++ b/engine/config/yaml_config.cc @@ -55,7 +55,7 @@ void YamlHandler::ReadYamlFile(const std::string& file_path) { } } - } catch (const YAML::BadFile& e) { + } catch (const YAML::BadFile&) { throw; } } diff --git a/engine/database/engines.cc b/engine/database/engines.cc index 61476fe3a..f34c41af7 100644 --- a/engine/database/engines.cc +++ b/engine/database/engines.cc @@ -60,7 +60,7 @@ std::optional Engines::UpsertEngine( } else { return std::nullopt; } - } catch (const std::exception& e) { + } catch (const std::exception&) { return std::nullopt; } } @@ -87,7 +87,7 @@ std::optional> Engines::GetEngines() const { } return engines; - } catch (const std::exception& e) { + } catch (const std::exception&) { return std::nullopt; } } @@ -115,7 +115,7 @@ std::optional Engines::GetEngineById(int id) const { } else { return std::nullopt; } - } catch (const std::exception& e) { + } catch (const std::exception&) { return std::nullopt; } } @@ -155,7 +155,7 @@ std::optional Engines::GetEngineByNameAndVariant( } else { return std::nullopt; } - } catch (const std::exception& e) { + } catch (const std::exception&) { return std::nullopt; } } diff --git a/engine/migrations/migration_manager.cc b/engine/migrations/migration_manager.cc index 8f9e22b5a..a0c3a08a3 100644 --- a/engine/migrations/migration_manager.cc +++ b/engine/migrations/migration_manager.cc @@ -24,7 +24,7 @@ int GetSchemaVersion(SQLite::Database& db) { version = query.getColumn(0).getInt(); // Get the version from the first column } - } catch (const std::exception& e) { + } catch (const std::exception&) { // CTL_WRN("SQLite error: " << e.what()); } diff --git a/engine/repositories/assistant_fs_repository.cc b/engine/repositories/assistant_fs_repository.cc index 290471b50..50949132b 100644 --- a/engine/repositories/assistant_fs_repository.cc +++ b/engine/repositories/assistant_fs_repository.cc @@ -103,7 +103,7 @@ cpp::result AssistantFsRepository::DeleteAssistant( } try { std::filesystem::remove_all(path); - } catch (const std::exception& e) { + } catch (const std::exception&) { return cpp::fail(""); } } diff --git a/engine/test/components/test_download_task_queue.cc b/engine/test/components/test_download_task_queue.cc index 929885183..73f451162 100644 --- a/engine/test/components/test_download_task_queue.cc +++ b/engine/test/components/test_download_task_queue.cc @@ -107,7 +107,7 @@ TEST_F(DownloadTaskQueueTest, ConcurrentPushAndPop) { std::atomic poppedTasks{0}; for (int i = 0; i < 4; ++i) { - pushThreads.emplace_back([this, i, &pushedTasks]() { + pushThreads.emplace_back([this, i, numTasks, &pushedTasks]() { for (int j = 0; j < numTasks; ++j) { queue.push(CreateDownloadTask("task_" + std::to_string(i) + "_" + std::to_string(j))); @@ -115,7 +115,7 @@ TEST_F(DownloadTaskQueueTest, ConcurrentPushAndPop) { } }); - popThreads.emplace_back([this, &poppedTasks, &pushedTasks]() { + popThreads.emplace_back([this, numTasks, &poppedTasks, &pushedTasks]() { while (poppedTasks.load() < pushedTasks.load() || pushedTasks.load() < numTasks * 4) { if (auto task = queue.pop()) { diff --git a/engine/utils/dylib_path_manager.cc b/engine/utils/dylib_path_manager.cc index 3d10fc8ff..7c389df06 100644 --- a/engine/utils/dylib_path_manager.cc +++ b/engine/utils/dylib_path_manager.cc @@ -1,5 +1,6 @@ #include "dylib_path_manager.h" #include "utils/logging_utils.h" +#include "utils/widechar_conv.h" namespace cortex { @@ -12,8 +13,7 @@ cpp::result DylibPathManager::RegisterPath( return cpp::fail("Path does not exist: " + path.string()); } - std::wstring_convert> converter; - std::wstring wide_path = converter.from_bytes(path.string()); + auto wide_path = cortex::wc::Utf8ToWstring(path.string()); auto cookie = AddDllDirectory(wide_path.c_str()); if (cookie == nullptr) { diff --git a/engine/utils/huggingface_utils.h b/engine/utils/huggingface_utils.h index bfabf2786..ad1524fc4 100644 --- a/engine/utils/huggingface_utils.h +++ b/engine/utils/huggingface_utils.h @@ -339,7 +339,7 @@ inline cpp::result GetModelAuthorCortexsoHub( return author.as(); } return ""; - } catch (const std::exception& e) { + } catch (const std::exception&) { return ""; } }