Commit 3b3895a8 authored by Bas Couwenberg's avatar Bas Couwenberg

New upstream version 2.14.2

parent 6d1d1c5a
......@@ -13,6 +13,14 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Fixed
## [2.14.2] - 2018-07-23
### Fixed
* PBF reader and writer depended on byte order of system architecture.
* Removed an unreliable test that didn't work on some architectures.
## [2.14.1] - 2018-07-23
### Changed
......@@ -861,7 +869,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
Doxygen (up to version 1.8.8). This version contains a workaround to fix
this.
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.14.1...HEAD
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.14.2...HEAD
[2.14.2]: https://github.com/osmcode/libosmium/compare/v2.14.1...v2.14.2
[2.14.1]: https://github.com/osmcode/libosmium/compare/v2.14.0...v2.14.1
[2.14.0]: https://github.com/osmcode/libosmium/compare/v2.13.1...v2.14.0
[2.13.1]: https://github.com/osmcode/libosmium/compare/v2.13.0...v2.13.1
......
......@@ -25,7 +25,7 @@ project(libosmium)
set(LIBOSMIUM_VERSION_MAJOR 2)
set(LIBOSMIUM_VERSION_MINOR 14)
set(LIBOSMIUM_VERSION_PATCH 1)
set(LIBOSMIUM_VERSION_PATCH 2)
set(LIBOSMIUM_VERSION
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
......
......@@ -13,6 +13,9 @@ bash -lc "pacman -S --needed --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-g
bash -lc "pacman -S --needed --noconfirm mingw-w64-x86_64-postgresql mingw-w64-x86_64-netcdf mingw-w64-x86_64-crypto++"
call C:\msys64\mingw64\bin\gem.cmd install json
REM Workaround for problem with gdal (see https://github.com/osmcode/libosmium/issues/262)
copy /y C:\msys64\mingw64\bin\libjson-c-4.dll C:\msys64\mingw64\bin\libjson-c-3.dll
echo "Setting PROJ_LIB variable for correct PROJ.4 working"
set PROJ_LIB=c:\msys64\mingw64\share\proj
......
......@@ -44,7 +44,6 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/thread/util.hpp>
#include <osmium/util/config.hpp>
#include <protozero/byteswap.hpp>
#include <protozero/pbf_message.hpp>
#include <protozero/types.hpp>
......@@ -97,18 +96,20 @@ namespace osmium {
* the length of the following BlobHeader.
*/
uint32_t read_blob_header_size_from_file() {
uint32_t size_in_network_byte_order;
uint32_t size;
try {
const std::string input_data{read_from_input_queue(sizeof(size_in_network_byte_order))};
size_in_network_byte_order = *reinterpret_cast<const uint32_t*>(input_data.data());
// size is encoded in network byte order
const std::string input_data{read_from_input_queue(sizeof(size))};
const char* d = input_data.data();
size = (static_cast<uint32_t>(d[3])) |
(static_cast<uint32_t>(d[2]) << 8u) |
(static_cast<uint32_t>(d[1]) << 16u) |
(static_cast<uint32_t>(d[0]) << 24u);
} catch (const osmium::pbf_error&) {
return 0; // EOF
}
uint32_t size = size_in_network_byte_order;
::protozero::byteswap_inplace(&size);
if (size > static_cast<uint32_t>(max_blob_header_size)) {
throw osmium::pbf_error{"invalid BlobHeader size (> max_blob_header_size)"};
}
......
......@@ -62,7 +62,6 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/util/misc.hpp>
#include <osmium/visitor.hpp>
#include <protozero/byteswap.hpp>
#include <protozero/pbf_builder.hpp>
#include <protozero/pbf_writer.hpp>
#include <protozero/types.hpp>
......@@ -193,13 +192,16 @@ namespace osmium {
// data plus a few header bytes (https://zlib.net/zlib_tech.html).
pbf_blob_header.add_int32(FileFormat::BlobHeader::required_int32_datasize, static_cast<int32_t>(blob_data.size()));
auto sz = static_cast<uint32_t>(blob_header_data.size());
::protozero::byteswap_inplace(&sz);
const auto size = static_cast<uint32_t>(blob_header_data.size());
// write to output: the 4-byte BlobHeader-Size followed by the BlobHeader followed by the Blob
// write to output: the 4-byte BlobHeader size in network
// byte order followed by the BlobHeader followed by the Blob
std::string output;
output.reserve(sizeof(sz) + blob_header_data.size() + blob_data.size());
output.append(reinterpret_cast<const char*>(&sz), sizeof(sz));
output.reserve(4 + blob_header_data.size() + blob_data.size());
output += static_cast<char>((size >> 24u) & 0xffu);
output += static_cast<char>((size >> 16u) & 0xffu);
output += static_cast<char>((size >> 8u) & 0xffu);
output += static_cast<char>( size & 0xffu);
output.append(blob_header_data);
output.append(blob_data);
......
......@@ -35,8 +35,8 @@ DEALINGS IN THE SOFTWARE.
#define LIBOSMIUM_VERSION_MAJOR 2
#define LIBOSMIUM_VERSION_MINOR 14
#define LIBOSMIUM_VERSION_PATCH 1
#define LIBOSMIUM_VERSION_PATCH 2
#define LIBOSMIUM_VERSION_STRING "2.14.1"
#define LIBOSMIUM_VERSION_STRING "2.14.2"
#endif // OSMIUM_VERSION_HPP
......@@ -6,29 +6,9 @@
TEST_CASE("Check memory usage") {
#ifdef __linux__
const int size_in_mbytes = 10;
osmium::MemoryUsage m1;
REQUIRE(m1.current() > 1);
REQUIRE(m1.peak() > 1);
// Memory reporting on M68k architecture doesn't work properly.
# ifndef __m68k__
{
std::vector<int> v;
v.reserve(size_in_mbytes * 1024 * 1024);
osmium::MemoryUsage m2;
REQUIRE(m2.current() >= m1.current() + size_in_mbytes);
REQUIRE(m2.peak() >= m1.peak() + size_in_mbytes);
REQUIRE(m2.peak() - m2.current() <= 1);
}
osmium::MemoryUsage m3;
REQUIRE(m3.current() > 1);
REQUIRE(m3.current() <= m3.peak());
REQUIRE(m3.peak() >= m1.peak() + size_in_mbytes);
# endif
#else
osmium::MemoryUsage m;
REQUIRE(m.current() == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment