summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-11-24 15:53:55 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-11-24 15:53:55 (GMT)
commit0dfd13d13b2587cbdc3388a205159c25eb83588f (patch)
tree9a5b5fea712a6c8a12712762784dc848c548d6e3 /src
parent9db8ce23f6d3014ff6b2901580faa37bdecae4fa (diff)
downloadhdf5-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.
Diffstat (limited to 'src')
-rw-r--r--src/H5.c41
-rw-r--r--src/H5Tconv.c18
-rw-r--r--src/H5config.h.in3
-rw-r--r--src/H5private.h9
4 files changed, 61 insertions, 10 deletions
diff --git a/src/H5.c b/src/H5.c
index f97409d..09f3c85 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -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