Handle possible narrowing of data type between unsigned long and signed long

This commit is contained in:
Joseph Lenox 2018-05-13 22:08:36 -05:00
parent 23a0f417d1
commit 121dd66362

View File

@ -950,7 +950,13 @@ void Plater::set_number_of_copies() {
long copies = -1; long copies = -1;
copies = wxGetNumberFromUser("", _("Enter the number of copies of the selected object:"), _("Copies"), model_object->instances.size(), 0, 1000, this); copies = wxGetNumberFromUser("", _("Enter the number of copies of the selected object:"), _("Copies"), model_object->instances.size(), 0, 1000, this);
if (copies < 0) return; if (copies < 0) return;
long diff {copies - model_object->instances.size() }; long instance_count = 0;
if (model_object->instances.size() <= LONG_MAX) {
instance_count = static_cast<long>(model_object->instances.size());
} else {
instance_count = LONG_MAX;
}
long diff {copies - instance_count };
if (diff == 0) { this->resume_background_process(); } if (diff == 0) { this->resume_background_process(); }
else if (diff > 0) { this->increase(diff); } else if (diff > 0) { this->increase(diff); }