summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-03-23 22:16:28 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-03-23 22:16:28 (GMT)
commit61b5fa8e2d69ce651ba4dd4757350be347c660a6 (patch)
tree68d90395fc95c994acc4f81f5618494a1c5475d3
parentb424ce1b3f357b50cea356a00d61c46d67345926 (diff)
downloadhdf5-61b5fa8e2d69ce651ba4dd4757350be347c660a6.zip
hdf5-61b5fa8e2d69ce651ba4dd4757350be347c660a6.tar.gz
hdf5-61b5fa8e2d69ce651ba4dd4757350be347c660a6.tar.bz2
[svn-r26551] Description:
Remove the VSNPRINTF_WORKS macro, it's working around bugs in old SGI & HP compilers. Tested on: MacOSX/64 10.10.2 (amazon) w/serial & parallel (h5committest not required on this branch)
-rw-r--r--config/cmake/H5pubconf.h.in4
-rw-r--r--configure.ac54
-rw-r--r--src/H5E.c16
-rw-r--r--src/H5Eint.c16
-rw-r--r--tools/lib/h5tools_str.c6
-rw-r--r--tools/lib/h5tools_utils.c19
6 files changed, 5 insertions, 110 deletions
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index 7c3a249..08ff406 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -640,10 +640,6 @@
/* Version number of package */
#define H5_VERSION "@HDF5_PACKAGE_VERSION_STRING@"
-/* Define if vsnprintf() returns the correct value for formatted strings that
- don't fit into size allowed */
-#cmakedefine H5_VSNPRINTF_WORKS @H5_VSNPRINTF_WORKS@
-
/* Check exception handling functions during data conversions */
#cmakedefine H5_WANT_DCONV_EXCEPTION @H5_WANT_DCONV_EXCEPTION@
diff --git a/configure.ac b/configure.ac
index 1c6c6bb..4222c62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1727,59 +1727,7 @@ AC_CHECK_FUNCS([gethostname getpwuid getrusage gettimeofday])
AC_CHECK_FUNCS([lstat rand_r random setsysinfo])
AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask])
AC_CHECK_FUNCS([snprintf srandom strdup symlink system])
-AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid])
-
-## Check for vsnprintf() separately, so we can detect situations where it
-## doesn't return the correct size for formatted strings that are too large
-## for the buffer provided
-AC_CHECK_FUNCS([vsnprintf],
-
- ## Check if vsnprintf() returns correct size for strings that don't fit
- ## into the size allowed. If vsnprintf() works correctly on this platform,
- ## it should return a value of 42 for the test below
- ##
- ## Note that vsnprintf fails in two different ways:
- ## - In IRIX64, calls to vnsprintf() with a formatted string that
- ## is larger than the buffer size allowed incorrectly
- ## return the size of the buffer minus one.
- ## - In HP/UX, calls to vsnprintf() with a formatted string that
- ## is larger than the buffer size allowed incorrectly
- ## return (-1)
- AC_MSG_CHECKING([if vsnprintf returns correct value])
-
- AC_CACHE_VAL([hdf5_cv_vsnprintf_works],
- AC_TRY_RUN([
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-int test_vsnprintf(const char *fmt,...)
-{
- va_list ap;
- char *s = malloc(16);
- int ret;
-
- va_start(ap, fmt);
- ret=vsnprintf(s,16,"%s",ap);
- va_end(ap);
-
- return(ret!=42 ? 1 : 0);
-}
-
-int main(void)
-{
- exit(test_vsnprintf("%s","A string that is longer than 16 characters"));
-}
- ],[hdf5_cv_vsnprintf_works=yes],[hdf5_cv_vsnprintf_works=no],))
-
- if test ${hdf5_cv_vsnprintf_works} = "yes"; then
- AC_MSG_RESULT([yes])
- AC_DEFINE([VSNPRINTF_WORKS], [1],
- [Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed])
- else
- AC_MSG_RESULT([no])
- fi
- ,)
+AC_CHECK_FUNCS([tmpfile asprintf vasprintf vsnprintf waitpid])
## ----------------------------------------------------------------------
## Check that a lone colon can be used as an argument
diff --git a/src/H5E.c b/src/H5E.c
index f36ab9a..c3c7685 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -1397,17 +1397,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* If the description doesn't fit into the initial buffer size, allocate more space and try again */
- while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap))
-#ifdef H5_VSNPRINTF_WORKS
- >
-#else /* H5_VSNPRINTF_WORKS */
- >=
-#endif /* H5_VSNPRINTF_WORKS */
- (tmp_len - 1)
-#ifndef H5_VSNPRINTF_WORKS
- || (desc_len < 0)
-#endif /* H5_VSNPRINTF_WORKS */
- ) {
+ while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
/* shutdown & restart the va_list */
va_end(ap);
va_start(ap, fmt);
@@ -1416,11 +1406,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
H5MM_xfree(tmp);
/* Allocate a description of the appropriate length */
-#ifdef H5_VSNPRINTF_WORKS
tmp_len = desc_len + 1;
-#else /* H5_VSNPRINTF_WORKS */
- tmp_len = 2 * tmp_len;
-#endif /* H5_VSNPRINTF_WORKS */
if(NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end while */
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 88dfdee..2092566 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -741,17 +741,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
HGOTO_DONE(FAIL)
/* If the description doesn't fit into the initial buffer size, allocate more space and try again */
- while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap))
-#ifdef H5_VSNPRINTF_WORKS
- >
-#else /* H5_VSNPRINTF_WORKS */
- >=
-#endif /* H5_VSNPRINTF_WORKS */
- (tmp_len - 1)
-#ifndef H5_VSNPRINTF_WORKS
- || (desc_len < 0)
-#endif /* H5_VSNPRINTF_WORKS */
- ) {
+ while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) {
/* shutdown & restart the va_list */
va_end(ap);
va_start(ap, fmt);
@@ -760,11 +750,7 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin
H5MM_xfree(tmp);
/* Allocate a description of the appropriate length */
-#ifdef H5_VSNPRINTF_WORKS
tmp_len = desc_len + 1;
-#else /* H5_VSNPRINTF_WORKS */
- tmp_len = 2 * tmp_len;
-#endif /* H5_VSNPRINTF_WORKS */
if(NULL == (tmp = H5MM_malloc((size_t)tmp_len)))
HGOTO_DONE(FAIL)
} /* end while */
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 3160cfa..6b94b68 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -155,11 +155,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
* to lack of buffer size, so try one more time after realloc more
* buffer size before return NULL.
*/
- if (nchars < 0
-#ifndef H5_VSNPRINTF_WORKS
- && (HDstrlen(str->s) < str->nalloc)
-#endif
- ) {
+ if (nchars < 0) {
/* failure, such as bad format */
return NULL;
}
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index d7c5adb..fc8cf1d 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -89,28 +89,11 @@ void parallel_print(const char* format, ...)
HDvprintf(format, ap);
else {
if(overflow_file == NULL) /*no overflow has occurred yet */ {
-#if 0
- printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset);
-#endif
bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
-#if 0
- printf("bytes_written=%ld\n", (long)bytes_written);
-#endif
HDva_end(ap);
HDva_start(ap, format);
-#if 0
- printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset);
-#endif
-
- if ((bytes_written < 0) ||
-#ifdef H5_VSNPRINTF_WORKS
- (bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
-#else
- ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset))
-#endif
- )
- {
+ if((bytes_written < 0) || (bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) {
/* Terminate the outbuff at the end of the previous output */
outBuff[outBuffOffset] = '\0';