HDF-NI / hdf5.node

A node module for reading/writing the HDF5 file format.
MIT License
123 stars 40 forks source link

GetMemberNames missing last char #77

Closed NINI1988 closed 6 years ago

NINI1988 commented 6 years ago

https://github.com/HDF-NI/hdf5.node/blob/ecc0ac312aad4e3815e3e3c42d0e586357eac792/src/methods.cc#L583

should be: name_len = H5Lget_name_by_idx(id, ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C.get(), name_len+1, H5P_DEFAULT);

name_len+1 changed.

rimmartin commented 6 years ago

https://support.hdfgroup.org/HDF5/doc1.8/RM/RM_H5L.html#Link-GetNameByIdx says the first call with the size NULL or 0 it returns the size it will be?

The test at https://github.com/HDF-NI/hdf5.node/blob/master/test/test_hdf5.js#L69 is working for getMemberNames

is there a name you have that is missing something?

What I really want to do is get rid of going thru return string at https://github.com/HDF-NI/hdf5.node/blob/master/src/methods.cc#L575 and then back to c_str() at https://github.com/HDF-NI/hdf5.node/blob/master/src/methods.cc#L103

checking further

rimmartin commented 6 years ago

oh it is missing 80 passing (3s) 9 pending 1 failing

co_mocha * was causing this test to be skipped

seems like a bug in hdf5 native H5Lget_name_by_idx which this name_len+1 may work around

rimmartin commented 6 years ago

81 passing (736ms) 9 pending

passing, committing soon for another travis-ci test