aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-11-01 10:33:17 +0100
committerThomas White <taw@physics.org>2018-11-02 14:24:55 +0100
commited94e880540cf1cbc3903ec5ec1489e2b67ac0ca (patch)
treec45cf8f2c76de85ba1989b4db3ec9ba03c7e8c42
parente1d6bf0cbd867573441d1c48dbbfed627b27af11 (diff)
Fix some warnings from static analyser
-rw-r--r--src/cell_explorer.c10
-rw-r--r--src/multihistogram.c4
-rw-r--r--src/multihistogram.h3
3 files changed, 12 insertions, 5 deletions
diff --git a/src/cell_explorer.c b/src/cell_explorer.c
index a48ab9b5..69dd7178 100644
--- a/src/cell_explorer.c
+++ b/src/cell_explorer.c
@@ -189,6 +189,12 @@ static void set_col(cairo_t *cr, CellWindow *w, int cat)
static gboolean destroy_sig(GtkWidget *da, CellWindow *w)
{
+ multihistogram_free(w->hist_a->h);
+ multihistogram_free(w->hist_b->h);
+ multihistogram_free(w->hist_c->h);
+ multihistogram_free(w->hist_al->h);
+ multihistogram_free(w->hist_be->h);
+ multihistogram_free(w->hist_ga->h);
gtk_main_quit();
return FALSE;
}
@@ -666,7 +672,7 @@ static void scan_cells(CellWindow *w)
for ( i=0; i<n_cells; i++ ) {
double a, b, c, al, be, ga;
- int cat, j;
+ unsigned int cat, j;
int ignore = 0;
for ( j=0; j<w->n_unique_indms; j++ ) {
@@ -706,7 +712,7 @@ static void scan_cells(CellWindow *w)
check_exclude(w->hist_be, be) ||
check_exclude(w->hist_ga, ga) )
{
- cat = 1<<CAT_EXCLUDE;
+ cat = (unsigned)1<<CAT_EXCLUDE;
n_excl++;
}
diff --git a/src/multihistogram.c b/src/multihistogram.c
index cf2b8c2b..ba1f7e76 100644
--- a/src/multihistogram.c
+++ b/src/multihistogram.c
@@ -93,7 +93,7 @@ void multihistogram_free(MultiHistogram *hi)
}
-void multihistogram_add_value(MultiHistogram *hi, double val, int cat)
+void multihistogram_add_value(MultiHistogram *hi, double val, unsigned int cat)
{
int i, j;
@@ -104,7 +104,7 @@ void multihistogram_add_value(MultiHistogram *hi, double val, int cat)
if ( j >= hi->n_bins ) j = hi->n_bins - 1;
for ( i=0; i<32; i++ ) {
- if ( cat & 1<<i ) hi->bins[i][j]++;
+ if ( cat & (unsigned)1<<i ) hi->bins[i][j]++;
}
}
diff --git a/src/multihistogram.h b/src/multihistogram.h
index e4c2ae89..0949d259 100644
--- a/src/multihistogram.h
+++ b/src/multihistogram.h
@@ -40,7 +40,8 @@ extern MultiHistogram *multihistogram_new();
extern void multihistogram_free(MultiHistogram *hi);
extern void multihistogram_delete_all_values(MultiHistogram *hi);
-extern void multihistogram_add_value(MultiHistogram *hi, double val, int cat);
+extern void multihistogram_add_value(MultiHistogram *hi, double val,
+ unsigned int cat);
extern void multihistogram_set_min(MultiHistogram *hi, double min);
extern void multihistogram_set_max(MultiHistogram *hi, double max);