mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fill in divecomputer serial number and firmware version on loading
We have the serial number and firmware version fields in "struct divecomputer", but we don't actually fill them in when loading the data from git or xml, because we save all that information in the separate device table instead. But in order to always have the serial number associated with a device, let's make sure to fill those fields in. It won't hurt, and this way we have the information available whether we just loaded the dive from a file, or imported it from the dive computer. One less semantic difference to worry about. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
777cbd9cfe
commit
c840ab4332
4 changed files with 35 additions and 2 deletions
|
|
@ -892,6 +892,8 @@ static int match_dc_data_fields(struct divecomputer *dc, const char *name, char
|
|||
/* We're in the top-level dive xml. Try to convert whatever value to a dive value */
|
||||
static void try_to_fill_dc(struct divecomputer *dc, const char *name, char *buf)
|
||||
{
|
||||
unsigned int deviceid;
|
||||
|
||||
start_match("divecomputer", name, buf);
|
||||
|
||||
if (MATCH("date", divedate, &dc->when))
|
||||
|
|
@ -900,8 +902,10 @@ static void try_to_fill_dc(struct divecomputer *dc, const char *name, char *buf)
|
|||
return;
|
||||
if (MATCH("model", utf8_string, &dc->model))
|
||||
return;
|
||||
if (MATCH("deviceid", hex_value, &dc->deviceid))
|
||||
if (MATCH("deviceid", hex_value, &deviceid)) {
|
||||
set_dc_deviceid(dc, deviceid);
|
||||
return;
|
||||
}
|
||||
if (MATCH("diveid", hex_value, &dc->diveid))
|
||||
return;
|
||||
if (MATCH("dctype", get_dc_type, &dc->divemode))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue