diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2014-09-29 15:31:40 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2014-09-29 15:31:40 (GMT) |
commit | 17893b24ea87ae013d88ab280e262cbde00e2815 (patch) | |
tree | c09c3e48a85d23a4d0c6001262bd28b8c86289cd /hl/test/test_lite.c | |
parent | c617cbdfb05564890f5d76e0d5c9ea525ec27a09 (diff) | |
download | hdf5-17893b24ea87ae013d88ab280e262cbde00e2815.zip hdf5-17893b24ea87ae013d88ab280e262cbde00e2815.tar.gz hdf5-17893b24ea87ae013d88ab280e262cbde00e2815.tar.bz2 |
[svn-r25629] Fix for hdffv-8855.
Diffstat (limited to 'hl/test/test_lite.c')
-rw-r--r-- | hl/test/test_lite.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index cb13061..d61d6cf 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1238,6 +1238,41 @@ static int test_strings(void) } HDfree(dt_str); + /* Length of the character buffer is larger then needed */ + str_len = str_len + 10; + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) { + printf("dt=\n%s\n", dt_str); + HDfree(dt_str); + goto out; + } + + /* Length of the character buffer is smaller then needed */ + str_len = 21; + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + /* check the truncated string */ + if(strlen(dt_str) != str_len-1) goto out; + str_len = strlen(dt_str); + if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) { + printf("dt=\n%s\n", dt_str); + HDfree(dt_str); + goto out; + } + + HDfree(dt_str); + if(H5Tclose(dtype)<0) goto out; @@ -1245,6 +1280,9 @@ static int test_strings(void) return 0; out: + if(dt_str) + HDfree(dt_str); + H5_FAILED(); return -1; } |