[Libreoffice-commits] libvisio.git: 2 commits - configure.ac src/lib

Fridrich Å trba fridrich.strba at bluewin.ch
Sat Jul 6 06:06:10 PDT 2013


 configure.ac               |    1 +
 src/lib/libvisio_utils.cpp |    9 ++++++---
 src/lib/libvisio_utils.h   |    2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 688aa1eb357b41e26d0a12f0d34dca426a50feb7
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Sat Jul 6 15:05:45 2013 +0200

    Proper fix for older boost and remove_whitespace

diff --git a/src/lib/libvisio_utils.cpp b/src/lib/libvisio_utils.cpp
index 42e2adc..88bd2b8 100644
--- a/src/lib/libvisio_utils.cpp
+++ b/src/lib/libvisio_utils.cpp
@@ -123,14 +123,15 @@ double libvisio::readDouble(WPXInputStream *input)
   return tmpUnion.d;
 }
 
-void libvisio::appendFromBase64(WPXBinaryData &data, const unsigned char *base64String, size_t base64StringLength)
+void libvisio::appendFromBase64(WPXBinaryData &data, const unsigned char *base64Data, size_t base64DataLength)
 {
+  std::string base64String((const char*)base64Data, base64DataLength);
   typedef boost::archive::iterators::transform_width<
   boost::archive::iterators::binary_from_base64<
-  boost::archive::iterators::remove_whitespace< const char * > >, 8, 6 > base64_decoder;
+  boost::archive::iterators::remove_whitespace< std::string::const_iterator > >, 8, 6 > base64_decoder;
 
   std::vector<unsigned char> buffer;
-  std::copy(base64_decoder(base64String), base64_decoder(base64String + base64StringLength), std::back_inserter(buffer));
+  std::copy(base64_decoder(base64String.begin()), base64_decoder(base64String.end()), std::back_inserter(buffer));
 
   if (!buffer.empty())
     data.append(&buffer[0], buffer.size());
diff --git a/src/lib/libvisio_utils.h b/src/lib/libvisio_utils.h
index 2298907..3cd6afa 100644
--- a/src/lib/libvisio_utils.h
+++ b/src/lib/libvisio_utils.h
@@ -98,7 +98,7 @@ uint64_t readU64(WPXInputStream *input);
 
 double readDouble(WPXInputStream *input);
 
-void appendFromBase64(WPXBinaryData &data, const unsigned char *base64String, size_t base64StringLength);
+void appendFromBase64(WPXBinaryData &data, const unsigned char *base64Data, size_t base64DataLength);
 
 const ::WPXString getColourString(const Colour &c);
 
commit 0cde479e62ce80a8a619f2e11b77f7f64b970802
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Sat Jul 6 14:29:41 2013 +0200

    Revert "Some older versions of boost have a buggy remove_whitespace and original code was not removing either"
    
    This reverts commit 6fe924aae90c7aed8a3ad6e172a90a341f7a82ca.

diff --git a/configure.ac b/configure.ac
index c560c1d..dd12566 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,7 @@ AC_CHECK_HEADERS(
 	boost/optional.hpp \
 	boost/spirit/include/classic.hpp \
 	boost/archive/iterators/binary_from_base64.hpp \
+	boost/archive/iterators/remove_whitespace.hpp \
 	boost/archive/iterators/transform_width.hpp,
 	[],
 	[AC_MSG_ERROR(Required boost headers not found. install boost >= 1.36)],
diff --git a/src/lib/libvisio_utils.cpp b/src/lib/libvisio_utils.cpp
index 8978385..42e2adc 100644
--- a/src/lib/libvisio_utils.cpp
+++ b/src/lib/libvisio_utils.cpp
@@ -33,6 +33,7 @@
 #include "libvisio_utils.h"
 
 #include <boost/archive/iterators/binary_from_base64.hpp>
+#include <boost/archive/iterators/remove_whitespace.hpp>
 #include <boost/archive/iterators/transform_width.hpp>
 
 uint8_t libvisio::readU8(WPXInputStream *input)
@@ -125,7 +126,8 @@ double libvisio::readDouble(WPXInputStream *input)
 void libvisio::appendFromBase64(WPXBinaryData &data, const unsigned char *base64String, size_t base64StringLength)
 {
   typedef boost::archive::iterators::transform_width<
-  boost::archive::iterators::binary_from_base64< const char * >, 8, 6 > base64_decoder;
+  boost::archive::iterators::binary_from_base64<
+  boost::archive::iterators::remove_whitespace< const char * > >, 8, 6 > base64_decoder;
 
   std::vector<unsigned char> buffer;
   std::copy(base64_decoder(base64String), base64_decoder(base64String + base64StringLength), std::back_inserter(buffer));


More information about the Libreoffice-commits mailing list