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