summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-20 09:37:56 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-20 09:53:06 -0800
commit0421a161b4e3e319fb57397b5a729a3440a82c80 (patch)
treea8994be0a1de08aea2a362baa0c0e1fb7aed69d2
parent4ab58d6b47e8786d0a10c1308ee487e10af7fa83 (diff)
downloadsubsurface-0421a161b4e3e319fb57397b5a729a3440a82c80.tar.gz
Silence a few warnings
None of these are actual bugs. But none of the fixes are harmful, either. And much as I hate adding the 'default' clauses, I'd rather not have the build output cluttered by invalid warnings. The exception is the fix in divelistview.cpp - while I don't think it is possible for this function to be called with no dive selected, initializing pd to NULL is cheap insurance in case that does happen for some weird reason. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--dive.c4
-rw-r--r--parse-xml.c5
-rw-r--r--qt-ui/divelistview.cpp2
3 files changed, 7 insertions, 4 deletions
diff --git a/dive.c b/dive.c
index d0c22734c..540f40eb5 100644
--- a/dive.c
+++ b/dive.c
@@ -57,6 +57,7 @@ int get_pressure_units(unsigned int mb, const char **units)
unit = translate("gettextFromC","pascal");
break;
case BAR:
+ default:
pressure = (mb + 500) / 1000;
unit = translate("gettextFromC","bar");
break;
@@ -97,6 +98,7 @@ double get_volume_units(unsigned int ml, int *frac, const char **units)
switch (units_p->volume) {
case LITER:
+ default:
vol = ml / 1000.0;
unit = translate("gettextFromC","l");
decimals = 1;
@@ -130,6 +132,7 @@ double get_depth_units(unsigned int mm, int *frac, const char **units)
switch (units_p->length) {
case METERS:
+ default:
d = mm / 1000.0;
unit = translate("gettextFromC","m");
decimals = d < 20;
@@ -156,6 +159,7 @@ double get_vertical_speed_units(unsigned int mms, int *frac, const char **units)
switch (units_p->length) {
case METERS:
+ default:
d = mms / 1000.0 * time_factor;
unit = translate("gettextFromC",(units_p->vertical_speed_time == MINUTES) ? "m/min" : "m/s");
break;
diff --git a/parse-xml.c b/parse-xml.c
index b9fa5ff01..cb8312008 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -267,7 +267,7 @@ double ascii_strtod(char *str, char **ptr)
{
char *p = str, c, *ep;
double val = 0.0;
- double decimal;
+ double decimal = 1.0;
int sign = 0, esign = 0;
int numbers = 0, dot = 0;
@@ -290,7 +290,6 @@ double ascii_strtod(char *str, char **ptr)
if (dot)
goto done;
dot = 1;
- decimal = 1.0;
continue;
}
if (c >= '0' && c <= '9') {
@@ -399,7 +398,7 @@ static enum number_type integer_or_float(char *buffer, union int_or_float *res)
static void pressure(char *buffer, void *_press)
{
- double mbar;
+ double mbar = 0.0;
pressure_t *pressure = _press;
union int_or_float val;
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 11d7124bc..0af6fbb10 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -581,7 +581,7 @@ void DiveListView::addToTripAbove()
{
int idx, delta = (currentOrder == Qt::AscendingOrder) ? -1 : +1;
dive_trip_t *trip = NULL;
- struct dive *pd;
+ struct dive *pd = NULL;
struct dive *d = (struct dive *) contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void*>();
if (!d) // shouldn't happen as we only are setting up this action if this is a dive
return;