[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,7 @@ add_library(
if(NOT MSVC)
target_compile_options(OxOrganicClaw PRIVATE -Wsign-conversion)
target_compile_options(OxOrganicClaw PRIVATE -Wconversion)
endif()
target_link_libraries(

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
@@ -107,7 +107,7 @@ class OrganicClawReader {
}
template<typename T = void>
constexpr void setTypeInfo(const char*, int, const Vector<String>& = {}, int = {}) noexcept {
constexpr void setTypeInfo(const char*, int, const Vector<String>& = {}, std::size_t = {}) noexcept {
}
/**

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
@@ -332,7 +332,7 @@ const std::map<std::string_view, ox::Error(*)()> tests = {
}
case ox::PrimitiveType::String: {
ox::Vector<char> v(rdr->stringLength(fieldName) + 1);
oxAssert(rdr->field(fieldName, ox::SerStr(v.data(), v.size())), "Walking model failed.");
oxAssert(rdr->field(fieldName, ox::SerStr(v.data(), static_cast<int>(v.size()))), "Walking model failed.");
oxOutf("{}:\tstring:\t{}\n", fieldName, v.data());
break;
}
@@ -362,5 +362,5 @@ int main(int argc, const char **args) {
oxErrorf("Test {} not found", testName);
return 1;
}
return test();
return static_cast<int>(test());
}

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
@@ -146,7 +146,7 @@ class OrganicClawWriter {
template<std::size_t L>
Error field(const char *key, BString<L> *val) noexcept {
return field(key, SerStr(val->data(), val->cap()));
return field(key, SerStr(val->data(), static_cast<int>(val->cap())));
}
template<std::size_t L>
@@ -180,7 +180,7 @@ class OrganicClawWriter {
template<typename T = void>
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
const Vector<String>& = {}, int = ModelFieldCount_v<T>) noexcept {
const Vector<String>& = {}, std::size_t = ModelFieldCount_v<T>) noexcept {
}
static constexpr auto opType() noexcept {