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 /libcrystfel/src/hdf5-file.c | |
parent | 83b4dbe4a0146da76fbb69fde213176d44e1a2ae (diff) |
Fix some compiler warnings about string handling
Diffstat (limited to 'libcrystfel/src/hdf5-file.c')
-rw-r--r-- | libcrystfel/src/hdf5-file.c | 14 |
1 files changed, 7 insertions, 7 deletions
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); |