private void setComponentDataType(DataTypeComponentDB comp, DataType newDt, int index)
			throws IOException {

		dataMgr.getSettingsAdapter().removeAllSettingsRecords(comp.getKey());
		comp.getDataType().removeParent(this);

		comp.setDataType(newDt); // saves component record
		newDt.addParent(this);

		if (isPackingEnabled()) {
			return;
		}

		int oldLen = comp.getLength();
		int length = getPreferredComponentLength(newDt, oldLen, getAvailableComponentSpace(index));

		if (length < oldLen) {
			comp.setLength(length, true);
			shiftOffsets(index + 1, oldLen - length, 0); // updates structure record and last modified time
		}
		else if (length > oldLen) {
			int consumed = consumeBytesAfter(index, length - oldLen); // updates component record
			if (consumed > 0) {
				shiftOffsets(index + 1, -consumed, 0); // updates structure record and last modified time
			}
		}
	}
Gets the number of Undefined bytes beginning at the indicated component ordinal. Undefined
bytes that have a field name or comment specified are also included.

@param ordinal the component ordinal to begin checking at.
@return the number of contiguous undefined bytes
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/StructureDB.java