summaryrefslogtreecommitdiffhomepage
path: root/diff.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-31 18:19:40 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-31 18:19:40 +0100
commit1771f788a5b9e844f0a5315faee104648e3b7d88 (patch)
tree6ed215805b1654060ef7ae4ad939fed306b1be58 /diff.cpp
parent8d1b4f06375bf676c5cf825ba4b116271f3d44c5 (diff)
Fix build of v1.5
Diffstat (limited to 'diff.cpp')
-rw-r--r--diff.cpp45
1 files changed, 5 insertions, 40 deletions
diff --git a/diff.cpp b/diff.cpp
index 35ff270..6ac24e7 100644
--- a/diff.cpp
+++ b/diff.cpp
@@ -5,44 +5,9 @@
#include <sstream>
#include <boost/property_tree/xml_parser.hpp>
-#include <boost/archive/iterators/binary_from_base64.hpp>
-#include <boost/archive/iterators/base64_from_binary.hpp>
-#include <boost/archive/iterators/transform_width.hpp>
-#include <boost/algorithm/string.hpp>
namespace pt = boost::property_tree;
-namespace {
-
-// prevent usage of same functions from libreichwein to keep unit self-contained
-
-std::string decode64(const std::string &val)
-{
-#if 0
- using namespace boost::archive::iterators;
- using It = transform_width<binary_from_base64<std::string::const_iterator>, 8, 6>;
- return boost::algorithm::trim_right_copy_if(std::string(It(std::begin(val)), It(std::end(val))), [](char c) {
- return c == '\0';
- });
-#else
- return val;
-#endif
-}
-
-std::string encode64(const std::string &val)
-{
-#if 0
- using namespace boost::archive::iterators;
- using It = base64_from_binary<transform_width<std::string::const_iterator, 6, 8>>;
- auto tmp = std::string(It(std::begin(val)), It(std::end(val)));
- return tmp.append((3 - val.size() % 3) % 3, '=');
-#else
- return val;
-#endif
-}
-
-} // namespace
-
Diff::Diff()
{
}
@@ -58,7 +23,7 @@ std::string Diff::apply(const std::string& old_version) const
if (m_pos0 <= m_pos1 && m_pos1 <= old_version.size()) {
result.erase(m_pos0, m_pos1 - m_pos0);
- result.insert(m_pos0, decode64(m_data));
+ result.insert(m_pos0, m_data);
}
return result;
@@ -82,7 +47,7 @@ void Diff::create(const std::string& old_version, const std::string& new_version
if (old_pos0 == old_version.size()) {
m_pos0 = old_pos0;
m_pos1 = old_pos0;
- m_data = encode64(new_version.substr(new_pos0));
+ m_data = new_version.substr(new_pos0);
return;
}
@@ -105,7 +70,7 @@ void Diff::create(const std::string& old_version, const std::string& new_version
if (old_pos1 == 0) {
m_pos0 = 0;
m_pos1 = 0;
- m_data = encode64(new_version.substr(0, new_pos1));
+ m_data = new_version.substr(0, new_pos1);
return;
}
@@ -131,7 +96,7 @@ void Diff::create(const std::string& old_version, const std::string& new_version
if (old_pos0 == old_pos1) {
m_pos0 = old_pos0;
m_pos1 = old_pos0;
- m_data = encode64(new_version.substr(new_pos0, new_pos1 - new_pos0));
+ m_data = new_version.substr(new_pos0, new_pos1 - new_pos0);
return;
}
@@ -146,7 +111,7 @@ void Diff::create(const std::string& old_version, const std::string& new_version
// last resort: remove and add in the middle
m_pos0 = old_pos0;
m_pos1 = old_pos1;
- m_data = encode64(new_version.substr(old_pos0, new_pos1 - new_pos0));
+ m_data = new_version.substr(old_pos0, new_pos1 - new_pos0);
}
Diff::Diff(const boost::property_tree::ptree& ptree)