1
0
mirror of synced 2024-11-12 02:00:52 +01:00

sys: Updated more code to libwolv

This commit is contained in:
WerWolv 2023-03-13 08:58:08 +01:00
parent fb2e668589
commit 55f9faea10
8 changed files with 8 additions and 41 deletions

@ -1 +1 @@
Subproject commit f98c18807a961dfcbf19dae256361e6b99a265d2
Subproject commit 3c3843db13a515edd0d3c7c2ed5eae5ffd05bb8f

@ -1 +1 @@
Subproject commit 0858a0a1a0309bacaa34670488f7643d53d91849
Subproject commit f7b6ca47ef6bfc41ca74581669e822b343e6fc6c

View File

@ -47,8 +47,7 @@ if (APPLE)
endif ()
endif ()
set(LIBIMHEX_SOURCES ${LIBIMHEX_SOURCES}
source/helpers/utils_macos.m)
set(LIBIMHEX_SOURCES ${LIBIMHEX_SOURCES} source/helpers/utils_macos.m)
endif ()
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")

View File

@ -1,12 +0,0 @@
#pragma once
#if defined(OS_MACOS)
#include <hex/helpers/fs.hpp>
extern "C" char * getMacExecutableDirectoryPath();
extern "C" char * getMacApplicationSupportDirectoryPath();
extern "C" void macFree(void *ptr);
#endif

View File

@ -238,26 +238,6 @@ namespace hex {
return result;
}
template<typename T>
inline void trimLeft(std::basic_string<T> &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
return !std::isspace(ch) && ch >= 0x20;
}));
}
template<typename T>
inline void trimRight(std::basic_string<T> &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
return !std::isspace(ch) && ch >= 0x20;
}).base(), s.end());
}
template<typename T>
inline void trim(std::basic_string<T> &s) {
trimLeft(s);
trimRight(s);
}
float float16ToFloat32(u16 float16);
inline bool equalsIgnoreCase(const std::string &left, const std::string &right) {

View File

@ -1,7 +1,9 @@
#include <hex/helpers/encoding_file.hpp>
#include <hex/helpers/utils.hpp>
#include <wolv/io/file.hpp>
#include <wolv/utils/string.hpp>
namespace hex {
@ -52,7 +54,7 @@ namespace hex {
if (fromBytes.empty()) continue;
if (to.length() > 1)
hex::trim(to);
to = wolv::util::trim(to);
if (to.empty())
to = " ";

View File

@ -316,8 +316,7 @@ namespace hex::plugin::builtin {
}
if (drawDefaultTextEditingTextBox(address, this->m_inputBuffer, ImGuiInputTextFlags_None)) {
hex::trim(this->m_inputBuffer);
if (auto result = hex::parseBinaryString(this->m_inputBuffer); result.has_value()) {
if (auto result = hex::parseBinaryString(wolv::util::trim(this->m_inputBuffer)); result.has_value()) {
*data = result.value();
return true;
}

View File

@ -294,9 +294,8 @@ namespace hex::plugin::builtin {
if (yr_compiler_add_file(compiler, file.getHandle(), nullptr, nullptr) != 0) {
std::string errorMessage(0xFFFF, '\x00');
yr_compiler_get_error_message(compiler, errorMessage.data(), errorMessage.size());
hex::trim(errorMessage);
TaskManager::doLater([this, errorMessage] {
TaskManager::doLater([this, errorMessage = wolv::util::trim(errorMessage)] {
this->clearResult();
this->m_consoleMessages.push_back("Error: " + errorMessage);