From eb1c64db27b60b3dc048e7cecdf6f9ade6f6ebcc Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Fri, 14 Oct 2016 15:47:54 -0700 Subject: [PATCH] Fix use of 32-bit zigzag encoding/decoding for 64-bit integers --- geojson.cpp | 1 - serial.cpp | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/geojson.cpp b/geojson.cpp index 7ce0f82..fdf4474 100644 --- a/geojson.cpp +++ b/geojson.cpp @@ -30,7 +30,6 @@ extern "C" { #include "pool.hpp" #include "projection.hpp" -#include "version.hpp" #include "memfile.hpp" #include "main.hpp" #include "mbtiles.hpp" diff --git a/serial.cpp b/serial.cpp index fa79186..ff768fc 100644 --- a/serial.cpp +++ b/serial.cpp @@ -27,7 +27,7 @@ void serialize_int(FILE *out, int n, long long *fpos, const char *fname) { } void serialize_long_long(FILE *out, long long n, long long *fpos, const char *fname) { - unsigned long long zigzag = protozero::encode_zigzag32(n); + unsigned long long zigzag = protozero::encode_zigzag64(n); serialize_ulong_long(out, zigzag, fpos, fname); } @@ -73,7 +73,7 @@ void deserialize_int(char **f, int *n) { void deserialize_long_long(char **f, long long *n) { unsigned long long zigzag = 0; deserialize_ulong_long(f, &zigzag); - *n = protozero::decode_zigzag32(zigzag); + *n = protozero::decode_zigzag64(zigzag); } void deserialize_ulong_long(char **f, unsigned long long *zigzag) { @@ -107,7 +107,7 @@ void deserialize_byte(char **f, signed char *n) { int deserialize_long_long_io(FILE *f, long long *n, long long *geompos) { unsigned long long zigzag = 0; int ret = deserialize_ulong_long_io(f, &zigzag, geompos); - *n = protozero::decode_zigzag32(zigzag); + *n = protozero::decode_zigzag64(zigzag); return ret; }