printGPSCoords() returned a newly allocated C-style string. Most
callers simply made a QString out of it and freed the C-style string.
This is paradoxical, as printGPSCoords internally works with QStrings
and converts them to C-style on return.
Therefore, let printGPSCoords() return a QString and create a
printGPSCoordsC() wrapper for the two C-callers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The printGPSCoords() function returns a copied C-style string. Since
the owndership is transferred to the caller, the correct return type
is "char *" instead of "const char *".
Thus a number of casts when calling free can be removed.
Moreover a number of callers didn't free the string and thus were
leaking memory. Fix them. Ultimately we might want two versions
of the function: one for QString, one for C-style strings.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
I'm about to update the build environment on lgtm.com from Ubuntu 18.04 to 18.10, and this breaks your project. It appears that [libgit2 now depends on libmbedtls](https://packages.ubuntu.com/cosmic/libgit2-dev), and it [didn't do this before](https://packages.ubuntu.com/bionic/libgit2-dev). By default, your project links statically with libgit2, but static linking requires specifying all dependencies of the library, and your builds doesn't specify libmbedtls. I'm working around the problem here by passing the `LIBGIT2_DYNAMIC` option to your CMake script, which makes libgit2 dynamically linked, and dynamically linked libraries don't need to have their transitive dependencies specified.
I'm taking this opportunity to make a few more changes to `.lgtm.yml` to prevent problems in the future when we upgrade the build environment.
1. Pass `-DNO_DOCS=ON` to avoid building things we don't need.
2. Pass `DCMAKE_VERBOSE_MAKEFILE=ON` for ease of debugging build problems.
3. Remove the manual list of dependency packages and instead rely on LGTM's automatic dependency detection. The manual dependency list contained version numbers and was therefore not likely to keep working over time. The automatic dependency detection only works in the `configure` and `index` steps, so I moved some lines from `after_prepare` to `configure`.
Signed-off-by: Jonas Jensen <jonas@semmle.com>
HINTS should be dynamically introspected, static entries should be in PATHS.
There is also a platform dependent list of things where CMake always looks if
not explicitely forbidden, so remove any entries that are usually in those
default lists.
Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
The complicated setup with the AddressRole is unnecessary. All we want to be
able to do is get the index of a specific text in the list. In hindsight I am
puzzled why I implemented this in such a complex fashion.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Printing never worked, none of this was ever included in test builds. Also, now
that there are official releases of QtWebKit again, this just doesn't seem worth
carrying along anymore.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The LGTM checker complained about passing large objects. Instead of
passing pointers, keep the old semantics and pass a reference. This
is more idiomatic C++.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of passing a pointer, pass a cons reference. This is more
idiomatic and consistent with RulerNodeItem2::setPlotInfo().
Also make the reference passed to RulerNodeItem2::setPlotInfo()
const, to make clear that the argument is copied.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
All these aren't actually things that need fixing, they are observations about
the code.
Given that LGTM.com reports FIXME comments as Alerts, let's change the ones
that aren't about things that need fixing to something more harmless.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
To test single bits, datatrak.c would transform bytes into
malloc()ed char[8] buffers. Instead, simply introduce a function
to test individual bits. This should make it distinctly easier for
the compiler to optimize away.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It's a drop in the bucket, but let's remove some unnecessary
global variables. With one exception these variables were only
used in one function anyway. The other one can be passed as a
parameter.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Otherwise PRs from people who create branches in the main repo will always
trigger two builds.
The second entry should ensure that we do build releases.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
ostcFirmwareCheck in DownloadFromDCWidget was neither freed
in the destructor, not freed if a new object was allocated.
Simply make it a unique_ptr<> to do all the work for us.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Having a parameter representing a location with the same name as a global
variable representing our locale is confusing.
Found via LGTM.com
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While in the specific calculations here there isn't really a risk that float
might overflow, it seems odd to cast to float in order to assign to double.
This caused an Alert via LGTM.com
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
snapcraft doesn't support remote parts any more, and there's no
extension (the replacement for remote parts) for Qt yet.
Signed-off-by: Michał Sawicz <michal.sawicz@canonical.com>
On LGTM we end up installing in /opt/out.
Also, fix a silly error in the existing code - don't look for libraries in
include directories.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When updating the coordinates of a dive site, the MapLocationModel
is updated. The code created a (col, row) index with col = 0.
[The idea of course being col = x, row = y]. Alas, that's not
how Qt works - its models want (row, col) indices. The code
worked, because the only time when the dive site locations were
updated was in dive site edit mode, when only one site is visible,
i.e. there is only one row leading to the correct (0, 0) index.
Fix this so that we can also change dive site positions if more
than one site is displayed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We already do that on mobile and I was certain we used to do this for
desktop as well, but apparently that got lost somewhere...
This should solve the problems we are seeing for people with mixed case
email addresses.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>