aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/events.c15
-rw-r--r--libcrystfel/src/hdf5-file.c14
-rw-r--r--src/make_pixelmap.c2
-rw-r--r--src/partialator.c4
-rw-r--r--src/post-refinement.c4
5 files changed, 19 insertions, 20 deletions
diff --git a/libcrystfel/src/events.c b/libcrystfel/src/events.c
index c73a816c..bb4047c9 100644
--- a/libcrystfel/src/events.c
+++ b/libcrystfel/src/events.c
@@ -314,9 +314,9 @@ char *get_event_string(struct event *ev)
}
ret_string=new_ret_string;
- strncpy(&ret_string[ret_string_len],"/", 1);
- strncpy(&ret_string[ret_string_len+1],ev->path_entries[pi],
- strlen(ev->path_entries[pi]));
+ ret_string[ret_string_len] = '/';
+ strcpy(&ret_string[ret_string_len+1],
+ ev->path_entries[pi]);
ret_string_len += 1+strlen(ev->path_entries[pi]);
@@ -330,7 +330,7 @@ char *get_event_string(struct event *ev)
ret_string = new_ret_string;
- strncpy(&ret_string[ret_string_len], "/", 1);
+ ret_string[ret_string_len] = '/';
ret_string_len += 1;
} else {
@@ -357,9 +357,8 @@ char *get_event_string(struct event *ev)
ret_string = new_ret_string;
- strncpy(&ret_string[ret_string_len],"/", 1);
- strncpy(&ret_string[ret_string_len+1], num_buf,
- strlen(num_buf));
+ ret_string[ret_string_len] = '/';
+ strcpy(&ret_string[ret_string_len+1], num_buf);
ret_string_len += 1+strlen(num_buf);
}
@@ -374,7 +373,7 @@ char *get_event_string(struct event *ev)
ret_string = new_ret_string;
- strncpy(&ret_string[ret_string_len], "/", 1);
+ ret_string[ret_string_len] = '/';
ret_string_len += 1;
}
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index 6ede34bc..3d9ea0b2 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -2300,11 +2300,11 @@ char **hdfile_read_group(struct hdfile *f, int *n, const char *parent,
H5Lget_name_by_idx(gh, ".", H5_INDEX_NAME, H5_ITER_NATIVE,
i, buf, 255, H5P_DEFAULT);
- res[i] = malloc(256);
+ res[i] = malloc(512);
if ( strlen(parent) > 1 ) {
- snprintf(res[i], 255, "%s/%s", parent, buf);
+ snprintf(res[i], 511, "%s/%s", parent, buf);
} else {
- snprintf(res[i], 255, "%s%s", parent, buf);
+ snprintf(res[i], 511, "%s%s", parent, buf);
} /* ick */
is_image[i] = 0;
@@ -2389,8 +2389,8 @@ int check_path_existence(hid_t fh, const char *path)
char *start = path_copy;
char *sep = NULL;
- strncpy(buffer, "\0",1);
- strncpy(buffer_full_path, "\0", 1);
+ buffer[0] = '\0';
+ buffer_full_path[0] = '\0';
if ( strcmp(path_copy, "/" ) == 0 ) {
return 1;
@@ -2416,7 +2416,7 @@ int check_path_existence(hid_t fh, const char *path)
}
strncpy(buffer, start, sep-start);
- buffer[sep-start]='\0';
+ buffer[sep-start] = '\0';
strcat(buffer_full_path, buffer);
check = H5Lexists(fh, buffer_full_path, H5P_DEFAULT);
@@ -2440,7 +2440,7 @@ int check_path_existence(hid_t fh, const char *path)
} else {
- strncpy(buffer, start, strlen(start)+1);
+ strcpy(buffer, start);
strcat(buffer_full_path, buffer);
check = H5Lexists(fh, buffer_full_path, H5P_DEFAULT);
diff --git a/src/make_pixelmap.c b/src/make_pixelmap.c
index b2e95a60..b5fed987 100644
--- a/src/make_pixelmap.c
+++ b/src/make_pixelmap.c
@@ -242,7 +242,7 @@ int main(int argc, char *argv[])
if ( output_file == NULL ) {
size_t len = strlen(input_file);
output_file = malloc(len+4);
- strncpy(output_file, input_file, len-1);
+ strcpy(output_file, input_file);
strip_extension(output_file);
strcat(output_file, ".h5");
}
diff --git a/src/partialator.c b/src/partialator.c
index fd610ddb..50518b99 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -622,10 +622,10 @@ static void write_to_pgraph(FILE *fh, RefList *list, RefList *full, Crystal *cr,
double G = crystal_get_osf(cr);
double B = crystal_get_Bfac(cr);
UnitCell *cell = crystal_get_cell(cr);
- char ins[5];
+ char ins[16];
if ( inum >= 0 ) {
- snprintf(ins, 4, "%i", inum);
+ snprintf(ins, 12, "%i", inum);
} else {
ins[0] = 'F';
ins[1] = '\0';
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 44fe6b45..8669a8f5 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -648,7 +648,7 @@ static void write_grid(Crystal *cr, const RefList *full,
const char *name)
{
FILE *fh;
- char fn[64];
+ char fn[16];
char ins[5];
gsl_multimin_fminimizer *min;
struct rf_priv priv;
@@ -667,7 +667,7 @@ static void write_grid(Crystal *cr, const RefList *full,
assert(idx2 != 99);
if ( cycle >= 0 ) {
- snprintf(ins, 4, "%i", cycle);
+ snprintf(ins, 12, "%i", cycle);
} else {
ins[0] = 'F';
ins[1] = '\0';