Field3D/Field3D-unit_test.patch

35 lines
1.1 KiB
Diff

From fc8ec604f5cc4cafca063029adb2cdfee3107360 Mon Sep 17 00:00:00 2001
From: Rafael Fonseca <rdossant@redhat.com>
Date: Thu, 13 Oct 2016 15:36:20 +0200
Subject: [PATCH] Fallback to HDF5 in case of big endian architectures.
Fixes https://github.com/imageworks/Field3D/issues/90
---
src/Field3DFile.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/Field3DFile.cpp b/src/Field3DFile.cpp
index d34d364..e6caced 100644
--- a/src/Field3DFile.cpp
+++ b/src/Field3DFile.cpp
@@ -826,6 +826,19 @@ bool Field3DInputFile::open(const string &filename)
"In file: " + filename + " - Bad file hierarchy. ");
success = false;
}
+ catch (runtime_error &e) {
+ // HDF5 fallback
+ m_hdf5.reset(new Field3DInputFileHDF5);
+ m_hdf5Base = m_hdf5;
+ if (m_hdf5->open(filename)) {
+ // Handled. Just return.
+ return true;
+ } else {
+ Msg::print(Msg::SevWarning,
+ "In file: " + filename + ": " + string(e.what()));
+ success = false;
+ }
+ }
catch (...) {
Msg::print(Msg::SevWarning,
"In file: " + filename + " Unknown exception ");