Skip to content

Commit ec9c468

Browse files
Merge branch 'master' of github.com:nexusformat/code
2 parents 2ba575d + dfce8bc commit ec9c468

2 files changed

Lines changed: 20 additions & 35 deletions

File tree

src/napi5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static herr_t readStringAttribute(hid_t attr, char **data)
156156
}
157157

158158
H5Tclose(atype);
159-
H5Tclose(space);
159+
H5Sclose(space);
160160
if (iRet < 0)
161161
return NX_ERROR;
162162
return NX_OK;

test/napi_test_cpp.cxx

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -227,50 +227,35 @@ string toString(const vector<NumT> & data) {
227227
return result.str();
228228
}
229229

230-
string get_extension(const string &filename)
231-
{
232-
int dot_pos = filename.find('.');
233-
return string(filename,dot_pos);
234-
}
235-
236230
int readTest(const string & filename) {
237231
const string SDS("SDS");
238232
// top level file information
239233
NeXus::File file(filename);
240-
241-
string file_extension = get_extension(filename);
242234
cout << "NXinquirefile found: " << relativePathOf(file.inquireFile()) << endl;
243-
vector<NeXus::AttrInfo> attr_infos;
244-
if(file_extension==".h5")
245-
{
246-
attr_infos = file.getAttrInfos();
247-
cout << "Number of global attributes: " << attr_infos.size() << endl;
248-
for (vector<NeXus::AttrInfo>::iterator it = attr_infos.begin();
249-
it != attr_infos.end(); it++) {
250-
if (it->name != "file_time" && it->name != "HDF_version" && it->name != "HDF5_Version" && it->name != "XML_version") {
251-
cout << " " << it->name << " = ";
252-
if (it->type == NeXus::CHAR) {
253-
cout << file.getStrAttr(*it);
254-
}
255-
cout << endl;
256-
}
257-
}
258-
}
259-
260-
// check group attributes
261-
file.openGroup("entry", "NXentry");
262-
if(file_extension==".h5")
263-
{
264-
attr_infos = file.getAttrInfos();
265-
cout << "Number of group attributes: " << attr_infos.size() << endl;
266-
for (vector<NeXus::AttrInfo>::iterator it = attr_infos.begin();
267-
it != attr_infos.end(); it++) {
235+
vector<NeXus::AttrInfo> attr_infos = file.getAttrInfos();
236+
cout << "Number of global attributes: " << attr_infos.size() << endl;
237+
for (vector<NeXus::AttrInfo>::iterator it = attr_infos.begin();
238+
it != attr_infos.end(); it++) {
239+
if (it->name != "file_time" && it->name != "HDF_version" && it->name != "HDF5_Version" && it->name != "XML_version") {
268240
cout << " " << it->name << " = ";
269241
if (it->type == NeXus::CHAR) {
270242
cout << file.getStrAttr(*it);
271243
}
272244
cout << endl;
273-
}
245+
}
246+
}
247+
248+
// check group attributes
249+
file.openGroup("entry", "NXentry");
250+
attr_infos = file.getAttrInfos();
251+
cout << "Number of group attributes: " << attr_infos.size() << endl;
252+
for (vector<NeXus::AttrInfo>::iterator it = attr_infos.begin();
253+
it != attr_infos.end(); it++) {
254+
cout << " " << it->name << " = ";
255+
if (it->type == NeXus::CHAR) {
256+
cout << file.getStrAttr(*it);
257+
}
258+
cout << endl;
274259
}
275260

276261
// print out the entry level fields

0 commit comments

Comments
 (0)