1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

bring back the max_str_len argument for read_ functions [hdf5]

This commit is contained in:
q-posev 2021-06-08 14:50:59 +02:00
parent 57a83d7cf2
commit 2e210bc212

View File

@ -414,13 +414,13 @@ trexio_hdf5_has_$group_dset$ (trexio_t* const file)
#+begin_src c :tangle hrw_dset_str_hdf5.h :exports none
trexio_exit_code trexio_hdf5_has_$group_dset$(trexio_t* const file);
trexio_exit_code trexio_hdf5_read_$group_dset$(trexio_t* const file, char* const $group_dset$, const uint32_t rank, const uint64_t* dims);
trexio_exit_code trexio_hdf5_read_$group_dset$(trexio_t* const file, char* const $group_dset$, const uint32_t rank, const uint64_t* dims, const uint32_t max_str_len);
trexio_exit_code trexio_hdf5_write_$group_dset$(trexio_t* const file, const char** $group_dset$, const uint32_t rank, const uint64_t* dims);
#+end_src
#+begin_src c :tangle read_dset_str_hdf5.c
trexio_exit_code
trexio_hdf5_read_$group_dset$ (trexio_t* const file, char* const $group_dset$, const uint32_t rank, const uint64_t* dims)
trexio_hdf5_read_$group_dset$ (trexio_t* const file, char* const $group_dset$, const uint32_t rank, const uint64_t* dims, const uint32_t max_str_len)
{
if (file == NULL) return TREXIO_INVALID_ARG_1;
@ -495,7 +495,6 @@ trexio_hdf5_read_$group_dset$ (trexio_t* const file, char* const $group_dset$, c
// copy contents of temporary rdata buffer into the group_dset otherwise they are lost
// after calling H5Treclaim or H5Dvlen_reclaim functions
size_t max_str_len = 2;
strcpy($group_dset$, "");
for (uint64_t i=0; i<dims[0]; i++) {
if (max_str_len < strlen(rdata[i])) {