[ox] Fix remaining implicit conversion issues

This commit is contained in:
2023-06-06 23:32:23 -05:00
parent acf04665bc
commit 3fdfee33a9
50 changed files with 218 additions and 191 deletions

View File

@@ -6,6 +6,11 @@ add_library(
)
if(NOT MSVC)
target_compile_options(OxClaw PRIVATE -Wsign-conversion)
target_compile_options(OxClaw PRIVATE -Wconversion)
endif()
target_link_libraries(
OxClaw PUBLIC
OxMetalClaw

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 - 2022 gary@drinkingtea.net
* Copyright 2015 - 2023 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -17,7 +17,7 @@ Result<ClawHeader> readClawHeader(const char *buff, std::size_t buffLen) noexcep
if (!s1End) {
return OxError(1, "Could not read Claw header");
}
const auto s1Size = s1End - buff;
const auto s1Size = static_cast<std::size_t>(s1End - buff);
const String fmt(buff, s1Size);
buff += s1Size + 1;
buffLen -= s1Size + 1;
@@ -26,7 +26,7 @@ Result<ClawHeader> readClawHeader(const char *buff, std::size_t buffLen) noexcep
if (!s2End) {
return OxError(2, "Could not read Claw header");
}
const auto s2Size = s2End - buff;
const auto s2Size = static_cast<std::size_t>(s2End - buff);
const String typeName(buff, s2Size);
buff += s2Size + 1;
buffLen -= s2Size + 1;
@@ -35,7 +35,7 @@ Result<ClawHeader> readClawHeader(const char *buff, std::size_t buffLen) noexcep
if (!s3End) {
return OxError(3, "Could not read Claw header");
}
const auto s3Size = s3End - buff;
const auto s3Size = static_cast<std::size_t>(s3End - buff);
const String versionStr(buff, s3Size);
buff += s3Size + 1;
buffLen -= s3Size + 1;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 - 2022 gary@drinkingtea.net
* Copyright 2015 - 2023 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -198,7 +198,7 @@ int main(int argc, const char **args) {
if (argc > 0) {
auto testName = args[1];
if (tests.find(testName) != tests.end()) {
retval = tests[testName]();
retval = static_cast<int>(tests[testName]());
} else {
retval = 1;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 - 2022 gary@drinkingtea.net
* Copyright 2015 - 2023 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -27,7 +27,7 @@ struct TypeInfoCatcher {
int version = 0;
template<typename T = void>
constexpr void setTypeInfo(const char *name = T::TypeName, int v = T::TypeVersion, const Vector<String>& = {}, int = 0) noexcept {
constexpr void setTypeInfo(const char *name = T::TypeName, int v = T::TypeVersion, const Vector<String>& = {}, std::size_t = 0) noexcept {
this->name = name;
this->version = v;
}