Spreadsheet: Fixes for coverity defects Feb 2025

This commit is contained in:
Chris Hennes
2025-02-20 21:17:55 -06:00
parent c4a4ce3ae0
commit dabcb2e506
6 changed files with 16 additions and 8 deletions

View File

@@ -543,7 +543,7 @@ void Cell::setDisplayUnit(const std::string& unit)
if (newDisplayUnit != displayUnit) {
PropertySheet::AtomicPropertyChange signaller(*owner);
displayUnit = newDisplayUnit;
displayUnit = std::move(newDisplayUnit);
setUsed(DISPLAY_UNIT_SET, !displayUnit.isEmpty());
setDirty();

View File

@@ -39,7 +39,7 @@ public:
explicit DisplayUnit(const std::string _stringRep = "",
const Base::Unit _unit = Base::Unit(),
double _scaler = 0.0)
: stringRep(_stringRep)
: stringRep(std::move(_stringRep))
, unit(_unit)
, scaler(_scaler)
{}

View File

@@ -787,7 +787,7 @@ void PropertySheet::setAlias(CellAddress address, const std::string& alias)
App::ObjectIdentifier key(owner, oldAlias);
App::ObjectIdentifier value(owner, alias.empty() ? address.toString() : alias);
m[key] = value;
m[key] = std::move(value);
owner->getDocument()->renameObjectIdentifiers(m);
}
@@ -1397,7 +1397,7 @@ void PropertySheet::addDependencies(CellAddress key)
// Insert into maps
propertyNameToCellMap[propName].insert(key);
cellToPropertyNameMap[key].insert(propName);
cellToPropertyNameMap[key].insert(std::move(propName));
}
}
}

View File

@@ -104,7 +104,15 @@ Sheet::Sheet()
Sheet::~Sheet()
{
clearAll();
try {
clearAll();
}
catch (boost::wrapexcept<boost::regex_error>&) {
// Don't let an exception propagate out of a destructor (calls terminate())
Base::Console().Error(
"clearAll() resulted in an exception when deleting the spreadsheet : %s\n",
*pcNameInDocument);
}
}
/**

View File

@@ -191,7 +191,7 @@ void DlgBindSheet::accept()
addr = std::string("<<") + copy + ">>";
}
else {
addr = copy;
addr = std::move(copy);
}
};

View File

@@ -68,9 +68,9 @@ private:
QPointer<SpreadsheetGui::SheetTableView> stv;
QGraphicsScene m_scene;
QGraphicsProxyWidget* qpw;
QGraphicsProxyWidget* qpw {nullptr};
int m_zoomLevel;
int m_zoomLevel {100};
protected:
void focusOutEvent(QFocusEvent* event) override;