From 8391d926c7355a0ff637c2b604e259d0d25c3cb2 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 6 Feb 2020 22:56:10 +0100 Subject: [PATCH] Cleanup: remove const bool parameters and return types These just make no sense. Since the value is copied, it has no meaning to the caller whether the function can change the value (and vice versa for return types). Signed-off-by: Berthold Stoeger --- backend-shared/exportfuncs.cpp | 6 +++--- backend-shared/exportfuncs.h | 6 +++--- commands/command.h | 2 +- core/dive.h | 2 +- core/save-html.c | 2 +- core/save-profiledata.c | 2 +- core/save-xml.c | 2 +- core/uploadDiveLogsDE.cpp | 2 +- core/uploadDiveLogsDE.h | 2 +- core/worldmap-save.c | 2 +- core/worldmap-save.h | 2 +- desktop-widgets/simplewidgets.cpp | 2 +- desktop-widgets/simplewidgets.h | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/backend-shared/exportfuncs.cpp b/backend-shared/exportfuncs.cpp index 54ec08139..a48f60066 100644 --- a/backend-shared/exportfuncs.cpp +++ b/backend-shared/exportfuncs.cpp @@ -12,7 +12,7 @@ #include "core/divesite.h" #include "exportfuncs.h" -void exportProfile(QString filename, const bool selected_only) +void exportProfile(QString filename, bool selected_only) { struct dive *dive; int i; @@ -33,7 +33,7 @@ void exportProfile(QString filename, const bool selected_only) } -void export_TeX(const char *filename, const bool selected_only, bool plain) +void export_TeX(const char *filename, bool selected_only, bool plain) { FILE *f; QDir texdir = QFileInfo(filename).dir(); @@ -233,7 +233,7 @@ void export_TeX(const char *filename, const bool selected_only, bool plain) } -void export_depths(const char *filename, const bool selected_only) +void export_depths(const char *filename, bool selected_only) { FILE *f; struct dive *dive; diff --git a/backend-shared/exportfuncs.h b/backend-shared/exportfuncs.h index ebd2b8fcb..250e8e60f 100644 --- a/backend-shared/exportfuncs.h +++ b/backend-shared/exportfuncs.h @@ -7,9 +7,9 @@ struct dive_site; -void exportProfile(QString filename, const bool selected_only); -void export_TeX(const char *filename, const bool selected_only, bool plain); -void export_depths(const char *filename, const bool selected_only); +void exportProfile(QString filename, bool selected_only); +void export_TeX(const char *filename, bool selected_only, bool plain); +void export_depths(const char *filename, bool selected_only); std::vector getDiveSitesToExport(bool selectedOnly); QFuture exportUsingStyleSheet(QString filename, bool doExport, int units, QString stylesheet, bool anonymize); diff --git a/commands/command.h b/commands/command.h index 34df6eba8..bf9bd13ec 100644 --- a/commands/command.h +++ b/commands/command.h @@ -24,7 +24,7 @@ QAction *redoAction(QObject *parent); // Create an redo action. // distance are added to a trip. dive d is consumed (the structure is reset)! // If newNumber is true, the dive is assigned a new number, depending on the // insertion position. -void addDive(dive *d, const bool autogroup, bool newNumber); +void addDive(dive *d, bool autogroup, bool newNumber); void importDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites, int flags, const QString &source); // The tables are consumed! void deleteDive(const QVector &divesToDelete); diff --git a/core/dive.h b/core/dive.h index e54006dd8..e602b4f4f 100644 --- a/core/dive.h +++ b/core/dive.h @@ -315,7 +315,7 @@ extern void set_filename(const char *filename); extern int save_dives(const char *filename); extern int save_dives_logic(const char *filename, bool select_only, bool anonymize); extern int save_dive(FILE *f, struct dive *dive, bool anonymize); -extern int export_dives_xslt(const char *filename, const bool selected, const int units, const char *export_xslt, bool anonymize); +extern int export_dives_xslt(const char *filename, bool selected, const int units, const char *export_xslt, bool anonymize); extern int save_dive_sites_logic(const char *filename, const struct dive_site *sites[], int nr_sites, bool anonymize); diff --git a/core/save-html.c b/core/save-html.c index 5902a8a71..d5f472058 100644 --- a/core/save-html.c +++ b/core/save-html.c @@ -344,7 +344,7 @@ void put_HTML_tags(struct membuffer *b, struct dive *dive, const char *pre, cons } /* if exporting list_only mode, we neglect exporting the samples, bookmarks and cylinders */ -void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_dir, int *dive_no, const bool list_only) +void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_dir, int *dive_no, bool list_only) { put_string(b, "{"); put_format(b, "\"number\":%d,", *dive_no); diff --git a/core/save-profiledata.c b/core/save-profiledata.c index 87047a34a..696dc7016 100644 --- a/core/save-profiledata.c +++ b/core/save-profiledata.c @@ -239,7 +239,7 @@ void save_subtitles_buffer(struct membuffer *b, struct dive *dive, int offset, i free_plot_info_data(&pi); } -int save_profiledata(const char *filename, const bool select_only) +int save_profiledata(const char *filename, bool select_only) { struct membuffer buf = { 0 }; FILE *f; diff --git a/core/save-xml.c b/core/save-xml.c index 963907fb2..3dde176bd 100644 --- a/core/save-xml.c +++ b/core/save-xml.c @@ -595,7 +595,7 @@ int save_dives(const char *filename) return save_dives_logic(filename, false, false); } -static void save_dives_buffer(struct membuffer *b, const bool select_only, bool anonymize) +static void save_dives_buffer(struct membuffer *b, bool select_only, bool anonymize) { int i; struct dive *dive; diff --git a/core/uploadDiveLogsDE.cpp b/core/uploadDiveLogsDE.cpp index b4b50a7ba..219e13f45 100644 --- a/core/uploadDiveLogsDE.cpp +++ b/core/uploadDiveLogsDE.cpp @@ -61,7 +61,7 @@ void uploadDiveLogsDE::doUpload(bool selected, const QString &userid, const QStr } -bool uploadDiveLogsDE::prepareDives(const QString &tempfile, const bool selected) +bool uploadDiveLogsDE::prepareDives(const QString &tempfile, bool selected) { static const char errPrefix[] = "divelog.de-upload:"; #ifndef SUBSURFACE_MOBILE diff --git a/core/uploadDiveLogsDE.h b/core/uploadDiveLogsDE.h index 5c17e64a5..da47b14af 100644 --- a/core/uploadDiveLogsDE.h +++ b/core/uploadDiveLogsDE.h @@ -30,7 +30,7 @@ private: void uploadDives(const QString &filename, const QString &userid, const QString &password); // only to be used in desktop-widgets::subsurfacewebservices - bool prepareDives(const QString &tempfile, const bool selected); + bool prepareDives(const QString &tempfile, bool selected); QNetworkReply *reply; QHttpMultiPart *multipart; diff --git a/core/worldmap-save.c b/core/worldmap-save.c index 48a5fcf5f..121f0f728 100644 --- a/core/worldmap-save.c +++ b/core/worldmap-save.c @@ -24,7 +24,7 @@ char *getGoogleApi() return "https://maps.googleapis.com/maps/api/js?"; } -void writeMarkers(struct membuffer *b, const bool selected_only) +void writeMarkers(struct membuffer *b, bool selected_only) { int i, dive_no = 0; struct dive *dive; diff --git a/core/worldmap-save.h b/core/worldmap-save.h index 9d74e123a..f3e2ddd29 100644 --- a/core/worldmap-save.h +++ b/core/worldmap-save.h @@ -6,7 +6,7 @@ extern "C" { #endif -extern void export_worldmap_HTML(const char *file_name, const bool selected_only); +extern void export_worldmap_HTML(const char *file_name, bool selected_only); #ifdef __cplusplus } diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index bba06542f..cf4b9b0ae 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -637,7 +637,7 @@ QString TextHyperlinkEventFilter::tryToFormulateUrl(QTextCursor *cursor) return stringMeetsOurUrlRequirements(maybeUrlStr) ? maybeUrlStr : QString(); } -QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, const bool searchBackwards) +QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, bool searchBackwards) { // fromCursorTilWhitespace calls cursor->movePosition repeatedly, while // preserving the original 'anchor' (qt terminology) of the cursor. diff --git a/desktop-widgets/simplewidgets.h b/desktop-widgets/simplewidgets.h index bf520422f..99cfc0fa2 100644 --- a/desktop-widgets/simplewidgets.h +++ b/desktop-widgets/simplewidgets.h @@ -156,7 +156,7 @@ private: void handleUrlClick(const QString &urlStr); void handleUrlTooltip(const QString &urlStr, const QPoint &pos); bool stringMeetsOurUrlRequirements(const QString &maybeUrlStr); - QString fromCursorTilWhitespace(QTextCursor *cursor, const bool searchBackwards); + QString fromCursorTilWhitespace(QTextCursor *cursor, bool searchBackwards); QString tryToFormulateUrl(QTextCursor *cursor); QTextEdit const *const textEdit;