summaryrefslogtreecommitdiffstats
path: root/test/s3comms.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-04-27 15:07:36 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-07-07 15:49:55 (GMT)
commit9159b93da623e5fdd95236322d79d003cce14c61 (patch)
treeff1dcc752b8b42dd06acd9f027b29b132a4149f2 /test/s3comms.c
parent345443f9ad239297e6dadbbf2153c12cbed2410e (diff)
downloadhdf5-9159b93da623e5fdd95236322d79d003cce14c61.zip
hdf5-9159b93da623e5fdd95236322d79d003cce14c61.tar.gz
hdf5-9159b93da623e5fdd95236322d79d003cce14c61.tar.bz2
Fix code that made GCC complain about a NULL or `unsigned char *` arguments for
"%s". XXX The duplication between test/ros3.c test/s3comms.c is really annoying.
Diffstat (limited to 'test/s3comms.c')
-rw-r--r--test/s3comms.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/test/s3comms.c b/test/s3comms.c
index 9453b75..77dfc7d 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -185,14 +185,19 @@ if (!(condition)) { \
*
*----------------------------------------------------------------------------
*/
+static inline void
+jserr_long(long expected, long actual, const char *reason)
+{
+ if (reason != NULL) {
+ HDprintf("%s\n", reason);
+ } else {
+ HDprintf(" ! Expected %ld\n ! Actual %ld\n", expected, actual);
+ }
+}
+
#define JSERR_LONG(expected, actual, reason) { \
JSFAILED_AT() \
- if (reason!= NULL) { \
- HDprintf("%s\n", (reason)); \
- } else { \
- HDprintf(" ! Expected %ld\n ! Actual %ld\n", \
- (long)(expected), (long)(actual)); \
- } \
+ jserr_long((long)(expected), (long)(actual), reason);\
}
@@ -224,14 +229,19 @@ if (!(condition)) { \
*
*----------------------------------------------------------------------------
*/
+static inline void
+jserr_str(const char *expected, const char *actual, const char *reason)
+{
+ if (reason != NULL) {
+ HDprintf("%s\n", reason);
+ } else {
+ HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", expected, actual);
+ }
+}
+
#define JSERR_STR(expected, actual, reason) { \
JSFAILED_AT() \
- if ((reason) != NULL) { \
- HDprintf("%s\n", (reason)); \
- } else { \
- HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \
- (expected), (actual)); \
- } \
+ jserr_str((expected), (actual), (reason)); \
}
#ifdef JSVERIFY_EXP_ACT
@@ -2260,7 +2270,7 @@ test_signing_key(void)
strncmp((const char *)cases[i].exp,
(const char *)key,
SHA256_DIGEST_LENGTH),
- cases[i].exp )
+ (const char *)cases[i].exp )
free(key);
key = NULL;