mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
fe1d80a585
2 changed files with 16 additions and 6 deletions
|
@ -17,6 +17,8 @@ package ghidra.program.database.data;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import db.DBRecord;
|
||||
import ghidra.docking.settings.*;
|
||||
import ghidra.program.model.data.*;
|
||||
|
@ -201,6 +203,9 @@ class DataTypeComponentDB implements InternalDataTypeComponent {
|
|||
@Override
|
||||
public void setComment(String comment) {
|
||||
if (record != null) {
|
||||
if (StringUtils.isBlank(comment)) {
|
||||
comment = null;
|
||||
}
|
||||
record.setString(ComponentDBAdapter.COMPONENT_COMMENT_COL, comment);
|
||||
updateRecord(true);
|
||||
}
|
||||
|
@ -398,16 +403,19 @@ class DataTypeComponentDB implements InternalDataTypeComponent {
|
|||
* Perform special-case component update that does not result in size or alignment changes.
|
||||
* @param name new component name
|
||||
* @param dt new resolved datatype
|
||||
* @param cmt new comment
|
||||
* @param comment new comment
|
||||
*/
|
||||
void update(String name, DataType dt, String cmt) {
|
||||
void update(String name, DataType dt, String comment) {
|
||||
if (record != null) {
|
||||
if (StringUtils.isBlank(comment)) {
|
||||
comment = null;
|
||||
}
|
||||
// TODO: Need to check field name and throw DuplicateNameException
|
||||
// name = checkFieldName(name);
|
||||
record.setString(ComponentDBAdapter.COMPONENT_FIELD_NAME_COL, name);
|
||||
record.setLongValue(ComponentDBAdapter.COMPONENT_DT_ID_COL,
|
||||
dataMgr.getResolvedID(dt));
|
||||
record.setString(ComponentDBAdapter.COMPONENT_COMMENT_COL, cmt);
|
||||
record.setString(ComponentDBAdapter.COMPONENT_COMMENT_COL, comment);
|
||||
updateRecord(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ package ghidra.program.model.data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ghidra.docking.settings.Settings;
|
||||
import ghidra.docking.settings.SettingsImpl;
|
||||
import ghidra.program.database.data.DataTypeUtilities;
|
||||
|
@ -57,8 +59,8 @@ public class DataTypeComponentImpl implements InternalDataTypeComponent, Seriali
|
|||
this.offset = offset;
|
||||
this.length = length;
|
||||
this.fieldName = fieldName;
|
||||
this.comment = comment;
|
||||
setDataType(dataType);
|
||||
setComment(comment);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,7 +117,7 @@ public class DataTypeComponentImpl implements InternalDataTypeComponent, Seriali
|
|||
|
||||
@Override
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
this.comment = StringUtils.isBlank(comment) ? null : comment;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -198,7 +200,7 @@ public class DataTypeComponentImpl implements InternalDataTypeComponent, Seriali
|
|||
// this.fieldName = = checkFieldName(name);
|
||||
this.fieldName = name;
|
||||
this.dataType = dt;
|
||||
this.comment = cmt;
|
||||
this.comment = StringUtils.isBlank(cmt) ? null : cmt;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue