GP-1111 chnage create structure from components to adopt the pack

settings from its parent
This commit is contained in:
ghidra1 2021-07-16 13:19:52 -04:00
parent 3073904c0f
commit ac1c9d9018
2 changed files with 19 additions and 7 deletions

View file

@ -238,9 +238,19 @@ public class StructureFactory {
throw new IllegalArgumentException("No data type components found");
}
for (int i = 0; i < dataComps.length; i++) {
structure.add(dataComps[i].getDataType(), dataComps[i].getLength(),
dataComps[i].getFieldName(), dataComps[i].getComment());
// adopt pack settings from parent - things could move as a result
DataType parent = dataComps[0].getParent();
if (parent instanceof Composite) {
Composite c = (Composite) parent;
structure.setPackingEnabled(c.isPackingEnabled());
if (c.getPackingType() == PackingType.EXPLICIT) {
structure.setExplicitPackingValue(c.getExplicitPackingValue());
}
}
for (DataTypeComponent dataComp : dataComps) {
structure.add(dataComp.getDataType(), dataComp.getLength(),
dataComp.getFieldName(), dataComp.getComment());
}
}
}