Some structure initializers

This commit is contained in:
Eric Fischer
2017-11-07 12:52:43 -08:00
parent 20e6e80cb1
commit 1b60fdbaf0
+94 -92
View File
@@ -76,21 +76,21 @@ int metacmp(int m1, const std::vector<long long> &keys1, const std::vector<long
int coalindexcmp(const struct coalesce *c1, const struct coalesce *c2); int coalindexcmp(const struct coalesce *c1, const struct coalesce *c2);
struct coalesce { struct coalesce {
char *stringpool; char *stringpool = NULL;
std::vector<long long> keys; std::vector<long long> keys = std::vector<long long>();
std::vector<long long> values; std::vector<long long> values = std::vector<long long>();
std::vector<std::string> full_keys; std::vector<std::string> full_keys = std::vector<std::string>();
std::vector<serial_val> full_values; std::vector<serial_val> full_values = std::vector<serial_val>();
drawvec geom; drawvec geom = drawvec();
unsigned long long index; unsigned long long index = 0;
unsigned long long index2; unsigned long long index2 = 0;
long long original_seq; long long original_seq = 0;
int type; int type = 0;
int m; int m = 0;
bool coalesced; bool coalesced = false;
double spacing; double spacing = 0;
bool has_id; bool has_id = false;
unsigned long long id; unsigned long long id = 0;
bool operator<(const coalesce &o) const { bool operator<(const coalesce &o) const {
int cmp = coalindexcmp(this, &o); int cmp = coalindexcmp(this, &o);
@@ -309,34 +309,34 @@ void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, u
} }
struct partial { struct partial {
std::vector<drawvec> geoms; std::vector<drawvec> geoms = std::vector<drawvec>();
std::vector<long long> keys; std::vector<long long> keys = std::vector<long long>();
std::vector<long long> values; std::vector<long long> values = std::vector<long long>();
std::vector<std::string> full_keys; std::vector<std::string> full_keys = std::vector<std::string>();
std::vector<serial_val> full_values; std::vector<serial_val> full_values = std::vector<serial_val>();
std::vector<ssize_t> arc_polygon; std::vector<ssize_t> arc_polygon = std::vector<ssize_t>();
long long layer; long long layer = 0;
long long original_seq; long long original_seq = 0;
unsigned long long index; unsigned long long index = 0;
unsigned long long index2; unsigned long long index2 = 0;
int m; int m = 0;
int segment; int segment = 0;
bool reduced; bool reduced = 0;
int z; int z = 0;
int line_detail; int line_detail = 0;
int maxzoom; int maxzoom = 0;
double spacing; double spacing = 0;
double simplification; double simplification = 0;
signed char t; signed char t = 0;
unsigned long long id; unsigned long long id = 0;
bool has_id; bool has_id = 0;
ssize_t renamed; ssize_t renamed = 0;
}; };
struct partial_arg { struct partial_arg {
std::vector<struct partial> *partials; std::vector<struct partial> *partials = NULL;
int task; int task = 0;
int tasks; int tasks = 0;
}; };
drawvec revive_polygon(drawvec &geom, double area, int z, int detail) { drawvec revive_polygon(drawvec &geom, double area, int z, int detail) {
@@ -523,11 +523,11 @@ static drawvec reverse_subring(drawvec const &dv) {
} }
struct edge { struct edge {
unsigned x1; unsigned x1 = 0;
unsigned y1; unsigned y1 = 0;
unsigned x2; unsigned x2 = 0;
unsigned y2; unsigned y2 = 0;
unsigned ring; unsigned ring = 0;
edge(unsigned _x1, unsigned _y1, unsigned _x2, unsigned _y2, unsigned _ring) { edge(unsigned _x1, unsigned _y1, unsigned _x2, unsigned _y2, unsigned _ring) {
x1 = _x1; x1 = _x1;
@@ -1127,51 +1127,51 @@ long long choose_minextent(std::vector<long long> &extents, double f) {
} }
struct write_tile_args { struct write_tile_args {
struct task *tasks; struct task *tasks = NULL;
char *metabase; char *metabase = NULL;
char *stringpool; char *stringpool = NULL;
int min_detail; int min_detail = 0;
sqlite3 *outdb; sqlite3 *outdb = NULL;
const char *outdir; const char *outdir = NULL;
int buffer; int buffer = 0;
const char *fname; const char *fname = NULL;
FILE **geomfile; FILE **geomfile = NULL;
double todo; double todo = 0;
volatile long long *along; volatile long long *along = NULL;
double gamma; double gamma = 0;
double gamma_out; double gamma_out = 0;
int child_shards; int child_shards = 0;
int *geomfd; int *geomfd = NULL;
off_t *geom_size; off_t *geom_size = NULL;
volatile unsigned *midx; volatile unsigned *midx = NULL;
volatile unsigned *midy; volatile unsigned *midy = NULL;
int maxzoom; int maxzoom = 0;
int minzoom; int minzoom = 0;
int full_detail; int full_detail = 0;
int low_detail; int low_detail = 0;
double simplification; double simplification = 0;
volatile long long *most; volatile long long *most = NULL;
long long *meta_off; long long *meta_off = NULL;
long long *pool_off; long long *pool_off = NULL;
unsigned *initial_x; unsigned *initial_x = NULL;
unsigned *initial_y; unsigned *initial_y = NULL;
volatile int *running; volatile int *running = NULL;
int err; int err = 0;
std::vector<std::map<std::string, layermap_entry>> *layermaps; std::vector<std::map<std::string, layermap_entry>> *layermaps = NULL;
std::vector<std::vector<std::string>> *layer_unmaps; std::vector<std::vector<std::string>> *layer_unmaps = NULL;
size_t pass; size_t pass = 0;
size_t passes; size_t passes = 0;
unsigned long long mingap; unsigned long long mingap = 0;
unsigned long long mingap_out; unsigned long long mingap_out = 0;
long long minextent; long long minextent = 0;
long long minextent_out; long long minextent_out = 0;
double fraction; double fraction = 0;
double fraction_out; double fraction_out = 0;
const char *prefilter; const char *prefilter = NULL;
const char *postfilter; const char *postfilter = NULL;
bool still_dropping; bool still_dropping = false;
int wrote_zoom; int wrote_zoom = 0;
size_t tiling_seg; size_t tiling_seg = 0;
}; };
bool clip_to_tile(serial_feature &sf, int z, long long buffer) { bool clip_to_tile(serial_feature &sf, int z, long long buffer) {
@@ -1680,7 +1680,8 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
} }
pthread_t pthreads[tasks]; pthread_t pthreads[tasks];
partial_arg args[tasks]; std::vector<partial_arg> args;
args.resize(tasks);
for (int i = 0; i < tasks; i++) { for (int i = 0; i < tasks; i++) {
args[i].task = i; args[i].task = i;
args[i].tasks = tasks; args[i].tasks = tasks;
@@ -2332,7 +2333,8 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
for (size_t pass = start; pass < 2; pass++) { for (size_t pass = start; pass < 2; pass++) {
pthread_t pthreads[threads]; pthread_t pthreads[threads];
write_tile_args args[threads]; std::vector<write_tile_args> args;
args.resize(threads);
int running = threads; int running = threads;
long long along = 0; long long along = 0;