From a1e4a5999584bcb8020aebf86881d551a61c44fe Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Mon, 4 Jan 2021 23:51:08 +0100 Subject: [PATCH] fileformat.proto: use oneof for blob data Ref: https://developers.google.com/protocol-buffers/docs/proto#oneof --- src/fileformat.proto | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/fileformat.proto b/src/fileformat.proto index 9e9b9bb..ad4e162 100644 --- a/src/fileformat.proto +++ b/src/fileformat.proto @@ -33,23 +33,26 @@ package OSMPBF; // message Blob { - optional bytes raw = 1; // No compression optional int32 raw_size = 2; // When compressed, the uncompressed size - // Possible compressed versions of the data. - optional bytes zlib_data = 3; + oneof data { + bytes raw = 1; // No compression - // For LZMA compressed data (optional) - optional bytes lzma_data = 4; + // Possible compressed versions of the data. + bytes zlib_data = 3; - // Formerly used for bzip2 compressed data. Deprecated in 2010. - optional bytes OBSOLETE_bzip2_data = 5 [deprecated=true]; // Don't reuse this tag number. + // For LZMA compressed data (optional) + bytes lzma_data = 4; - // For LZ4 compressed data (optional) - optional bytes lz4_data = 6; + // Formerly used for bzip2 compressed data. Deprecated in 2010. + bytes OBSOLETE_bzip2_data = 5 [deprecated=true]; // Don't reuse this tag number. - // For ZSTD compressed data (optional) - optional bytes zstd_data = 7; + // For LZ4 compressed data (optional) + bytes lz4_data = 6; + + // For ZSTD compressed data (optional) + bytes zstd_data = 7; + } } /* A file contains an sequence of fileblock headers, each prefixed by