Merge remote-tracking branch

'origin/GP-1111_ghidra1_PropogateStructPackSetting' into patch (Closes
#3193)
This commit is contained in:
ghidra1 2021-08-02 17:06:58 -04:00
commit 10db074bcc
2 changed files with 19 additions and 7 deletions

View file

@ -1216,11 +1216,13 @@ class StructureEditorModel extends CompEditorModel {
final StructureDataType structureDataType = final StructureDataType structureDataType =
new StructureDataType(originalCategoryPath, uniqueName, length, originalDTM); new StructureDataType(originalCategoryPath, uniqueName, length, originalDTM);
// if (isPackingEnabled()) { // adopt pack setting from current structure
// structureDataType.setPackingValue(getPackingValue()); structureDataType.setPackingEnabled(isPackingEnabled());
// } if (getPackingType() == PackingType.EXPLICIT) {
structureDataType.setExplicitPackingValue(getExplicitPackingValue());
}
// Get data type components to make into structure. // Get data type components to make into structure.
DataTypeComponent firstDtc = null; DataTypeComponent firstDtc = null;
DataTypeComponent lastDtc = null; DataTypeComponent lastDtc = null;
for (int rowIndex = minRow; rowIndex < maxRow; rowIndex++) { for (int rowIndex = minRow; rowIndex < maxRow; rowIndex++) {

View file

@ -238,9 +238,19 @@ public class StructureFactory {
throw new IllegalArgumentException("No data type components found"); throw new IllegalArgumentException("No data type components found");
} }
for (int i = 0; i < dataComps.length; i++) { // adopt pack settings from parent - things could move as a result
structure.add(dataComps[i].getDataType(), dataComps[i].getLength(), DataType parent = dataComps[0].getParent();
dataComps[i].getFieldName(), dataComps[i].getComment()); 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());
} }
} }
} }