[ox] Fix compiler warnings
This commit is contained in:
parent
062fa07f4d
commit
f2ddd15d63
8
deps/ox/src/ox/event/signal.hpp
vendored
8
deps/ox/src/ox/event/signal.hpp
vendored
@ -145,7 +145,7 @@ class Signal {
|
||||
|
||||
void emit(Args... args) const;
|
||||
|
||||
Error emitCheckError(Args... args) noexcept;
|
||||
Error emitCheckError(Args... args) const noexcept;
|
||||
};
|
||||
|
||||
extern template class Signal<const SignalHandler*>;
|
||||
@ -208,7 +208,7 @@ void Signal<Args...>::emit(Args... args) const {
|
||||
}
|
||||
|
||||
template<class... Args>
|
||||
Error Signal<Args...>::emitCheckError(Args... args) noexcept {
|
||||
Error Signal<Args...>::emitCheckError(Args... args) const noexcept {
|
||||
try {
|
||||
for (auto &f : m_slots) {
|
||||
f->call(args...);
|
||||
@ -321,7 +321,7 @@ class Signal<Error(Args...)> {
|
||||
|
||||
void emit(Args... args) const noexcept;
|
||||
|
||||
Error emitCheckError(Args... args) noexcept;
|
||||
Error emitCheckError(Args... args) const noexcept;
|
||||
};
|
||||
|
||||
extern template class Signal<Error(const SignalHandler*)>;
|
||||
@ -396,7 +396,7 @@ void Signal<Error(Args...)>::emit(Args... args) const noexcept {
|
||||
}
|
||||
|
||||
template<class... Args>
|
||||
Error Signal<Error(Args...)>::emitCheckError(Args... args) noexcept {
|
||||
Error Signal<Error(Args...)>::emitCheckError(Args... args) const noexcept {
|
||||
for (auto &f : m_slots) {
|
||||
oxReturnError(f->call(args...));
|
||||
}
|
||||
|
2
deps/ox/src/ox/mc/read.hpp
vendored
2
deps/ox/src/ox/mc/read.hpp
vendored
@ -144,7 +144,7 @@ Error MetalClawReader::field(const char *name, T *val) noexcept {
|
||||
++m_field;
|
||||
return OxError(0);
|
||||
} else {
|
||||
if ((m_unionIdx == -1 || m_unionIdx == m_field) && val && m_fieldPresence.get(m_field)) {
|
||||
if ((m_unionIdx == -1 || m_unionIdx == m_field) && val && m_fieldPresence.get(static_cast<std::size_t>(m_field))) {
|
||||
auto reader = child("");
|
||||
oxReturnError(model(&reader, val));
|
||||
}
|
||||
|
2
deps/ox/src/ox/std/array.hpp
vendored
2
deps/ox/src/ox/std/array.hpp
vendored
@ -55,7 +55,7 @@ class Array {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr typename std::iterator<std::bidirectional_iterator_tag, T>::difference_type
|
||||
constexpr typename Iterator<std::bidirectional_iterator_tag, T>::difference_type
|
||||
operator-(const iterator &other) const noexcept {
|
||||
if constexpr(reverse) {
|
||||
return m_offset + other.m_offset;
|
||||
|
2
deps/ox/src/ox/std/error.hpp
vendored
2
deps/ox/src/ox/std/error.hpp
vendored
@ -132,7 +132,7 @@ struct [[nodiscard]] Result {
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
constexpr Result(const Result<U> &other) noexcept: value(other.value), error(error) {
|
||||
constexpr Result(const Result<U> &other) noexcept: value(other.value), error(other.error) {
|
||||
}
|
||||
|
||||
constexpr Result(const Error &error) noexcept: error(error) {
|
||||
|
1
deps/ox/src/ox/std/fmt.hpp
vendored
1
deps/ox/src/ox/std/fmt.hpp
vendored
@ -191,7 +191,6 @@ constexpr Result<T> join(auto d, const auto &list) {
|
||||
}
|
||||
T out;
|
||||
out += list.front().value;
|
||||
const auto dLen = ox_strlen(d);
|
||||
for (auto i = 1ul; i < list.size(); ++i) {
|
||||
out += d;
|
||||
out += list[i];
|
||||
|
4
deps/ox/src/ox/std/hashmap.hpp
vendored
4
deps/ox/src/ox/std/hashmap.hpp
vendored
@ -223,8 +223,8 @@ void HashMap<K, T>::expand() {
|
||||
template<typename K, typename T>
|
||||
uint64_t HashMap<K, T>::hash(K k, int len) noexcept {
|
||||
uint64_t sum = 1;
|
||||
for (int i = 0; i < len && k[i]; ++i) {
|
||||
sum += ((sum + k[i]) * 7) * sum;
|
||||
for (auto i = 0u; i < static_cast<uint64_t>(len) && k[i]; ++i) {
|
||||
sum += ((sum + static_cast<uint64_t>(k[i])) * 7) * sum;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
2
deps/ox/src/ox/std/strops.hpp
vendored
2
deps/ox/src/ox/std/strops.hpp
vendored
@ -56,7 +56,7 @@ template<typename T1, typename T2>
|
||||
[[nodiscard]]
|
||||
constexpr int ox_strcmp(T1 str1, T2 str2) noexcept {
|
||||
auto retval = 0;
|
||||
auto i = 0;
|
||||
auto i = 0u;
|
||||
while (str1[i] || str2[i]) {
|
||||
if (str1[i] < str2[i]) {
|
||||
retval = -1;
|
||||
|
21
deps/ox/src/ox/std/vector.hpp
vendored
21
deps/ox/src/ox/std/vector.hpp
vendored
@ -337,6 +337,8 @@ class Vector: detail::VectorAllocator<T, SmallVectorSize> {
|
||||
[[nodiscard]]
|
||||
constexpr bool contains(const T&) const;
|
||||
|
||||
constexpr void insert(std::size_t pos, std::size_t cnt, const T &val);
|
||||
|
||||
constexpr void insert(std::size_t pos, const T &val);
|
||||
|
||||
template<typename... Args>
|
||||
@ -564,6 +566,25 @@ constexpr bool Vector<T, SmallVectorSize>::contains(const T &v) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T, std::size_t SmallVectorSize>
|
||||
constexpr void Vector<T, SmallVectorSize>::insert(std::size_t pos, std::size_t cnt, const T &val) {
|
||||
// TODO: insert should ideally have its own expandCap
|
||||
if (m_size + cnt > m_cap) {
|
||||
expandCap(m_cap ? m_size + cnt : initialSize);
|
||||
}
|
||||
if (pos < m_size) {
|
||||
for (auto i = m_size + cnt - 1; i > pos; --i) {
|
||||
std::construct_at(&m_items[i], std::move(m_items[i - cnt]));
|
||||
}
|
||||
m_items[pos] = val;
|
||||
} else {
|
||||
for (auto i = 0u; i < cnt; ++i) {
|
||||
std::construct_at(&m_items[pos + i], val);
|
||||
}
|
||||
}
|
||||
++m_size;
|
||||
}
|
||||
|
||||
template<typename T, std::size_t SmallVectorSize>
|
||||
constexpr void Vector<T, SmallVectorSize>::insert(std::size_t pos, const T &val) {
|
||||
// TODO: insert should ideally have its own expandCap
|
||||
|
Loading…
Reference in New Issue
Block a user