From 3fffe0c4cb5efb4c33e819708f0808aa419ea678 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 16 Jun 2021 14:43:16 +0200 Subject: Add DST_NONE for 'no data source' (e.g. image came from stream) --- libcrystfel/src/image.c | 12 +++++++++++- libcrystfel/src/image.h | 1 + libcrystfel/src/stream.c | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index ae143480..f25f70d2 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -366,6 +366,11 @@ static int read_header_to_cache(struct image *image, const char *from) { switch ( image->data_source_type ) { + case DST_NONE: + ERROR("No data source for %s %s - not loading header\n", + image->filename, image->ev); + return 1; + case DST_HDF5: return image_hdf5_read_header_to_cache(image, from); @@ -444,7 +449,7 @@ static DataSourceType file_type(const char *filename) { if ( !file_exists(filename) ) { ERROR("File not found: %s (file_type)\n", filename); - return DST_UNKNOWN; + return DST_NONE; } if ( is_hdf5_file(filename) ) { @@ -757,6 +762,11 @@ static int image_read_image_data(struct image *image, switch ( image->data_source_type ) { + case DST_NONE: + STATUS("No data source for %s %s - not loading.\n", + image->filename, image->ev); + return 1; + case DST_HDF5: return image_hdf5_read(image, dtempl, image->filename, image->ev); diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index 0d8e7166..1aabeccc 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -99,6 +99,7 @@ struct header_cache_entry { typedef enum { DST_UNKNOWN, + DST_NONE, DST_HDF5, DST_CBF, DST_CBFGZ, diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index ba6e13c8..68643a17 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -985,6 +985,8 @@ struct image *stream_read_chunk(Stream *st, StreamFlags srf) image = image_new(); if ( image == NULL ) return NULL; + image->data_source_type = DST_NONE; + do { int ser; float div, bw; -- cgit v1.2.3