1 --- inc/librevenge/RVNGString.h 2023-05-17 15:48:15.373159469 +0200
2 +++ inc/librevenge/RVNGString.h 2023-05-17 15:49:00.781411917 +0200
6 #include "librevenge-api.h"
13 RVNGString(const RVNGString &other);
14 RVNGString(const char *str);
15 + RVNGString(std::string&&);
18 /** Create a new string from \a s as escaped XML.
19 --- src/lib/RVNGBinaryData.cpp 2023-05-17 15:48:15.373159469 +0200
20 +++ src/lib/RVNGBinaryData.cpp 2023-05-17 15:49:00.773411873 +0200
22 boost::archive::iterators::transform_width<std::vector<unsigned char>::const_iterator, 6, 8 > > base64_encoder;
24 // Encode the buffer and create a string
26 + result.insert(result.begin(),
27 base64_encoder(source.begin()),
28 - base64_encoder(source.end()), std::back_inserter(result));
29 + base64_encoder(source.end()));
31 result.append(numPadding, '='); // add '=' for each padded character
35 m_binaryDataImpl->makeUnique();
37 - unsigned long previousSize = m_binaryDataImpl->m_ptr->m_buf.size();
38 - m_binaryDataImpl->m_ptr->m_buf.reserve(previousSize + data.m_binaryDataImpl->m_ptr->m_buf.size());
39 - for (unsigned long i = 0; i < data.m_binaryDataImpl->m_ptr->m_buf.size(); i++)
40 - m_binaryDataImpl->m_ptr->m_buf.push_back(data.m_binaryDataImpl->m_ptr->m_buf[i]);
41 + m_binaryDataImpl->m_ptr->m_buf.insert(
42 + m_binaryDataImpl->m_ptr->m_buf.end(),
43 + data.m_binaryDataImpl->m_ptr->m_buf.begin(),
44 + data.m_binaryDataImpl->m_ptr->m_buf.end());
47 void RVNGBinaryData::appendBase64Data(const RVNGString &base64)
49 const RVNGString RVNGBinaryData::getBase64Data() const
52 + base64.reserve(m_binaryDataImpl->m_ptr->m_buf.size() / 4 * 3);
53 convertToBase64(base64, m_binaryDataImpl->m_ptr->m_buf);
54 - return RVNGString(base64.c_str());
55 + return RVNGString(std::move(base64));
58 RVNGInputStream *RVNGBinaryData::getDataStream() const
59 --- src/lib/RVNGString.cpp 2023-05-17 15:48:15.373159469 +0200
60 +++ src/lib/RVNGString.cpp 2023-05-17 15:49:00.773411873 +0200
64 RVNGStringImpl() : m_buf() {}
65 + RVNGStringImpl(std::string&& str) : m_buf(std::move(str)) {}
70 m_stringImpl->m_buf = str;
73 +RVNGString::RVNGString(std::string&& str) :
74 + m_stringImpl(new RVNGStringImpl(std::move(str)))
78 RVNGString RVNGString::escapeXML(const RVNGString &s)