mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 21:05:56 -05:00
build: Fix cppcheck issues
This commit is contained in:
@@ -311,11 +311,15 @@ EXPORT_MODULE namespace hex {
|
||||
}
|
||||
|
||||
[[nodiscard]] bool isUnlockable() const {
|
||||
return std::all_of(this->parents.begin(), this->parents.end(), [](auto &parent) { return parent->achievement->isUnlocked(); });
|
||||
return std::ranges::all_of(this->parents, [](const auto &parent) {
|
||||
return parent->achievement->isUnlocked();
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] bool isVisible() const {
|
||||
return std::all_of(this->visibilityParents.begin(), this->visibilityParents.end(), [](auto &parent) { return parent->achievement->isUnlocked(); });
|
||||
return std::ranges::all_of(this->visibilityParents, [](const auto &parent) {
|
||||
return parent->achievement->isUnlocked();
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] bool isUnlocked() const {
|
||||
|
||||
@@ -731,7 +731,7 @@ EXPORT_MODULE namespace hex {
|
||||
add(impl::Entry {
|
||||
unlocalizedCategory,
|
||||
unlocalizedName,
|
||||
[=, ...args = std::forward<Args>(args)]() mutable {
|
||||
[unlocalizedName, ...args = std::forward<Args>(args)]() mutable {
|
||||
auto node = std::make_unique<T>(std::forward<Args>(args)...);
|
||||
node->setUnlocalizedName(unlocalizedName);
|
||||
return node;
|
||||
@@ -1072,7 +1072,7 @@ EXPORT_MODULE namespace hex {
|
||||
* @param unlocalizedName The unlocalized name of the formatter
|
||||
* @param callback The function to call to format the data
|
||||
*/
|
||||
void addFindExportFormatter(const UnlocalizedString &unlocalizedName, const std::string fileExtension, const impl::FindExporterCallback &callback);
|
||||
void addFindExportFormatter(const UnlocalizedString &unlocalizedName, const std::string &fileExtension, const impl::FindExporterCallback &callback);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace hex {
|
||||
m_valid = true;
|
||||
}
|
||||
|
||||
~AutoReset() {
|
||||
~AutoReset() override {
|
||||
ImHexApi::System::impl::removeAutoResetObject(this);
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace hex {
|
||||
m_value.reset();
|
||||
} else if constexpr (requires { m_value.clear(); }) {
|
||||
m_value.clear();
|
||||
} else if constexpr (requires(T t) { t = nullptr; }) {
|
||||
m_value = nullptr;
|
||||
} else if constexpr (std::is_pointer_v<T>) {
|
||||
m_value = nullptr; // cppcheck-suppress nullPointer
|
||||
} else {
|
||||
m_value = { };
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
#pragma once
|
||||
#include "imgui.h"
|
||||
#include <vector>
|
||||
|
||||
namespace hex::ft {
|
||||
|
||||
class Bitmap {
|
||||
ImU32 m_width;
|
||||
ImU32 m_height;
|
||||
ImU32 m_pitch;
|
||||
std::vector <ImU8> m_data;
|
||||
public:
|
||||
Bitmap(ImU32 width, ImU32 height, ImU32 pitch, ImU8 *data) : m_width(width), m_height(height), m_pitch(pitch), m_data(std::vector<ImU8>(data, data + pitch * height)) {}
|
||||
|
||||
Bitmap(ImU32 width, ImU32 height, ImU32 pitch) : m_width(width), m_height(height), m_pitch(pitch) { m_data.resize(pitch * height); }
|
||||
|
||||
void clear() { m_data.clear(); }
|
||||
|
||||
ImU32 getWidth() const { return m_width; }
|
||||
|
||||
ImU32 getHeight() const { return m_height; }
|
||||
|
||||
ImU32 getPitch() const { return m_pitch; }
|
||||
|
||||
const std::vector <ImU8> &getData() const { return m_data; }
|
||||
|
||||
ImU8 *getData() { return m_data.data(); }
|
||||
|
||||
void lcdFilter();
|
||||
};
|
||||
|
||||
class RGBA {
|
||||
public:
|
||||
|
||||
static ImU32 addAlpha(ImU8 r, ImU8 g, ImU8 b) {
|
||||
color.rgbaVec[0] = r;
|
||||
color.rgbaVec[1] = g;
|
||||
color.rgbaVec[2] = b;
|
||||
color.rgbaVec[3] = (r + g + b) / 3;//luminance
|
||||
return color.rgba;
|
||||
}
|
||||
|
||||
RGBA(ImU8 r, ImU8 g, ImU8 b, ImU8 a) {
|
||||
color.rgbaVec[0] = r;
|
||||
color.rgbaVec[1] = b;
|
||||
color.rgbaVec[2] = g;
|
||||
color.rgbaVec[3] = a;
|
||||
}
|
||||
|
||||
explicit RGBA(ImU32 rgba) {
|
||||
color.rgba = rgba;
|
||||
}
|
||||
|
||||
union RGBAU {
|
||||
ImU8 rgbaVec[4];
|
||||
ImU32 rgba;
|
||||
};
|
||||
inline static RGBAU color;
|
||||
};
|
||||
}
|
||||
@@ -79,7 +79,7 @@ namespace hex::gl {
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto operator-=(Vector other) {
|
||||
auto operator-=(const Vector &other) {
|
||||
for (size_t i = 0; i < Size; i++)
|
||||
m_data[i] -= other.m_data[i];
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace hex::gl {
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<T, Size> m_data;
|
||||
std::array<T, Size> m_data = { };
|
||||
};
|
||||
|
||||
template<typename T, size_t Rows, size_t Columns>
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace hex {
|
||||
|
||||
[[nodiscard]] T get() const { return pointer; }
|
||||
[[nodiscard]] T operator->() const { return pointer; }
|
||||
[[nodiscard]] T operator*() const { return *pointer; }
|
||||
[[nodiscard]] std::remove_pointer_t<T> operator*() const { return *pointer; }
|
||||
[[nodiscard]] operator T() const { return pointer; }
|
||||
|
||||
T pointer;
|
||||
|
||||
@@ -49,11 +49,11 @@ namespace hex {
|
||||
private:
|
||||
void run();
|
||||
|
||||
u16 m_port;
|
||||
u16 m_port = 0;
|
||||
Callback m_callback;
|
||||
std::thread m_thread;
|
||||
std::atomic<bool> m_running;
|
||||
int m_socketFd;
|
||||
int m_socketFd = -1;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace hex::prv::undo {
|
||||
|
||||
class Operation : public ICloneable<Operation> {
|
||||
public:
|
||||
virtual ~Operation() = default;
|
||||
~Operation() override = default;
|
||||
|
||||
virtual void undo(Provider *provider) = 0;
|
||||
virtual void redo(Provider *provider) = 0;
|
||||
|
||||
Reference in New Issue
Block a user