diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-11-24 15:53:55 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-11-24 15:53:55 (GMT) |
commit | 0dfd13d13b2587cbdc3388a205159c25eb83588f (patch) | |
tree | 9a5b5fea712a6c8a12712762784dc848c548d6e3 | |
parent | 9db8ce23f6d3014ff6b2901580faa37bdecae4fa (diff) | |
download | hdf5-0dfd13d13b2587cbdc3388a205159c25eb83588f.zip hdf5-0dfd13d13b2587cbdc3388a205159c25eb83588f.tar.gz hdf5-0dfd13d13b2587cbdc3388a205159c25eb83588f.tar.bz2 |
[svn-r946] Changes since 19981121
----------------------
./src/H5Tconv.c
With my poor eyesight I missed the definitions of SCHAR_MIN
and SCHAR_MAX in <limits.h> and used CHAR_MIN and CHAR_MAX
incorrectly. I changed all occurrences of the latter to the
former and the new hardware integer type conversions now work
on Irix.
./configure.in
./configure [REGENERATED]
./src/H5config.h.in [REGENERATED]
./src/H5private.h
./src/H5.c
./test/h5test.c
Added a wrapper for HDsnprintf() that just calls sprintf() if
snprintf() isn't available.
./MANIFEST
Added Paul's new h5toh4 files.
-rw-r--r-- | MANIFEST | 11 | ||||
-rw-r--r-- | README | 2 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/H5.c | 41 | ||||
-rw-r--r-- | src/H5Tconv.c | 18 | ||||
-rw-r--r-- | src/H5config.h.in | 3 | ||||
-rw-r--r-- | src/H5private.h | 9 | ||||
-rw-r--r-- | test/h5test.c | 8 |
9 files changed, 79 insertions, 17 deletions
@@ -357,43 +357,54 @@ ./tools/h5dump.c ./tools/h5dump.h ./tools/h5dumputil.c +./tools/h5findshd.c ./tools/h5import.c ./tools/h5ls.c ./tools/h5repart.c +./tools/h5toh4.c +./tools/h5toh4.h ./tools/h5tools.c ./tools/h5tools.h ./tools/testh5dump.sh +./tools/testh5toh4 ./tools/testfiles/h5dumptst.c ./tools/testfiles/tall-1.ddl ./tools/testfiles/tall-2.ddl ./tools/testfiles/tall-3.ddl +./tools/testfiles/tall.dmp ./tools/testfiles/tall.h5 ./tools/testfiles/tattr-1.ddl ./tools/testfiles/tattr-2.ddl ./tools/testfiles/tattr-3.ddl ./tools/testfiles/tattr-4.ddl +./tools/testfiles/tattr.dmp ./tools/testfiles/tattr.h5 ./tools/testfiles/tcomp-1.ddl ./tools/testfiles/tcomp-2.ddl ./tools/testfiles/tcomp-3.ddl ./tools/testfiles/tcomp-4.ddl +./tools/testfiles/tcompound.dmp ./tools/testfiles/tcompound.h5 ./tools/testfiles/tdset-1.ddl ./tools/testfiles/tdset-2.ddl ./tools/testfiles/tdset-3.ddl ./tools/testfiles/tdset-4.ddl +./tools/testfiles/tdset.dmp ./tools/testfiles/tdset.h5 ./tools/testfiles/tgroup-1.ddl ./tools/testfiles/tgroup-2.ddl ./tools/testfiles/tgroup-3.ddl +./tools/testfiles/tgroup.dmp ./tools/testfiles/tgroup.h5 ./tools/testfiles/thlink-1.ddl ./tools/testfiles/thlink-2.ddl ./tools/testfiles/thlink-3.ddl ./tools/testfiles/thlink-4.ddl ./tools/testfiles/thlink-5.ddl +./tools/testfiles/thlink.dmp ./tools/testfiles/thlink.h5 ./tools/testfiles/tslink-1.ddl ./tools/testfiles/tslink-2.ddl +./tools/testfiles/tslink.dmp ./tools/testfiles/tslink.h5 @@ -1,4 +1,4 @@ -This is hdf5-1.1.29 released on Sat Nov 21 04:26:08 CST 1998 +This is hdf5-1.1.32 released on Tue Nov 24 10:39:49 CST 1998 Please refer to the INSTALL file for installation instructions. ------------------------------------------------------------------------------ @@ -3582,7 +3582,7 @@ else fi done -for ac_func in gettimeofday BSDgettimeofday difftime sigaction +for ac_func in gettimeofday BSDgettimeofday difftime sigaction snprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:3589: checking for $ac_func" >&5 diff --git a/configure.in b/configure.in index 6f1eba3..3a60f86 100644 --- a/configure.in +++ b/configure.in @@ -358,7 +358,7 @@ dnl ---------------------------------------------------------------------- dnl Check for functions. dnl AC_CHECK_FUNCS(getpwuid gethostname system getrusage fork waitpid) -AC_CHECK_FUNCS(gettimeofday BSDgettimeofday difftime sigaction) +AC_CHECK_FUNCS(gettimeofday BSDgettimeofday difftime sigaction snprintf) AC_TRY_COMPILE([#include<sys/types.h>], [off64_t n = 0;], @@ -438,6 +438,47 @@ H5close (void) /*------------------------------------------------------------------------- + * Function: HDsnprintf + * + * Purpose: Writes output to the string BUF under control of the format + * FMT that specifies how subsequent arguments are converted for + * output. It is similar to sprintf except that SIZE specifies + * the maximum number of characters to produce. The trailing + * null character is counted towards this limit, so you should + * allocated at least SIZE characters for the string BUF. + * + * Note: This function is for compatibility on systems that don't have + * snprintf(3). It doesn't actually check for overflow like the + * real snprintf() would. + * + * Return: Success: Number of characters stored, not including + * the terminating null. If this value equals + * SIZE then there was not enough space in BUF + * for all the output. + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Tuesday, November 24, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +HDsnprintf(char *buf, size_t __unused__ size, const char *fmt, ...) +{ + int n; + va_list ap; + + va_start(ap, fmt); + n = vsprintf(buf, fmt, ap); + va_end(ap); + return n; +} + + +/*------------------------------------------------------------------------- * Function: HDfprintf * * Purpose: Prints the optional arguments under the control of the format diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 481437e..914c255 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2023,7 +2023,7 @@ H5T_conv_uchar_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_char_short, FAIL); H5T_CONV_us(cdata, src_id, dst_id, buf, nelmts, - unsigned char, signed char, CHAR_MAX); + unsigned char, signed char, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -2481,7 +2481,7 @@ H5T_conv_short_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_short_char, FAIL); H5T_CONV_Ss(cdata, src_id, dst_id, buf, nelmts, - short, signed char, CHAR_MIN, CHAR_MAX); + short, signed char, SCHAR_MIN, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -2535,7 +2535,7 @@ H5T_conv_ushort_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ushort_char, FAIL); H5T_CONV_Us(cdata, src_id, dst_id, buf, nelmts, - unsigned short, signed char, CHAR_MAX); + unsigned short, signed char, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -2965,7 +2965,7 @@ H5T_conv_int_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_int_char, FAIL); H5T_CONV_Ss(cdata, src_id, dst_id, buf, nelmts, - int, signed char, CHAR_MIN, CHAR_MAX); + int, signed char, SCHAR_MIN, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -3019,7 +3019,7 @@ H5T_conv_uint_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_uint_char, FAIL); H5T_CONV_Us(cdata, src_id, dst_id, buf, nelmts, - unsigned, signed char, CHAR_MAX); + unsigned, signed char, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -3450,7 +3450,7 @@ H5T_conv_long_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_long_char, FAIL); H5T_CONV_Ss(cdata, src_id, dst_id, buf, nelmts, - long, signed char, CHAR_MIN, CHAR_MAX); + long, signed char, SCHAR_MIN, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -3504,7 +3504,7 @@ H5T_conv_ulong_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ulong_char, FAIL); H5T_CONV_Us(cdata, src_id, dst_id, buf, nelmts, - unsigned long, signed char, CHAR_MAX); + unsigned long, signed char, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -3936,7 +3936,7 @@ H5T_conv_llong_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_llong_char, FAIL); H5T_CONV_Ss(cdata, src_id, dst_id, buf, nelmts, - long_long, signed char, CHAR_MIN, CHAR_MAX); + long_long, signed char, SCHAR_MIN, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } @@ -3990,7 +3990,7 @@ H5T_conv_ullong_char(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { FUNC_ENTER(H5T_conv_ullong_char, FAIL); H5T_CONV_Us(cdata, src_id, dst_id, buf, nelmts, - unsigned long_long, signed char, CHAR_MAX); + unsigned long_long, signed char, SCHAR_MAX); FUNC_LEAVE(SUCCEED); } diff --git a/src/H5config.h.in b/src/H5config.h.in index 11a538a..95e70c1 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -173,6 +173,9 @@ /* Define if you have the sigaction function. */ #undef HAVE_SIGACTION +/* Define if you have the snprintf function. */ +#undef HAVE_SNPRINTF + /* Define if you have the system function. */ #undef HAVE_SYSTEM diff --git a/src/H5private.h b/src/H5private.h index abd104a..13fdcb2 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -595,6 +595,9 @@ int HDfprintf (FILE *stream, const char *fmt, ...); #define HDsin(X) sin(X) #define HDsinh(X) sinh(X) #define HDsleep(N) sleep(N) +#ifdef HAVE_SNPRINTF +# define HDsnprintf snprintf /*varargs*/ +#endif /* sprintf() variable arguments */ #define HDsqrt(X) sqrt(X) #define HDsrand(N) srand(N) @@ -662,9 +665,13 @@ int64_t HDstrtoll (const char *s, const char **rest, int base); /* * And now for a couple non-Posix functions... */ -extern char *strdup(const char *s); +char *strdup(const char *s); #define HDstrdup(S) strdup(S) +#ifndef HAVE_SNPRINTF +int HDsnprintf(char *buf, size_t size, const char *fmt, ...); +#endif + /* * These macros check whether debugging has been requested for a certain * package at run-time. Code for debugging is conditionally compiled by diff --git a/test/h5test.c b/test/h5test.c index 4144455..0e2ef53 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -94,15 +94,15 @@ h5_cleanup(hid_t fapl) break; /*nothing to remove*/ case H5F_LOW_SPLIT: - snprintf(temp, sizeof temp, "%s.raw", filename); + HDsnprintf(temp, sizeof temp, "%s.raw", filename); remove(temp); - snprintf(temp, sizeof temp, "%s.meta", filename); + HDsnprintf(temp, sizeof temp, "%s.meta", filename); remove(temp); break; case H5F_LOW_FAMILY: for (j=0; /*void*/; j++) { - snprintf(temp, sizeof temp, filename, j); + HDsnprintf(temp, sizeof temp, filename, j); if (access(temp, F_OK)<0) break; remove(temp); } @@ -180,7 +180,7 @@ h5_fixname(const char *basename, hid_t fapl, char *fullname, size_t size) /* Prepend the prefix value to the base name */ if (prefix && *prefix) { - if (snprintf(fullname, size, "%s/%s", prefix, basename)==(int)size) { + if (HDsnprintf(fullname, size, "%s/%s", prefix, basename)==(int)size) { return NULL; /*buffer is too small*/ } } else if (strlen(basename)>=size) { |