diff options
Diffstat (limited to 'libcrystfel/src/hdf5-file.c')
-rw-r--r-- | libcrystfel/src/hdf5-file.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c index 9924e665..af06c1b4 100644 --- a/libcrystfel/src/hdf5-file.c +++ b/libcrystfel/src/hdf5-file.c @@ -720,7 +720,8 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name) hid_t type; hid_t class; herr_t r; - int buf; + int buf_i; + double buf_f; char *tmp; dh = H5Dopen2(f->fh, name, H5P_DEFAULT); @@ -768,11 +769,11 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name) case H5T_FLOAT : r = H5Dread(dh, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, - H5P_DEFAULT, &buf); + H5P_DEFAULT, &buf_f); if ( r < 0 ) goto fail; tmp = malloc(256); - snprintf(tmp, 255, "%f", buf); + snprintf(tmp, 255, "%f", buf_f); return tmp; @@ -780,18 +781,17 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name) r = H5Dread(dh, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, &buf); + H5P_DEFAULT, &buf_i); if ( r < 0 ) goto fail; tmp = malloc(256); - snprintf(tmp, 255, "%d", buf); + snprintf(tmp, 255, "%d", buf_i); return tmp; - } - default : { + default : goto fail; - } + } fail: |