From 6f4dc8830ad7fa758ceb322b2c04e380f9a9eec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gheorghi=C8=9B=C4=83=20Mutu?= Date: Fri, 29 Dec 2023 12:03:39 +0200 Subject: [PATCH] # fix gridview function call --- GViewCore/src/View/GridViewer/GridViewer.hpp | 2 +- GViewCore/src/View/GridViewer/Instance.cpp | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/GViewCore/src/View/GridViewer/GridViewer.hpp b/GViewCore/src/View/GridViewer/GridViewer.hpp index 8d1996da..788215d9 100644 --- a/GViewCore/src/View/GridViewer/GridViewer.hpp +++ b/GViewCore/src/View/GridViewer/GridViewer.hpp @@ -129,7 +129,7 @@ namespace View void SetCustomPropertyValue(uint32 propertyID) override; bool IsPropertyValueReadOnly(uint32 propertyID) override; const vector GetPropertiesList() override; - vector getHexCellContent(const std::string& content); + vector getHexCellContent(const AppCUI::Utils::String& content); private: void PopulateGrid(); diff --git a/GViewCore/src/View/GridViewer/Instance.cpp b/GViewCore/src/View/GridViewer/Instance.cpp index 9f0a0acc..9748dd2f 100644 --- a/GViewCore/src/View/GridViewer/Instance.cpp +++ b/GViewCore/src/View/GridViewer/Instance.cpp @@ -152,15 +152,13 @@ bool Instance::OnUpdateCommandBar(AppCUI::Application::CommandBar& commandBar) return false; } -vector Instance::getHexCellContent(const std::string& content) { - +vector Instance::getHexCellContent(const AppCUI::Utils::String& content) { + constexpr uint32_t SIZE = 8; vector hexData; - for (auto chunkIndex = 0; chunkIndex < content.size() / 8; chunkIndex++) - { + for (auto chunkIndex = 0; chunkIndex < content.Len() / SIZE; chunkIndex++) { uint8_t value = 0; - for (auto valueIndex = chunkIndex * 8; valueIndex < (chunkIndex + 1) * 8; valueIndex++) - { - value = value * 2 + content[valueIndex] - '0'; + for (auto valueIndex = chunkIndex * SIZE; valueIndex < (chunkIndex + 1) * SIZE; valueIndex++) { + value = value * 2 + content.GetChar(valueIndex) - '0'; } hexData.push_back(value); }