summaryrefslogtreecommitdiffstats
path: root/test/s3comms.c
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-04-30 16:07:50 (GMT)
committerGitHub <noreply@github.com>2021-04-30 16:07:50 (GMT)
commit27198d814a58640a6088f44b72d43d3bd4bb6629 (patch)
tree81ea462c0cd993553c7f3820d8ab288e9bea8ed5 /test/s3comms.c
parent4155e595e2ab16d81de79ed19d7de4fab5eb3302 (diff)
downloadhdf5-27198d814a58640a6088f44b72d43d3bd4bb6629.zip
hdf5-27198d814a58640a6088f44b72d43d3bd4bb6629.tar.gz
hdf5-27198d814a58640a6088f44b72d43d3bd4bb6629.tar.bz2
Hdf5 1 10 merge of printf specifiers and VS2015 min changes (#612)
* HDFFV-10865 - merge from dev, HDFArray perf fix. * Remove duplicate setting * Whitespace changes after clang format * Undo version 11 clang format changes * Merge CMake changes from develop * test testing script merge from develop * Update supported platforms * PR#3 merge from develop * Merge gcc 10 diagnostics option from develop * Merge #318 OSX changes from develop * Merge small changes from develop * Minor non-space formatting changes * #386 copyright corrections for java folder * Merges from develop #358 patches from vtk #361 fix header guard spelling * Merge updates #358 patches from vtk #361 fix header guard spelling * format fix * Fix missing underscore and make H5public.h closer to dev * Merges from develop #340 clang -Wformat-security warnings #360 Fixed uninitialized warnings header guard underscore cleanup JNI cleanup * format alignment * Add missing test ref file * Merge #380 from develop * Finish java merges from develop * Fix java issues with tests and javadoc * Correct use of attribute access plist * Remove debug code * Remove unused variable * Change file access to read only for java tests * Split clang format operations. * More javadoc comments * Remove pre-split setting * format source * Change windows TS to use older VS. * Mostly all javadoc fixes, one argument rename. * synch file * Merge of long double fix and compiler flags * HDFFV-11229 merge changes from develop * HDFFV-11229 correct test script * HDFFV-11229 update autotools test script for two ref files * HDFFV-11229 merge dev changes for long double display in tools * Committing clang-format changes * minor whitespace * remove unneeded macro * Committing clang-format changes * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument Update pkgconfig scripts for parallel builds. Fix install COPYING file reference. Remove unused round defines. Change CMake default setting of BUILD_CPP to off. * Fortran target depends * Remove incorrect source attribute * Revert define removal * printf specifiers and VS2015 min changes * Committing clang-format changes * Add time struct Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test/s3comms.c')
-rw-r--r--test/s3comms.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/test/s3comms.c b/test/s3comms.c
index b07ef42..2723921 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -299,7 +299,7 @@
*----------------------------------------------------------------------------
*/
#define JSVERIFY_STR(expected, actual, reason) \
- if (strcmp((actual), (expected)) != 0) { \
+ if (HDstrcmp((actual), (expected)) != 0) { \
JSERR_STR((expected), (actual), (reason)); \
goto error; \
} /* JSVERIFY_STR */
@@ -347,7 +347,7 @@
*----------------------------------------------------------------------------
*/
#define JSVERIFY_STR(actual, expected, reason) \
- if (strcmp((actual), (expected)) != 0) { \
+ if (HDstrcmp((actual), (expected)) != 0) { \
JSERR_STR((expected), (actual), (reason)); \
goto error; \
} /* JSVERIFY_STR */
@@ -1269,10 +1269,10 @@ test_HMAC_SHA256(void)
cases[i].msg);
if (cases[i].ret == SUCCEED) {
#ifdef VERBOSE
- if (0 != strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp))) {
+ if (0 != HDstrncmp(cases[i].exp, dest, HDstrlen(cases[i].exp))) {
/* print out how wrong things are, and then fail
*/
- dest = (char *)realloc(dest, cases[i].dest_size + 1);
+ dest = (char *)HDrealloc(dest, cases[i].dest_size + 1);
HDassert(dest != NULL);
dest[cases[i].dest_size] = 0;
HDfprintf(stdout, "ERROR:\n!!! \"%s\"\n != \"%s\"\n", cases[i].exp, dest);
@@ -1281,17 +1281,17 @@ test_HMAC_SHA256(void)
#else /* VERBOSE not defined */
/* simple pass/fail test
*/
- JSVERIFY(0, strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), NULL);
+ JSVERIFY(0, HDstrncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), NULL);
#endif /* VERBOSE */
}
- free(dest);
+ HDfree(dest);
}
PASSED();
return 0;
error:
- free(dest);
+ HDfree(dest);
return -1;
} /* end test_HMAC_SHA256() */
@@ -1357,9 +1357,9 @@ test_nlowercase(void)
JSVERIFY(SUCCEED, H5FD_s3comms_nlowercase(dest, cases[i].in, cases[i].len), cases[i].in)
if (cases[i].len > 0) {
- JSVERIFY(0, strncmp(dest, cases[i].exp, cases[i].len), NULL)
+ JSVERIFY(0, HDstrncmp(dest, cases[i].exp, cases[i].len), NULL)
}
- free(dest);
+ HDfree(dest);
} /* end for each testcase */
JSVERIFY(FAIL, H5FD_s3comms_nlowercase(NULL, cases[0].in, cases[0].len), "null distination should fail")
@@ -1368,7 +1368,7 @@ test_nlowercase(void)
return 0;
error:
- free(dest);
+ HDfree(dest);
return -1;
} /* end test_nlowercase() */
@@ -1729,7 +1729,7 @@ test_percent_encode_char(void)
JSVERIFY(SUCCEED, H5FD_s3comms_percent_encode_char(dest, (const unsigned char)cases[i].c, &dest_len),
NULL)
JSVERIFY(cases[i].exp_len, dest_len, NULL)
- JSVERIFY(0, strncmp(dest, cases[i].exp, dest_len), NULL)
+ JSVERIFY(0, HDstrncmp(dest, cases[i].exp, dest_len), NULL)
JSVERIFY_STR(cases[i].exp, dest, NULL)
}
@@ -1768,8 +1768,8 @@ test_s3r_get_filesize(void)
*/
if (FALSE == s3_test_bucket_defined) {
SKIPPED();
- puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
- fflush(stdout);
+ HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
+ HDfflush(stdout);
return 0;
}
@@ -1828,14 +1828,14 @@ test_s3r_open(void)
if (s3_test_credentials_loaded == 0) {
SKIPPED();
- puts(" s3 credentials are not loaded");
- fflush(stdout);
+ HDputs(" s3 credentials are not loaded");
+ HDfflush(stdout);
return 0;
}
if (FALSE == s3_test_bucket_defined) {
SKIPPED();
- puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
- fflush(stdout);
+ HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
+ HDfflush(stdout);
return 0;
}
@@ -1861,7 +1861,7 @@ test_s3r_open(void)
FAIL_IF(purl->port == NULL);
FAIL_IF(5 < HDsnprintf(purl->port, 5, "9000"))
}
- else if (strcmp(purl->port, "9000") != 0) {
+ else if (HDstrcmp(purl->port, "9000") != 0) {
FAIL_IF(5 < HDsnprintf(purl->port, 5, "9000"))
}
else {
@@ -2032,8 +2032,8 @@ test_s3r_read(void)
*/
if (FALSE == s3_test_bucket_defined) {
SKIPPED();
- puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
- fflush(stdout);
+ HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
+ HDfflush(stdout);
return 0;
}
@@ -2093,7 +2093,7 @@ test_s3r_read(void)
JSVERIFY(SUCCEED, H5FD_s3comms_s3r_read(handle, (haddr_t)6370, (size_t)0, buffer), NULL)
JSVERIFY(
0,
- strncmp(
+ HDstrncmp(
buffer,
"And my soul from out that shadow that lies floating on the floor\nShall be lifted—nevermore!\n",
94),
@@ -2110,7 +2110,7 @@ test_s3r_read(void)
H5FD_s3comms_s3r_read(handle, (haddr_t)6400, (size_t)100, /* 6400+100 > 6464 */
buffer),
NULL)
- JSVERIFY(0, strcmp("", buffer), NULL)
+ JSVERIFY(0, HDstrcmp("", buffer), NULL)
/************************
* read starts past eof *
@@ -2120,14 +2120,14 @@ test_s3r_read(void)
H5FD_s3comms_s3r_read(handle, (haddr_t)1200699, /* 1200699 > 6464 */
(size_t)100, buffer),
NULL)
- JSVERIFY(0, strcmp("", buffer), NULL)
+ JSVERIFY(0, HDstrcmp("", buffer), NULL)
/**********************
* read starts on eof *
**********************/
JSVERIFY(FAIL, H5FD_s3comms_s3r_read(handle, (haddr_t)6464, (size_t)0, buffer), NULL)
- JSVERIFY(0, strcmp("", buffer), NULL)
+ JSVERIFY(0, HDstrcmp("", buffer), NULL)
/*************
* TEAR DOWN *
@@ -2217,10 +2217,10 @@ test_signing_key(void)
JSVERIFY(SUCCEED, H5FD_s3comms_signing_key(key, cases[i].secret_key, cases[i].region, cases[i].when),
NULL)
- JSVERIFY(0, strncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH),
- cases[i].exp)
+ JSVERIFY(0, HDstrncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH),
+ (const char *)cases[i].exp)
- free(key);
+ HDfree(key);
key = NULL;
}
@@ -2243,7 +2243,7 @@ test_signing_key(void)
JSVERIFY(FAIL, H5FD_s3comms_signing_key(key, cases[0].secret_key, cases[0].region, NULL),
"time string cannot be NULL")
- free(key);
+ HDfree(key);
key = NULL;
PASSED();
@@ -2251,7 +2251,7 @@ test_signing_key(void)
error:
if (key != NULL) {
- free(key);
+ HDfree(key);
}
return -1;
@@ -2399,9 +2399,9 @@ test_trim(void)
JSVERIFY(SUCCEED, H5FD_s3comms_trim(dest, str, cases[i].in_len, &dest_len), NULL)
JSVERIFY(cases[i].exp_len, dest_len, cases[i].in)
if (dest_len > 0) {
- JSVERIFY(0, strncmp(cases[i].exp, dest, dest_len), cases[i].exp)
+ JSVERIFY(0, HDstrncmp(cases[i].exp, dest, dest_len), cases[i].exp)
}
- free(str);
+ HDfree(str);
str = NULL;
} /* end for each testcase */
@@ -2412,9 +2412,9 @@ test_trim(void)
HDassert(str == NULL);
str = (char *)HDmalloc(sizeof(char *) * 11);
HDassert(str != NULL);
- memcpy(str, "some text ", 11); /* string with null terminator */
+ HDmemcpy(str, "some text ", 11); /* string with null terminator */
JSVERIFY(FAIL, H5FD_s3comms_trim(NULL, str, 10, &dest_len), "destination for trim cannot be NULL");
- free(str);
+ HDfree(str);
str = NULL;
PASSED();
@@ -2422,7 +2422,7 @@ test_trim(void)
error:
if (str != NULL) {
- free(str);
+ HDfree(str);
}
return -1;
@@ -2513,9 +2513,9 @@ test_uriencode(void)
H5FD_s3comms_uriencode(dest, cases[i].str, str_len, cases[i].encode_slash, &dest_written),
NULL);
JSVERIFY(HDstrlen(cases[i].expected), dest_written, NULL)
- JSVERIFY(0, strncmp(dest, cases[i].expected, dest_written), cases[i].expected);
+ JSVERIFY(0, HDstrncmp(dest, cases[i].expected, dest_written), cases[i].expected);
- free(dest);
+ HDfree(dest);
dest = NULL;
} /* end for each testcase */
@@ -2531,7 +2531,7 @@ test_uriencode(void)
JSVERIFY(FAIL, H5FD_s3comms_uriencode(dest, NULL, 5, false, &dest_written),
"source string cannot be NULL");
- free(dest);
+ HDfree(dest);
dest = NULL;
PASSED();
@@ -2539,7 +2539,7 @@ test_uriencode(void)
error:
if (dest != NULL) {
- free(dest);
+ HDfree(dest);
}
return -1;