summaryrefslogtreecommitdiffstats
path: root/devicedetails.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-10-12 16:51:24 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-12 12:30:08 -0400
commit441bfbb66704d774d54d43e75c2db100b9858a03 (patch)
treee5b0d0a87af63380d4d3f7a208936d8ff007c70e /devicedetails.cpp
parentdf4e26c8757a81bb40ba2fd60431d5d1ecd64b11 (diff)
downloadsubsurface-441bfbb66704d774d54d43e75c2db100b9858a03.tar.gz
Initialize everything to zero in devicedetails
Before this, if you did click save backup xml before you read the data, you would get a xml file full of bogus. This initializes everything to zero. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'devicedetails.cpp')
-rw-r--r--devicedetails.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/devicedetails.cpp b/devicedetails.cpp
index 4f4d04030..d192c673c 100644
--- a/devicedetails.cpp
+++ b/devicedetails.cpp
@@ -1,9 +1,55 @@
#include "devicedetails.h"
+// This can probably be done better by someone with better c++-FU
+const struct gas zero_gas = {0};
+const struct setpoint zero_setpoint = {0};
+
DeviceDetails::DeviceDetails(QObject *parent) :
- QObject(parent)
+ QObject(parent),
+ m_data(0),
+ m_serialNo(""),
+ m_firmwareVersion(""),
+ m_customText(""),
+ m_syncTime(false),
+ m_gas1(zero_gas),
+ m_gas2(zero_gas),
+ m_gas3(zero_gas),
+ m_gas4(zero_gas),
+ m_gas5(zero_gas),
+ m_dil1(zero_gas),
+ m_dil2(zero_gas),
+ m_dil3(zero_gas),
+ m_dil4(zero_gas),
+ m_dil5(zero_gas),
+ m_sp1(zero_setpoint),
+ m_sp2(zero_setpoint),
+ m_sp3(zero_setpoint),
+ m_sp4(zero_setpoint),
+ m_sp5(zero_setpoint),
+ m_ccrMode(0),
+ m_diveMode(0),
+ m_decoType(0),
+ m_pp02Max(0),
+ m_pp02Min(0),
+ m_futureTTS(0),
+ m_gfLow(0),
+ m_gfHigh(0),
+ m_aGFLow(0),
+ m_aGFHigh(0),
+ m_aGFSelectable(0),
+ m_saturation(0),
+ m_desaturation(0),
+ m_lastDeco(0),
+ m_brightness(0),
+ m_units(0),
+ m_samplingRate(0),
+ m_salinity(0),
+ m_diveModeColor(0),
+ m_language(0),
+ m_dateFormat(0),
+ m_compassGain(0),
+ m_pressureSensorOffset(0)
{
-
}
device_data_t *DeviceDetails::data() const