mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
impr: Replace hex::unused with std::ignore
This commit is contained in:
@@ -129,7 +129,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.binary", sizeof(u8),
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(endian, style);
|
||||
std::ignore = endian;
|
||||
std::ignore = style;
|
||||
|
||||
std::string binary = hex::format("0b{:08b}", buffer[0]);
|
||||
|
||||
@@ -138,7 +139,7 @@ namespace hex::plugin::builtin {
|
||||
return binary;
|
||||
};
|
||||
}, [](const std::string &value, std::endian endian) -> std::vector<u8> {
|
||||
hex::unused(endian);
|
||||
std::ignore = endian;
|
||||
|
||||
std::string binary = value;
|
||||
if (binary.starts_with("0b"))
|
||||
@@ -269,7 +270,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.sleb128", 1, (sizeof(i128) * 8 / 7) + 1,
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(endian);
|
||||
std::ignore = endian;
|
||||
|
||||
auto format = (style == Style::Decimal) ? "{0}{1:d}" : ((style == Style::Hexadecimal) ? "{0}0x{1:X}" : "{0}0o{1:o}");
|
||||
|
||||
@@ -281,7 +282,7 @@ namespace hex::plugin::builtin {
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
},
|
||||
[](const std::string &value, std::endian endian) -> std::vector<u8> {
|
||||
hex::unused(endian);
|
||||
std::ignore = endian;
|
||||
|
||||
return hex::crypt::encodeSleb128(std::strtoll(value.c_str(), nullptr, 0));
|
||||
}
|
||||
@@ -289,7 +290,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.uleb128", 1, (sizeof(u128) * 8 / 7) + 1,
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(endian);
|
||||
std::ignore = endian;
|
||||
|
||||
auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "0o{0:o}");
|
||||
|
||||
@@ -298,7 +299,7 @@ namespace hex::plugin::builtin {
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
},
|
||||
[](const std::string &value, std::endian endian) -> std::vector<u8> {
|
||||
hex::unused(endian);
|
||||
std::ignore = endian;
|
||||
|
||||
return hex::crypt::encodeUleb128(std::strtoull(value.c_str(), nullptr, 0));
|
||||
}
|
||||
@@ -306,7 +307,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.bool", sizeof(bool),
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(endian, style);
|
||||
std::ignore = endian;
|
||||
std::ignore = style;
|
||||
|
||||
std::string value = [buffer] {
|
||||
switch (buffer[0]) {
|
||||
@@ -325,13 +327,14 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.ascii", sizeof(char8_t),
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(endian, style);
|
||||
std::ignore = endian;
|
||||
std::ignore = style;
|
||||
|
||||
auto value = makePrintable(*reinterpret_cast<char8_t *>(buffer.data()));
|
||||
return [value] { ImGuiExt::TextFormatted("'{0}'", value.c_str()); return value; };
|
||||
},
|
||||
[](const std::string &value, std::endian endian) -> std::vector<u8> {
|
||||
hex::unused(endian);
|
||||
std::ignore = endian;
|
||||
|
||||
if (value.length() > 1) return { };
|
||||
|
||||
@@ -341,7 +344,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.wide", sizeof(wchar_t),
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
wchar_t wideChar = '\x00';
|
||||
std::memcpy(&wideChar, buffer.data(), std::min(sizeof(wchar_t), buffer.size()));
|
||||
@@ -369,7 +372,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.utf8", sizeof(char8_t) * 4,
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(endian, style);
|
||||
std::ignore = endian;
|
||||
std::ignore = style;
|
||||
|
||||
char utf8Buffer[5] = { 0 };
|
||||
char codepointString[5] = { 0 };
|
||||
@@ -391,7 +395,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.string", 1,
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(buffer, endian, style);
|
||||
std::ignore = buffer;
|
||||
std::ignore = endian;
|
||||
std::ignore = style;
|
||||
|
||||
auto currSelection = ImHexApi::HexEditor::getSelection();
|
||||
|
||||
@@ -416,7 +422,7 @@ namespace hex::plugin::builtin {
|
||||
return [value, copyValue] { ImGuiExt::TextFormatted("\"{0}\"", value.c_str()); return copyValue; };
|
||||
},
|
||||
[](const std::string &value, std::endian endian) -> std::vector<u8> {
|
||||
hex::unused(endian);
|
||||
std::ignore = endian;
|
||||
|
||||
return hex::decodeByteString(value);
|
||||
}
|
||||
@@ -424,7 +430,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.string16", 2,
|
||||
[](auto buffer, auto endian, auto style) {
|
||||
hex::unused(buffer, endian, style);
|
||||
std::ignore = buffer;
|
||||
std::ignore = endian;
|
||||
std::ignore = style;
|
||||
|
||||
auto currSelection = ImHexApi::HexEditor::getSelection();
|
||||
|
||||
@@ -456,7 +464,7 @@ namespace hex::plugin::builtin {
|
||||
return [value, copyValue] { ImGuiExt::TextFormatted("L\"{0}\"", value.c_str()); return copyValue; };
|
||||
},
|
||||
[](const std::string &value, std::endian endian) -> std::vector<u8> {
|
||||
hex::unused(endian);
|
||||
std::ignore = endian;
|
||||
|
||||
return hex::decodeByteString(value);
|
||||
}
|
||||
@@ -465,7 +473,7 @@ namespace hex::plugin::builtin {
|
||||
#if defined(OS_WINDOWS)
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast<u32 *>(buffer.data()), endian);
|
||||
|
||||
@@ -480,7 +488,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time64", sizeof(u64), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast<u64 *>(buffer.data()), endian);
|
||||
|
||||
@@ -497,7 +505,7 @@ namespace hex::plugin::builtin {
|
||||
#else
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time", sizeof(time_t), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast<time_t *>(buffer.data()), endian);
|
||||
|
||||
@@ -526,7 +534,7 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.dos_date", sizeof(DOSDate), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
DOSDate date = { };
|
||||
std::memcpy(&date, buffer.data(), sizeof(DOSDate));
|
||||
@@ -538,7 +546,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.dos_time", sizeof(DOSTime), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
DOSTime time = { };
|
||||
std::memcpy(&time, buffer.data(), sizeof(DOSTime));
|
||||
@@ -550,7 +558,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.guid", sizeof(GUID), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
GUID guid = { };
|
||||
std::memcpy(&guid, buffer.data(), sizeof(GUID));
|
||||
@@ -572,7 +580,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.rgba8", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
ImColor value(hex::changeEndianness(*reinterpret_cast<u32 *>(buffer.data()), endian));
|
||||
|
||||
@@ -585,7 +593,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.rgb565", sizeof(u16), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
std::ignore = style;
|
||||
|
||||
auto value = hex::changeEndianness(*reinterpret_cast<u16 *>(buffer.data()), endian);
|
||||
ImColor color((value & 0x1F) << 3, ((value >> 5) & 0x3F) << 2, ((value >> 11) & 0x1F) << 3, 0xFF);
|
||||
|
||||
Reference in New Issue
Block a user