mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 05:05:19 -05:00
sys: Tons of long overdue cleanup
- std::string -> const std::string& where needed - Added a FileIO abstraction class - Fixed recent files not updating - Removed localization file from global include - Renamed lang to pattern_language/pl - Renamed EventFileDropped to RequestFileOpen
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
#include "helpers/encoding_file.hpp"
|
||||
|
||||
#include <ranges>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace hex {
|
||||
|
||||
EncodingFile::EncodingFile(Type type, std::string_view path) {
|
||||
std::ifstream encodingFile(path.data());
|
||||
EncodingFile::EncodingFile(Type type, const std::string &path) {
|
||||
std::ifstream encodingFile(path.c_str());
|
||||
|
||||
switch (type) {
|
||||
case Type::Thingy: parseThingyFile(encodingFile); break;
|
||||
@@ -16,9 +17,7 @@ namespace hex {
|
||||
}
|
||||
|
||||
std::pair<std::string_view, size_t> EncodingFile::getEncodingFor(const std::vector<u8> &buffer) const {
|
||||
for (auto iter = this->m_mapping.rbegin(); iter != this->m_mapping.rend(); iter++) {
|
||||
auto &[size, mapping] = *iter;
|
||||
|
||||
for (const auto &[size, mapping] : this->m_mapping | std::views::reverse) {
|
||||
if (size > buffer.size()) continue;
|
||||
|
||||
auto key = std::vector<u8>(buffer.begin(), buffer.begin() + size);
|
||||
|
||||
Reference in New Issue
Block a user