From a3fe71ba3a841530ea1c2ea110cba84f25ce64f0 Mon Sep 17 00:00:00 2001 From: Joscha Schmiedt <joscha@schmiedt.dev> Date: Tue, 15 Oct 2024 20:38:11 +0200 Subject: [PATCH] Fix compiler warnings - _CRT_SECURE_NO_WARNINGS suppresses warnings for "unsafe" fopen, strcpy etc. - int -> size_t --- CMakeLists.txt | 11 +++++++++-- include/linkahead/result_set.h | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8f7292..35826f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,9 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) IF (WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -ENDIF() + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) # suppress warnings for fopen, strcpy, etc. +endif() + IF (BUILD_ACM) message(STATUS "BUILD_ACM") @@ -370,7 +372,12 @@ endif() set(liblinkahead_INCLUDE_DEST "include/linkahead") set(liblinkahead_LIB_DEST "lib") -set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local/") +if (WIN32) + set(CMAKE_INSTALL_PREFIX "$ENV{LOCALAPPDATA}/linkahead") +else() + set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local/") +endif() + install( # targets to install TARGETS linkahead clinkahead caosdb_grpc diff --git a/include/linkahead/result_set.h b/include/linkahead/result_set.h index 0ada000..d8181fd 100644 --- a/include/linkahead/result_set.h +++ b/include/linkahead/result_set.h @@ -40,7 +40,7 @@ class ResultSet { public: virtual ~ResultSet() = default; - [[nodiscard]] virtual auto size() const noexcept -> int = 0; + [[nodiscard]] virtual auto size() const noexcept -> size_t = 0; [[nodiscard]] virtual auto at(const int index) const -> const Entity & = 0; [[nodiscard]] virtual auto mutable_at(int index) const -> Entity * = 0; /** @@ -91,7 +91,7 @@ public: virtual ~AbstractMultiResultSet() = default; inline explicit AbstractMultiResultSet(std::vector<std::unique_ptr<Entity>> result_set) : items(std::move(result_set)) {} - [[nodiscard]] inline auto size() const noexcept -> int override { return this->items.size(); } + [[nodiscard]] inline auto size() const noexcept -> size_t override { return this->items.size(); } [[nodiscard]] inline auto at(const int index) const -> const Entity & override { return *(this->items.at(index)); } -- GitLab