mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: CppCheck issues
This commit is contained in:
@@ -772,7 +772,7 @@ EXPORT_MODULE namespace hex {
|
||||
void pop() const;
|
||||
|
||||
[[nodiscard]] operator ImFont*() const;
|
||||
[[nodiscard]] UnlocalizedString getUnlocalizedName() const { return m_fontName; }
|
||||
[[nodiscard]] const UnlocalizedString& getUnlocalizedName() const { return m_fontName; }
|
||||
|
||||
private:
|
||||
void push(float size, ImFont *font) const;
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace hex::gl {
|
||||
|
||||
|
||||
T &getElement(int row,int col) {
|
||||
return this->mat[row * Columns+col];
|
||||
return this->mat[row * Columns + col];
|
||||
}
|
||||
|
||||
Vector<T,Rows> getColumn(int col) {
|
||||
@@ -205,12 +205,12 @@ namespace hex::gl {
|
||||
return result;
|
||||
}
|
||||
|
||||
void updateRow(int row, Vector<T,Columns> values) {
|
||||
void updateRow(int row, const Vector<T, Columns> &values) {
|
||||
for (size_t i = 0; i < Columns; i++)
|
||||
this->mat[row * Columns + i] = values[i];
|
||||
}
|
||||
|
||||
void updateColumn(int col, Vector<T,Rows> values) {
|
||||
void updateColumn(int col, const Vector<T, Rows> &values) {
|
||||
for (size_t i = 0; i < Rows; i++)
|
||||
this->mat[i * Columns + col] = values[i];
|
||||
}
|
||||
|
||||
@@ -69,11 +69,17 @@ namespace hex::messaging {
|
||||
}
|
||||
|
||||
bool setupNative() {
|
||||
|
||||
constexpr static auto UniqueMutexId = L"ImHex/a477ea68-e334-4d07-a439-4f159c683763";
|
||||
|
||||
// Check if an ImHex instance is already running by opening a global mutex
|
||||
HANDLE globalMutex = OpenMutexW(MUTEX_ALL_ACCESS, FALSE, UniqueMutexId);
|
||||
static HANDLE globalMutex;
|
||||
AT_FINAL_CLEANUP {
|
||||
if (globalMutex != nullptr) {
|
||||
CloseHandle(globalMutex);
|
||||
}
|
||||
};
|
||||
|
||||
globalMutex = OpenMutexW(MUTEX_ALL_ACCESS, FALSE, UniqueMutexId);
|
||||
if (globalMutex == nullptr) {
|
||||
// If no ImHex instance is running, create a new global mutex
|
||||
globalMutex = CreateMutexW(nullptr, FALSE, UniqueMutexId);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wolv/io/handle.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
@@ -63,12 +64,9 @@ namespace hex::plugin::builtin {
|
||||
std::string m_friendlyName;
|
||||
bool m_elevated = false;
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
void *m_diskHandle = reinterpret_cast<void*>(-1);
|
||||
#else
|
||||
std::string m_pathBuffer;
|
||||
int m_diskHandle = -1;
|
||||
#endif
|
||||
wolv::io::NativeHandle m_diskHandle;
|
||||
[[maybe_unused]] std::string m_pathBuffer;
|
||||
|
||||
|
||||
size_t m_diskSize = 0;
|
||||
size_t m_sectorSize = 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
std::string formatAs(Value other) {
|
||||
std::string formatAs(const Value &other) {
|
||||
return std::visit([&, this]<typename T>(T value) -> std::string {
|
||||
|
||||
auto unit = other.getUnit();
|
||||
|
||||
Reference in New Issue
Block a user