mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 19:13:24 +00:00
code cleanup: use std::move() to potentially void copies
Found by Coverity. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2d5094a48b
commit
d295ca1d17
5 changed files with 8 additions and 8 deletions
|
@ -294,7 +294,7 @@ int removeWeight(int index, bool currentDiveOnly)
|
|||
|
||||
int editWeight(int index, weightsystem_t ws, bool currentDiveOnly)
|
||||
{
|
||||
return execute_edit(new EditWeight(index, ws, currentDiveOnly));
|
||||
return execute_edit(new EditWeight(index, std::move(ws), currentDiveOnly));
|
||||
}
|
||||
|
||||
int addCylinder(bool currentDiveOnly)
|
||||
|
@ -309,7 +309,7 @@ int removeCylinder(int index, bool currentDiveOnly)
|
|||
|
||||
int editCylinder(int index, cylinder_t cyl, EditCylinderType type, bool currentDiveOnly)
|
||||
{
|
||||
return execute_edit(new EditCylinder(index, cyl, type, currentDiveOnly));
|
||||
return execute_edit(new EditCylinder(index, std::move(cyl), type, currentDiveOnly));
|
||||
}
|
||||
|
||||
void editSensors(int toCylinder, int fromCylinder, int dcNr)
|
||||
|
|
|
@ -407,7 +407,7 @@ void add_default_cylinder(struct dive *d)
|
|||
cyl.type.size.mliter = 11100;
|
||||
cyl.type.workingpressure.mbar = 207000;
|
||||
}
|
||||
d->cylinders.add(0, cyl);
|
||||
d->cylinders.add(0, std::move(cyl));
|
||||
reset_cylinders(d, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
|
|||
/* Just the main cylinder until we can handle the buddy cylinder porperly */
|
||||
for (i = 0; i < 1; i++) {
|
||||
cylinder_t cyl = default_cylinder(dive.get());
|
||||
dive->cylinders.add(i, cyl);
|
||||
dive->cylinders.add(i, std::move(cyl));
|
||||
}
|
||||
|
||||
// Model 0=Xen, 1,2=Xeo, 4=Lynx, other=Liquivision
|
||||
|
|
|
@ -469,11 +469,11 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
|
|||
|
||||
if (inPlanner) {
|
||||
// In the planner - simply overwrite the cylinder in the dive with the modified cylinder.
|
||||
*d->get_cylinder(row) = cyl;
|
||||
*d->get_cylinder(row) = std::move(cyl);
|
||||
dataChanged(index, index);
|
||||
} else {
|
||||
// On the EquipmentTab - place an editCylinder command.
|
||||
int count = Command::editCylinder(index.row(), cyl, type, false);
|
||||
int count = Command::editCylinder(index.row(), std::move(cyl), type, false);
|
||||
emit divesEdited(count);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -88,7 +88,7 @@ void WeightModel::setTempWS(int row, weightsystem_t ws)
|
|||
const weightsystem_t &oldWS = d->weightsystems[row];
|
||||
if (oldWS.description != ws.description) {
|
||||
tempRow = row;
|
||||
tempWS = ws;
|
||||
tempWS = std::move(ws);
|
||||
|
||||
// If the user had already set a weight, don't overwrite that
|
||||
if (oldWS.weight.grams && !oldWS.auto_filled)
|
||||
|
@ -133,7 +133,7 @@ bool WeightModel::setData(const QModelIndex &index, const QVariant &value, int r
|
|||
case WEIGHT:
|
||||
ws.weight = string_to_weight(qPrintable(vString));
|
||||
ws.auto_filled = false;
|
||||
int count = Command::editWeight(index.row(), ws, false);
|
||||
int count = Command::editWeight(index.row(), std::move(ws), false);
|
||||
emit divesEdited(count);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue