summaryrefslogtreecommitdiffstats
path: root/uemis.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-25 23:19:57 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-26 10:58:39 -0700
commitcb48db275e3877314c6da102990bed6c6980bd7f (patch)
tree93268c3621c14e18b146ece9e769986fa8be87b7 /uemis.c
parent43f122f9ff6eb933fcf831ac0b242f770204d2d5 (diff)
downloadsubsurface-cb48db275e3877314c6da102990bed6c6980bd7f.tar.gz
Fix stupid packing error on Windows
I guess no one has ever tried to import Uemis dive data under Windows. The glib-2 libraries for Windows (at least the ones that are part of the mingw package, but my guess is this is true for all of them), force the whole program to be compiled with Windows packing rules for structures. That broke the structure we use for decoding Uemis binary data. This commit changes the data structure to no longer use unaligned 16bit values but instead two 8bit values and assemble them in the actual code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis.c')
-rw-r--r--uemis.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/uemis.c b/uemis.c
index 06ef5b423..557c419f3 100644
--- a/uemis.c
+++ b/uemis.c
@@ -229,7 +229,8 @@ void uemis_parse_divelog_binary(char *base64, void *datap) {
sample->depth.mm = pressure_to_depth(u_sample->water_pressure);
sample->temperature.mkelvin = (u_sample->dive_temperature * 100) + 273150;
sample->cylinderindex = u_sample->active_tank;
- sample->cylinderpressure.mbar= u_sample->tank_pressure * 10;
+ sample->cylinderpressure.mbar =
+ (u_sample->tank_pressure_high * 256 + u_sample->tank_pressure_low) * 10;
uemis_event(dive, sample, u_sample);
finish_sample(dive);
i += 0x25;