Skip to content

Commit 2dba17b

Browse files
author
byrn
committed
Add #ifdef for long double and correct format string for signed char (compared with tools lib)
1 parent c7424c9 commit 2dba17b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎native/hdf5lib/h5util.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,13 @@ int h5str_sprintf(h5str_t *str, hid_t container, hid_t tid, void *ptr) {
153153
this_str = (char*) malloc(25);
154154
sprintf(this_str, "%g", tmp_double);
155155
}
156+
#if H5_SIZEOF_LONG_DOUBLE !=0
156157
else if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) {
157158
memcpy(&tmp_ldouble, ptr, sizeof(long double));
158159
this_str = (char*) malloc(27);
159160
sprintf(this_str, "%Lf", tmp_ldouble);
160161
}
162+
#endif
161163
break;
162164
case H5T_STRING:
163165
{
@@ -200,7 +202,7 @@ int h5str_sprintf(h5str_t *str, hid_t container, hid_t tid, void *ptr) {
200202
else if (H5Tequal(tid, H5T_NATIVE_SCHAR)) {
201203
memcpy(&tmp_char, ptr, sizeof(char));
202204
this_str = (char*) malloc(7);
203-
sprintf(this_str, "%d", tmp_char);
205+
sprintf(this_str, "%hhd", tmp_char);
204206
}
205207
else if (H5Tequal(tid, H5T_NATIVE_UCHAR)) {
206208
memcpy(&tmp_uchar, ptr, sizeof(unsigned char));

0 commit comments

Comments
 (0)