Skip to content

Commit 21a2ea3

Browse files
committed
fix: fix many clang tidy errors (7/x)
this is part 7 of 143 errors in the whole codebase, it is split into multiple commits, so that each patch is not to big
1 parent c008988 commit 21a2ea3

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

src/executables/game/application.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void Application::update() {
183183
if (scene_change) {
184184

185185
std::visit(
186-
helper::overloaded{
186+
helper::Overloaded{
187187
[this, index](const scenes::Scene::Pop&) {
188188
m_scene_stack.erase(
189189
m_scene_stack.begin()

src/executables/utility/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int main(int argc, char** argv) noexcept {
8181
const auto recording_reader = std::move(parsed.value());
8282

8383
std::visit(
84-
helper::overloaded{ [&recording_reader](const Dump& dump) {
84+
helper::Overloaded{ [&recording_reader](const Dump& dump) {
8585
dump_json(recording_reader, dump.pretty_print, dump.ensure_ascii);
8686
},
8787
[&recording_reader](const Info& /* info */) { print_info(recording_reader); } },

src/input/input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ namespace {
211211

212212

213213
auto result = std::visit(
214-
helper::overloaded{
214+
helper::Overloaded{
215215
[service_provider](const input::KeyboardSettings& keyboard_settings) mutable -> ReturnType {
216216
auto* const event_dispatcher = &(service_provider->event_dispatcher());
217217
return std::make_shared<input::KeyboardGameInput>(keyboard_settings, event_dispatcher);

src/libs/core/helper/date.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ helper::expected<date::ISO8601Date, std::string> date::ISO8601Date::from_string(
3737

3838

3939
std::istringstream input_stream{ input };
40-
input_stream >> std::get_time(&tm, ISO8601Date::iso_8601_format_string);
40+
input_stream >> std::get_time(&time_struct, ISO8601Date::iso_8601_format_string);
4141

4242
if (input_stream.fail()) {
4343
return helper::unexpected<std::string>{ "error calling std::get_time(): unable to convert input" };
@@ -69,7 +69,7 @@ helper::expected<date::ISO8601Date, std::string> date::ISO8601Date::from_string(
6969

7070
std::tm time_struct{};
7171
#if defined(_MSC_VER) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
72-
if (gmtime_s(&tm, &value) != 0) {
72+
if (gmtime_s(&time_struct, &value) != 0) {
7373
return helper::unexpected<std::string>{ "error calling gmtime_s" };
7474
}
7575
#else

src/libs/core/helper/static_string.hpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
#include <string>
1010
#include <string_view>
1111

12-
template<usize data_size>
12+
template<usize DataSize>
1313
struct StaticString {
1414
private:
15-
std::array<char, data_size> m_data;
15+
std::array<char, DataSize> m_data;
1616

1717
constexpr StaticString() : m_data{} { }
1818

1919
public:
2020
constexpr StaticString(const char (&chars // NOLINT(modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
21-
)[data_size]) {
22-
std::copy(chars, chars + data_size, begin());
21+
)[DataSize]) {
22+
std::copy(chars, chars + DataSize, begin());
2323
}
2424

2525
[[nodiscard]] constexpr usize size() const {
26-
return data_size - 1;
26+
return DataSize - 1;
2727
}
2828

2929
[[nodiscard]] constexpr usize length() const {
@@ -80,8 +80,8 @@ struct StaticString {
8080
return m_data.back();
8181
}
8282

83-
template<usize other_data_size, typename Result = StaticString<data_size + other_data_size - 1>>
84-
[[nodiscard]] constexpr Result operator+(const StaticString<other_data_size>& other) const {
83+
template<usize OtherDataSize, typename Result = StaticString<DataSize + OtherDataSize - 1>>
84+
[[nodiscard]] constexpr Result operator+(const StaticString<OtherDataSize>& other) const {
8585
auto concatenated = Result{};
8686
std::ranges::copy(*this, concatenated.begin());
8787
std::ranges::copy(other, concatenated.begin() + size());
@@ -101,46 +101,46 @@ struct StaticString {
101101
return std::string_view{ cbegin(), cend() };
102102
}
103103

104-
template<usize other_data_size>
104+
template<usize OtherDataSize>
105105
[[nodiscard]] friend constexpr bool
106-
operator==(const StaticString<data_size>& self, const StaticString<other_data_size>& other) {
106+
operator==(const StaticString<DataSize>& self, const StaticString<OtherDataSize>& other) {
107107
return self.m_data == other.m_data;
108108
}
109109

110-
template<usize other_data_size>
110+
template<usize OtherDataSize>
111111
[[nodiscard]] friend constexpr bool
112-
operator!=(const StaticString<data_size>& self, const StaticString<other_data_size>& other) {
112+
operator!=(const StaticString<DataSize>& self, const StaticString<OtherDataSize>& other) {
113113
return not(self == other);
114114
}
115115

116-
template<usize first_data_size, usize... other_data_sizes>
116+
template<usize FirstDataSize, usize... OtherDataSizes>
117117
[[nodiscard]] constexpr auto
118-
join(const StaticString<first_data_size>& first, const StaticString<other_data_sizes>&... rest) const {
118+
join(const StaticString<FirstDataSize>& first, const StaticString<OtherDataSizes>&... rest) const {
119119
if constexpr (sizeof...(rest) == 0) {
120120
return first;
121121
} else {
122122
return first + *this + join(rest...);
123123
}
124124
}
125125

126-
[[nodiscard]] constexpr operator const char*() const {
126+
[[nodiscard]] constexpr operator const char*() const { //NOLINT(google-explicit-constructor)
127127
return c_str();
128128
}
129129

130-
[[nodiscard]] constexpr operator std::string_view() const {
130+
[[nodiscard]] constexpr operator std::string_view() const { //NOLINT(google-explicit-constructor)
131131
return string_view();
132132
}
133133

134-
[[nodiscard]] operator std::string() const {
134+
[[nodiscard]] operator std::string() const { //NOLINT(google-explicit-constructor)
135135
return string();
136136
}
137137

138-
[[nodiscard]] operator std::filesystem::path() const {
138+
[[nodiscard]] operator std::filesystem::path() const { //NOLINT(google-explicit-constructor)
139139
return string();
140140
}
141141

142142
// make all template instantiations of this template a friend
143-
template<usize other_data_size>
143+
template<usize OtherDataSize>
144144
friend struct StaticString;
145145
};
146146

src/libs/core/helper/utils.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
namespace helper {
1919

2020
template<class... Ts>
21-
struct overloaded : Ts... {
21+
struct Overloaded : Ts... {
2222
using Ts::operator()...;
2323
};
2424
template<class... Ts>
25-
overloaded(Ts...) -> overloaded<Ts...>;
25+
Overloaded(Ts...) -> Overloaded<Ts...>;
2626
} // namespace helper
2727

2828

@@ -53,8 +53,8 @@ namespace utils {
5353
}
5454

5555
template<class Enum>
56-
[[nodiscard]] constexpr std::underlying_type_t<Enum> to_underlying(Enum enum_) noexcept {
57-
return static_cast<std::underlying_type_t<Enum>>(enum_);
56+
[[nodiscard]] constexpr std::underlying_type_t<Enum> to_underlying(Enum enum_value) noexcept {
57+
return static_cast<std::underlying_type_t<Enum>>(enum_value);
5858
}
5959

6060
#if __cpp_lib_unreachable >= 202202L

src/libs/recordings/utility/additional_information.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[[nodiscard]] std::string recorder::InformationValue::to_string(u32 recursion_depth // NOLINT(misc-no-recursion)
1010
) const {
1111
return std::visit(
12-
helper::overloaded{
12+
helper::Overloaded{
1313
[](const std::string& value) { return value; },
1414
[](const float& value) { return std::to_string(value); },
1515
[](const double& value) { return std::to_string(value); },

src/libs/recordings/utility/additional_information.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace recorder {
8181

8282
[[nodiscard]] bool operator==(const InformationValue& other) const { // NOLINT(misc-no-recursion)
8383
return std::visit(
84-
helper::overloaded{
84+
helper::Overloaded{
8585
[this](const std::string& value) { return *this == value; },
8686
[this](const float& value) { return *this == value; },
8787
[this](const double& value) { return *this == value; },

src/libs/recordings/utility/recording_json_wrapper.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace nlohmann {
2121

2222
static void to_json(json& obj, const recorder::InformationValue& information) { // NOLINT(misc-no-recursion)
2323
std::visit(
24-
helper::overloaded{
24+
helper::Overloaded{
2525
[&obj](const std::string& value) { obj = value; },
2626
[&obj](const float& value) { obj = value; }, [&obj](const double& value) { obj = value; },
2727
[&obj](const bool& value) { obj = value; }, [&obj](const u8& value) { obj = value; },

src/scenes/recording_selector/recording_selector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace scenes {
7979

8080
if (m_next_command.has_value()) {
8181
return std::visit(
82-
helper::overloaded{
82+
helper::Overloaded{
8383
[](const Return&) { return UpdateResult{ SceneUpdate::StopUpdating, Scene::Pop{} }; },
8484
[this](const Action& action) {
8585
if (auto recording_component =

0 commit comments

Comments
 (0)