From d8e17d6154ce644449ad5979eb6846e9e9816f6e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 5 May 2023 11:36:22 +0200 Subject: 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. --- libcrystfel/src/image-cbf.c | 46 --------------------------------------------- 1 file changed, 46 deletions(-) (limited to 'libcrystfel/src/image-cbf.c') 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) -- cgit v1.2.3