diff options
Diffstat (limited to 'hl')
-rw-r--r-- | hl/fortran/src/H5TBff.F90 | 4 | ||||
-rw-r--r-- | hl/fortran/test/tstimage.F90 | 2 | ||||
-rw-r--r-- | hl/fortran/test/tsttable.F90 | 2 | ||||
-rw-r--r-- | hl/src/H5LT.c | 19 | ||||
-rw-r--r-- | hl/test/test_ds.c | 2 |
5 files changed, 15 insertions, 14 deletions
diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index d18d023..40adf95 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -939,10 +939,10 @@ CONTAINS INTEGER(size_t), DIMENSION(nfields), INTENT(inout) :: field_offsets ! field offsets INTEGER(size_t), INTENT(inout):: type_size ! type size INTEGER :: errcode ! error code - INTEGER, OPTIONAL :: maxlen_out ! maximum character len of the field names + INTEGER(size_t), OPTIONAL :: maxlen_out ! maximum character len of the field names INTEGER(size_t) :: namelen ! name length INTEGER(size_t), DIMENSION(nfields) :: namelen2 ! name lengths - INTEGER(hsize_t) :: i ! general purpose integer + INTEGER(hsize_t) :: i ! general purpose integer INTEGER(size_t) :: maxlen INTEGER(size_t) :: c_maxlen_out diff --git a/hl/fortran/test/tstimage.F90 b/hl/fortran/test/tstimage.F90 index d6bd1e2..8586e68 100644 --- a/hl/fortran/test/tstimage.F90 +++ b/hl/fortran/test/tstimage.F90 @@ -62,7 +62,7 @@ character(len=4), parameter :: dsetname2 = "img2" ! dataset name character(len=15), parameter :: il ="INTERLACE_PIXEL"! dataset name integer(hid_t) :: file_id ! file identifier integer(hsize_t), parameter :: width = 500 ! width of image -integer(hsize_t), parameter :: height = 200 ! height of image +integer(hsize_t), parameter :: height = 270 ! height of image integer, parameter :: pal_entries = 9 ! palette number of entries integer, dimension(width*height) :: buf1 ! data buffer integer, dimension(width*height) :: bufr1 ! data buffer diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index 38cfa86..840d33d 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -93,7 +93,7 @@ SUBROUTINE test_table1() INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_offsetr ! field offset INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_sizesr ! field sizes INTEGER(SIZE_T) :: type_sizeout = 0 ! size of the datatype - INTEGER :: maxlen = 0 ! max chararter length of a field name + INTEGER(SIZE_T) :: maxlen = 0 ! max character length of a field name INTEGER :: Cs_sizeof_double = H5_SIZEOF_DOUBLE ! C's sizeof double INTEGER :: SIZEOF_X LOGICAL :: Exclude_double diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 0074d02..3ebca95 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2264,7 +2264,7 @@ out: *------------------------------------------------------------------------- */ static char* -realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add) +realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str_to_add) { size_t size_str_to_add, size_str; @@ -2360,7 +2360,6 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) { char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ - unsigned char *copy = NULL; /*a pointer to value array */ int nmembs; /*number of members */ char tmp_str[TMP_LEN]; int nchars; /*number of output characters */ @@ -2418,17 +2417,15 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "%*s ", MAX(0, 16 - nchars), ""); + HDmemset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1); + tmp_str[MAX(3, 19 - nchars)] = '\0'; if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + (size_t)i * dst_size; if (H5T_SGN_NONE == H5Tget_sign(native)) - HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)((void *)copy))); + HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)(value + (size_t)i * dst_size))); else - HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)((void *)copy))); + HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)(value + (size_t)i * dst_size))); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; @@ -2450,8 +2447,12 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) out: if(0 == nmembs) { - HDsnprintf(tmp_str, TMP_LEN, "\n%*s <empty>", (int)(indt + 4), ""); + str = realloc_and_append(no_ubuf, str_len, str, "\n"); + HDassert((indt + 4) < TMP_LEN); + HDmemset(tmp_str, ' ', (indt + 4) + 1); + tmp_str[(indt + 4)] = '\0'; str = realloc_and_append(no_ubuf, str_len, str, tmp_str); + str = realloc_and_append(no_ubuf, str_len, str, " <empty>"); } /* end if */ /* Release resources */ diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 95178fc..d7af9e9 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1138,7 +1138,7 @@ static int test_detachscales(void) int rank3 = 3; hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/ int *buf = NULL; - char dname[10]; + char dname[16]; int i; /* This tests creates two three dimensional datasets; then it creates |