Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/patch'
Browse files Browse the repository at this point in the history
  • Loading branch information
ghidra1 committed Jul 8, 2024
2 parents 99232e5 + e5bd423 commit 7972886
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private DataTypeComponent doAdd(DataType dataType, int length, String name, Stri
++numComponents;
structLength += structureGrowth;

if (validatePackAndNotify) {
if (validatePackAndNotify) { // else caller responsible for record updates
if (isPackingEnabled()) {
repack(false, false); // may not recognize length change
}
Expand Down Expand Up @@ -1684,6 +1684,9 @@ private void doReplaceWithPacked(Structure struct, DataType[] resolvedDts) {

private void doReplaceWithNonPacked(Structure struct, DataType[] resolvedDts)
throws IOException {

// caller responsible for record updates

// assumes components is clear and that alignment characteristics have been set.
if (struct.isNotYetDefined()) {
return;
Expand Down Expand Up @@ -1728,7 +1731,7 @@ private void doReplaceWithNonPacked(Structure struct, DataType[] resolvedDts)
private void doCopy(Structure struct, DataTypeComponent[] definedComponents,
DataType[] resolvedDts) throws IOException {

// simple replication of struct
// simple replication of struct - caller must perform record updates
structLength = struct.isZeroLength() ? 0 : struct.getLength();
numComponents = struct.getNumComponents();
structAlignment = struct.getAlignment();
Expand Down Expand Up @@ -2469,18 +2472,21 @@ private boolean adjustNonPackedComponents(boolean setLastChangeTime) {
private boolean updateComposite(int currentNumComponents, int currentLength,
int currentAlignment, boolean setLastChangeTime) {
boolean compositeChanged = false;
if (currentNumComponents >= 0 && numComponents != currentNumComponents) {
if (currentNumComponents >= 0 && currentNumComponents != record
.getIntValue(CompositeDBAdapter.COMPOSITE_NUM_COMPONENTS_COL)) {
numComponents = currentNumComponents;
record.setIntValue(CompositeDBAdapter.COMPOSITE_NUM_COMPONENTS_COL, numComponents);
setLastChangeTime = true;
compositeChanged = true;
}
if (currentLength >= 0 && structLength != currentLength) {
if (currentLength >= 0 &&
currentLength != record.getIntValue(CompositeDBAdapter.COMPOSITE_LENGTH_COL)) {
structLength = currentLength;
record.setIntValue(CompositeDBAdapter.COMPOSITE_LENGTH_COL, structLength);
compositeChanged = true;
}
if (currentAlignment >= 0 && structAlignment != currentAlignment) {
if (currentAlignment >= 0 &&
currentAlignment != record.getIntValue(CompositeDBAdapter.COMPOSITE_ALIGNMENT_COL)) {
structAlignment = currentAlignment;
record.setIntValue(CompositeDBAdapter.COMPOSITE_ALIGNMENT_COL, structAlignment);
compositeChanged = true;
Expand Down

0 comments on commit 7972886

Please sign in to comment.