mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-02-09 05:48:53 -06:00
fix: More build issues
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#include <pl/patterns/pattern.hpp>
|
||||
#include <wolv/utils/lock.hpp>
|
||||
|
||||
#include <ranges>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
ViewPatternData::ViewPatternData() : View::Window("hex.builtin.view.pattern_data.name", ICON_VS_DATABASE) {
|
||||
@@ -47,11 +49,7 @@ namespace hex::plugin::builtin {
|
||||
for (auto &[id, drawer] : drawers)
|
||||
drawer->reset();
|
||||
|
||||
const auto §ions = ContentRegistry::PatternLanguage::getRuntime().getSections();
|
||||
auto ids = sections | std::views::keys | std::ranges::to<std::vector<u64>>();
|
||||
ids.push_back(0);
|
||||
|
||||
for (const auto &id : ids) {
|
||||
const auto createDefaultDrawer = [this]() {
|
||||
auto drawer = std::make_unique<ui::PatternDrawer>();
|
||||
|
||||
drawer->setSelectionCallback([](const pl::ptrn::Pattern *pattern) {
|
||||
@@ -69,7 +67,14 @@ namespace hex::plugin::builtin {
|
||||
drawer->setTreeStyle(m_treeStyle);
|
||||
drawer->enableRowColoring(m_rowColoring);
|
||||
|
||||
(*m_patternDrawer)[id] = std::move(drawer);
|
||||
return drawer;
|
||||
};
|
||||
|
||||
const auto §ions = ContentRegistry::PatternLanguage::getRuntime().getSections();
|
||||
|
||||
(*m_patternDrawer)[0] = createDefaultDrawer();
|
||||
for (const auto &id : sections | std::views::keys) {
|
||||
(*m_patternDrawer)[id] = createDefaultDrawer();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -251,7 +251,8 @@ namespace hex::plugin::remote {
|
||||
}
|
||||
}
|
||||
|
||||
SFTPClient::RemoteFile::RemoteFile(RemoteFile &&other) noexcept : m_handle(other.m_handle), m_atEOF(other.m_atEOF) {
|
||||
SFTPClient::RemoteFile::RemoteFile(RemoteFile &&other) noexcept
|
||||
: m_handle(other.m_handle), m_atEOF(other.m_atEOF), m_mode(other.m_mode) {
|
||||
other.m_handle = nullptr;
|
||||
}
|
||||
SFTPClient::RemoteFile& SFTPClient::RemoteFile::operator=(RemoteFile &&other) noexcept {
|
||||
@@ -259,19 +260,20 @@ namespace hex::plugin::remote {
|
||||
if (m_handle) libssh2_sftp_close(m_handle);
|
||||
m_handle = other.m_handle;
|
||||
m_atEOF = other.m_atEOF;
|
||||
m_mode = other.m_mode;
|
||||
other.m_handle = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t SFTPClient::RemoteFile::read(std::span<u8> buffer) {
|
||||
auto size = this->size();
|
||||
auto dataSize = this->size();
|
||||
auto offset = this->tell();
|
||||
|
||||
if (offset > size || buffer.empty())
|
||||
if (offset > dataSize || buffer.empty())
|
||||
return 0;
|
||||
|
||||
ssize_t n = libssh2_sftp_read(m_handle, reinterpret_cast<char*>(buffer.data()), std::min<u64>(buffer.size_bytes(), size - offset));
|
||||
ssize_t n = libssh2_sftp_read(m_handle, reinterpret_cast<char*>(buffer.data()), std::min<u64>(buffer.size_bytes(), dataSize - offset));
|
||||
if (n < 0)
|
||||
return 0;
|
||||
if (n == 0)
|
||||
|
||||
Reference in New Issue
Block a user