summaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
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>
2017-12-25Use correct date formatGravatar Jan Mulder
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>
2017-12-25Prevent overflow in effective GF calculationGravatar Robert C. Helling
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>
2017-12-24Remove superfluous QScopedPointer<>s in singletonsGravatar Berthold Stoeger
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>
2017-12-24Re-add newlines to help messageGravatar Berthold Stoeger
The two final newlines in the help message were removed in commit 0c74f7a2c8e0af7ac006c16fc9ef05e5f9245518. Re-add them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-24Code cleanup: Indentation mistake plus simplificationGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-24Remove obsolete declaration of void gfLowAtMaxDepthChangedGravatar Stefan Fuchs
in ./core/subsurface-qt/SettingsObjectWrapper.h Code for this was removed here: 5b080beddef3e08b86eb53448e737b4867a50c1a Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-21cleanup: remove empty functionGravatar Jan Mulder
subsurface_OS_pref_setup() is not not used. Remove it. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-21Make QMap<> access in deleteGpsFix() more idiomaticGravatar Berthold Stoeger
To access a QMap<> entry, the value() function is used with a sentinel as default value. If the sentinel is returned, the code assumes that the searched for entry doesn't exist. Make this code more idiomatic by using an iterator and testing for end(). This fixes a compiler warning, because only one of the elements of the sentinel was initialized, but the remaining elements were copied. Harmless, because the code would exit early if it found the sentinel. Still not nice. While redoing this function, the entry-not-found message was improved (adding of function name, space between massage and timestamp) and elevated from debug to warning level. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-21Handle plot_info->nr <= 0 gracefullyGravatar Berthold Stoeger
plot_info->nr should always be > 0. If this is not the case, write a message to stderr instead of crashing in add_plot_pressure(). This silences an use-of-uninitialized-variable warning. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-21Fix use of uninitialized variable in core/profile.cGravatar Berthold Stoeger
last_ceiling was used before initialization in the first iteration of the loop in calculate_deco_information(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-21Check return of fread() in core/ostctools.cGravatar Berthold Stoeger
Since the corresponding error message appears thrice, it is translated once at the beginning of the function (even in the non-error case). A single-byte fread() was transformed into getc(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-20core: ignore erroneous quotes as wellGravatar Jan Mulder
A small redo of 78bafe8f620a066. The quotes cause the original functionality not to work. Ignore them as well. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-20core: fix commit 46004c39e266fe7 for real (erroneous quotes)Gravatar Jan Mulder
Unfortunately, in my commit 48d9c8eb6eb07a, I fixed only half of the problems related to the functionality introduced by Stefan in commit 46004c39e266fe7. The lonely m (that was fixed) caused a parsing error, but forgotten where the single quotes around the depth value. These quotes simply causes the new functionality not to work. Again, the fix is simple: do not erroneously save quotes. And as the new functionality is pretty obscure (replanning a non-planned dive, and manually entering a gas switch depth), another bug that could go unnoticed for years. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-19git storage: invalidate cache on merge dive siteGravatar Jan Mulder
In hindsight a very simple bug to fix, but it requires some knowledge on the inner workings of our git storage. The changes on merge of dive sites were simply not saved (completely) because the git storage code has a cache that we need to invalidate selectively (ie. for the dive we just gave a new dive site uuid) to get things finally embedded in the overall commit. The main reason this bug went unnoticed for more than 2 years is that most people use the XML/SSRF format (where this problem is non exsistent), and dive site merging is probably not a very much used feature either. Fixes: #939 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18core: ignore bogus m in cylinderGravatar Jan Mulder
A bogus key/value pair was introduced in the cylinder, consisting of a lonely "m" without value. This is caused by commit 46004c39e26 and fixed in 48d9c8eb6eb0. See referenced commits for more info. Just ignore this key/value pair. No processing is broken due to this, as the git storage stores only metric SI type data. In fact, the m unit is superfluous anyway. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18Allow to read factor cache concurrentlyGravatar Robert C. Helling
In a session with the profile I saw that the planner spends a lot of time waiting to obtain the lock for the factor cache. Most of the time we are only reading that cache and that is save to do in parallel (according to the Qt IRC channel). So we can use a QReadWriteLock instead of a QMutex. This appears to be quite a performance boost, in particular for VPM-B Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-18Elevate "can't write hashes" message from debug to warning levelGravatar Berthold Stoeger
I never realized that my hashes weren't written, because it only outputs a debug instead of a warning message. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-18core: fix git storage save (regression 4.7.4 -> 4.7.5)Gravatar Jan Mulder
Commit 46004c39e266fe7 introduces a new field in the logbook outputs (depth of a cylinder). While in XML the depth unit is stored with a space between value and unit (m), in our git storage, the unit m is without space. As the git storage parser uses a space to separate individual key/value pairs, the erroneously saved space results in parsing warnings when opening the logbook. The unwanted space is normally saved just after download of a new dive from the dive computers, so all desktop-git-storage uses are affected, and more worrying, mobile beta users. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-17CLeanup: remove duplicate typedefGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17Cleanup: durations are now signedGravatar Dirk Hohndel
Somehow a whitespace fix snuck in here. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17Unify float calulations: use doubleGravatar Berthold Stoeger
Internal floating point (FP) calculations should be performed using double unless there is a very good reason. This avoids headaches with conversions. Indeed, the vast majority of FP calculations were already done using double. This patch adapts most remaining calculations. Not converted where things that were based on binary representations and variables which weren't used anyway. An analysis of all instances follows: core/plannernotes.c, l.404: This was a comparison between two floats. On the left side, first an integer was cast to float then multiplied with and integer and divided by a constant double. The right hand side was an integer cast to a float. Simply divide by 1000.0 first to convert to double and continue with calculations. On the right hand side, remove the cast, because the integer will be implicitely cast to double for comparison. This conversion actually emits less instructions, because no conversion to double and back is performed. core/planner.c, l.613: Same analysis as previous case. subsurface-desktop-main.cpp, l.155: A local variable representing the version OpenGL version. Turn this into integer logic. Not only does this avoid dreaded FP rounding issues, it also works correctly for minor version > 10 (not that such a thing is to be expected anytime soon). abstractpreferenceswidget.[h/cpp]: A widget where the position is described as a float. Turn into double. desktop-widgets/divelogexportdialog.cpp, l.313: total_weight is described as float. Use double arithmetics instead. This instance fixes a truncation warning emitted by gcc.
2017-12-14Remove function isCloudUrl()Gravatar Berthold Stoeger
The function isCloudUrl() was only called in one place, parse_file(). But, isCloudUrl() could only return true if the filename was of the git-repository kind (url[branch]). In such a case, control flow would never reach the point where isCloudUrl() is called, since is_git_repository() returns non-NULL and the function returns early. Therefore, remove this function. Moreover, adapt the affected if-statement by replacing "str && !strcmp(str, ...)" with the more concise "same_string(str, ...)". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-13Enable removal of pictures from different dives at the same momentGravatar Stefan Fuchs
Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>