Skip to content

Commit 31113d5

Browse files
Change how getting simple strings works
1 parent ab21742 commit 31113d5

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

Framework/DataHandling/src/LoadNexusProcessed.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,13 +2043,11 @@ void LoadNexusProcessed::loadNonSpectraAxis(const API::MatrixWorkspace_sptr &loc
20432043
axis->setValue(i, axisData[i]);
20442044
}
20452045
} else if (axis->isText()) {
2046-
NXChar axisData = data.openNXChar("axis2");
2047-
std::string axisLabels;
2046+
std::string axisLabels("");
20482047
try {
2049-
axisData.load();
2050-
axisLabels = std::string(axisData(), axisData.dim0());
2048+
axisLabels = data.getString("axis2");
20512049
} catch (std::runtime_error &) {
2052-
axisLabels = "";
2050+
// let it drop on the floor
20532051
}
20542052
// Use boost::tokenizer to split up the input
20552053
Mantid::Kernel::StringTokenizer tokenizer(axisLabels, "\n", Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);

Framework/Nexus/src/NexusClasses.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,9 @@ void NXClass::clear() {
216216
}
217217

218218
std::string NXClass::getString(const std::string &name) const {
219-
NXChar buff = openNXChar(name);
220-
try {
221-
buff.load();
222-
return std::string(buff(), buff.dim0());
223-
} catch (std::runtime_error &) {
224-
// deals with reading uninitialized/empty data
225-
return std::string();
226-
}
219+
std::string value;
220+
m_fileID->readData(name, value);
221+
return value;
227222
}
228223

229224
double NXClass::getDouble(const std::string &name) const {

0 commit comments

Comments
 (0)