diff options
author | Thomas White <taw@physics.org> | 2023-05-05 11:36:22 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-05-05 11:51:09 +0200 |
commit | d8e17d6154ce644449ad5979eb6846e9e9816f6e (patch) | |
tree | aae2cc870ca3f7c0e3bcc1a8aa0de0ac4f7b3e38 /libcrystfel/src/image-cbf.c | |
parent | 309b65d75993abbc9804b392117baea3a1101e3a (diff) |
Move is_{hdf5,cbf,cbfgz}_file() to image.c
This also improves is_hdf5_file() to use the proper file signature, not
just the extension. See 9040220452a9cc02706159c21c78e43b374446cf.
Diffstat (limited to 'libcrystfel/src/image-cbf.c')
-rw-r--r-- | libcrystfel/src/image-cbf.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/libcrystfel/src/image-cbf.c b/libcrystfel/src/image-cbf.c index f8a15c1b..0fb3b61c 100644 --- a/libcrystfel/src/image-cbf.c +++ b/libcrystfel/src/image-cbf.c @@ -513,52 +513,6 @@ static float *read_cbf_data(const char *filename, int gz, int *w, int *h) } -signed int is_cbf_file(const char *filename) -{ - FILE *fh; - char line[1024]; - - fh = fopen(filename, "r"); - if ( fh == NULL ) return -1; - - if ( fgets(line, 1024, fh) == NULL ) { - fclose(fh); - return 0; - } - - fclose(fh); - - if ( strstr(line, "CBF") == NULL ) { - return 0; - } - - return 1; -} - - -signed int is_cbfgz_file(const char *filename) -{ - #ifdef HAVE_ZLIB - gzFile gzfh; - char line[1024]; - - gzfh = gzopen(filename, "rb"); - if ( gzfh == NULL ) return -1; - if ( gzgets(gzfh, line, 1024) == NULL ) return 0; - gzclose(gzfh); - - if ( strstr(line, "CBF") == NULL ) { - return 0; - } - - return 1; - - #else /* No zlib */ - return 0; - #endif -} - - int image_cbf_read_mask(struct panel_template *p, const char *filename, const char *event, int gz, int *bad, int mask_good, int mask_bad) |