Skip to content

Commit cc40cd1

Browse files
Tobias RichterTobias Richter
authored andcommitted
make link detection working for non-root level objects
refs nexusformat#345 git-svn-id: https://svn.nexusformat.org/code/trunk@1885 ff5d1e40-2be0-497f-93bd-dc18237bd3c7
1 parent e8728c8 commit cc40cd1

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/napi5.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,11 +2279,18 @@ static int countObjectsInGroup(hid_t loc_id)
22792279
char linkval_buff[1024];
22802280
const char *filepath = NULL, *objpath = NULL;
22812281
size_t val_size;
2282+
hid_t openthing;
22822283

22832284
pFile = NXI5assert(fileid);
22842285
memset(url, 0, urllen);
22852286

2286-
ret = H5Lget_info(pFile->iFID, name, &link_buff, H5P_DEFAULT);
2287+
if (pFile->iCurrentG > 0) {
2288+
openthing = pFile->iCurrentG;
2289+
} else {
2290+
openthing = pFile->iFID;
2291+
}
2292+
2293+
ret = H5Lget_info(openthing, name, &link_buff, H5P_DEFAULT);
22872294
if (ret < 0 || link_buff.type != H5L_TYPE_EXTERNAL) {
22882295
return NX_ERROR;
22892296
}
@@ -2294,7 +2301,7 @@ static int countObjectsInGroup(hid_t loc_id)
22942301
return NX_ERROR;
22952302
}
22962303

2297-
ret = H5Lget_val(pFile->iFID, name, linkval_buff, val_size, H5P_DEFAULT);
2304+
ret = H5Lget_val(openthing, name, linkval_buff, val_size, H5P_DEFAULT);
22982305
if (ret < 0) {
22992306
NXReportError("ERROR: H5Lget_val failed");
23002307
return NX_ERROR;

0 commit comments

Comments
 (0)