From 4f974b3dc6c48d4d8f48d37184366bc87c9a1a00 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 7 Nov 2017 15:25:54 -0800 Subject: [PATCH] Less verbose initializer syntax --- mbtiles.hpp | 2 +- memfile.hpp | 10 +++++----- mvt.hpp | 12 ++++++------ pool.hpp | 6 +++--- serial.hpp | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/mbtiles.hpp b/mbtiles.hpp index 55e31e0..db57e0f 100644 --- a/mbtiles.hpp +++ b/mbtiles.hpp @@ -22,7 +22,7 @@ struct type_and_string_stats { struct layermap_entry { size_t id = 0; - std::map file_keys = std::map(); + std::map file_keys{}; int minzoom = 0; int maxzoom = 0; diff --git a/memfile.hpp b/memfile.hpp index bf74a3e..9998cf9 100644 --- a/memfile.hpp +++ b/memfile.hpp @@ -2,11 +2,11 @@ #define MEMFILE_HPP struct memfile { - int fd; - char *map; - long long len; - long long off; - unsigned long tree; + int fd = 0; + char *map = NULL; + long long len = 0; + long long off = 0; + unsigned long tree = 0; }; struct memfile *memfile_open(int fd); diff --git a/mvt.hpp b/mvt.hpp index ee26d03..5ea92c8 100644 --- a/mvt.hpp +++ b/mvt.hpp @@ -43,8 +43,8 @@ enum mvt_geometry_type { }; struct mvt_feature { - std::vector tags = std::vector(); - std::vector geometry = std::vector(); + std::vector tags{}; + std::vector geometry{}; int /* mvt_geometry_type */ type = 0; unsigned long long id = 0; bool has_id = false; @@ -91,9 +91,9 @@ struct mvt_value { struct mvt_layer { int version = 0; std::string name = ""; - std::vector features = std::vector(); - std::vector keys = std::vector(); - std::vector values = std::vector(); + std::vector features{}; + std::vector keys{}; + std::vector values{}; long long extent = 0; // Add a key-value pair to a feature, using this layer's constant pool @@ -105,7 +105,7 @@ struct mvt_layer { }; struct mvt_tile { - std::vector layers; + std::vector layers{}; std::string encode(); bool decode(std::string &message, bool &was_compressed); diff --git a/pool.hpp b/pool.hpp index f79c4ae..54ac4ea 100644 --- a/pool.hpp +++ b/pool.hpp @@ -2,9 +2,9 @@ #define POOL_HPP struct stringpool { - unsigned long left; - unsigned long right; - unsigned long off; + unsigned long left = 0; + unsigned long right = 0; + unsigned long off = 0; }; long long addpool(struct memfile *poolfile, struct memfile *treefile, const char *s, char type); diff --git a/serial.hpp b/serial.hpp index 460acd2..2269bd8 100644 --- a/serial.hpp +++ b/serial.hpp @@ -57,14 +57,14 @@ struct serial_feature { long long extent = 0; size_t m = 0; - std::vector keys = std::vector(); - std::vector values = std::vector(); + std::vector keys{}; + std::vector values{}; long long metapos = 0; // XXX This isn't serialized. Should it be here? long long bbox[4] = {0, 0, 0, 0}; - std::vector full_keys = std::vector(); - std::vector full_values = std::vector(); + std::vector full_keys{}; + std::vector full_values{}; std::string layername = ""; };