core: replace (void) with UNUSED(x) and include ssrf.h

Unused parameters in C are "silenced" by adding UNUSED(x)

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-05-22 09:07:42 +02:00 committed by Dirk Hohndel
parent 6e253fa04f
commit 061be82e31
21 changed files with 213 additions and 198 deletions

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -592,7 +593,7 @@ static void cochran_parse_samples(struct dive *dive, const unsigned char *log,
offset += config.sample_size; offset += config.sample_size;
sample_cnt++; sample_cnt++;
} }
(void)ascent_rate; // mark the variable as unused UNUSED(ascent_rate); // mark the variable as unused
if (sample_cnt > 0) if (sample_cnt > 0)
*duration = sample_cnt * profile_period - 1; *duration = sample_cnt * profile_period - 1;
@ -792,7 +793,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
int try_to_open_cochran(const char *filename, struct memblock *mem) int try_to_open_cochran(const char *filename, struct memblock *mem)
{ {
(void) filename; UNUSED(filename);
unsigned int i; unsigned int i;
unsigned int mod; unsigned int mod;
unsigned int *offsets, dive1, dive2; unsigned int *offsets, dive1, dive2;

View file

@ -17,6 +17,7 @@
* restore_deco_state() * restore_deco_state()
* dump_tissues() * dump_tissues()
*/ */
#include "ssrf.h"
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include "dive.h" #include "dive.h"
@ -480,7 +481,7 @@ void calc_crushing_pressure(struct deco_state *ds, double pressure)
/* add period_in_seconds at the given pressure and gas to the deco calculation */ /* add period_in_seconds at the given pressure and gas to the deco calculation */
void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, enum divemode_t divemode, int sac) void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, enum divemode_t divemode, int sac)
{ {
(void) sac; UNUSED(sac);
int ci; int ci;
struct gas_pressures pressures; struct gas_pressures pressures;
bool icd = false; bool icd = false;

View file

@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "ssrf.h"
#include <string.h> #include <string.h>
#include "dive.h" #include "dive.h"
#include "subsurface-string.h" #include "subsurface-string.h"
@ -192,7 +193,7 @@ static void match_id(void *_dc, const char *model, uint32_t deviceid,
const char *nickname, const char *serial, const char *firmware) const char *nickname, const char *serial, const char *firmware)
{ {
// here nickname is unused // here nickname is unused
(void)nickname; UNUSED(nickname);
struct divecomputer *dc = _dc; struct divecomputer *dc = _dc;

View file

@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "ssrf.h"
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -118,9 +119,9 @@ int try_to_open_zip(const char *filename)
static int db_test_func(void *param, int columns, char **data, char **column) static int db_test_func(void *param, int columns, char **data, char **column)
{ {
(void) param; UNUSED(param);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
return *data[0] == '0'; return *data[0] == '0';
} }

View file

@ -18,6 +18,7 @@
* pr_track_t is defined in gaspressures.h * pr_track_t is defined in gaspressures.h
*/ */
#include "ssrf.h"
#include "dive.h" #include "dive.h"
#include "display.h" #include "display.h"
#include "profile.h" #include "profile.h"
@ -343,7 +344,7 @@ static void debug_print_pressures(struct plot_info *pi)
*/ */
void populate_pressure_information(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, int sensor) void populate_pressure_information(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, int sensor)
{ {
(void) dc; UNUSED(dc);
int first, last, cyl; int first, last, cyl;
cylinder_t *cylinder = dive->cylinder + sensor; cylinder_t *cylinder = dive->cylinder + sensor;
pr_track_t *track = NULL; pr_track_t *track = NULL;

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -66,8 +67,8 @@ int git_storage_update_progress(const char *text)
// map the git progress to 20% of overall progress // map the git progress to 20% of overall progress
static void progress_cb(const char *path, size_t completed_steps, size_t total_steps, void *payload) static void progress_cb(const char *path, size_t completed_steps, size_t total_steps, void *payload)
{ {
(void) path; UNUSED(path);
(void) payload; UNUSED(payload);
char buf[80]; char buf[80];
snprintf(buf, sizeof(buf), translate("gettextFromC", "Checkout from storage (%lu/%lu)"), completed_steps, total_steps); snprintf(buf, sizeof(buf), translate("gettextFromC", "Checkout from storage (%lu/%lu)"), completed_steps, total_steps);
(void)git_storage_update_progress(buf); (void)git_storage_update_progress(buf);
@ -78,7 +79,7 @@ static void progress_cb(const char *path, size_t completed_steps, size_t total_s
// if the user cancels the dialog this is passed back to libgit2 // if the user cancels the dialog this is passed back to libgit2
static int transfer_progress_cb(const git_transfer_progress *stats, void *payload) static int transfer_progress_cb(const git_transfer_progress *stats, void *payload)
{ {
(void) payload; UNUSED(payload);
static int last_done = -1; static int last_done = -1;
char buf[80]; char buf[80];
@ -109,8 +110,8 @@ static int transfer_progress_cb(const git_transfer_progress *stats, void *payloa
// the initial push to sync the repos is mapped to 10% of overall progress // the initial push to sync the repos is mapped to 10% of overall progress
static int push_transfer_progress_cb(unsigned int current, unsigned int total, size_t bytes, void *payload) static int push_transfer_progress_cb(unsigned int current, unsigned int total, size_t bytes, void *payload)
{ {
(void) bytes; UNUSED(bytes);
(void) payload; UNUSED(payload);
char buf[80]; char buf[80];
snprintf(buf, sizeof(buf), translate("gettextFromC", "Transfer to storage (%d/%d)"), current, total); snprintf(buf, sizeof(buf), translate("gettextFromC", "Transfer to storage (%d/%d)"), current, total);
return git_storage_update_progress(buf); return git_storage_update_progress(buf);
@ -143,7 +144,7 @@ static char *move_local_cache(const char *remote, const char *branch)
static int check_clean(const char *path, unsigned int status, void *payload) static int check_clean(const char *path, unsigned int status, void *payload)
{ {
(void) payload; UNUSED(payload);
status &= ~GIT_STATUS_CURRENT | GIT_STATUS_IGNORED; status &= ~GIT_STATUS_CURRENT | GIT_STATUS_IGNORED;
if (!status) if (!status)
return 0; return 0;
@ -220,9 +221,9 @@ int credential_ssh_cb(git_cred **out,
unsigned int allowed_types, unsigned int allowed_types,
void *payload) void *payload)
{ {
(void) url; UNUSED(url);
(void) payload; UNUSED(payload);
(void) username_from_url; UNUSED(username_from_url);
const char *username = prefs.cloud_storage_email_encoded; const char *username = prefs.cloud_storage_email_encoded;
const char *passphrase = prefs.cloud_storage_password ? prefs.cloud_storage_password : ""; const char *passphrase = prefs.cloud_storage_password ? prefs.cloud_storage_password : "";
@ -259,10 +260,10 @@ int credential_https_cb(git_cred **out,
unsigned int allowed_types, unsigned int allowed_types,
void *payload) void *payload)
{ {
(void) url; UNUSED(url);
(void) username_from_url; UNUSED(username_from_url);
(void) payload; UNUSED(payload);
(void) allowed_types; UNUSED(allowed_types);
if (exceeded_auth_attempts()) if (exceeded_auth_attempts())
return GIT_EUSER; return GIT_EUSER;
@ -276,7 +277,7 @@ int credential_https_cb(git_cred **out,
#define KNOWN_CERT "\xfd\xb8\xf7\x73\x76\xe2\x75\x53\x93\x37\xdc\xfe\x1e\x55\x43\x3d\xf2\x2c\x18\x2c" #define KNOWN_CERT "\xfd\xb8\xf7\x73\x76\xe2\x75\x53\x93\x37\xdc\xfe\x1e\x55\x43\x3d\xf2\x2c\x18\x2c"
int certificate_check_cb(git_cert *cert, int valid, const char *host, void *payload) int certificate_check_cb(git_cert *cert, int valid, const char *host, void *payload)
{ {
(void) payload; UNUSED(payload);
if (same_string(host, "cloud.subsurface-divelog.org") && cert->cert_type == GIT_CERT_X509) { if (same_string(host, "cloud.subsurface-divelog.org") && cert->cert_type == GIT_CERT_X509) {
SHA_CTX ctx; SHA_CTX ctx;
unsigned char hash[21]; unsigned char hash[21];
@ -297,8 +298,8 @@ int certificate_check_cb(git_cert *cert, int valid, const char *host, void *payl
static int update_remote(git_repository *repo, git_remote *origin, git_reference *local, git_reference *remote, enum remote_transport rt) static int update_remote(git_repository *repo, git_remote *origin, git_reference *local, git_reference *remote, enum remote_transport rt)
{ {
(void) repo; UNUSED(repo);
(void) remote; UNUSED(remote);
git_push_options opts = GIT_PUSH_OPTIONS_INIT; git_push_options opts = GIT_PUSH_OPTIONS_INIT;
git_strarray refspec; git_strarray refspec;
@ -331,7 +332,7 @@ extern int update_git_checkout(git_repository *repo, git_object *parent, git_tre
static int try_to_git_merge(git_repository *repo, git_reference **local_p, git_reference *remote, git_oid *base, const git_oid *local_id, const git_oid *remote_id) static int try_to_git_merge(git_repository *repo, git_reference **local_p, git_reference *remote, git_oid *base, const git_oid *local_id, const git_oid *remote_id)
{ {
(void) remote; UNUSED(remote);
git_tree *local_tree, *remote_tree, *base_tree; git_tree *local_tree, *remote_tree, *base_tree;
git_commit *local_commit, *remote_commit, *base_commit; git_commit *local_commit, *remote_commit, *base_commit;
git_index *merged_index; git_index *merged_index;
@ -683,7 +684,7 @@ static git_repository *update_local_repo(const char *localdir, const char *remot
static int repository_create_cb(git_repository **out, const char *path, int bare, void *payload) static int repository_create_cb(git_repository **out, const char *path, int bare, void *payload)
{ {
(void) payload; UNUSED(payload);
char *proxy_string; char *proxy_string;
git_config *conf; git_config *conf;

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include "dive.h" #include "dive.h"
#include "subsurface-string.h" #include "subsurface-string.h"
#include "parse.h" #include "parse.h"
@ -14,9 +15,9 @@
extern int cobalt_profile_sample(void *handle, int columns, char **data, char **column) extern int cobalt_profile_sample(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
sample_start(); sample_start();
if (data[0]) if (data[0])
@ -33,9 +34,9 @@ extern int cobalt_profile_sample(void *handle, int columns, char **data, char **
extern int cobalt_cylinders(void *handle, int columns, char **data, char **column) extern int cobalt_cylinders(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
cylinder_start(); cylinder_start();
if (data[0]) if (data[0])
@ -57,9 +58,9 @@ extern int cobalt_cylinders(void *handle, int columns, char **data, char **colum
extern int cobalt_buddies(void *handle, int columns, char **data, char **column) extern int cobalt_buddies(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
if (data[0]) if (data[0])
utf8_string(data[0], &cur_dive->buddy); utf8_string(data[0], &cur_dive->buddy);
@ -74,18 +75,18 @@ extern int cobalt_buddies(void *handle, int columns, char **data, char **column)
extern int cobalt_visibility(void *handle, int columns, char **data, char **column) extern int cobalt_visibility(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
(void) data; UNUSED(data);
return 0; return 0;
} }
extern int cobalt_location(void *handle, int columns, char **data, char **column) extern int cobalt_location(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
static char *location = NULL; static char *location = NULL;
if (data[0]) { if (data[0]) {
@ -108,8 +109,8 @@ extern int cobalt_location(void *handle, int columns, char **data, char **column
extern int cobalt_dive(void *param, int columns, char **data, char **column) extern int cobalt_dive(void *param, int columns, char **data, char **column)
{ {
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
int retval = 0; int retval = 0;
sqlite3 *handle = (sqlite3 *)param; sqlite3 *handle = (sqlite3 *)param;
@ -217,8 +218,8 @@ extern int cobalt_dive(void *param, int columns, char **data, char **column)
int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *buffer, int size, int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *buffer, int size,
struct dive_table *table) struct dive_table *table)
{ {
(void) buffer; UNUSED(buffer);
(void) size; UNUSED(size);
int retval; int retval;
char *err = NULL; char *err = NULL;

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include "dive.h" #include "dive.h"
#include "subsurface-string.h" #include "subsurface-string.h"
#include "parse.h" #include "parse.h"
@ -14,9 +15,9 @@
extern int divinglog_cylinder(void *handle, int columns, char **data, char **column) extern int divinglog_cylinder(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
short dbl = 1; short dbl = 1;
//char get_cylinder_template[] = "select TankID,TankSize,PresS,PresE,PresW,O2,He,DblTank from Tank where LogID = %d"; //char get_cylinder_template[] = "select TankID,TankSize,PresS,PresE,PresW,O2,He,DblTank from Tank where LogID = %d";
@ -60,9 +61,9 @@ extern int divinglog_cylinder(void *handle, int columns, char **data, char **col
extern int divinglog_profile(void *handle, int columns, char **data, char **column) extern int divinglog_profile(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
int sinterval = 0; int sinterval = 0;
unsigned long time; unsigned long time;
@ -197,7 +198,7 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu
int ppo2_2 = atoi_n(ptr5 + 3, 3); int ppo2_2 = atoi_n(ptr5 + 3, 3);
int ppo2_3 = atoi_n(ptr5 + 6, 3); int ppo2_3 = atoi_n(ptr5 + 6, 3);
int otu = atoi_n(ptr5 + 9, 4); int otu = atoi_n(ptr5 + 9, 4);
(void) otu; // we seem to not store this? Do we understand its format? UNUSED(otu); // we seem to not store this? Do we understand its format?
int cns = atoi_n(ptr5 + 13, 4); int cns = atoi_n(ptr5 + 13, 4);
int setpoint = atoi_n(ptr5 + 17, 2); int setpoint = atoi_n(ptr5 + 17, 2);
@ -267,8 +268,8 @@ extern int divinglog_profile(void *handle, int columns, char **data, char **colu
extern int divinglog_dive(void *param, int columns, char **data, char **column) extern int divinglog_dive(void *param, int columns, char **data, char **column)
{ {
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
int retval = 0; int retval = 0;
sqlite3 *handle = (sqlite3 *)param; sqlite3 *handle = (sqlite3 *)param;
@ -397,8 +398,8 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column)
int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *buffer, int size, int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *buffer, int size,
struct dive_table *table) struct dive_table *table)
{ {
(void) buffer; UNUSED(buffer);
(void) size; UNUSED(size);
int retval; int retval;
char *err = NULL; char *err = NULL;

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include "dive.h" #include "dive.h"
#include "subsurface-string.h" #include "subsurface-string.h"
#include "parse.h" #include "parse.h"
@ -14,9 +15,9 @@
extern int shearwater_cylinders(void *handle, int columns, char **data, char **column) extern int shearwater_cylinders(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
int o2 = lrint(strtod_flags(data[0], NULL, 0) * 1000); int o2 = lrint(strtod_flags(data[0], NULL, 0) * 1000);
int he = lrint(strtod_flags(data[1], NULL, 0) * 1000); int he = lrint(strtod_flags(data[1], NULL, 0) * 1000);
@ -36,9 +37,9 @@ extern int shearwater_cylinders(void *handle, int columns, char **data, char **c
extern int shearwater_changes(void *handle, int columns, char **data, char **column) extern int shearwater_changes(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
if (columns != 3) { if (columns != 3) {
return 1; return 1;
@ -78,9 +79,9 @@ extern int shearwater_changes(void *handle, int columns, char **data, char **col
extern int shearwater_profile_sample(void *handle, int columns, char **data, char **column) extern int shearwater_profile_sample(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
sample_start(); sample_start();
if (data[0]) if (data[0])
@ -111,9 +112,9 @@ extern int shearwater_profile_sample(void *handle, int columns, char **data, cha
extern int shearwater_ai_profile_sample(void *handle, int columns, char **data, char **column) extern int shearwater_ai_profile_sample(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
sample_start(); sample_start();
if (data[0]) if (data[0])
@ -146,9 +147,9 @@ extern int shearwater_ai_profile_sample(void *handle, int columns, char **data,
extern int shearwater_mode(void *handle, int columns, char **data, char **column) extern int shearwater_mode(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
if (data[0]) if (data[0])
cur_dive->dc.divemode = atoi(data[0]) == 0 ? CCR : OC; cur_dive->dc.divemode = atoi(data[0]) == 0 ? CCR : OC;
@ -158,8 +159,8 @@ extern int shearwater_mode(void *handle, int columns, char **data, char **column
extern int shearwater_dive(void *param, int columns, char **data, char **column) extern int shearwater_dive(void *param, int columns, char **data, char **column)
{ {
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
int retval = 0; int retval = 0;
sqlite3 *handle = (sqlite3 *)param; sqlite3 *handle = (sqlite3 *)param;
@ -278,8 +279,8 @@ extern int shearwater_dive(void *param, int columns, char **data, char **column)
int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *buffer, int size, int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *buffer, int size,
struct dive_table *table) struct dive_table *table)
{ {
(void) buffer; UNUSED(buffer);
(void) size; UNUSED(size);
int retval; int retval;
char *err = NULL; char *err = NULL;

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include "dive.h" #include "dive.h"
#include "subsurface-string.h" #include "subsurface-string.h"
#include "parse.h" #include "parse.h"
@ -14,9 +15,9 @@
extern int dm4_events(void *handle, int columns, char **data, char **column) extern int dm4_events(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
event_start(); event_start();
if (data[1]) if (data[1])
@ -147,9 +148,9 @@ extern int dm4_events(void *handle, int columns, char **data, char **column)
extern int dm4_tags(void *handle, int columns, char **data, char **column) extern int dm4_tags(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
if (data[0]) if (data[0])
taglist_add_tag(&cur_dive->tag_list, data[0]); taglist_add_tag(&cur_dive->tag_list, data[0]);
@ -159,8 +160,8 @@ extern int dm4_tags(void *handle, int columns, char **data, char **column)
extern int dm4_dive(void *param, int columns, char **data, char **column) extern int dm4_dive(void *param, int columns, char **data, char **column)
{ {
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
int i; int i;
int interval, retval = 0; int interval, retval = 0;
sqlite3 *handle = (sqlite3 *)param; sqlite3 *handle = (sqlite3 *)param;
@ -289,8 +290,8 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *buffer, int size, int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *buffer, int size,
struct dive_table *table) struct dive_table *table)
{ {
(void) buffer; UNUSED(buffer);
(void) size; UNUSED(size);
int retval; int retval;
char *err = NULL; char *err = NULL;
@ -312,9 +313,9 @@ int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *buffer, int s
extern int dm5_cylinders(void *handle, int columns, char **data, char **column) extern int dm5_cylinders(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
cylinder_start(); cylinder_start();
if (data[7] && atoi(data[7]) > 0 && atoi(data[7]) < 350000) if (data[7] && atoi(data[7]) > 0 && atoi(data[7]) < 350000)
@ -340,9 +341,9 @@ extern int dm5_cylinders(void *handle, int columns, char **data, char **column)
extern int dm5_gaschange(void *handle, int columns, char **data, char **column) extern int dm5_gaschange(void *handle, int columns, char **data, char **column)
{ {
(void) handle; UNUSED(handle);
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
event_start(); event_start();
if (data[0]) if (data[0])
@ -362,8 +363,8 @@ extern int dm5_gaschange(void *handle, int columns, char **data, char **column)
extern int dm5_dive(void *param, int columns, char **data, char **column) extern int dm5_dive(void *param, int columns, char **data, char **column)
{ {
(void) columns; UNUSED(columns);
(void) column; UNUSED(column);
int i; int i;
int tempformat = 0; int tempformat = 0;
int interval, retval = 0, block_size; int interval, retval = 0, block_size;
@ -546,8 +547,8 @@ extern int dm5_dive(void *param, int columns, char **data, char **column)
int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buffer, int size, int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buffer, int size,
struct dive_table *table) struct dive_table *table)
{ {
(void) buffer; UNUSED(buffer);
(void) size; UNUSED(size);
int retval; int retval;
char *err = NULL; char *err = NULL;

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <inttypes.h> #include <inttypes.h>
@ -429,7 +430,7 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
static void dev_info(device_data_t *devdata, const char *fmt, ...) static void dev_info(device_data_t *devdata, const char *fmt, ...)
{ {
(void) devdata; UNUSED(devdata);
static char buffer[1024]; static char buffer[1024];
va_list ap; va_list ap;
@ -445,7 +446,7 @@ static int import_dive_number = 0;
static int parse_samples(device_data_t *devdata, struct divecomputer *dc, dc_parser_t *parser) static int parse_samples(device_data_t *devdata, struct divecomputer *dc, dc_parser_t *parser)
{ {
(void) devdata; UNUSED(devdata);
// Parse the sample data. // Parse the sample data.
return dc_parser_samples_foreach(parser, sample_cb, dc); return dc_parser_samples_foreach(parser, sample_cb, dc);
} }
@ -549,8 +550,8 @@ static uint32_t calculate_string_hash(const char *str)
*/ */
static void dc_match_serial(void *_dc, const char *model, uint32_t deviceid, const char *nickname, const char *serial, const char *firmware) static void dc_match_serial(void *_dc, const char *model, uint32_t deviceid, const char *nickname, const char *serial, const char *firmware)
{ {
(void)nickname; UNUSED(nickname);
(void)firmware; UNUSED(firmware);
struct divecomputer *dc = _dc; struct divecomputer *dc = _dc;
@ -1060,7 +1061,7 @@ static void lookup_fingerprint(dc_device_t *device, device_data_t *devdata)
static void event_cb(dc_device_t *device, dc_event_type_t event, const void *data, void *userdata) static void event_cb(dc_device_t *device, dc_event_type_t event, const void *data, void *userdata)
{ {
(void) device; UNUSED(device);
const dc_event_progress_t *progress = data; const dc_event_progress_t *progress = data;
const dc_event_devinfo_t *devinfo = data; const dc_event_devinfo_t *devinfo = data;
const dc_event_clock_t *clock = data; const dc_event_clock_t *clock = data;
@ -1140,7 +1141,7 @@ int import_thread_cancelled;
static int cancel_cb(void *userdata) static int cancel_cb(void *userdata)
{ {
(void) userdata; UNUSED(userdata);
return import_thread_cancelled; return import_thread_cancelled;
} }
@ -1190,7 +1191,7 @@ static const char *do_device_import(device_data_t *data)
void logfunc(dc_context_t *context, dc_loglevel_t loglevel, const char *file, unsigned int line, const char *function, const char *msg, void *userdata) void logfunc(dc_context_t *context, dc_loglevel_t loglevel, const char *file, unsigned int line, const char *function, const char *msg, void *userdata)
{ {
(void) context; UNUSED(context);
const char *loglevels[] = { "NONE", "ERROR", "WARNING", "INFO", "DEBUG", "ALL" }; const char *loglevels[] = { "NONE", "ERROR", "WARNING", "INFO", "DEBUG", "ALL" };
FILE *fp = (FILE *)userdata; FILE *fp = (FILE *)userdata;

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* linux.c */ /* linux.c */
/* implements Linux specific functions */ /* implements Linux specific functions */
#include "ssrf.h"
#include "dive.h" #include "dive.h"
#include "subsurface-string.h" #include "subsurface-string.h"
#include "display.h" #include "display.h"
@ -22,7 +23,7 @@ double system_divelist_default_font_size = -1.0;
bool subsurface_ignore_font(const char *font) bool subsurface_ignore_font(const char *font)
{ {
// there are no old default fonts to ignore // there are no old default fonts to ignore
(void)font; UNUSED(font);
return false; return false;
} }

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <string.h> #include <string.h>
#include "ssrf.h"
#include "dive.h" #include "dive.h"
#include "divelist.h" #include "divelist.h"
#include "file.h" #include "file.h"
@ -36,10 +37,10 @@ struct lv_sensor_ids sensor_ids;
static int handle_event_ver2(int code, const unsigned char *ps, unsigned int ps_ptr, struct lv_event *event) static int handle_event_ver2(int code, const unsigned char *ps, unsigned int ps_ptr, struct lv_event *event)
{ {
(void) code; UNUSED(code);
(void) ps; UNUSED(ps);
(void) ps_ptr; UNUSED(ps_ptr);
(void) event; UNUSED(event);
// Skip 4 bytes // Skip 4 bytes
return 4; return 4;
@ -288,9 +289,9 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
break; break;
} }
// we aren't using the start_cns, dive_mode, and algorithm, yet // we aren't using the start_cns, dive_mode, and algorithm, yet
(void)start_cns; UNUSED(start_cns);
(void)dive_mode; UNUSED(dive_mode);
(void)algorithm; UNUSED(algorithm);
ptr += 4; ptr += 4;
@ -443,7 +444,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
int try_to_open_liquivision(const char *filename, struct memblock *mem) int try_to_open_liquivision(const char *filename, struct memblock *mem)
{ {
(void) filename; UNUSED(filename);
const unsigned char *buf = mem->buffer; const unsigned char *buf = mem->buffer;
unsigned int buf_size = mem->size; unsigned int buf_size = mem->size;
unsigned int ptr; unsigned int ptr;

View file

@ -1,9 +1,5 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#ifdef __clang__ #include "ssrf.h"
// Clang has a bug on zero-initialization of C structs.
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -154,7 +150,7 @@ static int get_hex(const char *line)
static void parse_dive_gps(char *line, struct membuffer *str, void *_dive) static void parse_dive_gps(char *line, struct membuffer *str, void *_dive)
{ {
(void) str; UNUSED(str);
uint32_t uuid; uint32_t uuid;
degrees_t latitude = parse_degrees(line, &line); degrees_t latitude = parse_degrees(line, &line);
degrees_t longitude = parse_degrees(line, &line); degrees_t longitude = parse_degrees(line, &line);
@ -181,7 +177,7 @@ static void parse_dive_gps(char *line, struct membuffer *str, void *_dive)
static void parse_dive_location(char *line, struct membuffer *str, void *_dive) static void parse_dive_location(char *line, struct membuffer *str, void *_dive)
{ {
(void) line; UNUSED(line);
uint32_t uuid; uint32_t uuid;
char *name = get_utf8(str); char *name = get_utf8(str);
struct dive *dive = _dive; struct dive *dive = _dive;
@ -205,19 +201,19 @@ static void parse_dive_location(char *line, struct membuffer *str, void *_dive)
} }
static void parse_dive_divemaster(char *line, struct membuffer *str, void *_dive) static void parse_dive_divemaster(char *line, struct membuffer *str, void *_dive)
{ (void) line; struct dive *dive = _dive; dive->divemaster = get_utf8(str); } { UNUSED(line); struct dive *dive = _dive; dive->divemaster = get_utf8(str); }
static void parse_dive_buddy(char *line, struct membuffer *str, void *_dive) static void parse_dive_buddy(char *line, struct membuffer *str, void *_dive)
{ (void) line; struct dive *dive = _dive; dive->buddy = get_utf8(str); } { UNUSED(line); struct dive *dive = _dive; dive->buddy = get_utf8(str); }
static void parse_dive_suit(char *line, struct membuffer *str, void *_dive) static void parse_dive_suit(char *line, struct membuffer *str, void *_dive)
{ (void) line; struct dive *dive = _dive; dive->suit = get_utf8(str); } { UNUSED(line); struct dive *dive = _dive; dive->suit = get_utf8(str); }
static void parse_dive_notes(char *line, struct membuffer *str, void *_dive) static void parse_dive_notes(char *line, struct membuffer *str, void *_dive)
{ (void) line; struct dive *dive = _dive; dive->notes = get_utf8(str); } { UNUSED(line); struct dive *dive = _dive; dive->notes = get_utf8(str); }
static void parse_dive_divesiteid(char *line, struct membuffer *str, void *_dive) static void parse_dive_divesiteid(char *line, struct membuffer *str, void *_dive)
{ (void) str; struct dive *dive = _dive; dive->dive_site_uuid = get_hex(line); } { UNUSED(str); struct dive *dive = _dive; dive->dive_site_uuid = get_hex(line); }
/* /*
* We can have multiple tags in the membuffer. They are separated by * We can have multiple tags in the membuffer. They are separated by
@ -225,7 +221,7 @@ static void parse_dive_divesiteid(char *line, struct membuffer *str, void *_dive
*/ */
static void parse_dive_tags(char *line, struct membuffer *str, void *_dive) static void parse_dive_tags(char *line, struct membuffer *str, void *_dive)
{ {
(void) line; UNUSED(line);
struct dive *dive = _dive; struct dive *dive = _dive;
const char *tag; const char *tag;
int len = str->len; int len = str->len;
@ -248,40 +244,40 @@ static void parse_dive_tags(char *line, struct membuffer *str, void *_dive)
} }
static void parse_dive_airtemp(char *line, struct membuffer *str, void *_dive) static void parse_dive_airtemp(char *line, struct membuffer *str, void *_dive)
{ (void) str; struct dive *dive = _dive; dive->airtemp = get_temperature(line); } { UNUSED(str); struct dive *dive = _dive; dive->airtemp = get_temperature(line); }
static void parse_dive_watertemp(char *line, struct membuffer *str, void *_dive) static void parse_dive_watertemp(char *line, struct membuffer *str, void *_dive)
{ (void) str; struct dive *dive = _dive; dive->watertemp = get_temperature(line); } { UNUSED(str); struct dive *dive = _dive; dive->watertemp = get_temperature(line); }
static void parse_dive_duration(char *line, struct membuffer *str, void *_dive) static void parse_dive_duration(char *line, struct membuffer *str, void *_dive)
{ (void) str; struct dive *dive = _dive; dive->duration = get_duration(line); } { UNUSED(str); struct dive *dive = _dive; dive->duration = get_duration(line); }
static void parse_dive_rating(char *line, struct membuffer *str, void *_dive) static void parse_dive_rating(char *line, struct membuffer *str, void *_dive)
{ (void) str; struct dive *dive = _dive; dive->rating = get_index(line); } { UNUSED(str); struct dive *dive = _dive; dive->rating = get_index(line); }
static void parse_dive_visibility(char *line, struct membuffer *str, void *_dive) static void parse_dive_visibility(char *line, struct membuffer *str, void *_dive)
{ (void) str; struct dive *dive = _dive; dive->visibility = get_index(line); } { UNUSED(str); struct dive *dive = _dive; dive->visibility = get_index(line); }
static void parse_dive_notrip(char *line, struct membuffer *str, void *_dive) static void parse_dive_notrip(char *line, struct membuffer *str, void *_dive)
{ {
(void) str; UNUSED(str);
(void) line; UNUSED(line);
struct dive *dive = _dive; dive->tripflag = NO_TRIP; struct dive *dive = _dive; dive->tripflag = NO_TRIP;
} }
static void parse_site_description(char *line, struct membuffer *str, void *_ds) static void parse_site_description(char *line, struct membuffer *str, void *_ds)
{ (void) line; struct dive_site *ds = _ds; ds->description = strdup(mb_cstring(str)); } { UNUSED(line); struct dive_site *ds = _ds; ds->description = strdup(mb_cstring(str)); }
static void parse_site_name(char *line, struct membuffer *str, void *_ds) static void parse_site_name(char *line, struct membuffer *str, void *_ds)
{ (void) line; struct dive_site *ds = _ds; ds->name = strdup(mb_cstring(str)); } { UNUSED(line); struct dive_site *ds = _ds; ds->name = strdup(mb_cstring(str)); }
static void parse_site_notes(char *line, struct membuffer *str, void *_ds) static void parse_site_notes(char *line, struct membuffer *str, void *_ds)
{ (void) line; struct dive_site *ds = _ds; ds->notes = strdup(mb_cstring(str)); } { UNUSED(line); struct dive_site *ds = _ds; ds->notes = strdup(mb_cstring(str)); }
extern degrees_t parse_degrees(char *buf, char **end); extern degrees_t parse_degrees(char *buf, char **end);
static void parse_site_gps(char *line, struct membuffer *str, void *_ds) static void parse_site_gps(char *line, struct membuffer *str, void *_ds)
{ {
(void) str; UNUSED(str);
struct dive_site *ds = _ds; struct dive_site *ds = _ds;
ds->latitude = parse_degrees(line, &line); ds->latitude = parse_degrees(line, &line);
@ -651,52 +647,52 @@ static void sample_parser(char *line, struct divecomputer *dc)
} }
static void parse_dc_airtemp(char *line, struct membuffer *str, void *_dc) static void parse_dc_airtemp(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->airtemp = get_temperature(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->airtemp = get_temperature(line); }
static void parse_dc_date(char *line, struct membuffer *str, void *_dc) static void parse_dc_date(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; update_date(&dc->when, line); } { UNUSED(str); struct divecomputer *dc = _dc; update_date(&dc->when, line); }
static void parse_dc_deviceid(char *line, struct membuffer *str, void *_dc) static void parse_dc_deviceid(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; set_dc_deviceid(dc, get_hex(line)); } { UNUSED(str); struct divecomputer *dc = _dc; set_dc_deviceid(dc, get_hex(line)); }
static void parse_dc_diveid(char *line, struct membuffer *str, void *_dc) static void parse_dc_diveid(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->diveid = get_hex(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->diveid = get_hex(line); }
static void parse_dc_duration(char *line, struct membuffer *str, void *_dc) static void parse_dc_duration(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->duration = get_duration(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->duration = get_duration(line); }
static void parse_dc_dctype(char *line, struct membuffer *str, void *_dc) static void parse_dc_dctype(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->divemode = get_dctype(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->divemode = get_dctype(line); }
static void parse_dc_lastmanualtime(char *line, struct membuffer *str, void *_dc) static void parse_dc_lastmanualtime(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->last_manual_time = get_duration(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->last_manual_time = get_duration(line); }
static void parse_dc_maxdepth(char *line, struct membuffer *str, void *_dc) static void parse_dc_maxdepth(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->maxdepth = get_depth(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->maxdepth = get_depth(line); }
static void parse_dc_meandepth(char *line, struct membuffer *str, void *_dc) static void parse_dc_meandepth(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->meandepth = get_depth(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->meandepth = get_depth(line); }
static void parse_dc_model(char *line, struct membuffer *str, void *_dc) static void parse_dc_model(char *line, struct membuffer *str, void *_dc)
{ (void) line; struct divecomputer *dc = _dc; dc->model = get_utf8(str); } { UNUSED(line); struct divecomputer *dc = _dc; dc->model = get_utf8(str); }
static void parse_dc_numberofoxygensensors(char *line, struct membuffer *str, void *_dc) static void parse_dc_numberofoxygensensors(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->no_o2sensors = get_index(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->no_o2sensors = get_index(line); }
static void parse_dc_surfacepressure(char *line, struct membuffer *str, void *_dc) static void parse_dc_surfacepressure(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->surface_pressure = get_pressure(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->surface_pressure = get_pressure(line); }
static void parse_dc_salinity(char *line, struct membuffer *str, void *_dc) static void parse_dc_salinity(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->salinity = get_salinity(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->salinity = get_salinity(line); }
static void parse_dc_surfacetime(char *line, struct membuffer *str, void *_dc) static void parse_dc_surfacetime(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->surfacetime = get_duration(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->surfacetime = get_duration(line); }
static void parse_dc_time(char *line, struct membuffer *str, void *_dc) static void parse_dc_time(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; update_time(&dc->when, line); } { UNUSED(str); struct divecomputer *dc = _dc; update_time(&dc->when, line); }
static void parse_dc_watertemp(char *line, struct membuffer *str, void *_dc) static void parse_dc_watertemp(char *line, struct membuffer *str, void *_dc)
{ (void) str; struct divecomputer *dc = _dc; dc->watertemp = get_temperature(line); } { UNUSED(str); struct divecomputer *dc = _dc; dc->watertemp = get_temperature(line); }
int get_divemode(const char *divemodestring) { int get_divemode(const char *divemodestring) {
@ -807,37 +803,37 @@ static void parse_dc_event(char *line, struct membuffer *str, void *_dc)
} }
static void parse_trip_date(char *line, struct membuffer *str, void *_trip) static void parse_trip_date(char *line, struct membuffer *str, void *_trip)
{ (void) str; dive_trip_t *trip = _trip; update_date(&trip->when, line); } { UNUSED(str); dive_trip_t *trip = _trip; update_date(&trip->when, line); }
static void parse_trip_time(char *line, struct membuffer *str, void *_trip) static void parse_trip_time(char *line, struct membuffer *str, void *_trip)
{ (void) str; dive_trip_t *trip = _trip; update_time(&trip->when, line); } { UNUSED(str); dive_trip_t *trip = _trip; update_time(&trip->when, line); }
static void parse_trip_location(char *line, struct membuffer *str, void *_trip) static void parse_trip_location(char *line, struct membuffer *str, void *_trip)
{ (void) line; dive_trip_t *trip = _trip; trip->location = get_utf8(str); } { UNUSED(line); dive_trip_t *trip = _trip; trip->location = get_utf8(str); }
static void parse_trip_notes(char *line, struct membuffer *str, void *_trip) static void parse_trip_notes(char *line, struct membuffer *str, void *_trip)
{ (void) line; dive_trip_t *trip = _trip; trip->notes = get_utf8(str); } { UNUSED(line); dive_trip_t *trip = _trip; trip->notes = get_utf8(str); }
static void parse_settings_autogroup(char *line, struct membuffer *str, void *_unused) static void parse_settings_autogroup(char *line, struct membuffer *str, void *_unused)
{ {
(void) line; UNUSED(line);
(void) str; UNUSED(str);
(void) _unused; UNUSED(_unused);
set_autogroup(true); set_autogroup(true);
} }
static void parse_settings_units(char *line, struct membuffer *str, void *unused) static void parse_settings_units(char *line, struct membuffer *str, void *unused)
{ {
(void) str; UNUSED(str);
(void) unused; UNUSED(unused);
if (line) if (line)
set_informational_units(line); set_informational_units(line);
} }
static void parse_settings_userid(char *line, struct membuffer *str, void *_unused) static void parse_settings_userid(char *line, struct membuffer *str, void *_unused)
{ {
(void) str; UNUSED(str);
(void) _unused; UNUSED(_unused);
if (line) { if (line) {
prefs.save_userid_local = true; prefs.save_userid_local = true;
set_userid(line); set_userid(line);
@ -846,8 +842,8 @@ static void parse_settings_userid(char *line, struct membuffer *str, void *_unus
static void parse_settings_prefs(char *line, struct membuffer *str, void *unused) static void parse_settings_prefs(char *line, struct membuffer *str, void *unused)
{ {
(void) str; UNUSED(str);
(void) unused; UNUSED(unused);
if (line) if (line)
set_git_prefs(line); set_git_prefs(line);
} }
@ -861,8 +857,8 @@ static void parse_settings_prefs(char *line, struct membuffer *str, void *unused
*/ */
static void parse_settings_version(char *line, struct membuffer *str, void *_unused) static void parse_settings_version(char *line, struct membuffer *str, void *_unused)
{ {
(void) str; UNUSED(str);
(void) _unused; UNUSED(_unused);
int version = atoi(line); int version = atoi(line);
report_datafile_version(version); report_datafile_version(version);
if (version > DATAFORMAT_VERSION) if (version > DATAFORMAT_VERSION)
@ -872,9 +868,9 @@ static void parse_settings_version(char *line, struct membuffer *str, void *_unu
/* The string in the membuffer is the version string of subsurface that saved things, just FYI */ /* The string in the membuffer is the version string of subsurface that saved things, just FYI */
static void parse_settings_subsurface(char *line, struct membuffer *str, void *_unused) static void parse_settings_subsurface(char *line, struct membuffer *str, void *_unused)
{ {
(void) line; UNUSED(line);
(void) str; UNUSED(str);
(void) _unused; UNUSED(_unused);
} }
struct divecomputerid { struct divecomputerid {
@ -922,7 +918,7 @@ static void parse_divecomputerid_keyvalue(void *_cid, const char *key, const cha
*/ */
static void parse_settings_divecomputerid(char *line, struct membuffer *str, void *_unused) static void parse_settings_divecomputerid(char *line, struct membuffer *str, void *_unused)
{ {
(void) _unused; UNUSED(_unused);
struct divecomputerid id = { mb_cstring(str) }; struct divecomputerid id = { mb_cstring(str) };
id.cstr = id.model + strlen(id.model) + 1; id.cstr = id.model + strlen(id.model) + 1;
@ -943,14 +939,14 @@ static void parse_settings_divecomputerid(char *line, struct membuffer *str, voi
static void parse_picture_filename(char *line, struct membuffer *str, void *_pic) static void parse_picture_filename(char *line, struct membuffer *str, void *_pic)
{ {
(void) line; UNUSED(line);
struct picture *pic = _pic; struct picture *pic = _pic;
pic->filename = get_utf8(str); pic->filename = get_utf8(str);
} }
static void parse_picture_gps(char *line, struct membuffer *str, void *_pic) static void parse_picture_gps(char *line, struct membuffer *str, void *_pic)
{ {
(void) str; UNUSED(str);
struct picture *pic = _pic; struct picture *pic = _pic;
pic->latitude = parse_degrees(line, &line); pic->latitude = parse_degrees(line, &line);
@ -959,7 +955,7 @@ static void parse_picture_gps(char *line, struct membuffer *str, void *_pic)
static void parse_picture_hash(char *line, struct membuffer *str, void *_pic) static void parse_picture_hash(char *line, struct membuffer *str, void *_pic)
{ {
(void) line; UNUSED(line);
struct picture *pic = _pic; struct picture *pic = _pic;
char *hash = get_utf8(str); char *hash = get_utf8(str);
register_hash(pic->filename, get_utf8(str)); register_hash(pic->filename, get_utf8(str));
@ -1031,7 +1027,7 @@ static struct keyword_action settings_action[] = {
static void settings_parser(char *line, struct membuffer *str, void *_unused) static void settings_parser(char *line, struct membuffer *str, void *_unused)
{ {
(void) _unused; UNUSED(_unused);
match_action(line, str, NULL, settings_action, ARRAY_SIZE(settings_action)); match_action(line, str, NULL, settings_action, ARRAY_SIZE(settings_action));
} }
@ -1346,8 +1342,8 @@ static int dive_directory(const char *root, const git_tree_entry *entry, const c
static int picture_directory(const char *root, const char *name) static int picture_directory(const char *root, const char *name)
{ {
(void) root; UNUSED(root);
(void) name; UNUSED(name);
if (!active_dive) if (!active_dive)
return GIT_WALK_SKIP; return GIT_WALK_SKIP;
return GIT_WALK_OK; return GIT_WALK_OK;
@ -1484,7 +1480,7 @@ static struct divecomputer *create_new_dc(struct dive *dive)
*/ */
static int parse_divecomputer_entry(git_repository *repo, const git_tree_entry *entry, const char *suffix) static int parse_divecomputer_entry(git_repository *repo, const git_tree_entry *entry, const char *suffix)
{ {
(void) suffix; UNUSED(suffix);
git_blob *blob = git_tree_entry_blob(repo, entry); git_blob *blob = git_tree_entry_blob(repo, entry);
if (!blob) if (!blob)

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* macos.c */ /* macos.c */
/* implements Mac OS X specific functions */ /* implements Mac OS X specific functions */
#include "ssrf.h"
#include <stdlib.h> #include <stdlib.h>
#include <dirent.h> #include <dirent.h>
#include <fnmatch.h> #include <fnmatch.h>
@ -19,7 +20,7 @@
void subsurface_user_info(struct user_info *info) void subsurface_user_info(struct user_info *info)
{ {
(void) info; UNUSED(info);
/* Nothing, let's use libgit2-20 on MacOS */ /* Nothing, let's use libgit2-20 on MacOS */
} }
@ -46,7 +47,7 @@ void subsurface_OS_pref_setup(void)
bool subsurface_ignore_font(const char *font) bool subsurface_ignore_font(const char *font)
{ {
(void) font; UNUSED(font);
// there are no old default fonts to ignore // there are no old default fonts to ignore
return false; return false;
} }

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -404,8 +405,8 @@ static void gasmix(char *buffer, fraction_t *fraction)
static void gasmix_nitrogen(char *buffer, struct gasmix *gasmix) static void gasmix_nitrogen(char *buffer, struct gasmix *gasmix)
{ {
(void) buffer; UNUSED(buffer);
(void) gasmix; UNUSED(gasmix);
/* Ignore n2 percentages. There's no value in them. */ /* Ignore n2 percentages. There's no value in them. */
} }
@ -925,7 +926,7 @@ static void try_to_fill_sample(struct sample *sample, const char *name, char *bu
static void try_to_fill_userid(const char *name, char *buf) static void try_to_fill_userid(const char *name, char *buf)
{ {
(void) name; UNUSED(name);
if (prefs.save_userid_local) if (prefs.save_userid_local)
set_userid(buf); set_userid(buf);
} }
@ -1606,7 +1607,7 @@ static const char *preprocess_divelog_de(const char *buffer)
int parse_xml_buffer(const char *url, const char *buffer, int size, int parse_xml_buffer(const char *url, const char *buffer, int size,
struct dive_table *table, const char **params) struct dive_table *table, const char **params)
{ {
(void) size; UNUSED(size);
xmlDoc *doc; xmlDoc *doc;
const char *res = preprocess_divelog_de(buffer); const char *res = preprocess_divelog_de(buffer);
int ret = 0; int ret = 0;

View file

@ -1,3 +1,4 @@
#include "ssrf.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
@ -195,7 +196,7 @@ bool is_dive(void)
void reset_dc_info(struct divecomputer *dc) void reset_dc_info(struct divecomputer *dc)
{ {
/* WARN: reset dc info does't touch the dc? */ /* WARN: reset dc info does't touch the dc? */
(void) dc; UNUSED(dc);
lastcylinderindex = 0; lastcylinderindex = 0;
} }

View file

@ -5,6 +5,7 @@
* *
* (c) Dirk Hohndel 2013 * (c) Dirk Hohndel 2013
*/ */
#include "ssrf.h"
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
@ -533,7 +534,7 @@ static int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops, int gnr)
int ascent_velocity(int depth, int avg_depth, int bottom_time) int ascent_velocity(int depth, int avg_depth, int bottom_time)
{ {
(void) bottom_time; UNUSED(bottom_time);
/* We need to make this configurable */ /* We need to make this configurable */
/* As an example (and possibly reasonable default) this is the Tech 1 provedure according /* As an example (and possibly reasonable default) this is the Tech 1 provedure according

View file

@ -2,6 +2,7 @@
/* profile.c */ /* profile.c */
/* creates all the necessary data for drawing the dive profile /* creates all the necessary data for drawing the dive profile
*/ */
#include "ssrf.h"
#include "gettext.h" #include "gettext.h"
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
@ -373,9 +374,9 @@ static int set_setpoint(struct plot_info *pi, int i, int setpoint, int end)
static void check_setpoint_events(struct dive *dive, struct divecomputer *dc, struct plot_info *pi) static void check_setpoint_events(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
{ {
UNUSED(dive);
int i = 0; int i = 0;
pressure_t setpoint; pressure_t setpoint;
(void) dive;
setpoint.mbar = 0; setpoint.mbar = 0;
struct event *ev = get_next_event(dc->events, "SP change"); struct event *ev = get_next_event(dc->events, "SP change");
@ -502,12 +503,11 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *dc, struct plot_info *pi) struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
{ {
UNUSED(dive);
int idx, maxtime, nr, i; int idx, maxtime, nr, i;
int lastdepth, lasttime, lasttemp = 0; int lastdepth, lasttime, lasttemp = 0;
struct plot_data *plot_data; struct plot_data *plot_data;
struct event *ev = dc->events; struct event *ev = dc->events;
(void) dive;
maxtime = pi->maxtime; maxtime = pi->maxtime;
/* /*
@ -793,8 +793,8 @@ static void calculate_sac(struct dive *dive, struct divecomputer *dc, struct plo
static void populate_secondary_sensor_data(struct divecomputer *dc, struct plot_info *pi) static void populate_secondary_sensor_data(struct divecomputer *dc, struct plot_info *pi)
{ {
(void) dc; UNUSED(dc);
(void) pi; UNUSED(pi);
/* We should try to see if it has interesting pressure data here */ /* We should try to see if it has interesting pressure data here */
} }
@ -1322,7 +1322,7 @@ void create_plot_info_new(struct dive *dive, struct divecomputer *dc, struct plo
struct deco_state plot_deco_state; struct deco_state plot_deco_state;
init_decompression(&plot_deco_state, dive); init_decompression(&plot_deco_state, dive);
#else #else
(void)planner_ds; UNUSED(planner_ds);
#endif #endif
/* Create the new plot data */ /* Create the new plot data */
free((void *)last_pi_entry_new); free((void *)last_pi_entry_new);

View file

@ -4,6 +4,7 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
#include "ssrf.h"
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -1021,11 +1022,11 @@ static int notify_cb(git_checkout_notify_t why,
const git_diff_file *workdir, const git_diff_file *workdir,
void *payload) void *payload)
{ {
(void) baseline; UNUSED(baseline);
(void) target; UNUSED(target);
(void) workdir; UNUSED(workdir);
(void) payload; UNUSED(payload);
(void) why; UNUSED(why);
report_error("File '%s' does not match in working tree", path); report_error("File '%s' does not match in working tree", path);
return 0; /* Continue with checkout */ return 0; /* Continue with checkout */
} }

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* windows.c */ /* windows.c */
/* implements Windows specific functions */ /* implements Windows specific functions */
#include "ssrf.h"
#include <io.h> #include <io.h>
#include "dive.h" #include "dive.h"
#include "display.h" #include "display.h"
@ -391,7 +392,7 @@ static struct {
void subsurface_console_init(void) void subsurface_console_init(void)
{ {
(void)console_desc; UNUSED(console_desc);
/* if this is a console app already, do nothing */ /* if this is a console app already, do nothing */
#ifndef WIN32_CONSOLE_APP #ifndef WIN32_CONSOLE_APP