aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2018-01-08Parse water temperature from ZDTGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08Function to look for new line on DL7 importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08Use dynamic indexing instead of hard codedGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08Add support for air temp on DL7 importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08Dummy parse empty divesGravatar Miika Turkia
Easiest way to get dives without profiles in, is to just parse empty csv tags. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08Stricter check we get dive profileGravatar Miika Turkia
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>
2018-01-08Ignore empty divesGravatar Miika Turkia
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>
2018-01-08Refactor CSV importGravatar Miika Turkia
Move CSV import related functions into import-csv.c. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-06Remove cloud_background_sync preferences optionGravatar Berthold Stoeger
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>
2018-01-06Sync with any remote git repositoryGravatar Berthold Stoeger
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>
2018-01-06Trivial: remove redundant declarations of downloadTableGravatar Berthold Stoeger
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>
2018-01-06Remove unused urlsGravatar Jan Mulder
They are unused, and a relic from earlier plans. Just remove. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-05core: free() in a safe way, reverse geolookup unstabilityGravatar Jan Mulder
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>
2018-01-05Increase size of name_buffer to fit any integerGravatar Berthold Stoeger
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>
2018-01-05Don't define cur_setting in header fileGravatar Berthold Stoeger
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>
2018-01-04parse-xml.c: add get_bool() functionGravatar Berthold Stoeger
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>
2018-01-04Turn autogroup from short into boolGravatar Berthold Stoeger
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>
2018-01-04mark_divelist_changed(): only update title if necessaryGravatar Berthold Stoeger
Only change the title if the changed status was updated. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04Turn dive_list_changed into boolGravatar Berthold Stoeger
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>
2017-12-31divesite.c: use union in create_divesite_uuid()Gravatar Lubomir I. Ivanov
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>
2017-12-31Workaround for invalid bluetooth device namesGravatar Berthold Stoeger
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>
2017-12-30Cleanup: consistently handle file open failuresGravatar Dirk Hohndel
In part based on Coverity CID 45129 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-30Cleanup: fix memory leakGravatar Dirk Hohndel
Oops, I previously fixed only one of two instances. Coverity CID 45078 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-29cleanup: Uninitialized scalar fieldGravatar Jan Mulder
CID 208303 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-29cleanup: Unchecked return value from libraryGravatar Jan Mulder
CID 60227 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-28Planner notes: don't omit deco stops with rapid ascent ratesGravatar Rick Walsh
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>
2017-12-28cleanup: correct signature and declare externGravatar Jan Mulder
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>
2017-12-28Cleanup: Uninitialized scalar fieldGravatar Jan Mulder
CID 208315 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-27Cleanup: avoid dereferencing NULL pointerGravatar Dirk Hohndel
Coverity CID 208330 Coverity CID 208301 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27Cleanup: avoid uninitialized membersGravatar Dirk Hohndel
This is basically to make Coverity happy. Coverity CID 208300 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27Cleanup: avoid potentially uninitialized membersGravatar Dirk Hohndel
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>
2017-12-27Cleanup: avoid memory leakGravatar Dirk Hohndel
Coverity CID 45078 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27Cleanup: avoid memory leakGravatar Dirk Hohndel
Coverity CID 45121 Coverity CID 45163 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27Cleanup: correctly prevent memory leakGravatar Dirk Hohndel
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>
2017-12-27Check different sensors on divinglog importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-12-26Cleanup: avoid dereferencing NULL pointerGravatar Dirk Hohndel
Coverity CID 208323 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid accessing uninitialized variableGravatar Dirk Hohndel
Coverity CID 208289 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid out of bounds accessGravatar Dirk Hohndel
sizeof() is clearly the wrong way to get to the size of that array... Coverity CID 208294 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid out of bounds accessGravatar Dirk Hohndel
sizeof() is clearly the wrong way to get to the size of that array... Coverity CID 208290 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid memory leakGravatar Dirk Hohndel
Coverity CID 208298 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid memory leakGravatar Dirk Hohndel
Coverity CID 208308 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid memory leakGravatar Dirk Hohndel
Coverity CID 208314 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid memory leakGravatar Dirk Hohndel
No point in doing the strdup of the password if we then bail. Coverity CID 208316 Coverity CID 209293 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: prevent out of bounds readGravatar Dirk Hohndel
Don't access cylinder[MAX_CYLINDERS] Coverity CID 208324 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid memory leakGravatar Dirk Hohndel
Coverity CID 208327 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid memory leakGravatar Dirk Hohndel
Coverity CID 208333 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid memory leakGravatar Dirk Hohndel
Coverity CID 208337 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: prevent potential out of bounds writeGravatar Dirk Hohndel
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>
2017-12-26Cleanup: avoid memory leakGravatar Dirk Hohndel
The JUMP macro includes a 'goto bail', so we need to free devdata there Coverity CID 208340 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26Cleanup: avoid a few memory leaksGravatar Dirk Hohndel
Coverity CID 215199 Coverity CID 215195 Coverity CID 215196 Coverity CID 215198 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>