aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-11-08iOS: build the debug version of Google maps library if neededGravatar Dirk Hohndel
When trying to debug on device Xcode really wants a debug build (which is nearly unusably slow, but that's a different issue). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08iOS: explicitly disable open source SSL implementationsGravatar Dirk Hohndel
Those aren't allowed on iOS and adding these two flags removes some confusing warnings that look like errors in the build log. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08iOS: small change to storeIconGravatar Dirk Hohndel
This was updated by Xcode - just checking it in so that running Xcode doesn't cause dirty source tree. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Profile: remove ProfileWidget2::recalcCeiling()Gravatar Berthold Stoeger
The ProfileWidget2::recalcCeiling() function is used in one place, namely when an undo-command changes the mode. It recalculates decompression data and repaints the ceilings and thus avoids a full profile-redraw. This is smart, but it becomes problematic when the dive is changed and the ceiling is recalculated before the profile is redrawn. The DivePlotDataModel then still has data from the previous dive but cylinders of the new dive are accessed. This kind of situation may arise if multiple dive fields are updated, as for example when replanning a dive. Currently, this only causes a temporary mis-calculation. When removing MAX_CYLINDERS this will lead to crashes. One might attempt to fix the whole data-dependency mess. This commit goes the cheap route and simply redraws the profile when the mode is changed. Yes, it is in a way ineffective, but we do worse things. The ProfileWidget2::recalcCeiling() thus becomes unused and is removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-03Planner: Don't accumulate rounding errors in stop durationsGravatar Robert C. Helling
When displaying segment or stop times in the planner notes, we always round to the next full minute. This can mean for example that we round down more often than rounding up with the result that the sum of the segment times does not match the total runtime and can for example lead to stops that are shown with 0min duration. With this patch, we increase the reference time of the last display only by the duration time actually shown. This way, the rounding errors don't accumulate but having rounded down previously makes rounding up the next time more propable. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-11-03Mobile: don't dereference the dive list model when it's disconnectedGravatar Dirk Hohndel
This avoids a bunch of annoying warnings. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03Mobile: disconnect model while updating dive listGravatar Dirk Hohndel
If the dive list is connected to the model while the model is updated with the downloaded dives, sometimes the UI hangs completely. Disconnecting the model and then reconnecting it does add a fairly noticeable delay on longer dive lists, so there are tradeoffs here. Of course the obvious solution is to make reconnecting the model faster... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03Mobile: use appendTextToLog to get timestamps in logsGravatar Dirk Hohndel
This helps tremendously when tracking down some problems. We should never use console.log. In the process this also updates a couple of the messages to be clearer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-31Planner: Add option to treat O2 as narcoticGravatar Robert C. Helling
When computing the best mix for a target depth, for helium, one can either require that the partial pressure of N2 is the same as at the target depth or the partial pressure of N2 plus O2. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-10-28Mobile: add circle around the side actionsGravatar Dirk Hohndel
That seems slightly more visually pleasing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Mobile: make the action button widerGravatar Dirk Hohndel
This makes it hard to fat finger the side buttons. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Cleanup: avoid dereferencing NULLGravatar Dirk Hohndel
We should call this function with two well defined dive_or_trip structures which means that exactly one of the two values is set in each argument. But in order to not have bugs elsewhere leed to crashes here, be more tolerant of malformed argumnts. Fixes CID 350100 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Cleanup: better handling of NULL dive in setCurrentDiveSiteGravatar Dirk Hohndel
We test for d being NULL so that's clearly an option we worried about, yet we already called get_dive_site_for_dive(d) which dereferences d. Found by Coverity. Fixes CID 350118 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Cleanup: prevent NULL dereferenceGravatar Dirk Hohndel
This should never happen based on the logic in the callers, but just to be on the safe side. Should fix CID 350128 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Cleanup: use helper to avoid NULL dereferenceGravatar Dirk Hohndel
We have these helper functions for exactly this purpose. Found by Coverity. Fixes CID 350129 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Desktop: fix dive site editingGravatar Berthold Stoeger
When clicking "done" on the dive site edit screen, the diveSite member variable was reset to nullptr in acceptChanges() at the beginning of the function. This prevented posting an undo-command as a consequence of the active widget losing focus. Reset the diveSite variable after exiting dive-site mode, which causes the active widget to lose focus. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-27Don't expose 'detach_buffer()' to membuffer usersGravatar Linus Torvalds
The native buffer of a membuffer is not NUL-terminated, so when you want to detach it and use it as a C string, you had to first do 'mb_cstring()' that adds the proper termination/ This was all documented in the header files, and all but two users did it correctly. But there were those two users, and the exported interface was unnecessarily hard to use. We do want the "just detach the raw buffer" internally in the membuffer code, but let's not make the exported interface be that hard to use. So this switches the exported interface to be 'detach_cstring()', which does that 'mb_cstring()' for you, and avoids the possibility that you'd use a non-terminated memory buffer as a C string. The old 'detach_buffer()' is now purely the internal membuffer implementation, and not used by others. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-10-27Mobile: make the GPS service icon work againGravatar Dirk Hohndel
I don't recall when this stopped working. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: turn TankItem member variable into a constantGravatar Berthold Stoeger
TankItem had a "height" member variable that was never modified. Turn it into a constant, which is local to the translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-27Profile: don't copy plot data for tank-barGravatar Berthold Stoeger
The whole plot info data was copied only so that the time of the last item could be determined later. Instead, simply store the timestamp. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-27Cleanup: move common code into TankItem::createBar() functionGravatar Berthold Stoeger
Calculation of the x-position and the width of the tank-bar was done outside of the function. Move it into the function to make the caller a bit more readable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-27Cleanup: remove TankItem::modelData member variableGravatar Berthold Stoeger
This is only used for an "is initialized"-check. But there are other member variables that are used for that purpose. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-27Cleanup: NULL check pointer before dereferencingGravatar Dirk Hohndel
I we have no dive, whatever this is shouldn't be shown. Found by Coverity. Fixes CID 350093 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: NULL check pointer before dereferencingGravatar Dirk Hohndel
Found by Coverity. CID 350081, 350087, 350095 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: add missing break statementsGravatar Dirk Hohndel
The current code of course works just fine. But there's a risk someone might add something to one of these cases and not realize that there is an implicit fall through going on. This is cleaner. Found by Coverity. Fixes CID 350079 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: prevent uninitialized pointerGravatar Dirk Hohndel
This should never matter as we should never call undoit before redoit. Extra ensurance that we don't access random data. Found by Coverity. Fixes CID 350076 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: remove pointless call to get_unitsGravatar Dirk Hohndel
This simply returns the address of prefs.units. Found by Coverity. Fixes CID 60237 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: consider lseek return valueGravatar Dirk Hohndel
This seems excessively unlikely to actually fail. SEEK_END works, but SEEK_SET fails? Oh well. Belts and suspenders. Found by Coverity. Fixes CID 45039 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: avoid out of bounds accessGravatar Dirk Hohndel
This one is a bit complicated as it depends on a specific flow, but it seems like setup_cvs_parms might indeed write NULL to the element at index 49 of parm. I'm not 100% sure that the sequence of events required for this can happen, but adding one more pointer to the array seems like cheap insurance. Found by Coverity. Fixes CID 350120 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: close open file before returningGravatar Dirk Hohndel
This prevents a resource leak. Found by Coverity. Fixes CID 350080 The commit also includes some tiny whitespace/empty line fixes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: pass NULL pointer for error string pointer (part 2)Gravatar Dirk Hohndel
I missed one file fixing this earlier. Since we never did anything with the error string, why even ask for it. And this way we don't have to deal with the memory returned, either. Found by Coverity. Fixes CID 350082 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27GitHub Actions: switch back to the GitHub artifacts for PRsGravatar Dirk Hohndel
transfer.sh has suddenly started to time out. And for the rather occasional need of having a binary to test from a PR, this should be good enough. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Cleanup: fix obvious resource leakGravatar Dirk Hohndel
Found by Coverity. Fixes CID 350084 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Cleanup: avoid resource leak in dive planner modelGravatar Dirk Hohndel
Found by Coverity. Fixes CID 350121 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Cleanup: avoid out of bounds accessGravatar Dirk Hohndel
This is extremely unlikely to ever happen since we reserve space for a hundred weight models, but hey, doing this right is quite easy, so let's fix it. Found by Coverity. Fixes CID #350117 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Cleanup: pass NULL pointer for error string pointerGravatar Dirk Hohndel
Since we never did anything with the error string, why even ask for it. And this way we don't have to deal with the memory returned, either. Found by Coverity. Fixes CIDs 350124, 350113, 350106, 350099, 350091 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Cleanup: don't add invalid dive to tripGravatar Dirk Hohndel
Even if there is a valid trip, we should not add a structure that isn't a dive to it. Found by Coverity. Fixes CID #350073 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Cleanup: clean up resource handling in ostctools.cGravatar Dirk Hohndel
Free resources allocated by alloc_dive() with free_dive(). Don't allocate and re-allocate a fixed two byte buffer on the heap. Indirectly this fixes CID 216616 Suggested-by; Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Cleanup: unconditionally call freeGravatar Dirk Hohndel
While this is debatably correct, free will happily accept (and ignore the NULL pointer), so let's just always call it and make Coverity happy. Fixes CID 45163 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: ensure we go back to the dive list after downloadGravatar Dirk Hohndel
The pop() by itself wasn't enough to do that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: try harder to get the right dive listGravatar Dirk Hohndel
This should ensure that the dive list correctly repopulates after the model was updated. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: also show busy spinner when applying GPS fixesGravatar Dirk Hohndel
That's another function that can take a little while. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: simple message and busy spinner while storing downloaded divesGravatar Dirk Hohndel
Due to some recent changes processing the downloaded dives and re-displaying the dive list can take quite a while. So show a small message and the busy spinner to warn the user. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: change show/hide busy functionsGravatar Dirk Hohndel
The old code was ill named - this way the busy spinner itself becomes reusable with a reasonable set of function names. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: provide better tracking of applied GPS fixesGravatar Dirk Hohndel
Also reset the page stack to make sure we don't end up with stale data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: more code to deal with undefined elementsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: reset dive list after applying GPS fixesGravatar Dirk Hohndel
This way new fixes are actually shown when the user looks at the dive list after applying the GPS fixes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: don't show nothing for the locationGravatar Dirk Hohndel
We use 'Dive details' as page title, everywhere else we use '<unnamed dive site>'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: fix incorrect variable dereference for dive siteGravatar Dirk Hohndel
Since we are accessing the model, this is the variable we should use. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: don't push map page if it's already on the stackGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>