mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
chore: apply light lints (#2570)
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
while (true) {
|
||||
const auto result = splashWindow->loop();
|
||||
if (result.has_value()) {
|
||||
if (result.value() == false) {
|
||||
if (!result.value()) {
|
||||
ImHexApi::System::impl::addInitArgument("tasks-failed");
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace hex::init {
|
||||
|
||||
WindowSplash::WindowSplash() : m_window(nullptr) {
|
||||
RequestAddInitTask::subscribe([this](const std::string& name, bool async, const TaskFunction &function){
|
||||
std::lock_guard guard(m_progressMutex);
|
||||
std::scoped_lock guard(m_progressMutex);
|
||||
|
||||
m_tasks.push_back(Task{ name, function, async, false });
|
||||
m_totalTaskCount += 1;
|
||||
@@ -210,14 +210,14 @@ namespace hex::init {
|
||||
// Save an iterator to the current task name
|
||||
decltype(m_currTaskNames)::iterator taskNameIter;
|
||||
{
|
||||
std::lock_guard guard(m_progressMutex);
|
||||
std::scoped_lock guard(m_progressMutex);
|
||||
m_currTaskNames.push_back(task.name + "...");
|
||||
taskNameIter = std::prev(m_currTaskNames.end());
|
||||
}
|
||||
|
||||
// When the task finished, increment the progress bar
|
||||
ON_SCOPE_EXIT {
|
||||
std::lock_guard guard(m_progressMutex);
|
||||
std::scoped_lock guard(m_progressMutex);
|
||||
m_completedTaskCount += 1;
|
||||
m_progress = float(m_completedTaskCount) / float(m_totalTaskCount);
|
||||
};
|
||||
@@ -239,7 +239,7 @@ namespace hex::init {
|
||||
|
||||
// Erase the task name from the list of running tasks
|
||||
{
|
||||
std::lock_guard guard(m_progressMutex);
|
||||
std::scoped_lock guard(m_progressMutex);
|
||||
m_currTaskNames.erase(taskNameIter);
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
@@ -272,11 +272,11 @@ namespace hex::init {
|
||||
// Check every 10ms if all tasks have run
|
||||
while (true) {
|
||||
// Loop over all registered init tasks
|
||||
for (auto it = m_tasks.begin(); it != m_tasks.end(); ++it) {
|
||||
for (auto & m_task : m_tasks) {
|
||||
// Construct a new task callback
|
||||
if (!it->running) {
|
||||
this->createTask(*it);
|
||||
it->running = true;
|
||||
if (!m_task.running) {
|
||||
this->createTask(m_task);
|
||||
m_task.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ namespace hex::init {
|
||||
|
||||
// Draw the task progress bar
|
||||
{
|
||||
std::lock_guard guard(m_progressMutex);
|
||||
std::scoped_lock guard(m_progressMutex);
|
||||
|
||||
const auto progressBackgroundStart = ImVec2(99, 357);
|
||||
const auto progressBackgroundSize = ImVec2(442, 30);
|
||||
|
||||
@@ -64,7 +64,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
if (auto distro = ImHexApi::System::getLinuxDistro(); distro.has_value()) {
|
||||
log::info("Linux distribution: {}. Version: {}", distro->name, distro->version == "" ? "None" : distro->version);
|
||||
log::info("Linux distribution: {}. Version: {}", distro->name, distro->version.empty() ? "None" : distro->version);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#if defined(OS_LINUX)
|
||||
|
||||
#include <stdexcept>
|
||||
#include <fcntl.h>
|
||||
#include <sys/file.h>
|
||||
#include <unistd.h>
|
||||
@@ -25,7 +24,7 @@ namespace hex::messaging {
|
||||
|
||||
fullEventData.insert(fullEventData.end(), args.begin(), args.end());
|
||||
|
||||
u8 *data = &fullEventData[0];
|
||||
u8 *data = fullEventData.data();
|
||||
auto dataSize = fullEventData.size();
|
||||
|
||||
int fifo = open(CommunicationPipePath, O_WRONLY);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <string.h>
|
||||
#include <ranges>
|
||||
|
||||
#if defined(IMHEX_HAS_FONTCONFIG)
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include <hex/ui/banner.hpp>
|
||||
|
||||
#include <cmath>
|
||||
#include <chrono>
|
||||
#include <csignal>
|
||||
#include <numbers>
|
||||
|
||||
#include <romfs/romfs.hpp>
|
||||
@@ -663,7 +661,7 @@ namespace hex {
|
||||
|
||||
const auto windowPos = ImHexApi::System::getMainWindowPosition();
|
||||
float startY = windowPos.y + ImGui::GetTextLineHeight() + ((ImGui::GetTextLineHeight() + (ImGui::GetStyle().FramePadding.y * 2.0F)) * (onWelcomeScreen ? 1 : 2));
|
||||
const auto height = ImGui::GetTextLineHeightWithSpacing() * 1.5f;
|
||||
const auto height = ImGui::GetTextLineHeightWithSpacing() * 1.5F;
|
||||
|
||||
// Offset banner based on the size of the title bar. On macOS, it's slightly taller
|
||||
#if defined(OS_MACOS)
|
||||
@@ -956,13 +954,13 @@ namespace hex {
|
||||
GLuint quadVAO, quadVBO;
|
||||
float quadVertices[] = {
|
||||
// positions // texCoords
|
||||
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 0.0f,
|
||||
1.0f, -1.0f, 1.0f, 0.0f,
|
||||
-1.0F, 1.0F, 0.0F, 1.0F,
|
||||
-1.0F, -1.0F, 0.0F, 0.0F,
|
||||
1.0F, -1.0F, 1.0F, 0.0F,
|
||||
|
||||
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, -1.0f, 1.0f, 0.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f
|
||||
-1.0F, 1.0F, 0.0F, 1.0F,
|
||||
1.0F, -1.0F, 1.0F, 0.0F,
|
||||
1.0F, 1.0F, 1.0F, 1.0F
|
||||
};
|
||||
|
||||
glGenVertexArrays(1, &quadVAO);
|
||||
@@ -971,7 +969,7 @@ namespace hex {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, quadVBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), quadVertices, GL_STATIC_DRAW);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), nullptr);
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));
|
||||
glBindVertexArray(0);
|
||||
|
||||
Reference in New Issue
Block a user