aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/stream.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-10-17 13:33:37 +0200
committerThomas White <taw@physics.org>2017-10-17 13:33:37 +0200
commitf15f4b792826c917f258c2e6195f6994d3450754 (patch)
tree02ebac694c3b1a49059089fa3c65879a3bda2896 /libcrystfel/src/stream.c
parentc0ce8fb481a89225a99c3ab27571ed22709d4ac2 (diff)
Handle old indexing methods
There are limits to how well they can be handled, but this avoids screwing users over too much.
Diffstat (limited to 'libcrystfel/src/stream.c')
-rw-r--r--libcrystfel/src/stream.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index fb4b0c70..d7d997cf 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -67,8 +67,18 @@ struct _stream
int minor_version;
long long int ln;
+
+ int old_indexers; /* True if the stream reader encountered a deprecated
+ * indexing method */
};
+
+int stream_has_old_indexers(Stream *st)
+{
+ return st->old_indexers;
+}
+
+
static int read_peaks(Stream *st, struct image *image)
{
char *rval = NULL;
@@ -1196,10 +1206,14 @@ int read_chunk_2(Stream *st, struct image *image, StreamReadFlags srf)
}
if ( strncmp(line, "indexed_by = ", 13) == 0 ) {
- image->indexed_by = get_indm_from_string(line+13);
+ int err = 0;
+ image->indexed_by = get_indm_from_string_2(line+13, &err);
if ( image->indexed_by == INDEXING_ERROR ) {
ERROR("Failed to read indexer list\n");
}
+ if ( err ) {
+ st->old_indexers = 1;
+ }
}
if ( strncmp(line, "photon_energy_eV = ", 19) == 0 ) {
@@ -1327,6 +1341,7 @@ Stream *open_stream_for_read(const char *filename)
st = malloc(sizeof(struct _stream));
if ( st == NULL ) return NULL;
+ st->old_indexers = 0;
if ( strcmp(filename, "-") == 0 ) {
st->fh = stdin;
@@ -1393,6 +1408,7 @@ Stream *open_stream_fd_for_write(int fd)
st = malloc(sizeof(struct _stream));
if ( st == NULL ) return NULL;
+ st->old_indexers = 0;
st->fh = fdopen(fd, "w");
if ( st->fh == NULL ) {
@@ -1442,6 +1458,7 @@ Stream *open_stream_for_write_3(const char *filename,
st = malloc(sizeof(struct _stream));
if ( st == NULL ) return NULL;
+ st->old_indexers = 0;
st->fh = fopen(filename, "w");
if ( st->fh == NULL ) {
@@ -1493,6 +1510,7 @@ Stream *open_stream_for_write_2(const char *filename,
st = malloc(sizeof(struct _stream));
if ( st == NULL ) return NULL;
+ st->old_indexers = 0;
st->fh = fopen(filename, "w");
if ( st->fh == NULL ) {