1
0
mirror of synced 2025-01-31 03:53:44 +01:00

Fixed additional issues with padding and zero sized arrays

This commit is contained in:
WerWolv 2020-12-06 23:15:51 +01:00
parent 5c96a28fb6
commit b06f5630c7
2 changed files with 6 additions and 3 deletions

View File

@ -354,6 +354,9 @@ namespace hex::lang {
: PatternData(Type::Array, offset, size, name, endianess, color), m_entries(entries) { } : PatternData(Type::Array, offset, size, name, endianess, color), m_entries(entries) { }
void createEntry(prv::Provider* &provider) override { void createEntry(prv::Provider* &provider) override {
if (this->m_entries.empty())
return;
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
bool open = ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth); bool open = ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth);

View File

@ -46,7 +46,7 @@ namespace hex::lang {
std::tie(pattern, memberSize) = this->createStringPattern(member, memberOffset); std::tie(pattern, memberSize) = this->createStringPattern(member, memberOffset);
} }
else if (member->getArraySize() > 1) { else if (member->getArraySize() > 1 || member->getVariableType() == Token::TypeToken::Type::Padding) {
std::tie(pattern, memberSize) = this->createArrayPattern(member, memberOffset); std::tie(pattern, memberSize) = this->createArrayPattern(member, memberOffset);
} }
else if (member->getArraySizeVariable().has_value()) { else if (member->getArraySizeVariable().has_value()) {
@ -140,7 +140,7 @@ namespace hex::lang {
std::tie(pattern, memberSize) = this->createStringPattern(member, memberOffset); std::tie(pattern, memberSize) = this->createStringPattern(member, memberOffset);
} }
else if (member->getArraySize() > 1) { else if (member->getArraySize() > 1 || member->getVariableType() == Token::TypeToken::Type::Padding) {
std::tie(pattern, memberSize) = this->createArrayPattern(member, memberOffset); std::tie(pattern, memberSize) = this->createArrayPattern(member, memberOffset);
} }
@ -277,7 +277,7 @@ namespace hex::lang {
delete nonArrayVarDeclNode; delete nonArrayVarDeclNode;
} }
return { new PatternDataArray(offset, arrayOffset, varDeclNode->getVariableName(), varDeclNode->getEndianess().value_or(this->m_defaultDataEndianess), entries, arrayColor.value()), arrayOffset }; return { new PatternDataArray(offset, arrayOffset, varDeclNode->getVariableName(), varDeclNode->getEndianess().value_or(this->m_defaultDataEndianess), entries, arrayColor.value_or(0xFF000000)), arrayOffset };
} }
std::pair<PatternData*, size_t> Evaluator::createStringPattern(ASTNodeVariableDecl *varDeclNode, u64 offset) { std::pair<PatternData*, size_t> Evaluator::createStringPattern(ASTNodeVariableDecl *varDeclNode, u64 offset) {