Code such as `report_info("msg: %s", i)` may crash if `i` is
not a string type. To avoid such problems make format-warnings
hard compile errors.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The old code was leaking memory. Use std::unique_ptr<> for
ownership management.
This is still very primitive and divetags are kept during
application lifetime. There should probably be some form
of reference counting. And the taglist should not be global,
but attached to the divelog.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The only case left is in android.cpp, though that is only compiled
when compiling the full desktop app on Android. I.e. never. So
don't bother for now.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Remove those that are commented out, since this part of the code
will not be ported to QtQuick. So why bother?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Let's use std::string in the core. Notably, I'd like to make
the numerous main() functions mostly independent of Qt. Some
things will have to remain, such as argument parsing, of course.
This changes the API: instead of returning an error code and
taking a pointer to the actual return-value, return an
std::optional<std::string>> that is set if the function succeeds.
Returning an empty string in the error case might be simpler,
but oh well...
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Use the C++-version of membuffer.
This fixes two memory leaks: report_info() on every(!) invocation
and report_error() before the error callback is set.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In C++ files, replace MIN and MAX by std::min and std::max,
respectively. There are still a few C files using these
macros. Convert them in due course.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The code was crashing if it couldn't reach the cloud, because then
info.repo is NULL. Skip the test if that happens.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Had to rewrite the thing, because gcc's warnings don't work
with templatized var-args. Since there is no string-format.cpp
and I didn't want to inline it, moved it to format.cpp.
String formatting is distributed around at least four
headers: membuffer.h, subsurface-string.h, format.h
and format-string.h. This really should be unified!
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Quite a bit of fallout in users of this structure.
Conveniently, since git-access.cpp is now C++ we can move
some helpers from the monstrous qthelper.cpp to git-access.cpp.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This may appear a bit ominous, as it doesn't generate a string,
but a vector of strings (one for each line). However, that is
in preparation for the QtQuickification of the profile, where
the text-items take such a list.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since this is the only caller, onvert the get_file_name() function
to return an std::string.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This used to have multiple values, but is currently only checked for
true/false. Reflect that in the type.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The deco timestep is a parameter to the plan() function. There
seems no need to define this as a global macro. Probably some
code reshuffeling artifact.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We had locale aware formatting functions that generated QStrings.
Create an alternative that creates std::string, since we want that
in the core.
This commit is unfortunate for two reasons:
- The function is called "casprintf()" for analogy with the QString
version. However, the non locale aware function is called
"format_string_std()" for analogy with "format_string()".
Ultimately these names should be unified. Probably, once there
are no membuffer users left.
- This does UTF-16->UTF-8->UTF-16 roundtrips. The core formatting
functions should render UTF-8 and only convert to UTF-16, in
the UI layer.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since the removal of this special case for MacOS was confirmed to be
working in the case of building with bluetooth support in #4120, we should
probably remove it from the code used when building without bluetooth
support as well.
Signed-off-by: Michael Keller <mikeller@042.ch>
Add a script that finds the changeset ID in the subsurface repository
that a given CICD release was built from.
The option '-c' can be used to check out the changeset, if one is found.
Signed-off-by: Michael Keller <mikeller@042.ch>