From 98414ac9a9ab927b475088a982ebaf8200c647c8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 3 May 2013 14:16:09 -0700 Subject: [PATCH] Fix compiler warnings Doing this on Arch Linux with gcc 4.8.0 helped find one real bug. The rest are simply changes to make static functions externally visible (as they are kept around to eventually become helpers used by Qt) which for now avoids the warnings. Signed-off-by: Dirk Hohndel --- divelist.c | 6 +++--- download-dialog.c | 6 +++--- equipment.c | 2 +- profile.c | 16 +++++++++------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/divelist.c b/divelist.c index e22dd331a..deab1b05c 100644 --- a/divelist.c +++ b/divelist.c @@ -620,12 +620,12 @@ char *get_nitrox_string(struct dive *dive) o2low = (o2low + 5) / 10; if (he) - snprintf(buffer, sizeof(buffer), "%d/%d", o2, he); + snprintf(buffer, MAX_NITROX_STRING, "%d/%d", o2, he); else if (o2) if (o2 == o2low) - snprintf(buffer, sizeof(buffer), "%d", o2); + snprintf(buffer, MAX_NITROX_STRING, "%d", o2); else - snprintf(buffer, sizeof(buffer), "%d" UTF8_ELLIPSIS "%d", o2low, o2); + snprintf(buffer, MAX_NITROX_STRING, "%d" UTF8_ELLIPSIS "%d", o2low, o2); else strcpy(buffer, _("air")); } diff --git a/download-dialog.c b/download-dialog.c index 729f3a6b6..e12b07abd 100644 --- a/download-dialog.c +++ b/download-dialog.c @@ -81,7 +81,7 @@ int is_default_dive_computer_device(const char *name) return default_dive_computer_device && !strcmp(name, default_dive_computer_device); } -static void set_default_dive_computer(const char *vendor, const char *product) +void set_default_dive_computer(const char *vendor, const char *product) { if (!vendor || !*vendor) return; @@ -99,7 +99,7 @@ static void set_default_dive_computer(const char *vendor, const char *product) subsurface_set_conf("dive_computer_product", product); } -static void set_default_dive_computer_device(const char *name) +void set_default_dive_computer_device(const char *name) { if (!name || !*name) return; @@ -159,7 +159,7 @@ static GtkWidget *import_dive_computer(device_data_t *data, GtkDialog *dialog) #endif /* create a list of lists and keep the elements sorted */ -static void add_dc(const char *vendor, const char *product, dc_descriptor_t *descriptor) +void add_dc(const char *vendor, const char *product, dc_descriptor_t *descriptor) { struct vendor *dcl = dc_list; struct vendor **dclp = &dc_list; diff --git a/equipment.c b/equipment.c index 93f26dab1..4c692f33b 100644 --- a/equipment.c +++ b/equipment.c @@ -112,7 +112,7 @@ void convert_volume_pressure(int ml, int mbar, double *v, double *p) *v = volume; } -static int convert_weight(int grams, double *m) +int convert_weight(int grams, double *m) { int decimals = 1; /* not sure - do people do less than whole lbs/kg ? */ double weight; diff --git a/profile.c b/profile.c index f30ff1d06..b9a633cf6 100644 --- a/profile.c +++ b/profile.c @@ -18,7 +18,10 @@ int selected_dive = 0; char zoomed_plot = 0; char dc_number = 0; +#if USE_GTK_UI static double plot_scale = SCALE_SCREEN; +#endif + static struct plot_data *last_pi_entry = NULL; #define cairo_set_line_width_scaled(cr, w) \ @@ -228,7 +231,7 @@ static void dump_pi (struct plot_info *pi) * We also need to add 180 seconds at the end so the min/max * plots correctly */ -static int get_maxtime(struct plot_info *pi) +int get_maxtime(struct plot_info *pi) { int seconds = pi->maxtime; if (zoomed_plot) { @@ -251,7 +254,7 @@ static int get_maxtime(struct plot_info *pi) /* get the maximum depth to which we want to plot * take into account the additional verical space needed to plot * partial pressure graphs */ -static int get_maxdepth(struct plot_info *pi) +int get_maxdepth(struct plot_info *pi) { unsigned mm = pi->maxdepth; int md; @@ -1018,8 +1021,7 @@ static int get_cylinder_pressure_range(struct graphics_context *gc, struct plot_ * as compared to avg_sac; the calculation simply maps the delta between * sac and avg_sac to indexes 0 .. (SAC_COLORS - 1) with everything * more than 6000 ml/min below avg_sac mapped to 0 */ - -static void set_sac_color(struct graphics_context *gc, int sac, int avg_sac) +void set_sac_color(struct graphics_context *gc, int sac, int avg_sac) { int sac_index = 0; int delta = sac - avg_sac + 7000; @@ -1038,7 +1040,7 @@ static void set_sac_color(struct graphics_context *gc, int sac, int avg_sac) #endif /* USE_GTK_UI */ /* Get local sac-rate (in ml/min) between entry1 and entry2 */ -static int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, struct dive *dive) +int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, struct dive *dive) { int index = entry1->cylinderindex; cylinder_t *cyl; @@ -1597,7 +1599,7 @@ static void check_gas_change_events(struct dive *dive, struct divecomputer *dc, set_cylinder_index(pi, i, cylinderindex, ~0u); } -static void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) +void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) { struct plot_info *pi; int maxdepth; @@ -1953,7 +1955,7 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d * sides, so that you can do end-points without having to worry * about it. */ -static struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) +struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) { struct plot_info *pi;