diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-22 20:50:07 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-22 20:50:07 -0700 |
commit | 33b6d090003e5c06ac036808361cf3488c7dfee6 (patch) | |
tree | 359828e493c7a9a69c619e6d60ddaf2fbb7dbffc /dive.c | |
parent | a6f6e8d6ff06d03fc01d8a6e7f50240e405b7ea6 (diff) | |
download | subsurface-33b6d090003e5c06ac036808361cf3488c7dfee6.tar.gz |
Merge latitude and longitude data properly
When merging two identical dives and one of them has lat/long data, pick
it up correctly for the merged dive.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -222,6 +222,7 @@ struct dive *fixup_dive(struct dive *dive) #define MERGE_MAX(res, a, b, n) res->n = MAX(a->n, b->n) #define MERGE_MIN(res, a, b, n) res->n = (a->n)?(b->n)?MIN(a->n, b->n):(a->n):(b->n) #define MERGE_TXT(res, a, b, n) res->n = merge_text(a->n, b->n) +#define MERGE_NONZERO(res, a, b, n) res->n = a->n ? a->n : b->n static struct dive *add_sample(struct sample *sample, int time, struct dive *dive) { @@ -411,6 +412,8 @@ struct dive *try_to_merge(struct dive *a, struct dive *b) res = alloc_dive(); res->when = a->when; + MERGE_NONZERO(res, a, b, latitude); + MERGE_NONZERO(res, a, b, longitude); MERGE_TXT(res, a, b, location); MERGE_TXT(res, a, b, notes); MERGE_TXT(res, a, b, buddy); |