diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2019-07-26 16:56:03 (GMT) |
---|---|---|
committer | Larry Knox <lrknox@hdfgroup.org> | 2019-07-26 16:56:03 (GMT) |
commit | 094f14ef3857a47deb15bdfe45a1d4fe26655a6a (patch) | |
tree | e3aa525daacf5262a255b9b693e7f85b44d25bef /src | |
parent | 8008294578b5a133907d7ab1dd20e34735c54535 (diff) | |
download | hdf5-094f14ef3857a47deb15bdfe45a1d4fe26655a6a.zip hdf5-094f14ef3857a47deb15bdfe45a1d4fe26655a6a.tar.gz hdf5-094f14ef3857a47deb15bdfe45a1d4fe26655a6a.tar.bz2 |
Add HD to string functions.
Switched strtoul to strtoumax in H5FDs3comms.c.
Removed unused functions and variables in s3 and hdfs TestH5Pfapl*.java.
Update Copyright headers.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDros3.c | 34 | ||||
-rw-r--r-- | src/H5FDros3.h | 18 | ||||
-rw-r--r-- | src/H5FDs3comms.c | 42 | ||||
-rw-r--r-- | src/H5FDs3comms.h | 17 |
4 files changed, 58 insertions, 53 deletions
diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 8bf0420..86642aa 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* + * Read-Only S3 Virtual File Driver (VFD) + * * Programmer: Jacob Smith <jake.smith@hdfgroup.org> * 2017-10-13 * @@ -1334,14 +1334,14 @@ H5FD_ros3_cmp(const H5FD_t *_f1, HDassert(purl2->host != NULL); /* URL: SCHEME */ - if (strcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1); /* URL: HOST */ - if (strcmp(purl1->host, purl2->host)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->host, purl2->host)) HGOTO_DONE(-1); /* URL: PORT */ if (purl1->port && purl2->port) { - if (strcmp(purl1->port, purl2->port)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->port, purl2->port)) HGOTO_DONE(-1); } else if (purl1->port) { HGOTO_DONE(-1); } else if (purl2->port) { @@ -1350,7 +1350,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* URL: PATH */ if (purl1->path && purl2->path) { - if (strcmp(purl1->path, purl2->path)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->path, purl2->path)) HGOTO_DONE(-1); } else if (purl1->path && !purl2->path) { HGOTO_DONE(-1); } else if (purl2->path && !purl1->path) { @@ -1359,7 +1359,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* URL: QUERY */ if (purl1->query && purl2->query) { - if (strcmp(purl1->query, purl2->query)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->query, purl2->query)) HGOTO_DONE(-1); } else if (purl1->query && !purl2->query) { HGOTO_DONE(-1); } else if (purl2->query && !purl1->query) { @@ -1368,7 +1368,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* FAPL: AWS_REGION */ if (f1->fa.aws_region[0] != '\0' && f1->fa.aws_region[0] != '\0') { - if (strcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1); + if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1); } else if (f1->fa.aws_region[0] != '\0') { HGOTO_DONE(-1); } else if (f2->fa.aws_region[0] != '\0') { @@ -1377,7 +1377,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* FAPL: SECRET_ID */ if (f1->fa.secret_id[0] != '\0' && f1->fa.secret_id[0] != '\0') { - if (strcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1); + if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1); } else if (f1->fa.secret_id[0] != '\0') { HGOTO_DONE(-1); } else if (f2->fa.secret_id[0] != '\0') { @@ -1386,7 +1386,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* FAPL: SECRET_KEY */ if (f1->fa.secret_key[0] != '\0' && f1->fa.secret_key[0] != '\0') { - if (strcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1); + if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1); } else if (f1->fa.secret_key[0] != '\0') { HGOTO_DONE(-1); } else if (f2->fa.secret_key[0] != '\0') { diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 49e757c..7dfc95b 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* + * Read-Only S3 Virtual File Driver (VFD) + * * Programmer: John Mainzer * 2017-10-10 * diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 7caeacb..4c24866 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** + * Read-Only S3 Virtual File Driver (VFD) + * * Source for S3 Communications module * * ***NOT A FILE DRIVER*** @@ -1005,7 +1005,7 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle) { #ifdef H5_HAVE_ROS3_VFD - unsigned long int content_length = 0; + uintmax_t content_length = 0; CURL *curlh = NULL; char *end = NULL; char *headerresponse = NULL; @@ -1135,9 +1135,14 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) */ *end = '\0'; - content_length = strtoul((const char *)start, + content_length = strtoumax((const char *)start, NULL, 0); + + if (UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) { + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n"); + } + if (content_length == 0 || content_length == ULONG_MAX || errno == ERANGE) /* errno set by strtoul */ @@ -1156,7 +1161,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) if ( CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, - 0) ) + NULL) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_NOBODY). " @@ -1166,7 +1171,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) if ( CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, - 0) ) + NULL) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA). " @@ -2518,7 +2523,7 @@ done: * + internal error occurred. * + -1 :: unable to format profile label * + -2 :: profile name/label not found in file - * + -3 :: some other error + * + -3 :: some other error * * Programmer: Jacob Smith * 2018-02-27 @@ -2602,14 +2607,14 @@ H5FD__s3comms_load_aws_creds_from_file( "unable to format line prefix") /* found a matching name? */ - if (!strncmp(line_buffer, line_prefix, setting_name_len + 1)) { + if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { found_setting = 1; /* skip NULL destination buffer */ if (setting_pointers[setting_i] == NULL) break; - /* advance to end fo name in string */ + /* advance to end of name in string */ do { line_buffer++; } while (*line_buffer != 0 && *line_buffer != '='); @@ -2620,7 +2625,8 @@ H5FD__s3comms_load_aws_creds_from_file( line_buffer++; /* was pointing at '='; advance */ /* copy line buffer into out pointer */ - strcpy(setting_pointers[setting_i], (const char *)line_buffer); + HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, + HDstrlen(line_buffer)); /* "trim" tailing whitespace by replacing with null terminator*/ buffer_i = 0; @@ -2889,7 +2895,7 @@ H5FD_s3comms_parse_url(const char *str, * READ SCHEME * ***************/ - tmpstr = strchr(curstr, ':'); + tmpstr = HDstrchr(curstr, ':'); if (tmpstr == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction: probably not URL"); diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 0524c46..93a5a81 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -1,18 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** + * Read-Only S3 Virtual File Driver (VFD) * * This is the header for the S3 Communications module * |