-
-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cartographer: remove boost & set ceres-solver version (#3146)
* cartographer: add patch to remove boost * cartographer: fix patch & fix ceres-solver * cartographer: remove `windows|x86` * ceres-solver: re-add windows|x86 * cartographer: add windows|x86 * ceres-solver: use suitesparse 5.x if under version 2.2.0 * suitesparse: remove limits for windows * suiteparse: limit add version v7.5.1 * suitesparse: add link graphblas * suitesparse: use config to add graphblas * suitesparse: able to set graphblas option with string * suitesparse: make graphblas shared by default on versions ge 7.4.0 * cartographer: add cstring & set ceres-solver version * cartographer: revert changes to other packages
- Loading branch information
Showing
3 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
diff --git a/cartographer/common/port.h b/cartographer/common/port.h | ||
index 338861f..252c566 100644 | ||
--- a/cartographer/common/port.h | ||
+++ b/cartographer/common/port.h | ||
@@ -19,11 +19,12 @@ | ||
|
||
#include <cinttypes> | ||
#include <cmath> | ||
+#include <cstring> | ||
#include <string> | ||
+#include <stdexcept> | ||
+#include <functional> | ||
|
||
-#include <boost/iostreams/device/back_inserter.hpp> | ||
-#include <boost/iostreams/filter/gzip.hpp> | ||
-#include <boost/iostreams/filtering_stream.hpp> | ||
+#include <zlib.h> | ||
|
||
namespace cartographer { | ||
|
||
@@ -48,22 +49,54 @@ inline int64 RoundToInt64(const double x) { return std::lround(x); } | ||
|
||
inline void FastGzipString(const std::string& uncompressed, | ||
std::string* compressed) { | ||
- boost::iostreams::filtering_ostream out; | ||
- out.push( | ||
- boost::iostreams::gzip_compressor(boost::iostreams::zlib::best_speed)); | ||
- out.push(boost::iostreams::back_inserter(*compressed)); | ||
- boost::iostreams::write(out, | ||
- reinterpret_cast<const char*>(uncompressed.data()), | ||
- uncompressed.size()); | ||
+ z_stream zs; | ||
+ memset(&zs, 0, sizeof(zs)); | ||
+ | ||
+ if (deflateInit(&zs, Z_BEST_SPEED) != Z_OK) | ||
+ throw std::runtime_error("deflateInit failed while compressing."); | ||
+ | ||
+ zs.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(uncompressed.data())); | ||
+ zs.avail_in = static_cast<uInt>(uncompressed.size()); | ||
+ | ||
+ int ret; | ||
+ char buffer[4096]; | ||
+ | ||
+ do { | ||
+ zs.next_out = reinterpret_cast<Bytef*>(buffer); | ||
+ zs.avail_out = sizeof(buffer); | ||
+ | ||
+ ret = deflate(&zs, Z_FINISH); | ||
+ | ||
+ compressed->append(buffer, sizeof(buffer) - zs.avail_out); | ||
+ } while (zs.avail_out == 0); | ||
+ | ||
+ deflateEnd(&zs); | ||
} | ||
|
||
inline void FastGunzipString(const std::string& compressed, | ||
std::string* decompressed) { | ||
- boost::iostreams::filtering_ostream out; | ||
- out.push(boost::iostreams::gzip_decompressor()); | ||
- out.push(boost::iostreams::back_inserter(*decompressed)); | ||
- boost::iostreams::write(out, reinterpret_cast<const char*>(compressed.data()), | ||
- compressed.size()); | ||
+ z_stream zs; | ||
+ memset(&zs, 0, sizeof(zs)); | ||
+ | ||
+ if (inflateInit(&zs) != Z_OK) | ||
+ throw std::runtime_error("inflateInit failed while decompressing."); | ||
+ | ||
+ zs.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(compressed.data())); | ||
+ zs.avail_in = static_cast<uInt>(compressed.size()); | ||
+ | ||
+ int ret; | ||
+ char buffer[4096]; | ||
+ | ||
+ do { | ||
+ zs.next_out = reinterpret_cast<Bytef*>(buffer); | ||
+ zs.avail_out = sizeof(buffer); | ||
+ | ||
+ ret = inflate(&zs, Z_NO_FLUSH); | ||
+ | ||
+ decompressed->append(buffer, sizeof(buffer) - zs.avail_out); | ||
+ } while (zs.avail_out == 0); | ||
+ | ||
+ inflateEnd(&zs); | ||
} | ||
|
||
} // namespace common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters