mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-21 12:05:05 +00:00
Fix warnings about shadowed variables
This commit is contained in:
parent
5775d088eb
commit
f1b3f6d231
2
Makefile
2
Makefile
@ -8,7 +8,7 @@ CXX := $(CXX)
|
||||
CFLAGS := $(CFLAGS)
|
||||
CXXFLAGS := $(CXXFLAGS) -std=c++11
|
||||
LDFLAGS := $(LDFLAGS)
|
||||
WARNING_FLAGS := -Wall
|
||||
WARNING_FLAGS := -Wall -Wshadow
|
||||
RELEASE_FLAGS := -O3 -DNDEBUG
|
||||
DEBUG_FLAGS := -O0 -DDEBUG -fno-inline-functions -fno-omit-frame-pointer
|
||||
|
||||
|
18
decode.cpp
18
decode.cpp
@ -34,10 +34,10 @@ struct lonlat {
|
||||
double lon;
|
||||
double lat;
|
||||
|
||||
lonlat(int op, double lon, double lat) {
|
||||
this->op = op;
|
||||
this->lon = lon;
|
||||
this->lat = lat;
|
||||
lonlat(int nop, double nlon, double nlat) {
|
||||
this->op = nop;
|
||||
this->lon = nlon;
|
||||
this->lat = nlat;
|
||||
}
|
||||
};
|
||||
|
||||
@ -387,13 +387,13 @@ void decode(char *fname, int z, unsigned x, unsigned y) {
|
||||
within = 1;
|
||||
|
||||
int len = sqlite3_column_bytes(stmt, 0);
|
||||
int z = sqlite3_column_int(stmt, 1);
|
||||
int x = sqlite3_column_int(stmt, 2);
|
||||
int y = sqlite3_column_int(stmt, 3);
|
||||
y = (1LL << z) - 1 - y;
|
||||
int tz = sqlite3_column_int(stmt, 1);
|
||||
int tx = sqlite3_column_int(stmt, 2);
|
||||
int ty = sqlite3_column_int(stmt, 3);
|
||||
ty = (1LL << tz) - 1 - ty;
|
||||
const char *s = (const char *) sqlite3_column_blob(stmt, 0);
|
||||
|
||||
handle(std::string(s, len), z, x, y, 1);
|
||||
handle(std::string(s, len), tz, tx, ty, 1);
|
||||
}
|
||||
|
||||
printf("] }\n");
|
||||
|
14
geometry.cpp
14
geometry.cpp
@ -268,15 +268,15 @@ static void decode_rings(ClipperLib::PolyNode *t, std::vector<ring> &out) {
|
||||
// Supposedly inner rings
|
||||
|
||||
for (int n = 0; n < t->ChildCount(); n++) {
|
||||
ClipperLib::Path p = t->Childs[n]->Contour;
|
||||
drawvec dv;
|
||||
for (size_t i = 0; i < p.size(); i++) {
|
||||
dv.push_back(draw((i == 0) ? VT_MOVETO : VT_LINETO, p[i].X, p[i].Y));
|
||||
ClipperLib::Path cp = t->Childs[n]->Contour;
|
||||
drawvec ring;
|
||||
for (size_t i = 0; i < cp.size(); i++) {
|
||||
ring.push_back(draw((i == 0) ? VT_MOVETO : VT_LINETO, cp[i].X, cp[i].Y));
|
||||
}
|
||||
if (p.size() > 0) {
|
||||
dv.push_back(draw(VT_LINETO, p[0].X, p[0].Y));
|
||||
if (cp.size() > 0) {
|
||||
ring.push_back(draw(VT_LINETO, cp[0].X, cp[0].Y));
|
||||
}
|
||||
out.push_back(dv);
|
||||
out.push_back(ring);
|
||||
}
|
||||
|
||||
// Recurse to supposedly outer rings (children of the children)
|
||||
|
@ -17,10 +17,10 @@ struct draw {
|
||||
long long y;
|
||||
int necessary;
|
||||
|
||||
draw(int op, long long x, long long y) {
|
||||
this->op = op;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
draw(int nop, long long nx, long long ny) {
|
||||
this->op = nop;
|
||||
this->x = nx;
|
||||
this->y = ny;
|
||||
}
|
||||
|
||||
draw() {
|
||||
|
39
main.cpp
39
main.cpp
@ -856,7 +856,7 @@ void radix(struct reader *reader, int nreaders, FILE *geomfile, int geomfd, FILE
|
||||
}
|
||||
}
|
||||
|
||||
int read_input(std::vector<source> &sources, char *fname, const char *layername, int maxzoom, int minzoom, int basezoom, double basezoom_marker_width, sqlite3 *outdb, std::set<std::string> *exclude, std::set<std::string> *include, int exclude_all, double droprate, int buffer, const char *tmpdir, double gamma, int *prevent, int *additional, int read_parallel, int forcetable, const char *attribution) {
|
||||
int read_input(std::vector<source> &sources, char *fname, const char *layername, int maxzoom, int minzoom, int basezoom, double basezoom_marker_width, sqlite3 *outdb, std::set<std::string> *exclude, std::set<std::string> *include, int exclude_all, double droprate, int buffer, const char *tmpdir, double gamma, int read_parallel, int forcetable, const char *attribution) {
|
||||
int ret = EXIT_SUCCESS;
|
||||
|
||||
struct reader reader[CPUS];
|
||||
@ -1421,22 +1421,22 @@ int read_input(std::vector<source> &sources, char *fname, const char *layername,
|
||||
} tile[MAX_ZOOM + 1], max[MAX_ZOOM + 1];
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i <= MAX_ZOOM; i++) {
|
||||
tile[i].x = tile[i].y = tile[i].count = tile[i].fullcount = tile[i].gap = tile[i].previndex = 0;
|
||||
max[i].x = max[i].y = max[i].count = max[i].fullcount = 0;
|
||||
int z;
|
||||
for (z = 0; z <= MAX_ZOOM; z++) {
|
||||
tile[z].x = tile[z].y = tile[z].count = tile[z].fullcount = tile[z].gap = tile[z].previndex = 0;
|
||||
max[z].x = max[z].y = max[z].count = max[z].fullcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
long long progress = -1;
|
||||
|
||||
long long indices = indexpos / sizeof(struct index);
|
||||
long long i;
|
||||
for (i = 0; i < indices; i++) {
|
||||
long long ip;
|
||||
for (ip = 0; ip < indices; ip++) {
|
||||
unsigned xx, yy;
|
||||
decode(map[i].index, &xx, &yy);
|
||||
decode(map[ip].index, &xx, &yy);
|
||||
|
||||
long long nprogress = 100 * i / indices;
|
||||
long long nprogress = 100 * ip / indices;
|
||||
if (nprogress != progress) {
|
||||
progress = nprogress;
|
||||
if (!quiet) {
|
||||
@ -1469,7 +1469,7 @@ int read_input(std::vector<source> &sources, char *fname, const char *layername,
|
||||
|
||||
tile[z].fullcount++;
|
||||
|
||||
if (manage_gap(map[i].index, &tile[z].previndex, scale, gamma, &tile[z].gap)) {
|
||||
if (manage_gap(map[ip].index, &tile[z].previndex, scale, gamma, &tile[z].gap)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1980,20 +1980,19 @@ int main(int argc, char **argv) {
|
||||
default: {
|
||||
int width = 7 + strlen(argv[0]);
|
||||
fprintf(stderr, "Usage: %s", argv[0]);
|
||||
int i;
|
||||
for (i = 0; long_options[i].name != NULL; i++) {
|
||||
if (width + strlen(long_options[i].name) + 9 >= 80) {
|
||||
for (int lo = 0; long_options[lo].name != NULL; lo++) {
|
||||
if (width + strlen(long_options[lo].name) + 9 >= 80) {
|
||||
fprintf(stderr, "\n ");
|
||||
width = 8;
|
||||
}
|
||||
width += strlen(long_options[i].name) + 9;
|
||||
if (strcmp(long_options[i].name, "output") == 0) {
|
||||
fprintf(stderr, " --%s=output.mbtiles", long_options[i].name);
|
||||
width += strlen(long_options[lo].name) + 9;
|
||||
if (strcmp(long_options[lo].name, "output") == 0) {
|
||||
fprintf(stderr, " --%s=output.mbtiles", long_options[lo].name);
|
||||
width += 9;
|
||||
} else if (long_options[i].has_arg) {
|
||||
fprintf(stderr, " [--%s=...]", long_options[i].name);
|
||||
} else if (long_options[lo].has_arg) {
|
||||
fprintf(stderr, " [--%s=...]", long_options[lo].name);
|
||||
} else {
|
||||
fprintf(stderr, " [--%s]", long_options[i].name);
|
||||
fprintf(stderr, " [--%s]", long_options[lo].name);
|
||||
}
|
||||
}
|
||||
if (width + 16 >= 80) {
|
||||
@ -2070,7 +2069,7 @@ int main(int argc, char **argv) {
|
||||
sources.push_back(src);
|
||||
}
|
||||
|
||||
ret = read_input(sources, name ? name : outdir, layer, maxzoom, minzoom, basezoom, basezoom_marker_width, outdb, &exclude, &include, exclude_all, droprate, buffer, tmpdir, gamma, prevent, additional, read_parallel, forcetable, attribution);
|
||||
ret = read_input(sources, name ? name : outdir, layer, maxzoom, minzoom, basezoom, basezoom_marker_width, outdb, &exclude, &include, exclude_all, droprate, buffer, tmpdir, gamma, read_parallel, forcetable, attribution);
|
||||
|
||||
mbtiles_close(outdb, argv);
|
||||
|
||||
|
8
mvt.cpp
8
mvt.cpp
@ -9,10 +9,10 @@
|
||||
#include "protozero/pbf_reader.hpp"
|
||||
#include "protozero/pbf_writer.hpp"
|
||||
|
||||
mvt_geometry::mvt_geometry(int op, long long x, long long y) {
|
||||
this->op = op;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
mvt_geometry::mvt_geometry(int nop, long long nx, long long ny) {
|
||||
this->op = nop;
|
||||
this->x = nx;
|
||||
this->y = ny;
|
||||
}
|
||||
|
||||
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
|
||||
|
@ -115,13 +115,13 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::vector<std:
|
||||
for (size_t i = 1; i < fields.size(); i++) {
|
||||
std::string joinkey = header[i];
|
||||
std::string joinval = fields[i];
|
||||
int type = VT_STRING;
|
||||
int attr_type = VT_STRING;
|
||||
|
||||
if (joinval.size() > 0) {
|
||||
if (joinval[0] == '"') {
|
||||
joinval = dequote(joinval);
|
||||
} else if ((joinval[0] >= '0' && joinval[0] <= '9') || joinval[0] == '-') {
|
||||
type = VT_NUMBER;
|
||||
attr_type = VT_NUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,12 +130,12 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::vector<std:
|
||||
if (exclude.count(joinkey) == 0) {
|
||||
type_and_string tas;
|
||||
tas.string = std::string(sjoinkey);
|
||||
tas.type = type;
|
||||
tas.type = attr_type;
|
||||
file_keys[ll].insert(tas);
|
||||
outlayer.tag(outfeature, layer.keys[feat.tags[t]], val);
|
||||
|
||||
mvt_value outval;
|
||||
if (type == VT_STRING) {
|
||||
if (attr_type == VT_STRING) {
|
||||
outval.type = mvt_string;
|
||||
outval.string_value = joinval;
|
||||
} else {
|
||||
|
44
tile.cpp
44
tile.cpp
@ -259,9 +259,9 @@ struct sll {
|
||||
}
|
||||
}
|
||||
|
||||
sll(char *name, long long val) {
|
||||
this->name = name;
|
||||
this->val = val;
|
||||
sll(char *nname, long long nval) {
|
||||
this->name = nname;
|
||||
this->val = nval;
|
||||
}
|
||||
};
|
||||
|
||||
@ -440,14 +440,14 @@ void *partial_feature_worker(void *v) {
|
||||
if (t == VT_POLYGON) {
|
||||
// Scaling may have made the polygon degenerate.
|
||||
// Give Clipper a chance to try to fix it.
|
||||
for (size_t i = 0; i < geoms.size(); i++) {
|
||||
for (size_t g = 0; g < geoms.size(); g++) {
|
||||
drawvec before;
|
||||
if (additional[A_DEBUG_POLYGON]) {
|
||||
before = geoms[i];
|
||||
before = geoms[g];
|
||||
}
|
||||
geoms[i] = clean_or_clip_poly(geoms[i], 0, 0, 0, false);
|
||||
geoms[g] = clean_or_clip_poly(geoms[g], 0, 0, 0, false);
|
||||
if (additional[A_DEBUG_POLYGON]) {
|
||||
check_polygon(geoms[i], before);
|
||||
check_polygon(geoms[g], before);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -804,7 +804,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < partials.size(); i++) {
|
||||
std::vector<drawvec> geoms = partials[i].geoms;
|
||||
std::vector<drawvec> pgeoms = partials[i].geoms;
|
||||
partials[i].geoms.clear(); // avoid keeping two copies in memory
|
||||
long long layer = partials[i].layer;
|
||||
signed char t = partials[i].t;
|
||||
@ -812,14 +812,14 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
|
||||
// A complex polygon may have been split up into multiple geometries.
|
||||
// Break them out into multiple features if necessary.
|
||||
for (size_t j = 0; j < geoms.size(); j++) {
|
||||
if (t == VT_POINT || draws_something(geoms[j])) {
|
||||
for (size_t j = 0; j < pgeoms.size(); j++) {
|
||||
if (t == VT_POINT || draws_something(pgeoms[j])) {
|
||||
struct coalesce c;
|
||||
|
||||
c.type = t;
|
||||
c.index = partials[i].index;
|
||||
c.index2 = partials[i].index2;
|
||||
c.geom = geoms[j];
|
||||
c.geom = pgeoms[j];
|
||||
c.coalesced = false;
|
||||
c.original_seq = original_seq;
|
||||
c.m = partials[i].m;
|
||||
@ -858,8 +858,8 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
#endif
|
||||
|
||||
if (additional[A_COALESCE] && out.size() > 0 && out[y].geom.size() + features[j][x].geom.size() < 700 && coalcmp(&features[j][x], &out[y]) == 0 && features[j][x].type != VT_POINT) {
|
||||
for (size_t z = 0; z < features[j][x].geom.size(); z++) {
|
||||
out[y].geom.push_back(features[j][x].geom[z]);
|
||||
for (size_t g = 0; g < features[j][x].geom.size(); g++) {
|
||||
out[y].geom.push_back(features[j][x].geom[g]);
|
||||
}
|
||||
out[y].coalesced = true;
|
||||
} else {
|
||||
@ -898,25 +898,25 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
|
||||
mvt_tile tile;
|
||||
|
||||
for (size_t j = 0; j < features.size(); j++) {
|
||||
for (size_t k = 0; k < features.size(); k++) {
|
||||
mvt_layer layer;
|
||||
|
||||
layer.name = (*layernames)[j];
|
||||
layer.name = (*layernames)[k];
|
||||
layer.version = 2;
|
||||
layer.extent = 1 << line_detail;
|
||||
|
||||
for (size_t x = 0; x < features[j].size(); x++) {
|
||||
for (size_t x = 0; x < features[k].size(); x++) {
|
||||
mvt_feature feature;
|
||||
|
||||
if (features[j][x].type == VT_LINE || features[j][x].type == VT_POLYGON) {
|
||||
features[j][x].geom = remove_noop(features[j][x].geom, features[j][x].type, 0);
|
||||
if (features[k][x].type == VT_LINE || features[k][x].type == VT_POLYGON) {
|
||||
features[k][x].geom = remove_noop(features[k][x].geom, features[k][x].type, 0);
|
||||
}
|
||||
|
||||
feature.type = features[j][x].type;
|
||||
feature.geometry = to_feature(features[j][x].geom);
|
||||
count += features[j][x].geom.size();
|
||||
feature.type = features[k][x].type;
|
||||
feature.geometry = to_feature(features[k][x].geom);
|
||||
count += features[k][x].geom.size();
|
||||
|
||||
decode_meta(features[j][x].m, &features[j][x].meta, features[j][x].stringpool, layer, feature);
|
||||
decode_meta(features[k][x].m, &features[k][x].meta, features[k][x].stringpool, layer, feature);
|
||||
layer.features.push_back(feature);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user