aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/detector.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index cefad709..629e13f0 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -1189,7 +1189,7 @@ struct detector *get_detector_geometry(const char *filename,
}
-struct detector *get_detector_geometry_from_string(const char *string,
+struct detector *get_detector_geometry_from_string(const char *string_in,
struct beam_params *beam,
char **hdf5_peak_path)
{
@@ -1207,6 +1207,9 @@ struct detector *get_detector_geometry_from_string(const char *string,
struct rgc_definition **rgc_defl = NULL;
int n_rg_definitions = 0;
int n_rgc_definitions = 0;
+ char *string;
+ char *string_orig;
+ size_t len;
det = calloc(1, sizeof(struct detector));
if ( det == NULL ) return NULL;
@@ -1264,6 +1267,16 @@ struct detector *get_detector_geometry_from_string(const char *string,
det->defaults.dim_structure = NULL;
strncpy(det->defaults.name, "", 1023);
+ string = strdup(string_in);
+ if ( string == NULL ) return NULL;
+ len = strlen(string);
+ for ( i=0; i<len; i++ ) {
+ if ( string_in[i] == '\r' ) string[i] = '\n';
+ }
+
+ /* Because 'string' will get modified */
+ string_orig = string;
+
do {
int n1, n2;
@@ -1718,6 +1731,7 @@ struct detector *get_detector_geometry_from_string(const char *string,
}
find_min_max_d(det);
+ free(string_orig);
if ( reject ) return NULL;