cleanup: remove count_divecomputers() function

There is a number_of_computers() function which does
the same thing with two exceptions:
1) checks for null-dive
2) returns an unsigned int

Replace calls to count_divecomputers() by calls to number_of_computers().
In one case, the return type makes a different - add a cast to int there.
Ultimately, we should probably change the dc_number to signed int
throughout the code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-09-06 17:41:25 +02:00 committed by Dirk Hohndel
parent 0424ee8996
commit 048cdcaa31
4 changed files with 4 additions and 16 deletions

View file

@ -905,7 +905,7 @@ MoveDiveComputerToFront::MoveDiveComputerToFront(dive *d, int dc_num)
}
DeleteDiveComputer::DeleteDiveComputer(dive *d, int dc_num)
: DiveComputerBase(d, clone_delete_divecomputer(d, dc_num), std::min(count_divecomputers(d) - 1, dc_num))
: DiveComputerBase(d, clone_delete_divecomputer(d, dc_num), std::min((int)number_of_computers(d) - 1, dc_num))
{
setText(Command::Base::tr("delete dive computer"));
}