From ecc63e50a4086b6ec885c8808bccb49f0d976fcb Mon Sep 17 00:00:00 2001 From: Matthew Larson Date: Fri, 13 Dec 2024 15:14:10 -0600 Subject: [PATCH] Fix warnings --- .github/workflows/main.yml | 4 ++-- src/rest_vol.c | 12 ++++-------- src/rest_vol_dataset.c | 9 ++++----- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d98b5cd7..f3d8a77f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -80,7 +80,7 @@ jobs: - name: Build + Install REST VOL run: | - make + make -j make install shell: bash working-directory: ${{github.workspace}}/vol-rest/ @@ -212,7 +212,7 @@ jobs: - name: Build + Install REST VOL run: | - make + make -j make install shell: bash working-directory: ${{github.workspace}}/vol-rest/build diff --git a/src/rest_vol.c b/src/rest_vol.c index dba6f201..5dbf90c1 100644 --- a/src/rest_vol.c +++ b/src/rest_vol.c @@ -4125,8 +4125,7 @@ RV_curl_delete(CURL *curl_handle, server_info_t *server_info, const char *reques strcpy(host_header, host_string); - curl_headers_local = curl_slist_append( - curl_headers_local, strncat(host_header, filename, host_header_len - strlen(host_string) - 1)); + curl_headers_local = curl_slist_append(curl_headers_local, strcat(host_header, filename)); /* Disable use of Expect: 100 Continue HTTP response */ curl_headers_local = curl_slist_append(curl_headers_local, "Expect:"); @@ -4201,8 +4200,7 @@ RV_curl_put(CURL *curl_handle, server_info_t *server_info, const char *request_e strcpy(host_header, host_string); - curl_headers_local = curl_slist_append( - curl_headers_local, strncat(host_header, filename, host_header_len - strlen(host_string) - 1)); + curl_headers_local = curl_slist_append(curl_headers_local, strcat(host_header, filename)); /* Disable use of Expect: 100 Continue HTTP response */ curl_headers_local = curl_slist_append(curl_headers_local, "Expect:"); @@ -4301,8 +4299,7 @@ RV_curl_get(CURL *curl_handle, server_info_t *server_info, const char *request_e strcpy(host_header, host_string); - curl_headers_local = curl_slist_append( - curl_headers_local, strncat(host_header, filename, host_header_len - strlen(host_string) - 1)); + curl_headers_local = curl_slist_append(curl_headers_local, strcat(host_header, filename)); /* Specify type of content being sent through cURL */ switch (content_type) { @@ -4387,8 +4384,7 @@ RV_curl_post(CURL *curl_handle, server_info_t *server_info, const char *request_ strcpy(host_header, host_string); - curl_headers_local = curl_slist_append( - curl_headers_local, strncat(host_header, filename, host_header_len - strlen(host_string) - 1)); + curl_headers_local = curl_slist_append(curl_headers_local, strcat(host_header, filename)); /* Specify type of content being sent through cURL */ switch (content_type) { diff --git a/src/rest_vol_dataset.c b/src/rest_vol_dataset.c index b5fc7cbc..34aaa506 100644 --- a/src/rest_vol_dataset.c +++ b/src/rest_vol_dataset.c @@ -1273,9 +1273,9 @@ RV_dataset_write(size_t count, void *dset[], hid_t mem_type_id[], hid_t _mem_spa if (NULL == (transfer_info[i].u.write_info.point_sel_buf = RV_malloc(write_body_len + 1))) FUNC_GOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate space for write buffer"); - if ((bytes_printed = - snprintf(transfer_info[i].u.write_info.point_sel_buf, write_body_len + 1, fmt_string, - selection_body, transfer_info[i].u.write_info.base64_encoded_values)) < 0) + if ((bytes_printed = snprintf(transfer_info[i].u.write_info.point_sel_buf, write_body_len + 1, + fmt_string, selection_body, + (char *)transfer_info[i].u.write_info.base64_encoded_values)) < 0) FUNC_GOTO_ERROR(H5E_DATASET, H5E_SYSERRSTR, FAIL, "snprintf error"); transfer_info[i].u.write_info.uinfo.buffer = transfer_info[i].u.write_info.point_sel_buf; @@ -3498,8 +3498,7 @@ RV_convert_dataset_creation_properties_to_JSON(hid_t dcpl, char **creation_prope const char *const external_file_str = "%s{" "\"name\": %s," "\"offset\": " OFF_T_SPECIFIER "," - "\"size\": %llu" - "}"; + "\"size\": " PRIuHSIZE "}"; /* Check whether the buffer needs to be grown */ bytes_to_print += strlen(external_storage_str);