More structure initializers

This commit is contained in:
Eric Fischer
2017-11-07 15:20:17 -08:00
parent 891f99f24c
commit ba62ab8596
10 changed files with 146 additions and 135 deletions
+61 -61
View File
@@ -31,102 +31,102 @@ int deserialize_uint_io(FILE *f, unsigned *n, long long *geompos);
int deserialize_byte_io(FILE *f, signed char *n, long long *geompos);
struct serial_val {
int type;
std::string s;
int type = 0;
std::string s = "";
};
struct serial_feature {
long long layer;
int segment;
long long seq;
long long layer = 0;
int segment = 0;
long long seq = 0;
signed char t;
signed char feature_minzoom;
signed char t = 0;
signed char feature_minzoom = 0;
bool has_id;
unsigned long long id;
bool has_id = false;
unsigned long long id = 0;
bool has_tippecanoe_minzoom;
int tippecanoe_minzoom;
bool has_tippecanoe_minzoom = false;
int tippecanoe_minzoom = 0;
bool has_tippecanoe_maxzoom;
int tippecanoe_maxzoom;
bool has_tippecanoe_maxzoom = false;
int tippecanoe_maxzoom = 0;
drawvec geometry;
unsigned long long index;
long long extent;
drawvec geometry = drawvec();
unsigned long long index = 0;
long long extent = 0;
size_t m;
std::vector<long long> keys;
std::vector<long long> values;
long long metapos;
size_t m = 0;
std::vector<long long> keys = std::vector<long long>();
std::vector<long long> values = std::vector<long long>();
long long metapos = 0;
// XXX This isn't serialized. Should it be here?
long long bbox[4];
std::vector<std::string> full_keys;
std::vector<serial_val> full_values;
std::string layername;
long long bbox[4] = {0, 0, 0, 0};
std::vector<std::string> full_keys = std::vector<std::string>();
std::vector<serial_val> full_values = std::vector<serial_val>();
std::string layername = "";
};
void serialize_feature(FILE *geomfile, serial_feature *sf, long long *geompos, const char *fname, long long wx, long long wy, bool include_minzoom);
serial_feature deserialize_feature(FILE *geoms, long long *geompos_in, char *metabase, long long *meta_off, unsigned z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y);
struct reader {
int metafd;
int poolfd;
int treefd;
int geomfd;
int indexfd;
int metafd = -1;
int poolfd = -1;
int treefd = -1;
int geomfd = -1;
int indexfd = -1;
FILE *metafile;
struct memfile *poolfile;
struct memfile *treefile;
FILE *geomfile;
FILE *indexfile;
FILE *metafile = NULL;
struct memfile *poolfile = NULL;
struct memfile *treefile = NULL;
FILE *geomfile = NULL;
FILE *indexfile = NULL;
long long metapos;
long long geompos;
long long indexpos;
long long metapos = 0;
long long geompos = 0;
long long indexpos = 0;
long long file_bbox[4];
long long file_bbox[4] = {0, 0, 0, 0};
struct stat geomst;
struct stat metast;
char *geom_map;
char *geom_map = NULL;
};
struct serialization_state {
const char *fname; // source file name
int line; // user-oriented location within source for error reports
const char *fname = NULL; // source file name
int line = 0; // user-oriented location within source for error reports
volatile long long *layer_seq; // sequence within current layer
volatile long long *progress_seq; // overall sequence for progress indicator
volatile long long *layer_seq = NULL; // sequence within current layer
volatile long long *progress_seq = NULL; // overall sequence for progress indicator
struct reader *readers; // array of data for each input thread
int segment; // the current input thread
std::vector<struct reader> *readers = NULL; // array of data for each input thread
int segment = 0; // the current input thread
unsigned *initial_x; // relative offset of all geometries
unsigned *initial_y;
int *initialized;
unsigned *initial_x = NULL; // relative offset of all geometries
unsigned *initial_y = NULL;
int *initialized = NULL;
double *dist_sum; // running tally for calculation of resolution within features
size_t *dist_count;
bool want_dist;
double *dist_sum = NULL; // running tally for calculation of resolution within features
size_t *dist_count = NULL;
bool want_dist = false;
int maxzoom;
int basezoom;
int maxzoom = 0;
int basezoom = 0;
bool filters;
bool uses_gamma;
bool filters = false;
bool uses_gamma = false;
std::map<std::string, layermap_entry> *layermap;
std::map<std::string, layermap_entry> *layermap = NULL;
std::map<std::string, int> const *attribute_types;
std::set<std::string> *exclude;
std::set<std::string> *include;
int exclude_all;
json_object *filter;
std::map<std::string, int> const *attribute_types = NULL;
std::set<std::string> *exclude = NULL;
std::set<std::string> *include = NULL;
int exclude_all = 0;
json_object *filter = NULL;
};
int serialize_feature(struct serialization_state *sst, serial_feature &sf);