Hello!

http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Iterate says:

index_type specifies the index to be used. If the links have not been indexed by the index type, they will first be sorted by that index then the iteration will begin; if the links have been so indexed, the sorting step will be unnecesary[1], so the iteration may begin more quickly.

[1] Original spelling retained.

However H5Literate fails to iterate in H5_INDEX_CRT_ORDER if the corresponding index is missing, as shown by the attached minimal example program (Pascal):

another group
group
yet another group
HDF5-DIAG: Error detected in HDF5 (1.8.12) thread 0:
  #000: ..\..\src\H5L.c line 1183 in H5Literate(): link iteration failed
    major: Symbol table
    minor: Iteration failed
#001: ..\..\src\H5Gint.c line 844 in H5G_iterate(): error iterating over links
    major: Symbol table
    minor: Iteration failed
#002: ..\..\src\H5Gobj.c line 704 in H5G__obj_iterate(): no creation order index to query
    major: Symbol table
    minor: Bad value

The documented behavior seems to be useful; it is proposed that the library is fixed to conform to the documentation.

Best wishes
and thank you for very useful software,
Andrey Paramonov

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

program test;

{$APPTYPE CONSOLE}

uses
  sysutils;

type
  hid_t = Integer;
  herr_t = Integer;
  hsize_t = Int64;
  Phsize_t = ^hsize_t;
  H5_index_t = Integer;
  H5_iter_order_t = Integer;
  H5L_iterate_t = function(group: hid_t;
                           name: PAnsiChar;
                           info: Pointer;
                           op_data: Pointer): herr_t; cdecl;

const
  H5P_DEFAULT = 0;
  H5_INDEX_NAME = 0;
  H5_INDEX_CRT_ORDER = 1;
  H5_ITER_INC = 0;
  H5_ITER_DEC = 1;

function H5Fopen(filename: PAnsiChar;
                 flags: Cardinal;
                 access_plist: hid_t): hid_t; cdecl; external 'hdf5.dll';

function H5Literate(grp_id: hid_t;
                    idx_type: H5_index_t;
                    order: H5_iter_order_t;
                    idx: Phsize_t;
                    op: H5L_iterate_t;
                    op_data: Pointer): herr_t; cdecl; external 'hdf5.dll';

function Callback(group: hid_t; name: PAnsiChar; info: Pointer;
  op_data: Pointer): herr_t; cdecl;
begin
  WriteLn(name);
  Result := 0;
end;

var
  FileID: hid_t;
begin
  FileID := H5Fopen('test.hdf', 0, H5P_DEFAULT);
  H5Literate(FileID, H5_INDEX_NAME, H5_ITER_INC, nil, @Callback, nil);
  H5Literate(FileID, H5_INDEX_CRT_ORDER, H5_ITER_INC, nil, @Callback, nil);
end.

Attachment: test.hdf
Description: Binary data

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to