aboutsummaryrefslogtreecommitdiffstats
path: root/core/device.c
AgeCommit message (Collapse)Author
2018-05-24core: replace (void) with UNUSED(x) and include ssrf.hGravatar jan Iversen
Unused parameters in C are "silenced" by adding UNUSED(x) Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-14Core: introduce new subsurface-string headerGravatar Dirk Hohndel
First small step to shrinking dive.h. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-07Planner: Unify final ascent rates in plan() and fake_dc()Gravatar Berthold Stoeger
When generating fake profiles for manually entered dives, fake_dc() and plan() used different final ascent rates of 5 m/min and 4.5 m/min, respectively. This led to dives that were 6 seconds longer than entered by the user and to confusion. See #554. Therefore, use the same ascent rate taken from the preferences field flag.ascratelast6m in both cases. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-07Planner: Correctly fill out last_manual_time in fake_dc()Gravatar Berthold Stoeger
By not filling out this value, entering of manual dives was broken for dive lengths starting with a digit 5 or higher. Fixes #1211 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-07Planner: don't return static data in fake_dc()Gravatar Berthold Stoeger
fake_dc() used to return a statically allocated dc with statically allocated samples. This is of course a questionable practice in the light of multi-threading / resource ownership. Once these problems were recognized, the parameter "alloc" was added. If set to true, the function would still return a statically allocated dc, but heap-allocated samples, which could then be copied in a different dc. All in all an ownership nightmare and a recipie for disaster. The returned static dc was only used as a pointer to the samples anyway. There are four callers of fake_dc() and they all have access to a dc-structure without samples. Therefore, change the semantics of fake_dc() to fill out the passed in dc. If the caller does not care about the samples, it can simply reset the sample number to zero after work. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-13Init every struct sample with default valuesGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-29Add SPDX header to core C filesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-09Fix potential double/float to int rounding errorsGravatar Jeremie Guichard
Not using lrint(f) when converting double/float to int creates rounding errors. This error was detected by TestParse::testParseDM4 failure on Windows. It was creating rounding inconsistencies on Linux too, see change in TestDiveDM4.xml. Enable -Wfloat-conversion for gcc version greater than 4.9.0 Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2016-09-20Second attempt to fix crashGravatar Dirk Hohndel
Linus pointed out that it might be another call site (and looking at his proposed patch I noticed a logic error in my earlier attempt) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-16Hide compile time warningGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-14Fill in divecomputer serial number and firmware version on loadingGravatar Linus Torvalds
We have the serial number and firmware version fields in "struct divecomputer", but we don't actually fill them in when loading the data from git or xml, because we save all that information in the separate device table instead. But in order to always have the serial number associated with a device, let's make sure to fill those fields in. It won't hurt, and this way we have the information available whether we just loaded the dive from a file, or imported it from the dive computer. One less semantic difference to worry about. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>