You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using H5P.iterate to iterate over faplID (H5Pcreate(H5P_FILE_ACCESS)). See the repro code below.
In the iterate function, I am simply printing the name of the function.
If the starting index is 0 or NULL, 38 values are printed and the index is updated to 38, which indicates that there are 38 properties.
In the next run of the program, I modify the starting index to 40 which is a bad starting index since it is beyond the number of properties.
Ideally this should have errored out, but the status value returned by H5Piterate is 0, indicating success. The idx value is updated to 38.
Shouldn't there be an error status code returned if the starting index is beyond the last available index?
#include <iostream>
#include <hdf5.h>
// Callback function for iterating over properties
herr_t prop_iter_func(hid_t loc_id, const char *name, void *op_data) {
std::cout << name << std::endl;
return 0; // Continue iteration
}
int main() {
// Create a file access property list
hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
if (fapl < 0) {
std::cerr << "Failed to create property list." << std::endl;
return -1;
}
// Iterate over properties
int idxOut = 40; // Starting index for iteration
herr_t status = H5Piterate(fapl, &idxOut, prop_iter_func, NULL);
std::cout << "Status: " << status << std::endl;
std::cout << "IdxOut: " << idxOut << std::endl;
if (status < 0) {
std::cerr << "Failed to iterate over properties." << std::endl;
H5Pclose(fapl);
return -1;
}
// Close the property list
H5Pclose(fapl);
return 0;
}
The text was updated successfully, but these errors were encountered:
I am using H5P.iterate to iterate over faplID (H5Pcreate(H5P_FILE_ACCESS)). See the repro code below.
In the iterate function, I am simply printing the name of the function.
If the starting index is 0 or NULL, 38 values are printed and the index is updated to 38, which indicates that there are 38 properties.
In the next run of the program, I modify the starting index to 40 which is a bad starting index since it is beyond the number of properties.
Ideally this should have errored out, but the status value returned by H5Piterate is 0, indicating success. The idx value is updated to 38.
Shouldn't there be an error status code returned if the starting index is beyond the last available index?
The text was updated successfully, but these errors were encountered: