summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-10-18 16:47:34 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-10-18 16:47:34 (GMT)
commit4efd9af4fa44a920f81936500d859dcb2395ea49 (patch)
treefa5897f1eabdf610133cfce5d2e14e56cd724065
parentdc90cfc1c2619b3e5455ed2da6a627e1296f1cbc (diff)
downloadhdf5-4efd9af4fa44a920f81936500d859dcb2395ea49.zip
hdf5-4efd9af4fa44a920f81936500d859dcb2395ea49.tar.gz
hdf5-4efd9af4fa44a920f81936500d859dcb2395ea49.tar.bz2
[svn-r21597] Issue 7701 - fix for H5LTdtype_to_text. I made two corrections: 1. I changed all snprintf to HDsnprintf; 2. I corrected all wrong length passed to snprintf which cause Mac machines to fail.
Tested on jam. But I tested the same change for 1.8 branch on jam, koala, linew, Windows, and Apple.
-rw-r--r--hl/src/H5LT.c172
1 files changed, 87 insertions, 85 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 4e88053..1cc1017 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -18,11 +18,13 @@
#include <assert.h>
#include <stdio.h>
#include "H5LTprivate.h"
+#include "H5private.h"
/* For Lex and Yacc */
#define COL 3
#define LIMIT 512
#define INCREMENT 1024
+#define TMP_LEN 256
#define MAX(a,b) (((a)>(b)) ? (a) : (b))
int input_len;
char *myinput;
@@ -1675,13 +1677,13 @@ out:
static char*
indentation(size_t x, char* str, hbool_t no_u_buf, size_t *s_len)
{
- char tmp_str[256];
+ char tmp_str[TMP_LEN];
if (x < 80) {
memset(tmp_str, ' ', x);
tmp_str[x]='\0';
} else
- snprintf(tmp_str, *s_len, "error: the indentation exceeds the number of cols.");
+ HDsnprintf(tmp_str, TMP_LEN, "error: the indentation exceeds the number of cols.");
if(!(str = realloc_and_append(no_u_buf, s_len, str, tmp_str)))
goto out;
@@ -1711,7 +1713,7 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
unsigned char *value = NULL; /*value array */
unsigned char *copy = NULL; /*a pointer to value array */
int nmembs; /*number of members */
- char tmp_str[256];
+ char tmp_str[TMP_LEN];
int nchars; /*number of output characters */
hid_t super = -1; /*enum base integer type */
hid_t native = -1; /*native integer data type */
@@ -1764,10 +1766,10 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
for (i = 0; i < nmembs; i++) {
if(!(str = indentation(indt + COL, str, no_ubuf, str_len)))
goto out;
- nchars = snprintf(tmp_str, *str_len, "\"%s\"", name[i]);
+ nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]);
if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
- snprintf(tmp_str, *str_len, "%*s ", MAX(0, 16 - nchars), "");
+ HDsnprintf(tmp_str, TMP_LEN, "%*s ", MAX(0, 16 - nchars), "");
if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
@@ -1775,13 +1777,13 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
*strangely, unless use another pointer "copy".*/
copy = value+i*dst_size;
if (H5T_SGN_NONE == H5Tget_sign(native))
- snprintf(tmp_str, *str_len, "%u", *((unsigned int*)((void *)copy)));
+ HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)((void *)copy)));
else
- snprintf(tmp_str, *str_len, "%d", *((int*)((void *)copy)));
+ HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)((void *)copy)));
if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
- snprintf(tmp_str, *str_len, ";\n");
+ HDsnprintf(tmp_str, TMP_LEN, ";\n");
if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
}
@@ -1799,7 +1801,7 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
out:
if(0 == nmembs) {
- snprintf(tmp_str, *str_len, "\n%*s <empty>", indt + 4, "");
+ HDsnprintf(tmp_str, TMP_LEN, "\n%*s <empty>", indt + 4, "");
str = realloc_and_append(no_ubuf, str_len, str, tmp_str);
} /* end if */
@@ -1888,14 +1890,14 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
hbool_t no_user_buf)
{
H5T_class_t tcls;
- char tmp_str[256];
+ char tmp_str[TMP_LEN];
int i;
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, NULL)))
goto out;
if(lang != H5LT_DDL) {
- snprintf(dt_str, *slen, "only DDL is supported for now");
+ HDsnprintf(dt_str, *slen, "only DDL is supported for now");
goto out;
}
@@ -1905,81 +1907,81 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
switch (tcls) {
case H5T_INTEGER:
if (H5Tequal(dtype, H5T_STD_I8BE)) {
- snprintf(dt_str, *slen, "H5T_STD_I8BE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_I8BE");
} else if (H5Tequal(dtype, H5T_STD_I8LE)) {
- snprintf(dt_str, *slen, "H5T_STD_I8LE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_I8LE");
} else if (H5Tequal(dtype, H5T_STD_I16BE)) {
- snprintf(dt_str, *slen, "H5T_STD_I16BE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_I16BE");
} else if (H5Tequal(dtype, H5T_STD_I16LE)) {
- snprintf(dt_str, *slen, "H5T_STD_I16LE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_I16LE");
} else if (H5Tequal(dtype, H5T_STD_I32BE)) {
- snprintf(dt_str, *slen, "H5T_STD_I32BE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_I32BE");
} else if (H5Tequal(dtype, H5T_STD_I32LE)) {
- snprintf(dt_str, *slen, "H5T_STD_I32LE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_I32LE");
} else if (H5Tequal(dtype, H5T_STD_I64BE)) {
- snprintf(dt_str, *slen, "H5T_STD_I64BE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_I64BE");
} else if (H5Tequal(dtype, H5T_STD_I64LE)) {
- snprintf(dt_str, *slen, "H5T_STD_I64LE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_I64LE");
} else if (H5Tequal(dtype, H5T_STD_U8BE)) {
- snprintf(dt_str, *slen, "H5T_STD_U8BE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_U8BE");
} else if (H5Tequal(dtype, H5T_STD_U8LE)) {
- snprintf(dt_str, *slen, "H5T_STD_U8LE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_U8LE");
} else if (H5Tequal(dtype, H5T_STD_U16BE)) {
- snprintf(dt_str, *slen, "H5T_STD_U16BE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_U16BE");
} else if (H5Tequal(dtype, H5T_STD_U16LE)) {
- snprintf(dt_str, *slen, "H5T_STD_U16LE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_U16LE");
} else if (H5Tequal(dtype, H5T_STD_U32BE)) {
- snprintf(dt_str, *slen, "H5T_STD_U32BE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_U32BE");
} else if (H5Tequal(dtype, H5T_STD_U32LE)) {
- snprintf(dt_str, *slen, "H5T_STD_U32LE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_U32LE");
} else if (H5Tequal(dtype, H5T_STD_U64BE)) {
- snprintf(dt_str, *slen, "H5T_STD_U64BE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_U64BE");
} else if (H5Tequal(dtype, H5T_STD_U64LE)) {
- snprintf(dt_str, *slen, "H5T_STD_U64LE");
+ HDsnprintf(dt_str, *slen, "H5T_STD_U64LE");
} else if (H5Tequal(dtype, H5T_NATIVE_SCHAR)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_SCHAR");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_SCHAR");
} else if (H5Tequal(dtype, H5T_NATIVE_UCHAR)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_UCHAR");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_UCHAR");
} else if (H5Tequal(dtype, H5T_NATIVE_SHORT)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_SHORT");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_SHORT");
} else if (H5Tequal(dtype, H5T_NATIVE_USHORT)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_USHORT");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_USHORT");
} else if (H5Tequal(dtype, H5T_NATIVE_INT)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_INT");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_INT");
} else if (H5Tequal(dtype, H5T_NATIVE_UINT)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_UINT");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_UINT");
} else if (H5Tequal(dtype, H5T_NATIVE_LONG)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_LONG");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_LONG");
} else if (H5Tequal(dtype, H5T_NATIVE_ULONG)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_ULONG");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_ULONG");
} else if (H5Tequal(dtype, H5T_NATIVE_LLONG)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_LLONG");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_LLONG");
} else if (H5Tequal(dtype, H5T_NATIVE_ULLONG)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_ULLONG");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_ULLONG");
} else {
- snprintf(dt_str, *slen, "undefined integer");
+ HDsnprintf(dt_str, *slen, "undefined integer");
}
break;
case H5T_FLOAT:
if (H5Tequal(dtype, H5T_IEEE_F32BE)) {
- snprintf(dt_str, *slen, "H5T_IEEE_F32BE");
+ HDsnprintf(dt_str, *slen, "H5T_IEEE_F32BE");
} else if (H5Tequal(dtype, H5T_IEEE_F32LE)) {
- snprintf(dt_str, *slen, "H5T_IEEE_F32LE");
+ HDsnprintf(dt_str, *slen, "H5T_IEEE_F32LE");
} else if (H5Tequal(dtype, H5T_IEEE_F64BE)) {
- snprintf(dt_str, *slen, "H5T_IEEE_F64BE");
+ HDsnprintf(dt_str, *slen, "H5T_IEEE_F64BE");
} else if (H5Tequal(dtype, H5T_IEEE_F64LE)) {
- snprintf(dt_str, *slen, "H5T_IEEE_F64LE");
+ HDsnprintf(dt_str, *slen, "H5T_IEEE_F64LE");
} else if (H5Tequal(dtype, H5T_NATIVE_FLOAT)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_FLOAT");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_FLOAT");
} else if (H5Tequal(dtype, H5T_NATIVE_DOUBLE)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_DOUBLE");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_DOUBLE");
#if H5_SIZEOF_LONG_DOUBLE !=0
} else if (H5Tequal(dtype, H5T_NATIVE_LDOUBLE)) {
- snprintf(dt_str, *slen, "H5T_NATIVE_LDOUBLE");
+ HDsnprintf(dt_str, *slen, "H5T_NATIVE_LDOUBLE");
#endif
} else {
- snprintf(dt_str, *slen, "undefined float");
+ HDsnprintf(dt_str, *slen, "undefined float");
}
break;
@@ -2008,16 +2010,16 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
goto out;
/* Print lead-in */
- snprintf(dt_str, *slen, "H5T_STRING {\n");
+ HDsnprintf(dt_str, *slen, "H5T_STRING {\n");
indent += COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
if(is_vlstr)
- snprintf(tmp_str, *slen, "STRSIZE H5T_VARIABLE;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "STRSIZE H5T_VARIABLE;\n");
else
- snprintf(tmp_str, *slen, "STRSIZE %d;\n", (int)size);
+ HDsnprintf(tmp_str, TMP_LEN, "STRSIZE %d;\n", (int)size);
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2026,13 +2028,13 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
goto out;
if (str_pad == H5T_STR_NULLTERM)
- snprintf(tmp_str, *slen, "STRPAD H5T_STR_NULLTERM;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLTERM;\n");
else if (str_pad == H5T_STR_NULLPAD)
- snprintf(tmp_str, *slen, "STRPAD H5T_STR_NULLPAD;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLPAD;\n");
else if (str_pad == H5T_STR_SPACEPAD)
- snprintf(tmp_str, *slen, "STRPAD H5T_STR_SPACEPAD;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_SPACEPAD;\n");
else
- snprintf(tmp_str, *slen, "STRPAD H5T_STR_ERROR;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_ERROR;\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2041,11 +2043,11 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
goto out;
if (cset == H5T_CSET_ASCII)
- snprintf(tmp_str, *slen, "CSET H5T_CSET_ASCII;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_ASCII;\n");
else if (cset == H5T_CSET_UTF8)
- snprintf(tmp_str, *slen, "CSET H5T_CSET_UTF8;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_UTF8;\n");
else
- snprintf(tmp_str, *slen, "CSET unknown;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "CSET unknown;\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2070,7 +2072,7 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
/* Check C variable-length string first. Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
- snprintf(tmp_str, *slen, "CTYPE H5T_C_S1;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
goto next;
@@ -2088,7 +2090,7 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
}
if (H5Tequal(tmp_type, str_type)) {
- snprintf(tmp_str, *slen, "CTYPE H5T_C_S1;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
goto next;
@@ -2109,7 +2111,7 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
/* Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
- snprintf(tmp_str, *slen, "CTYPE H5T_FORTRAN_S1;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
goto next;
@@ -2128,14 +2130,14 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
/* Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
- snprintf(tmp_str, *slen, "CTYPE H5T_FORTRAN_S1;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
goto next;
}
/* Type doesn't match any of above. */
- snprintf(tmp_str, *slen, "CTYPE unknown_one_character_type;\n");
+ HDsnprintf(tmp_str, TMP_LEN, "CTYPE unknown_one_character_type;\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2147,7 +2149,7 @@ next:
indent -= COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
- snprintf(tmp_str, *slen, "}");
+ HDsnprintf(tmp_str, TMP_LEN, "}");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2158,12 +2160,12 @@ next:
char *tag = NULL;
/* Print lead-in */
- snprintf(dt_str, *slen, "H5T_OPAQUE {\n");
+ HDsnprintf(dt_str, *slen, "H5T_OPAQUE {\n");
indent += COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
- snprintf(tmp_str, *slen, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype));
+ HDsnprintf(tmp_str, TMP_LEN, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype));
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2171,12 +2173,12 @@ next:
goto out;
tag = H5Tget_tag(dtype);
if(tag) {
- snprintf(tmp_str, *slen, "OPQ_TAG \"%s\";\n", tag);
+ HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"%s\";\n", tag);
if(tag)
free(tag);
tag = NULL;
} else
- snprintf(tmp_str, *slen, "OPQ_TAG \"\";\n");
+ HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"\";\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2184,7 +2186,7 @@ next:
indent -= COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
- snprintf(tmp_str, *slen, "}");
+ HDsnprintf(tmp_str, TMP_LEN, "}");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2197,7 +2199,7 @@ next:
char* stmp = NULL;
/* Print lead-in */
- snprintf(dt_str, *slen, "H5T_ENUM {\n");
+ HDsnprintf(dt_str, *slen, "H5T_ENUM {\n");
indent += COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
@@ -2216,7 +2218,7 @@ next:
free(stmp);
stmp = NULL;
- snprintf(tmp_str, *slen, ";\n");
+ HDsnprintf(tmp_str, TMP_LEN, ";\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
H5Tclose(super);
@@ -2228,7 +2230,7 @@ next:
indent -= COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
- snprintf(tmp_str, *slen, "}");
+ HDsnprintf(tmp_str, TMP_LEN, "}");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2241,7 +2243,7 @@ next:
char* stmp = NULL;
/* Print lead-in */
- snprintf(dt_str, *slen, "H5T_VLEN {\n");
+ HDsnprintf(dt_str, *slen, "H5T_VLEN {\n");
indent += COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
@@ -2259,7 +2261,7 @@ next:
if(stmp)
free(stmp);
stmp = NULL;
- snprintf(tmp_str, *slen, "\n");
+ HDsnprintf(tmp_str, TMP_LEN, "\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
H5Tclose(super);
@@ -2268,7 +2270,7 @@ next:
indent -= COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
- snprintf(tmp_str, *slen, "}");
+ HDsnprintf(tmp_str, TMP_LEN, "}");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2283,7 +2285,7 @@ next:
int ndims;
/* Print lead-in */
- snprintf(dt_str, *slen, "H5T_ARRAY {\n");
+ HDsnprintf(dt_str, *slen, "H5T_ARRAY {\n");
indent += COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
@@ -2296,11 +2298,11 @@ next:
/* Print array dimensions */
for (i = 0; i < ndims; i++) {
- snprintf(tmp_str, *slen, "[%d]", (int) dims[i]);
+ HDsnprintf(tmp_str, TMP_LEN, "[%d]", (int) dims[i]);
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
}
- snprintf(tmp_str, *slen, " ");
+ HDsnprintf(tmp_str, TMP_LEN, " ");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2316,7 +2318,7 @@ next:
if(stmp)
free(stmp);
stmp = NULL;
- snprintf(tmp_str, *slen, "\n");
+ HDsnprintf(tmp_str, TMP_LEN, "\n");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
H5Tclose(super);
@@ -2325,7 +2327,7 @@ next:
indent -= COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
- snprintf(tmp_str, *slen, "}");
+ HDsnprintf(tmp_str, TMP_LEN, "}");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
@@ -2344,7 +2346,7 @@ next:
if((nmembs = H5Tget_nmembers(dtype)) < 0)
goto out;
- snprintf(dt_str, *slen, "H5T_COMPOUND {\n");
+ HDsnprintf(dt_str, *slen, "H5T_COMPOUND {\n");
indent += COL;
for (i = 0; i < nmembs; i++) {
@@ -2375,14 +2377,14 @@ next:
if (H5T_COMPOUND == mclass)
indent -= COL;
- snprintf(tmp_str, *slen, " \"%s\"", mname);
+ HDsnprintf(tmp_str, TMP_LEN, " \"%s\"", mname);
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
if(mname)
free(mname);
mname = NULL;
- snprintf(tmp_str, *slen, " : %lu;\n", (unsigned long)moffset);
+ HDsnprintf(tmp_str, TMP_LEN, " : %lu;\n", (unsigned long)moffset);
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
}
@@ -2391,20 +2393,20 @@ next:
indent -= COL;
if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
goto out;
- snprintf(tmp_str, *slen, "}");
+ HDsnprintf(tmp_str, TMP_LEN, "}");
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
goto out;
break;
}
case H5T_TIME:
- snprintf(dt_str, *slen, "H5T_TIME: not yet implemented");
+ HDsnprintf(dt_str, *slen, "H5T_TIME: not yet implemented");
break;
case H5T_BITFIELD:
- snprintf(dt_str, *slen, "H5T_BITFIELD: not yet implemented");
+ HDsnprintf(dt_str, *slen, "H5T_BITFIELD: not yet implemented");
break;
default:
- snprintf(dt_str, *slen, "unknown data type");
+ HDsnprintf(dt_str, *slen, "unknown data type");
}
return dt_str;