aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-21 15:20:51 +0200
committerThomas White <taw@physics.org>2021-07-21 15:34:33 +0200
commitd5cf0404a08253f52c6ddf3f6d80e694b9de4e7a (patch)
tree19a8a0806c5949bd2a10407fee4959a00b503fb1 /libcrystfel
parent49a64e6e63e2da019d7ee1d5900b72693b79818a (diff)
read_cbf_data: Fix types
'buf' has to be char *, otherwise "buf+len" isn't portable. 'len_read' has to be int, because that's the return type of gzread. If the value is immediately put into a size_t, the sign information is lost and we can no longer tell if gzread() failed.
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/image-cbf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libcrystfel/src/image-cbf.c b/libcrystfel/src/image-cbf.c
index 8a97cc6d..807141d3 100644
--- a/libcrystfel/src/image-cbf.c
+++ b/libcrystfel/src/image-cbf.c
@@ -263,7 +263,7 @@ static int convert_type(float *data_out, long nmemb_exp,
static float *read_cbf_data(const char *filename, int gz, int *w, int *h)
{
FILE *fh;
- void *buf = NULL;
+ char *buf = NULL;
char *rval;
size_t data_compressed_len = 0;
float *data_out = NULL;
@@ -285,7 +285,8 @@ static float *read_cbf_data(const char *filename, int gz, int *w, int *h)
} else {
gzFile gzfh;
- size_t len, len_read;
+ int len_read;
+ size_t len;
const size_t bufinc = 8*1024*1024; /* Allocate buffer in 8Mb chunks */
size_t bufsz = bufinc;