aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-12-04 18:53:05 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-04 16:27:08 -0600
commit7bc5a62ca1e5b80fbfdcfe33e351d553cb388d97 (patch)
tree444ae060de6980443baff861c2e83047d828ed12
parentaa22e0610c67dd86a54f7d7cab7987c399be4c46 (diff)
downloadsubsurface-7bc5a62ca1e5b80fbfdcfe33e351d553cb388d97.tar.gz
Fix DM4/DM5 import
The implementation of import for DM5 removed the profileBlob from SQL query, thus breaking the backward compatibility on import of old dives. Need to have bot profile and sample blobs within the query... Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--parse-xml.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 456af4d39..80cd2021a 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -2081,7 +2081,7 @@ extern int dm5_dive(void *param, int columns, char **data, char **column)
cur_dive->dc.surface_pressure.mbar = (atoi(data[14]) * 1000);
interval = data[16] ? atoi(data[16]) : 0;
- sampleBlob = (unsigned const char *)data[17];
+ sampleBlob = (unsigned const char *)data[24];
for (i = 0; interval && sampleBlob && i * interval < cur_dive->duration.seconds; i++) {
float *depth = (float *)&sampleBlob[i * 16 + 3];
int32_t temp = (sampleBlob[i * 16 + 10] << 8) + sampleBlob[i * 16 + 11];
@@ -2180,7 +2180,7 @@ int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buffer, int s
/* StartTime is converted from Suunto's nano seconds to standard
* time. We also need epoch, not seconds since year 1. */
- char get_dives[] = "select D.DiveId,StartTime/10000000-62135596800,Note,Duration,SourceSerialNumber,Source,MaxDepth,SampleInterval,StartTemperature,BottomTemperature,D.StartPressure,D.EndPressure,Size,CylinderWorkPressure,SurfacePressure,DiveTime,SampleInterval,SampleBlob,TemperatureBlob,PressureBlob,Oxygen,Helium,MIX.StartPressure,MIX.EndPressure FROM Dive AS D JOIN DiveMixture AS MIX ON D.DiveId=MIX.DiveId";
+ char get_dives[] = "select D.DiveId,StartTime/10000000-62135596800,Note,Duration,SourceSerialNumber,Source,MaxDepth,SampleInterval,StartTemperature,BottomTemperature,D.StartPressure,D.EndPressure,Size,CylinderWorkPressure,SurfacePressure,DiveTime,SampleInterval,ProfileBlob,TemperatureBlob,PressureBlob,Oxygen,Helium,MIX.StartPressure,MIX.EndPressure,SampleBlob FROM Dive AS D JOIN DiveMixture AS MIX ON D.DiveId=MIX.DiveId";
retval = sqlite3_exec(handle, get_dives, &dm5_dive, handle, &err);