mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Uemis downloader: multiple buddy support
- changed the uemis_add_string to support a delimiter in parameter 3 - passing each nickname to the parse_tag function appending dive->buddy with concatentated nicknames separaed by comma Signed-off-by: glerch <guido.lerch@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bc3a2ff89b
commit
e77d9cbd55
1 changed files with 8 additions and 8 deletions
|
@ -99,7 +99,7 @@ static void uemis_get_index(char *buffer, int *idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* space separated */
|
/* space separated */
|
||||||
static void uemis_add_string(const char *buffer, char **text)
|
static void uemis_add_string(const char *buffer, char **text, const char *delimit)
|
||||||
{
|
{
|
||||||
/* do nothing if this is an empty buffer (Uemis sometimes returns a single
|
/* do nothing if this is an empty buffer (Uemis sometimes returns a single
|
||||||
* space for empty buffers) */
|
* space for empty buffers) */
|
||||||
|
@ -110,7 +110,7 @@ static void uemis_add_string(const char *buffer, char **text)
|
||||||
} else {
|
} else {
|
||||||
char *buf = malloc(strlen(buffer) + strlen(*text) + 2);
|
char *buf = malloc(strlen(buffer) + strlen(*text) + 2);
|
||||||
strcpy(buf, *text);
|
strcpy(buf, *text);
|
||||||
strcat(buf, " ");
|
strcat(buf, delimit);
|
||||||
strcat(buf, buffer);
|
strcat(buf, buffer);
|
||||||
free(*text);
|
free(*text);
|
||||||
*text = buf;
|
*text = buf;
|
||||||
|
@ -721,18 +721,18 @@ static void parse_tag(struct dive *dive, char *tag, char *val)
|
||||||
} else if (!strcmp(tag, "f32Weight")) {
|
} else if (!strcmp(tag, "f32Weight")) {
|
||||||
uemis_get_weight(val, &dive->weightsystem[0], dive->dc.diveid);
|
uemis_get_weight(val, &dive->weightsystem[0], dive->dc.diveid);
|
||||||
} else if (!strcmp(tag, "notes")) {
|
} else if (!strcmp(tag, "notes")) {
|
||||||
uemis_add_string(val, &dive->notes);
|
uemis_add_string(val, &dive->notes , " ");
|
||||||
} else if (!strcmp(tag, "u8DiveSuit")) {
|
} else if (!strcmp(tag, "u8DiveSuit")) {
|
||||||
if (*suit[atoi(val)])
|
if (*suit[atoi(val)])
|
||||||
uemis_add_string(translate("gettextFromC", suit[atoi(val)]), &dive->suit);
|
uemis_add_string(translate("gettextFromC", suit[atoi(val)]), &dive->suit, " ");
|
||||||
} else if (!strcmp(tag, "u8DiveSuitType")) {
|
} else if (!strcmp(tag, "u8DiveSuitType")) {
|
||||||
if (*suit_type[atoi(val)])
|
if (*suit_type[atoi(val)])
|
||||||
uemis_add_string(translate("gettextFromC", suit_type[atoi(val)]), &dive->suit);
|
uemis_add_string(translate("gettextFromC", suit_type[atoi(val)]), &dive->suit, " ");
|
||||||
} else if (!strcmp(tag, "u8SuitThickness")) {
|
} else if (!strcmp(tag, "u8SuitThickness")) {
|
||||||
if (*suit_thickness[atoi(val)])
|
if (*suit_thickness[atoi(val)])
|
||||||
uemis_add_string(translate("gettextFromC", suit_thickness[atoi(val)]), &dive->suit);
|
uemis_add_string(translate("gettextFromC", suit_thickness[atoi(val)]), &dive->suit, " ");
|
||||||
} else if (!strcmp(tag, "dive_no")) {
|
} else if (!strcmp(tag, "nickname")) {
|
||||||
dive->number = atoi(val);
|
uemis_add_string(val, &dive->buddy, ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue