fix: Misspelling of Endianness (#1609)
### Problem description fix 40 typos ### Implementation description `endianess` => `endianness` Signed-off-by: RoboSchmied <github@roboschmie.de>
This commit is contained in:
parent
aeabc0c436
commit
cc593fb6c4
@ -109,7 +109,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
|
||||
<details>
|
||||
<summary><strong>Data Inspector</strong></summary>
|
||||
|
||||
- Interpreting data as many different types with endianess, decimal, hexadecimal and octal support and bit inversion
|
||||
- Interpreting data as many different types with endianness, decimal, hexadecimal and octal support and bit inversion
|
||||
- Unsigned and signed integers (8, 16, 24, 32, 48, 64 bit)
|
||||
- Floats (16, 32, 64 bit)
|
||||
- Signed and Unsigned LEB128
|
||||
@ -158,7 +158,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
|
||||
- Numeric Value search
|
||||
- Search for signed/unsigned integers and floats
|
||||
- Search for ranges of values
|
||||
- Option to specify size and endianess
|
||||
- Option to specify size and endianness
|
||||
- Option to ignore unaligned values
|
||||
</details>
|
||||
<details>
|
||||
|
@ -152,7 +152,7 @@ namespace hex {
|
||||
using SizeType = typename SizeTypeImpl<Size>::Type;
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]] constexpr T changeEndianess(const T &value, size_t size, std::endian endian) {
|
||||
[[nodiscard]] constexpr T changeEndianness(const T &value, size_t size, std::endian endian) {
|
||||
if (endian == std::endian::native)
|
||||
return value;
|
||||
|
||||
@ -172,8 +172,8 @@ namespace hex {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]] constexpr T changeEndianess(const T &value, std::endian endian) {
|
||||
return changeEndianess(value, sizeof(value), endian);
|
||||
[[nodiscard]] constexpr T changeEndianness(const T &value, std::endian endian) {
|
||||
return changeEndianness(value, sizeof(value), endian);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr u128 bitmask(u8 bits) {
|
||||
|
@ -73,7 +73,7 @@ namespace hex {
|
||||
if (color == 0x00000000)
|
||||
return ImVec4(0, 0, 0, -1);
|
||||
|
||||
return ImColor(hex::changeEndianess(color, std::endian::big));
|
||||
return ImColor(hex::changeEndianness(color, std::endian::big));
|
||||
}
|
||||
|
||||
nlohmann::json ThemeManager::exportCurrentTheme(const std::string &name) {
|
||||
@ -90,7 +90,7 @@ namespace hex {
|
||||
|
||||
for (const auto &[key, value] : handler.colorMap) {
|
||||
auto color = handler.getFunction(value);
|
||||
theme["colors"][type][key] = fmt::format("#{:08X}", hex::changeEndianess(u32(color), std::endian::big));
|
||||
theme["colors"][type][key] = fmt::format("#{:08X}", hex::changeEndianness(u32(color), std::endian::big));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace hex {
|
||||
result.push_back(addressBytes[2]);
|
||||
result.push_back(addressBytes[1]);
|
||||
result.push_back(addressBytes[0]);
|
||||
pushBytesBack<u16>(result, changeEndianess<u16>(bytes.size(), std::endian::big));
|
||||
pushBytesBack<u16>(result, changeEndianness<u16>(bytes.size(), std::endian::big));
|
||||
|
||||
for (auto byte : bytes)
|
||||
result.push_back(byte);
|
||||
@ -189,7 +189,7 @@ namespace hex {
|
||||
result.push_back(addressBytes[2]);
|
||||
result.push_back(addressBytes[1]);
|
||||
result.push_back(addressBytes[0]);
|
||||
pushBytesBack<u16>(result, changeEndianess<u16>(bytes.size(), std::endian::big));
|
||||
pushBytesBack<u16>(result, changeEndianness<u16>(bytes.size(), std::endian::big));
|
||||
|
||||
for (auto byte : bytes)
|
||||
result.push_back(byte);
|
||||
|
@ -87,7 +87,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
T value = 0x00;
|
||||
std::memcpy(&value, buffer.data(), std::min(sizeof(T), Size));
|
||||
return hex::format(format, hex::changeEndianess(value, Size, endian));
|
||||
return hex::format(format, hex::changeEndianness(value, Size, endian));
|
||||
}
|
||||
|
||||
template<std::integral T, size_t Size = sizeof(T)>
|
||||
@ -99,7 +99,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
T value = 0x00;
|
||||
std::memcpy(&value, buffer.data(), std::min(sizeof(T), Size));
|
||||
auto number = hex::changeEndianess(value, Size, endian);
|
||||
auto number = hex::changeEndianness(value, Size, endian);
|
||||
if (Size != sizeof(T))
|
||||
number = hex::signExtend(Size * 8, number);
|
||||
|
||||
@ -222,7 +222,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
const auto formatString = style == Style::Hexadecimal ? "{0:a}" : "{0:G}";
|
||||
|
||||
auto value = hex::format(formatString, float16ToFloat32(hex::changeEndianess(result, endian)));
|
||||
auto value = hex::format(formatString, float16ToFloat32(hex::changeEndianness(result, endian)));
|
||||
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
}
|
||||
@ -235,7 +235,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
const auto formatString = style == Style::Hexadecimal ? "{0:a}" : "{0:G}";
|
||||
|
||||
auto value = hex::format(formatString, hex::changeEndianess(result, endian));
|
||||
auto value = hex::format(formatString, hex::changeEndianness(result, endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
},
|
||||
stringToFloat<float>
|
||||
@ -248,7 +248,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
const auto formatString = style == Style::Hexadecimal ? "{0:a}" : "{0:G}";
|
||||
|
||||
auto value = hex::format(formatString, hex::changeEndianess(result, endian));
|
||||
auto value = hex::format(formatString, hex::changeEndianness(result, endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
},
|
||||
stringToFloat<double>
|
||||
@ -261,7 +261,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
const auto formatString = style == Style::Hexadecimal ? "{0:a}" : "{0:G}";
|
||||
|
||||
auto value = hex::format(formatString, hex::changeEndianess(result, endian));
|
||||
auto value = hex::format(formatString, hex::changeEndianness(result, endian));
|
||||
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
|
||||
},
|
||||
stringToFloat<long double>
|
||||
@ -346,7 +346,7 @@ namespace hex::plugin::builtin {
|
||||
wchar_t wideChar = '\x00';
|
||||
std::memcpy(&wideChar, buffer.data(), std::min(sizeof(wchar_t), buffer.size()));
|
||||
|
||||
auto c = hex::changeEndianess(wideChar, endian);
|
||||
auto c = hex::changeEndianness(wideChar, endian);
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter("Invalid");
|
||||
|
||||
@ -435,7 +435,7 @@ namespace hex::plugin::builtin {
|
||||
ImHexApi::Provider::get()->read(currSelection->address, stringBuffer.data(), stringBuffer.size());
|
||||
|
||||
for (auto &c : stringBuffer)
|
||||
c = hex::changeEndianess(c, endian);
|
||||
c = hex::changeEndianness(c, endian);
|
||||
|
||||
auto it = std::remove_if(buffer.begin(), buffer.end(),
|
||||
[](auto c) { return c == 0x00; });
|
||||
@ -467,7 +467,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<u32 *>(buffer.data()), endian);
|
||||
auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast<u32 *>(buffer.data()), endian);
|
||||
|
||||
std::string value;
|
||||
try {
|
||||
@ -482,7 +482,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time64", sizeof(u64), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<u64 *>(buffer.data()), endian);
|
||||
auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast<u64 *>(buffer.data()), endian);
|
||||
|
||||
std::string value;
|
||||
try {
|
||||
@ -499,7 +499,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.time", sizeof(time_t), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
|
||||
auto endianAdjustedTime = hex::changeEndianess(*reinterpret_cast<time_t *>(buffer.data()), endian);
|
||||
auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast<time_t *>(buffer.data()), endian);
|
||||
|
||||
std::string value;
|
||||
try {
|
||||
@ -530,7 +530,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
DOSDate date = { };
|
||||
std::memcpy(&date, buffer.data(), sizeof(DOSDate));
|
||||
date = hex::changeEndianess(date, endian);
|
||||
date = hex::changeEndianness(date, endian);
|
||||
|
||||
auto value = hex::format("{}/{}/{}", date.day, date.month, date.year + 1980);
|
||||
|
||||
@ -542,7 +542,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
DOSTime time = { };
|
||||
std::memcpy(&time, buffer.data(), sizeof(DOSTime));
|
||||
time = hex::changeEndianess(time, endian);
|
||||
time = hex::changeEndianness(time, endian);
|
||||
|
||||
auto value = hex::format("{:02}:{:02}:{:02}", time.hours, time.minutes, time.seconds * 2);
|
||||
|
||||
@ -555,10 +555,10 @@ namespace hex::plugin::builtin {
|
||||
GUID guid = { };
|
||||
std::memcpy(&guid, buffer.data(), sizeof(GUID));
|
||||
auto value = hex::format("{}{{{:08X}-{:04X}-{:04X}-{:02X}{:02X}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}}}",
|
||||
(hex::changeEndianess(guid.data3, endian) >> 12) <= 5 && ((guid.data4[0] >> 4) >= 8 || (guid.data4[0] >> 4) == 0) ? "" : "Invalid ",
|
||||
hex::changeEndianess(guid.data1, endian),
|
||||
hex::changeEndianess(guid.data2, endian),
|
||||
hex::changeEndianess(guid.data3, endian),
|
||||
(hex::changeEndianness(guid.data3, endian) >> 12) <= 5 && ((guid.data4[0] >> 4) >= 8 || (guid.data4[0] >> 4) == 0) ? "" : "Invalid ",
|
||||
hex::changeEndianness(guid.data1, endian),
|
||||
hex::changeEndianness(guid.data2, endian),
|
||||
hex::changeEndianness(guid.data3, endian),
|
||||
guid.data4[0],
|
||||
guid.data4[1],
|
||||
guid.data4[2],
|
||||
@ -574,7 +574,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.rgba8", sizeof(u32), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
|
||||
ImColor value(hex::changeEndianess(*reinterpret_cast<u32 *>(buffer.data()), endian));
|
||||
ImColor value(hex::changeEndianness(*reinterpret_cast<u32 *>(buffer.data()), endian));
|
||||
|
||||
auto copyValue = hex::format("#{:02X}{:02X}{:02X}{:02X}", u8(0xFF * (value.Value.x)), u8(0xFF * (value.Value.y)), u8(0xFF * (value.Value.z)), u8(0xFF * (value.Value.w)));
|
||||
|
||||
@ -587,7 +587,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::DataInspector::add("hex.builtin.inspector.rgb565", sizeof(u16), [](auto buffer, auto endian, auto style) {
|
||||
hex::unused(style);
|
||||
|
||||
auto value = hex::changeEndianess(*reinterpret_cast<u16 *>(buffer.data()), endian);
|
||||
auto value = hex::changeEndianness(*reinterpret_cast<u16 *>(buffer.data()), endian);
|
||||
ImColor color((value & 0x1F) << 3, ((value >> 5) & 0x3F) << 2, ((value >> 11) & 0x1F) << 3, 0xFF);
|
||||
|
||||
auto copyValue = hex::format("#{:02X}{:02X}{:02X}", u8(0xFF * (color.Value.x)), u8(0xFF * (color.Value.y)), u8(0xFF * (color.Value.z)), 0xFF);
|
||||
|
@ -251,7 +251,7 @@ namespace hex::plugin::builtin {
|
||||
std::endian endian = (endianness == Endianness::Little)
|
||||
? std::endian::little
|
||||
: std::endian::big;
|
||||
value = hex::changeEndianess(value, endian);
|
||||
value = hex::changeEndianness(value, endian);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -172,7 +172,7 @@ namespace hex::plugin::builtin {
|
||||
result += "## Bookmarks\n\n";
|
||||
|
||||
for (const auto &[bookmark, editor] : bookmarks) {
|
||||
result += hex::format("### <span style=\"background-color: #{:06X}80\">{} [0x{:04X} - 0x{:04X}]</span>\n\n", hex::changeEndianess(bookmark.color, std::endian::big) >> 8, bookmark.name, bookmark.region.getStartAddress(), bookmark.region.getEndAddress());
|
||||
result += hex::format("### <span style=\"background-color: #{:06X}80\">{} [0x{:04X} - 0x{:04X}]</span>\n\n", hex::changeEndianness(bookmark.color, std::endian::big) >> 8, bookmark.name, bookmark.region.getStartAddress(), bookmark.region.getEndAddress());
|
||||
|
||||
for (const auto &line : hex::splitString(bookmark.comment, "\n"))
|
||||
result += hex::format("> {}\n", line);
|
||||
|
@ -160,7 +160,7 @@ namespace hex::plugin::builtin {
|
||||
T value = 0x00;
|
||||
std::memcpy(&value, bytes.data(), bytes.size());
|
||||
|
||||
value = hex::changeEndianess(value, bytes.size(), endian);
|
||||
value = hex::changeEndianness(value, bytes.size(), endian);
|
||||
|
||||
if (std::signed_integral<T>)
|
||||
value = hex::signExtend(bytes.size() * 8, value);
|
||||
@ -456,7 +456,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
DecayedType value = 0;
|
||||
reader.read(address, reinterpret_cast<u8*>(&value), size);
|
||||
value = hex::changeEndianess(value, size, settings.endian);
|
||||
value = hex::changeEndianness(value, size, settings.endian);
|
||||
|
||||
return value >= minValue && value <= maxValue;
|
||||
}, min);
|
||||
|
@ -1141,8 +1141,8 @@ namespace hex::plugin::builtin {
|
||||
u64 value = 0;
|
||||
provider->read(selection->getStartAddress(), &value, selection->getSize());
|
||||
|
||||
auto littleEndianValue = hex::changeEndianess(value, selection->size, std::endian::little);
|
||||
auto bigEndianValue = hex::changeEndianess(value, selection->size, std::endian::big);
|
||||
auto littleEndianValue = hex::changeEndianness(value, selection->size, std::endian::little);
|
||||
auto bigEndianValue = hex::changeEndianness(value, selection->size, std::endian::big);
|
||||
|
||||
auto canJumpTo = [provider](u64 value) {
|
||||
return (value >= provider->getBaseAddress()) && (value < (provider->getBaseAddress() + provider->getActualSize()));
|
||||
|
@ -914,12 +914,12 @@ namespace hex::ui {
|
||||
auto &visualizers = ContentRegistry::HexEditor::impl::getVisualizers();
|
||||
|
||||
{
|
||||
bool hasEndianess = m_currDataVisualizer->getBytesPerCell() > 1;
|
||||
bool hasEndianness = m_currDataVisualizer->getBytesPerCell() > 1;
|
||||
|
||||
if (!hasEndianess)
|
||||
if (!hasEndianness)
|
||||
m_dataVisualizerEndianness = std::endian::native;
|
||||
|
||||
ImGui::BeginDisabled(!hasEndianess);
|
||||
ImGui::BeginDisabled(!hasEndianness);
|
||||
{
|
||||
int sliderPos = m_dataVisualizerEndianness == std::endian::little ? 0 : 1;
|
||||
ImGui::PushItemWidth(60_scaled);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <hex/test/tests.hpp>
|
||||
|
||||
TEST_SEQUENCE("32BitIntegerEndianSwap") {
|
||||
TEST_ASSERT(hex::changeEndianess<u32>(0xAABBCCDD, std::endian::big) == 0xDDCCBBAA);
|
||||
TEST_ASSERT(hex::changeEndianness<u32>(0xAABBCCDD, std::endian::big) == 0xDDCCBBAA);
|
||||
|
||||
TEST_SUCCESS();
|
||||
};
|
||||
@ -12,8 +12,8 @@ TEST_SEQUENCE("64BitFloatEndianSwap") {
|
||||
double floatValue = 1234.5;
|
||||
u64 integerValue = reinterpret_cast<u64 &>(floatValue);
|
||||
|
||||
double swappedFloatValue = hex::changeEndianess(floatValue, std::endian::big);
|
||||
u64 swappedIntegerValue = hex::changeEndianess(integerValue, std::endian::big);
|
||||
double swappedFloatValue = hex::changeEndianness(floatValue, std::endian::big);
|
||||
u64 swappedIntegerValue = hex::changeEndianness(integerValue, std::endian::big);
|
||||
|
||||
TEST_ASSERT(std::memcmp(&floatValue, &integerValue, 8) == 0 && std::memcmp(&swappedFloatValue, &swappedIntegerValue, 8) == 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user