From c1aac6c85e582f0e6cbfa0fc70d80cfd06a61ceb Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 18 Feb 2024 10:06:51 +0100 Subject: [PATCH] fix: Data inspector showing double negative signs sometimes Fixes #1534 --- plugins/builtin/source/content/data_inspector.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index e23362896..73433b031 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -95,7 +95,7 @@ namespace hex::plugin::builtin { if (buffer.size() < Size) return { }; - auto format = (style == Style::Decimal) ? "{0}{1:d}" : ((style == Style::Hexadecimal) ? hex::format("{{0}}0x{{1:0{}X}}", Size * 2) : hex::format("{{0}}0o{{1:0{}o}}", Size * 3)); + auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? hex::format("0x{{0:0{}X}}", Size * 2) : hex::format("0o{{0:0{}o}}", Size * 3)); T value = 0x00; std::memcpy(&value, buffer.data(), std::min(sizeof(T), Size)); @@ -103,9 +103,7 @@ namespace hex::plugin::builtin { if (Size != sizeof(T)) number = hex::signExtend(Size * 8, number); - bool negative = number < 0; - - return hex::format(format, negative ? "-" : "", std::abs(number)); + return hex::format(format, number); } template