mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
core: port printGPSCoordsC to return std::string
Less memory management hassle. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
119fe908c7
commit
2f3d8d83f5
4 changed files with 7 additions and 9 deletions
|
@ -181,10 +181,9 @@ static void parse_dive_gps(char *line, struct membuffer *, struct git_parser_sta
|
|||
add_dive_to_dive_site(state->active_dive, ds);
|
||||
} else {
|
||||
if (dive_site_has_gps_location(ds) && !same_location(&ds->location, &location)) {
|
||||
char *coords = printGPSCoordsC(&location);
|
||||
std::string coords = printGPSCoordsC(&location);
|
||||
// we have a dive site that already has GPS coordinates
|
||||
ds->notes = add_to_string(ds->notes, translate("gettextFromC", "multiple GPS locations for this dive site; also %s\n"), coords);
|
||||
free(coords);
|
||||
ds->notes = add_to_string(ds->notes, translate("gettextFromC", "multiple GPS locations for this dive site; also %s\n"), coords.c_str());
|
||||
}
|
||||
ds->location = location;
|
||||
}
|
||||
|
|
|
@ -1230,9 +1230,8 @@ static void gps_in_dive(const char *buffer, struct dive *dive, struct parser_sta
|
|||
fprintf(stderr, "dive site uuid in dive, but gps location (%10.6f/%10.6f) different from dive location (%10.6f/%10.6f)\n",
|
||||
ds->location.lat.udeg / 1000000.0, ds->location.lon.udeg / 1000000.0,
|
||||
location.lat.udeg / 1000000.0, location.lon.udeg / 1000000.0);
|
||||
char *coords = printGPSCoordsC(&location);
|
||||
ds->notes = add_to_string(ds->notes, translate("gettextFromC", "multiple GPS locations for this dive site; also %s\n"), coords);
|
||||
free(coords);
|
||||
std::string coords = printGPSCoordsC(&location);
|
||||
ds->notes = add_to_string(ds->notes, translate("gettextFromC", "multiple GPS locations for this dive site; also %s\n"), coords.c_str());
|
||||
} else {
|
||||
ds->location = location;
|
||||
}
|
||||
|
|
|
@ -115,9 +115,9 @@ QString printGPSCoords(const location_t *location)
|
|||
return result;
|
||||
}
|
||||
|
||||
extern "C" char *printGPSCoordsC(const location_t *location)
|
||||
std::string printGPSCoordsC(const location_t *location)
|
||||
{
|
||||
return copy_qstring(printGPSCoords(location));
|
||||
return printGPSCoords(location).toStdString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,6 +93,7 @@ QLocale getLocale();
|
|||
QVector<QPair<QString, int>> selectedDivesGasUsed();
|
||||
QString getUserAgent();
|
||||
QString printGPSCoords(const location_t *loc);
|
||||
std::string printGPSCoordsC(const location_t *loc);
|
||||
std::vector<int> get_cylinder_map_for_remove(int count, int n);
|
||||
std::vector<int> get_cylinder_map_for_add(int count, int n);
|
||||
|
||||
|
@ -118,7 +119,6 @@ extern "C" {
|
|||
|
||||
struct git_info;
|
||||
|
||||
char *printGPSCoordsC(const location_t *loc);
|
||||
bool getProxyString(char **buffer);
|
||||
bool canReachCloudServer(struct git_info *);
|
||||
void updateWindowTitle();
|
||||
|
|
Loading…
Reference in a new issue