GP-4756 Corrected StructureDB length update issue

This commit is contained in:
ghidra1 2024-07-09 10:10:36 -04:00
parent 282c6b698a
commit 369bf3b05e

View file

@ -2472,21 +2472,23 @@ class StructureDB extends CompositeDB implements StructureInternal {
private boolean updateComposite(int currentNumComponents, int currentLength, private boolean updateComposite(int currentNumComponents, int currentLength,
int currentAlignment, boolean setLastChangeTime) { int currentAlignment, boolean setLastChangeTime) {
boolean compositeChanged = false; boolean compositeChanged = false;
if (currentNumComponents >= 0 && currentNumComponents != record if (currentNumComponents >= 0 &&
.getIntValue(CompositeDBAdapter.COMPOSITE_NUM_COMPONENTS_COL)) { (currentNumComponents != numComponents || currentNumComponents != record
.getIntValue(CompositeDBAdapter.COMPOSITE_NUM_COMPONENTS_COL))) {
numComponents = currentNumComponents; numComponents = currentNumComponents;
record.setIntValue(CompositeDBAdapter.COMPOSITE_NUM_COMPONENTS_COL, numComponents); record.setIntValue(CompositeDBAdapter.COMPOSITE_NUM_COMPONENTS_COL, numComponents);
setLastChangeTime = true; setLastChangeTime = true;
compositeChanged = true; compositeChanged = true;
} }
if (currentLength >= 0 && if (currentLength >= 0 && (currentLength != structLength ||
currentLength != record.getIntValue(CompositeDBAdapter.COMPOSITE_LENGTH_COL)) { currentLength != record.getIntValue(CompositeDBAdapter.COMPOSITE_LENGTH_COL))) {
structLength = currentLength; structLength = currentLength;
record.setIntValue(CompositeDBAdapter.COMPOSITE_LENGTH_COL, structLength); record.setIntValue(CompositeDBAdapter.COMPOSITE_LENGTH_COL, structLength);
compositeChanged = true; compositeChanged = true;
} }
if (currentAlignment >= 0 && if (currentAlignment >= 0 &&
currentAlignment != record.getIntValue(CompositeDBAdapter.COMPOSITE_ALIGNMENT_COL)) { (currentAlignment != structAlignment || currentAlignment != record
.getIntValue(CompositeDBAdapter.COMPOSITE_ALIGNMENT_COL))) {
structAlignment = currentAlignment; structAlignment = currentAlignment;
record.setIntValue(CompositeDBAdapter.COMPOSITE_ALIGNMENT_COL, structAlignment); record.setIntValue(CompositeDBAdapter.COMPOSITE_ALIGNMENT_COL, structAlignment);
compositeChanged = true; compositeChanged = true;