mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Use stricter C++ compiler flags
Enable more warnings, and treat all warnings as errors. This would have caught the incomplete switch fixed in f5f89be659.
This commit is contained in:
+7
-6
@@ -43,8 +43,6 @@ LogLevel convert(uint8_t level) {
|
||||
return LogLevel::info;
|
||||
} else if (level == LIBLOOT_LOG_LEVEL_WARNING) {
|
||||
return LogLevel::warning;
|
||||
} else if (level == LIBLOOT_LOG_LEVEL_ERROR) {
|
||||
return LogLevel::error;
|
||||
} else {
|
||||
return LogLevel::error;
|
||||
}
|
||||
@@ -67,10 +65,13 @@ loot::rust::LogLevel convert(LogLevel level) {
|
||||
}
|
||||
}
|
||||
|
||||
void loggingCallback(uint8_t level, const char* message, void* context) {
|
||||
auto& callback = *static_cast<Callback*>(context);
|
||||
|
||||
callback(convert(level), message);
|
||||
void loggingCallback(uint8_t level, const char* message, void* context) noexcept {
|
||||
try {
|
||||
auto& callback = *static_cast<Callback*>(context);
|
||||
callback(convert(level), message);
|
||||
} catch (...) {
|
||||
// Can't do anything with the exception.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ std::optional<loot::EdgeType> convert(loot::rust::EdgeType edgeType) {
|
||||
return loot::EdgeType::tieBreak;
|
||||
case loot::rust::EdgeType::BlueprintMaster:
|
||||
return loot::EdgeType::blueprintMaster;
|
||||
case loot::rust::EdgeType::None:
|
||||
return std::nullopt;
|
||||
default:
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace {
|
||||
template<typename T>
|
||||
std::vector<T> mergeVectors(std::vector<T> first,
|
||||
const std::vector<T>& second) {
|
||||
const auto initialSizeOfFirst = first.size();
|
||||
const auto initialSizeOfFirst = first.end() - first.begin();
|
||||
for (const auto& element : second) {
|
||||
const auto end = first.cbegin() + initialSizeOfFirst;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user