diff options
author | Thomas White <taw@physics.org> | 2019-01-29 17:15:06 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-01-29 17:21:06 +0100 |
commit | 1fdbafbb687c32dc167a572a3048e32099720fde (patch) | |
tree | 7c2f71637cad9d11fce81cff35e94b24c0b2654c /src | |
parent | 83b4dbe4a0146da76fbb69fde213176d44e1a2ae (diff) |
Fix some compiler warnings about string handling
Diffstat (limited to 'src')
-rw-r--r-- | src/make_pixelmap.c | 2 | ||||
-rw-r--r-- | src/partialator.c | 4 | ||||
-rw-r--r-- | src/post-refinement.c | 4 |
3 files changed, 5 insertions, 5 deletions
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'; |