[PATCH 4/9] divelogexportdialog.cpp: fix a 'uninitialized variable' warning

Lubomir I. Ivanov neolit123 at gmail.com
Sat Oct 25 03:03:32 PDT 2014


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

DiveLogExportDialog::export_depths()

We set a default value of 'unit' which will silence the warning itself.
Then hope that the compiler will respect the argument order i.e. call
get_depth_units() (which sets 'unit') before using *unit as the last
argument passsed to put_format().

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 qt-ui/divelogexportdialog.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index a0fbc50..4e00b4e 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -322,7 +322,7 @@ void DiveLogExportDialog::export_depths(const char *filename, const bool selecte
 	struct dive *dive;
 	depth_t depth;
 	int i;
-	const char **unit;
+	const char **unit = NULL;
 
 	struct membuffer buf = { 0 };
 
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list