mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Cleanup: don't access downloadTable directly in Uemis-downloader
The Uemis downloader determines the dive-number to be downloaded by either checking the download-table [interrupted connection] or the global dive table [fresh download]. The downloadTable is passed in the device data structure, but in the function to determine the latest dive, the global downloadTable is accessed directly [thus supposing that this table was passed in device data]. Instead, use the table from device data to avoid funny surprises should we change to a non-global download table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5a78730561
commit
8a18396104
1 changed files with 6 additions and 7 deletions
|
@ -1029,12 +1029,11 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
|
|||
return true;
|
||||
}
|
||||
|
||||
static char *uemis_get_divenr(char *deviceidstr, int force)
|
||||
static char *uemis_get_divenr(char *deviceidstr, struct dive_table *table, int force)
|
||||
{
|
||||
uint32_t deviceid, maxdiveid = 0;
|
||||
int i;
|
||||
char divenr[10];
|
||||
struct dive_table *table;
|
||||
deviceid = atoi(deviceidstr);
|
||||
mindiveid = 0xFFFFFFFF;
|
||||
|
||||
|
@ -1044,11 +1043,11 @@ static char *uemis_get_divenr(char *deviceidstr, int force)
|
|||
* already have.
|
||||
*
|
||||
* Also, if "force_download" is true, do this even if we
|
||||
* don't have any dives (maxdiveid will remain zero)
|
||||
* don't have any dives (maxdiveid will remain ~0).
|
||||
*
|
||||
* Otherwise, use the global dive table.
|
||||
*/
|
||||
if (force || downloadTable.nr)
|
||||
table = &downloadTable;
|
||||
else
|
||||
if (!force && !table->nr)
|
||||
table = &dive_table;
|
||||
|
||||
for (i = 0; i < table->nr; i++) {
|
||||
|
@ -1350,7 +1349,7 @@ const char *do_uemis_import(device_data_t *data)
|
|||
goto bail;
|
||||
|
||||
param_buff[1] = "notempty";
|
||||
newmax = uemis_get_divenr(deviceid, force_download);
|
||||
newmax = uemis_get_divenr(deviceid, data->download_table, force_download);
|
||||
if (verbose)
|
||||
fprintf(stderr, "Uemis downloader: start looking at dive nr %s\n", newmax);
|
||||
|
||||
|
|
Loading…
Reference in a new issue