Skip to content

Commit c5ff067

Browse files
committed
fix: fix clang-tidy warnings
1 parent ddcc600 commit c5ff067

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

src/executables/game/application.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ Application::Application(std::shared_ptr<Window>&& window, CommandLineArguments&
4242
m_window{ std::move(window) },
4343
m_renderer{ *m_window, m_command_line_arguments.target_fps.has_value() ? Renderer::VSync::Disabled
4444
: Renderer::VSync::Enabled },
45-
m_target_framerate{ m_command_line_arguments.target_fps },
46-
m_api{} {
45+
m_target_framerate{ m_command_line_arguments.target_fps } {
4746
initialize();
4847
} catch (const helper::GeneralError& general_error) {
4948
const auto severity = general_error.severity();

src/lobby/api.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ helper::expected<lobby::API, std::string> lobby::API::get_api(const std::string&
9696
//TODO(Totto): once version is standard, check here if the version is supported
9797

9898
return api;
99-
} catch (const std::exception& err) {
100-
return helper::unexpected<std::string>{ err.what() };
99+
} catch (const std::exception& error) {
100+
return helper::unexpected<std::string>{ error.what() };
101101
}
102102
}
103103

src/lobby/credentials/secret.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace {
1919

2020
key_serial_t get_id_from_name(key_serial_t keyring_id, const std::string& key) {
2121

22-
std::string full_key = get_key_name(key);
22+
const std::string full_key = get_key_name(key);
2323

2424
// 0 stands for: do not create a link to another keyring
2525
return keyctl_search(keyring_id, constants::key_type_user, full_key.c_str(), 0);
@@ -84,8 +84,11 @@ secret::SecretStorage::~SecretStorage() = default;
8484
};
8585
}
8686

87-
auto result_string = std::string{ static_cast<char*>(buffer), static_cast<char*>(buffer) + result };
88-
free(buffer);
87+
auto result_string = std::string{
88+
static_cast<char*>(buffer),
89+
static_cast<char*>(buffer) + result //NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
90+
};
91+
free(buffer); // NOLINT(cppcoreguidelines-no-malloc,cppcoreguidelines-owning-memory)
8992
return result_string;
9093
}
9194

src/manager/settings_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "input/touch_input.hpp"
55

66
namespace {
7-
static constexpr auto settings_filename = "settings.json";
7+
constexpr const auto settings_filename = "settings.json";
88

99
}
1010

@@ -47,7 +47,7 @@ void SettingsManager::save() const {
4747

4848
const auto result = json::try_write_json_to_file(settings_file, m_settings, true);
4949

50-
if (not result.has_value()) {
50+
if (result.has_value()) {
5151
spdlog::error("unable to save settings to \"{}\": {}", settings_filename, result.value());
5252
return;
5353
}

src/manager/settings_manager.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,4 @@ struct SettingsManager {
3232

3333
private:
3434
void fire_callbacks() const;
35-
std::optional<std::string> save_to_file(const std::string& content) const;
3635
};

0 commit comments

Comments
 (0)