diff options
author | Alexandra Tolstikova <alexandra.tolstikova@desy.de> | 2015-03-25 10:19:07 +0100 |
---|---|---|
committer | Alexandra Tolstikova <alexandra.tolstikova@desy.de> | 2015-03-25 10:19:07 +0100 |
commit | d2155d4115786c3520af6d9b76a85d3921fa034d (patch) | |
tree | 1ff03e2a571d36808e617bd00b2e154b13da026b | |
parent | d6f855a933aa900f47be27649d42895393420761 (diff) |
Fix malloc and memcpy of asdf_cell.indices (int -> double)
-rw-r--r-- | libcrystfel/src/asdf.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c index 1d3d2c89..53214a12 100644 --- a/libcrystfel/src/asdf.c +++ b/libcrystfel/src/asdf.c @@ -110,9 +110,9 @@ static struct asdf_cell asdf_cell_new(int n) c.N_refls = n; c.reflections = malloc(sizeof(int) * n); - c.indices = malloc(sizeof(int *) * n); + c.indices = malloc(sizeof(double *) * n); for ( i = 0; i < n; i++ ) { - c.indices[i] = malloc(sizeof(int) * 3); + c.indices[i] = malloc(sizeof(double) * 3); } c.n = 0; @@ -139,11 +139,9 @@ static int asdf_cell_memcpy(struct asdf_cell *dest, struct asdf_cell *src) dest->n = src->n; memcpy(dest->reflections, src->reflections, sizeof(int) * n); - - memcpy(dest->indices, src->indices, sizeof(int *) * n); - + for (i = 0; i < n; i++ ) { - memcpy(dest->indices[i], src->indices[i], sizeof(int) * 3); + memcpy(dest->indices[i], src->indices[i], sizeof(double) * 3); } dest->acl = src->acl; @@ -1012,7 +1010,7 @@ int run_asdf(struct image *image, IndexingPrivate *ipriv) if ( dp->indm & INDEXING_CHECK_CELL_AXES ) { double volume = cell_get_volume(dp->template); double vtol = (dp->ltl[0] + dp->ltl[1] + dp->ltl[2]) / 100 + - dp->ltl[3] / 180 * M_PI; + dp->ltl[3] / 180 * M_PI; volume_min = volume * (1 - vtol); volume_max = volume * (1 + vtol); } |