We should get either dive trailer or dive profile immediately after
header. Thus make sure that is the case.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This is first step towards parsing "empty" dives properly. I.e. now the
updated test dive parses properly.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
The preferences flag cloud_background_sync used to be used heavily in
the mobile code, but is not used there anymore. Now, it is accessed
only in one place, but does not do what it actually says: If it is off,
the remote storage is not synced on save (but will be synced on next
load).
Syncing on save can also be prevented by unchecking the "Cloud online"
menu checkbox. Since the latter seems more logical and general
(support for non-cloud remote git repositories), remove the cloud_background_sync
option.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Sync with remote git repository, even if this isn't the cloud storage.
There seems to be no point in remote git repositories if they aren't
synced.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
downloadTable was declared twice in "dive.h". Remove one occurence.
Moreover, "uemis-downloader.c" also declared downloadTable. This can
likewise be removed, because "uemis-downloader.c" indirectly includes
"dive.h".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
A simple one line change that solves (for me) numerous hard crashes
when adding geo tags by reverse lookup from the dive site edit
screen. This is one of those crashes that is might not be
reproducible on any platform, or even between different builds
on one platform.
This said, I found that the free() on line 99 of divesitehelpers.cpp
tried to free pointers to random data, ie. not pointing to valid
taxonomy category strings. And those pointers where simply caused by
freeing the string earlier, and leaving the pointer around. So, this
change is nothing more than setting the just freed pointer to NULL,
to allow free() to be called later safely.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
In libdivecomputer.c, name_buffer is formatted with calls like
snprintf(name_buffer, 9, "%d cuft", rounded_size);
This works fine in the regular case, but it generates compiler
warnings, since theoretically the integer might produce up to
11 digits, leading to a truncation of the string.
Increasing the size of name_buffer to 17 chars silences these
warnings. This may seem like pointless warning-silencing.
Nevertheless, in the case of invalid data, it might make debugging
easier since, in the above case, the "cuft" is never truncated.
In total, it seems that this is a benign change with potential,
though in a very unlikely case, positive effects.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The object cur_setting was defined in core/pref.h. Instead, declare
it as extern and define it in core/parse.c. This silences a compiler
warning, since inclusion of core/pref.h would define the object, which
was then left unused in tests/testparse.cpp.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The boolean "autogroup" was parsed as an integer. In principle OK, but
let's make the type more explicit by introducing a get_bool() function.
Suggested-by: "Lubomir I. Ivanov" <neolit123@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
All users of autogroup are clearly expecting a boolean value, so
let the type reflect this.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
All callers of mark_divelist_changed() were passing a bool. Therefore,
let mark_divelist_changed() take a bool and make dive_list_changed a bool.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The return produces a warning about "strict-aliasing rules".
Use a union to fit the hash and the uint32_t into the same
block of memory, which obeys the GCC strict-aliasing rules.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Owing to bug #1002 invalid bluetooth device addresses of the form
"devicename (deviceaddress)" or "deviceaddress (devicename)" may
have found their way into the preferences. Recognize such names
and extract the correct address.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This fixes a bug where if the user entered very high ascent (or less commonly
descent) rates such that the time to ascend (or descend) from one level to the
next was less than 10s, that leg would be skipped in the dive plan notes.
Reported-by: Alexander Maier <maieralex@me.com>
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
clear_vpmb_state() was declared with incorrect signature, and all
functios in this change are extern, so declare them as such.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Realistically this is a false positive as we should never use a second
BTDiscovery instance - but there's nothing wrong with being extra certain.
Coverity CID 208319
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The previous attempt to fix this in commit 652e382e68 ("Cleanup: avoid a
few memory leaks") was clearly bogus. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we cannot store tanks / gases past MAX_CYLINDERS (currently 20),
there is no point in analyzing those data.
Coverity CID 208339
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A very very trival fix, for a mysterious issue. When loading
GPS fix data from the server, the string date was parsed with
the format "yyy-M-d". And no, the "yyy" is no typo here, but
was the reason that data from the read from server got a
1/1/1970 data. And when a user decided to upload that data
to the server again, we ended up with 2 copies of the
GPS fix. One with correct data (as originally saved), and
one new with the bogus date.
In order to het rid of those weird 1/1/1970 GPS fixes, users
will have to remove them by hand.
Fixes: #567
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
For deep dives with long deco, the sum of deco stops could
overflow. This is prevent by turning it into long.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
There was a curious pattern of singletons being implemented based on
QScopedPointer<>s. This is an unnecessary level of indirection:
The lifetime of the smart pointer is the same as that of the
pointed-to object. Therefore, replace these pointers by the respective
objects.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The two final newlines in the help message were removed in commit
0c74f7a2c8.
Re-add them.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>