Blob Blame History Raw
commit be2f060b67e9718994b731757480dacecf074fce
Author: Alejandro Alvarez Ayllon <a.alvarezayllon@gmail.com>
Date:   Tue Jul 21 10:38:22 2020 +0200

    boost::io::quoted changed in boost 1.73

diff --git a/SEFramework/src/lib/FITS/FitsFile.cpp b/SEFramework/src/lib/FITS/FitsFile.cpp
index 7d4bf431..542eb416 100644
--- a/SEFramework/src/lib/FITS/FitsFile.cpp
+++ b/SEFramework/src/lib/FITS/FitsFile.cpp
@@ -35,7 +35,6 @@
 #include <boost/algorithm/string/trim.hpp>
 
 #include "ElementsKernel/Exception.h"
-
 #include "SEFramework/FITS/FitsFile.h"
 
 namespace SourceXtractor {
@@ -67,9 +66,23 @@ static typename MetadataEntry::value_t valueAutoCast(const std::string& value) {
   } catch (...) {
   }
 
-  std::stringstream quoted(value);
+  // Single quotes are used as escape code of another single quote, and
+  // the string starts and ends with single quotes.
+  // We used to use boost::io::quoted here, but it seems that starting with 1.73 it
+  // does not work well when the escape code and the delimiter are the same
   std::string unquoted;
-  quoted >> boost::io::quoted(unquoted, '\'', '\'');
+  bool escape = false;
+  unquoted.reserve(value.size());
+  for (auto i = value.begin(); i != value.end(); ++i) {
+    if (*i == '\'' && !escape) {
+      escape = true;
+      // skip this char
+    }
+    else {
+      escape = false;
+      unquoted.push_back(*i);
+    }
+  }
   return unquoted;
 }
 
diff --git a/SEFramework/src/lib/FITS/FitsImageSource.cpp b/SEFramework/src/lib/FITS/FitsImageSource.cpp
index 68aa860b..c4b06629 100644
--- a/SEFramework/src/lib/FITS/FitsImageSource.cpp
+++ b/SEFramework/src/lib/FITS/FitsImageSource.cpp
@@ -31,7 +31,6 @@
 #include <boost/regex.hpp>
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/algorithm/string/trim.hpp>
-#include <boost/io/detail/quoted_manip.hpp>
 
 #include <ElementsKernel/Exception.h>
 
diff --git a/SEImplementation/src/lib/Output/LdacWriter.cpp b/SEImplementation/src/lib/Output/LdacWriter.cpp
index d34aff9a..7d2d1deb 100644
--- a/SEImplementation/src/lib/Output/LdacWriter.cpp
+++ b/SEImplementation/src/lib/Output/LdacWriter.cpp
@@ -16,13 +16,18 @@
  */
 
 #include <sstream>
-#include <boost/io/detail/quoted_manip.hpp>
 #include <AlexandriaKernel/memory_tools.h>
 #include "SEFramework/Property/DetectionFrame.h"
 #include "SEImplementation/Output/LdacWriter.h"
 #include "SEImplementation/Configuration/DetectionImageConfig.h"
 #include "SOURCEXTRACTORPLUSPLUS_VERSION.h"
 
+#if BOOST_VERSION < 107300
+#include <boost/io/detail/quoted_manip.hpp>
+#else
+#include <boost/io/quoted.hpp>
+#endif
+
 namespace SourceXtractor {
 
 using Euclid::Configuration::ConfigManager;