mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix picture loading
Signed vs unsigned comparisons are such a pain. Since we want offsets to be +/- 30 minutes around the dive we need to allow negative offsets - but duration_t was defined as uint32_t. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c054b18b70
commit
f297d9f91e
5 changed files with 33 additions and 6 deletions
11
save-xml.c
11
save-xml.c
|
@ -333,8 +333,15 @@ static void save_picture(struct membuffer *b, struct picture *pic)
|
|||
put_string(b, " <picture filename='");
|
||||
put_string(b, pic->filename);
|
||||
put_string(b, "'");
|
||||
if (pic->offset.seconds)
|
||||
put_format(b, " offset='%u:%02u min'", FRACTION(pic->offset.seconds, 60));
|
||||
if (pic->offset.seconds) {
|
||||
int offset = pic->offset.seconds;
|
||||
char sign = '+';
|
||||
if (offset < 0) {
|
||||
sign = '-';
|
||||
offset = -offset;
|
||||
}
|
||||
put_format(b, " offset='%c%u:%02u min'", sign, FRACTION(offset, 60));
|
||||
}
|
||||
if (pic->latitude.udeg || pic->longitude.udeg) {
|
||||
put_degrees(b, pic->latitude, " gps='", " ");
|
||||
put_degrees(b, pic->longitude, "", "'");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue