diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-04-07 19:50:26 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-04-07 20:31:49 -0700 |
commit | a70a8898722e1e70ba0ff408414b20fdfce52548 (patch) | |
tree | da68ec64f074eb1984408e43c0866554750160aa /uemis.c | |
parent | 387dbe510f14ac5590075544431bbedf1e44fb2f (diff) | |
download | subsurface-a70a8898722e1e70ba0ff408414b20fdfce52548.tar.gz |
Fix some of the gcc-4.8 warnings
Most of the warnings are IMHO false positives:
e.g.: an enum variable is initialized in a switch statement that has a case for
each possible enum value - yet gcc 4.8 warns that it could be used
uninitialized;
or: two variables are initialized together in the code - second one of them
is previously initialized to -1 at declaration time, both are initialized
in an if (second one == -1) clause - so they are guaranteed to both be
initialized...
I did not "fix" those as the code is actually correct.
But there are three spots where it catches things that could indeed go wrong
(with odd input data in one of them).
This commit also adds a check to only call g_type_init() for older versions of
glib as in newer ones it is deprecated.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis.c')
-rw-r--r-- | uemis.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -288,7 +288,7 @@ void uemis_parse_divelog_binary(char *base64, void *datap) { int datalen; int i; uint8_t *data; - struct sample *sample; + struct sample *sample = NULL; uemis_sample_t *u_sample; struct dive *dive = datap; struct divecomputer *dc = &dive->dc; @@ -365,6 +365,7 @@ void uemis_parse_divelog_binary(char *base64, void *datap) { i += 0x25; u_sample++; } - dive->dc.duration.seconds = sample->time.seconds - 1; + if (sample) + dive->dc.duration.seconds = sample->time.seconds - 1; return; } |