This is a change mainly for developers working on both mobile and
desktop application. As the current setup is that all preferences
are stored in one file (Subsurface.conf), for both mobile and desktop,
the unwary developer might get confused that the things tested on
mobile-on-desktop are not working on mobile-on-device. As we share
a lot of code between the desktop and the mobile code, also
our fairly extensive set of preferences play a significant role
in the inner workings of our applications.
So, this commit introduces an own preferences file for mobile
(on desktop) resulting in the preferences between the plain
desktop apllication now invisible to the mobile-on-desktop
application and vise versa. Making the mobile-on-desktop a
much more realistic test plaform for mobile development.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
get_matching_dive does not check if the DC wrote an acknowledgement for the requested dive.
As result, the sync stalls if dive number 0 is not available.
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
Since this helper-function exists, we might just use it. A subtle
reuse of a buffer (string of second use was known to be shorter than
string of first use) was replaced by a separate allocation.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The libgit2 functions git_cred_ssh_key_new() and git_cred_userpass_plaintext_new()
copy their arguments. Therefore, free the string arguments or don't
copy them in the first place.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The last 2 commits have now been squashed.
S Fuchs's comment on line 315 has been fixed
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
In core/file.c move ++lineptr out of the while condition
!empty_string(lineptr) && (lineptr = strchr(lineptr, '\n') && ++lineptr
since it always evaluates to true.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There are ca. 50 constructs of the kind
same_string(s, "")
to test for empty or null strings. Replace them by the new helper
function empty_string().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
No reason to mess around with a 5 byte buffer when we have a
proper buffer available to receive a possibly 8 byte output
based on the format string. And silences compiler warning.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This is the only case where C-code sets the current file.
Remove this call for a better separation of C-backend and
C++-frontend parts.
There were four callers of clear_dive_file_data(). Two of them
would call set_filename() anyway. For the remaining two add an
explicit call to set_filename().
This commit fixes a bug introduced in commit b3901aa8f9:
The cloud-online menu entry was still enabled after "closing" the
cloud storage.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In case syncing with the online repository failed, enter offline mode.
This reflects the message sent to the user ("working with local copy").
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Make functions in core/file.c, core/parse.c and core/import-csv.c
that were not used outside their translation unit of static linkage.
parse_date is moved from core/file.c to core/import-csv.c, since it
is used only there.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The used parse_dl7_new_line function already prints an error / debug
message so these are unnecessary.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
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>