diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-03-03 10:10:51 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-03-14 13:55:36 +0200 |
commit | 4e44fe7598430f9879736ec2d00b99b15dc05451 (patch) | |
tree | 04943cc4d2abd2e4b264157ab26498c00ea8e832 /core | |
parent | 6f2169488a1790268054554fd275e49d614947c6 (diff) | |
download | subsurface-4e44fe7598430f9879736ec2d00b99b15dc05451.tar.gz |
Cleanup: constify string arguments in core/dive.c
Make arguments to set_informational_units(), set_git_prefs(),
set_userid(), dive_remove_picture() and update_event_name()
"const char *" for consistency with the rest of core/dive.c.
This will allow replacing toUtf8().data() with the constData()
version in a subsequent commit.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/dive.c | 10 | ||||
-rw-r--r-- | core/dive.h | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/core/dive.c b/core/dive.c index 7866962d4..b7ce01ea4 100644 --- a/core/dive.c +++ b/core/dive.c @@ -205,7 +205,7 @@ void remove_event(struct event *event) * have to actually remove the existing event and replace it with a new one. * WARNING, WARNING... this may end up freeing event in case that event is indeed * WARNING, WARNING... part of this divecomputer on this dive! */ -void update_event_name(struct dive *d, struct event *event, char *name) +void update_event_name(struct dive *d, struct event *event, const char *name) { if (!d || !event) return; @@ -3633,7 +3633,7 @@ timestamp_t get_times() return dive->when; } -void set_userid(char *rUserId) +void set_userid(const char *rUserId) { char *userid = strdup(rUserId); if (strlen(userid) > 30) @@ -3653,7 +3653,7 @@ void set_userid(char *rUserId) * functionality for the core library that Subsurface itself doesn't * use but that another consumer of the library (like an HTML exporter) * will need */ -void set_informational_units(char *units) +void set_informational_units(const char *units) { if (strstr(units, "METRIC")) { git_prefs.unit_system = METRIC; @@ -3691,7 +3691,7 @@ void set_informational_units(char *units) } -void set_git_prefs(char *prefs) +void set_git_prefs(const char *prefs) { if (strstr(prefs, "TANKBAR")) git_prefs.tankbar = 1; @@ -3850,7 +3850,7 @@ struct picture *clone_picture(struct picture *src) } // Return true if picture was found and deleted -bool dive_remove_picture(struct dive *d, char *filename) +bool dive_remove_picture(struct dive *d, const char *filename) { struct picture **picture = &d->picture_list; while (*picture && !same_string((*picture)->filename, filename)) diff --git a/core/dive.h b/core/dive.h index 56b0fbcfc..a1cb7fb60 100644 --- a/core/dive.h +++ b/core/dive.h @@ -430,7 +430,7 @@ extern struct picture *clone_picture(struct picture *src); extern bool dive_check_picture_time(struct dive *d, int shift_time, timestamp_t timestamp); extern void dive_create_picture(struct dive *d, const char *filename, int shift_time, bool match_all); extern void dive_add_picture(struct dive *d, struct picture *newpic); -extern bool dive_remove_picture(struct dive *d, char *filename); +extern bool dive_remove_picture(struct dive *d, const char *filename); extern unsigned int dive_get_picture_count(struct dive *d); extern bool picture_check_valid(const char *filename, int shift_time); extern void picture_load_exif_data(struct picture *p); @@ -816,7 +816,7 @@ extern void fill_default_cylinder(cylinder_t *cyl); extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx); extern struct event *add_event(struct divecomputer *dc, unsigned int time, int type, int flags, int value, const char *name); extern void remove_event(struct event *event); -extern void update_event_name(struct dive *d, struct event* event, char *name); +extern void update_event_name(struct dive *d, struct event* event, const char *name); extern void add_extra_data(struct divecomputer *dc, const char *key, const char *value); extern void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *mean, int *duration); extern int get_cylinder_index(struct dive *dive, struct event *ev); @@ -1011,9 +1011,9 @@ extern double strtod_flags(const char *str, const char **ptr, unsigned int flags #define ascii_strtod(str, ptr) strtod_flags(str, ptr, STRTOD_ASCII) -extern void set_userid(char *user_id); -extern void set_informational_units(char *units); -extern void set_git_prefs(char *prefs); +extern void set_userid(const char *user_id); +extern void set_informational_units(const char *units); +extern void set_git_prefs(const char *prefs); extern const char *get_dive_date_c_string(timestamp_t when); extern void update_setpoint_events(struct dive *dive, struct divecomputer *dc); |