From e295e00053fff65f53e45ebb6b149d65225d04a8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 8 Aug 2012 11:59:46 +0200 Subject: Fix buglets spotted by new compiler on Fedora 17 --- libcrystfel/src/cell.c | 3 +-- libcrystfel/src/detector.c | 3 --- libcrystfel/src/reax.c | 15 ++++----------- libcrystfel/src/stream.c | 2 -- libcrystfel/src/symmetry.c | 6 ++---- src/check_hkl.c | 4 ---- src/compare_hkl.c | 6 ------ src/dw-hdfsee.c | 12 ++++-------- src/get_hkl.c | 4 +--- src/im-sandbox.c | 3 +-- src/powder_plot.c | 4 ++-- src/process_hkl.c | 7 +------ tests/pr_gradient_check.c | 4 ---- 13 files changed, 16 insertions(+), 57 deletions(-) diff --git a/libcrystfel/src/cell.c b/libcrystfel/src/cell.c index b6ea010b..84361414 100644 --- a/libcrystfel/src/cell.c +++ b/libcrystfel/src/cell.c @@ -895,7 +895,7 @@ UnitCell *match_cell_ab(UnitCell *cell, UnitCell *template) int used[3]; struct rvec real_a, real_b, real_c; struct rvec params[3]; - double alen, blen, clen; + double alen, blen; float ltl = 5.0; /* percent */ int have_real_a; int have_real_b; @@ -911,7 +911,6 @@ UnitCell *match_cell_ab(UnitCell *cell, UnitCell *template) } alen = modulus(ax, ay, az); blen = modulus(bx, by, bz); - clen = modulus(cx, cy, cz); /* Get the lengths from the cell and turn them into anonymous vectors */ if ( cell_get_cartesian(cell, &ax, &ay, &az, diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c index f212821d..5f138eac 100644 --- a/libcrystfel/src/detector.c +++ b/libcrystfel/src/detector.c @@ -750,7 +750,6 @@ struct detector *get_detector_geometry(const char *filename) char line[1024]; struct badregion *badregion = NULL; struct panel *panel = NULL; - char *key; char wholeval[1024]; rval = fgets(line, 1023, fh); @@ -802,8 +801,6 @@ struct detector *get_detector_geometry(const char *filename) } } - key = path[1]; - if ( panel != NULL ) { if ( parse_field_for_panel(panel, path[1], wholeval, det) ) diff --git a/libcrystfel/src/reax.c b/libcrystfel/src/reax.c index 259ec199..5cfa908a 100644 --- a/libcrystfel/src/reax.c +++ b/libcrystfel/src/reax.c @@ -467,7 +467,6 @@ static void find_candidates(struct reax_private *p, const char *rg, struct detector *det) { int i; - double th, ph; for ( i=0; in_search; i++ ) { s->search[i].cand = calloc(MAX_CANDIDATES, @@ -475,7 +474,6 @@ static void find_candidates(struct reax_private *p, s->search[i].n_cand = 0; } - th = 0.0; ph = 0.0; for ( i=0; in_dir; i++ ) { check_dir(&p->directions[i], flist, p->nel, pmax, fft_in, fft_out, p->plan, @@ -492,7 +490,10 @@ static void find_candidates(struct reax_private *p, int j; sv = &s->search[i]; - refine_vector(flist, &sv->cand[j].v); + + for ( j=0; jn_cand; j++ ) { + refine_vector(flist, &sv->cand[j].v); + } } @@ -593,7 +594,6 @@ static void refine_rigid_group(struct image *image, UnitCell *cell, double bx, by, bz, mb; double cx, cy, cz, mc; double pha, phb, phc; - struct panel *p; int i, j; fftw_complex *r_fft_in; fftw_complex *r_fft_out; @@ -618,13 +618,6 @@ static void refine_rigid_group(struct image *image, UnitCell *cell, pr->nel, pmax, fft_in, fft_out, plan, smin, smax, rg, det); - for ( i=0; in_panels; i++ ) { - if ( det->panels[i].rigid_group == rg ) { - p = &det->panels[i]; - break; - } - } - r_fft_in = fftw_malloc(pr->cw*pr->ch*sizeof(fftw_complex)); r_fft_out = fftw_malloc(pr->cw*pr->ch*sizeof(fftw_complex)); for ( i=0; icw; i++ ) { diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index ce0ee33e..6627e7ea 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -335,7 +335,6 @@ int read_chunk(FILE *fh, struct image *image) int have_bs = 0; int have_cs = 0; int have_filename = 0; - int have_cell = 0; int have_ev = 0; if ( find_start_of_chunk(fh) ) return 1; @@ -410,7 +409,6 @@ int read_chunk(FILE *fh, struct image *image) image->indexed_cell = cell_new_from_reciprocal_axes(as, bs, cs); - have_cell = 1; have_as = 0; have_bs = 0; have_cs = 0; } diff --git a/libcrystfel/src/symmetry.c b/libcrystfel/src/symmetry.c index ab837ec0..0352e441 100644 --- a/libcrystfel/src/symmetry.c +++ b/libcrystfel/src/symmetry.c @@ -1275,8 +1275,7 @@ SymOpList *get_ambiguities(const SymOpList *source, const SymOpList *target) SymOpList *src_reordered; SymOpMask *used; char *name; - int index; - + n_src = num_ops(source); n_tgt = num_ops(target); @@ -1290,8 +1289,7 @@ SymOpList *get_ambiguities(const SymOpList *source, const SymOpList *target) ERROR("Subgroup index would be fractional.\n"); return NULL; } - index = n_src / n_tgt; - + src_reordered = new_symoplist(); used = new_symopmask(source); diff --git a/src/check_hkl.c b/src/check_hkl.c index fbc29f00..a1688ad2 100644 --- a/src/check_hkl.c +++ b/src/check_hkl.c @@ -68,8 +68,6 @@ static void show_help(const char *s) static void plot_shells(RefList *list, UnitCell *cell, const SymOpList *sym, double rmin_fix, double rmax_fix) { - double num[NBINS]; - int cts[NBINS]; int possible[NBINS]; unsigned int measurements[NBINS]; unsigned int measured[NBINS]; @@ -104,8 +102,6 @@ static void plot_shells(RefList *list, UnitCell *cell, const SymOpList *sym, } for ( i=0; ipixbufs != NULL ) { int i; for ( i=0; in_pixbufs; i++ ) { - gdk_pixbuf_unref(dw->pixbufs[i]); + g_object_unref(dw->pixbufs[i]); } free(dw->pixbufs); } if ( dw->col_scale != NULL ) { - gdk_pixbuf_unref(dw->col_scale); + g_object_unref(dw->col_scale); } if ( dw->image != NULL ) { @@ -189,12 +189,8 @@ static void show_ring(cairo_t *cr, DisplayWindow *dw, static void show_simple_ring(cairo_t *cr, DisplayWindow *dw, double d, cairo_matrix_t *basic_m) { - struct detector *det; - if ( !dw->use_geom ) return; - det = dw->image->det; - cairo_identity_matrix(cr); cairo_translate(cr, -dw->min_x/dw->binning, dw->max_y/dw->binning); @@ -431,7 +427,7 @@ static void set_window_size(DisplayWindow *dw) static void update_colscale(DisplayWindow *dw) { if ( dw->col_scale != NULL ) { - gdk_pixbuf_unref(dw->col_scale); + g_object_unref(dw->col_scale); } dw->col_scale = render_get_colour_scale(20, dw->height, dw->scale); } @@ -446,7 +442,7 @@ static void displaywindow_update(DisplayWindow *dw) if ( dw->pixbufs != NULL ) { int i; for ( i=0; in_pixbufs; i++ ) { - gdk_pixbuf_unref(dw->pixbufs[i]); + g_object_unref(dw->pixbufs[i]); } free(dw->pixbufs); } diff --git a/src/get_hkl.c b/src/get_hkl.c index e298680d..00de38a5 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -270,10 +270,8 @@ static RefList *expand_reflections(RefList *in, const SymOpList *target, signed int h, k, l; int n, j; - double intensity; get_indices(refl, &h, &k, &l); - intensity = get_intensity(refl); special_position(initial, m, h, k, l); n = num_equivs(initial, m); @@ -298,7 +296,7 @@ static RefList *expand_reflections(RefList *in, const SymOpList *target, /* FIXME: Make phase negative if the reflection is * separated from the original via an inversion */ - get_phase(refl, &have_phase); + ph = get_phase(refl, &have_phase); if ( have_phase ) set_phase(new, -ph); } diff --git a/src/im-sandbox.c b/src/im-sandbox.c index fdbbf3a3..c9ad5300 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -840,7 +840,6 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix, char results[1024]; char *rval; int fd; - int n; char *eptr; if ( !sb->running[i] ) { @@ -863,7 +862,7 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix, chomp(results); - n = strtol(results, &eptr, 10); + strtol(results, &eptr, 10); if ( eptr == results ) { if ( strlen(results) > 0 ) { ERROR("Invalid result '%s'\n", results); diff --git a/src/powder_plot.c b/src/powder_plot.c index 049b9c0e..84f292a3 100644 --- a/src/powder_plot.c +++ b/src/powder_plot.c @@ -725,7 +725,7 @@ int main(int argc, char *argv[]) unsigned int n_patterns = 0; unsigned int n_peaks = 0; - int c, rval, file_type, data_type; + int c, file_type, data_type; int config_satcorr = 1; int need_geometry = 0; int need_beam = 0; @@ -953,7 +953,7 @@ int main(int argc, char *argv[]) return 1; } /* Use wavelength from first chunk */ - rval = read_chunk(fh, &image); + read_chunk(fh, &image); rewind(fh); } else if (file_type == FILE_H5) { hdfile = hdfile_open(filename); diff --git a/src/process_hkl.c b/src/process_hkl.c index e06270bc..28d54360 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -356,7 +356,6 @@ int main(int argc, char *argv[]) unsigned int n_total_patterns; char *sym_str = NULL; SymOpList *sym; - char *pdb = NULL; char *histo = NULL; signed int hist_h, hist_k, hist_l; signed int hist_nbins=50; @@ -387,7 +386,7 @@ int main(int argc, char *argv[]) }; /* Short options */ - while ((c = getopt_long(argc, argv, "hi:e:o:p:y:g:f:b:z:", + while ((c = getopt_long(argc, argv, "hi:e:o:y:g:f:b:z:", longopts, NULL)) != -1) { switch (c) { @@ -411,10 +410,6 @@ int main(int argc, char *argv[]) config_startafter = atoi(optarg); break; - case 'p' : - pdb = strdup(optarg); - break; - case 'y' : sym_str = strdup(optarg); break; diff --git a/tests/pr_gradient_check.c b/tests/pr_gradient_check.c index 8ca8ace5..6972b66a 100644 --- a/tests/pr_gradient_check.c +++ b/tests/pr_gradient_check.c @@ -225,10 +225,6 @@ static int test_gradients(struct image *image, double incr_val, int refine, double r1, r2, p; int cl, ch; - double tt, dstar; - - dstar = 2.0 * resolution(image->indexed_cell, h, k, l), - tt = 2.0*asin(image->lambda/(2.0/dstar)); grad1 = (vals[1][i] - vals[0][i]) / incr_val; grad2 = (vals[2][i] - vals[1][i]) / incr_val; -- cgit v1.2.3