mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 09:55:41 +02:00
Fix additional g++ warnings
This commit is contained in:
+6
-12
@@ -204,9 +204,9 @@ drawvec shrink_lines(drawvec &geom, int z, int detail, int basezoom, long long *
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double get_area(drawvec &geom, int i, int j) {
|
double get_area(drawvec &geom, size_t i, size_t j) {
|
||||||
double area = 0;
|
double area = 0;
|
||||||
for (unsigned k = i; k < j; k++) {
|
for (size_t k = i; k < j; k++) {
|
||||||
area += (long double) geom[k].x * (long double) geom[i + ((k - i + 1) % (j - i))].y;
|
area += (long double) geom[k].x * (long double) geom[i + ((k - i + 1) % (j - i))].y;
|
||||||
area -= (long double) geom[k].y * (long double) geom[i + ((k - i + 1) % (j - i))].x;
|
area -= (long double) geom[k].y * (long double) geom[i + ((k - i + 1) % (j - i))].x;
|
||||||
}
|
}
|
||||||
@@ -214,10 +214,10 @@ double get_area(drawvec &geom, int i, int j) {
|
|||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reverse_ring(drawvec &geom, int start, int end) {
|
void reverse_ring(drawvec &geom, size_t start, size_t end) {
|
||||||
drawvec tmp;
|
drawvec tmp;
|
||||||
|
|
||||||
for (unsigned i = start; i < end; i++) {
|
for (size_t i = start; i < end; i++) {
|
||||||
tmp.push_back(geom[i]);
|
tmp.push_back(geom[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,8 +375,6 @@ static void decode_clipped(ClipperLib::PolyNode *t, drawvec &out) {
|
|||||||
static void dump(drawvec &geom) {
|
static void dump(drawvec &geom) {
|
||||||
ClipperLib::Clipper clipper(ClipperLib::ioStrictlySimple);
|
ClipperLib::Clipper clipper(ClipperLib::ioStrictlySimple);
|
||||||
|
|
||||||
bool has_area = false;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < geom.size(); i++) {
|
for (size_t i = 0; i < geom.size(); i++) {
|
||||||
if (geom[i].op == VT_MOVETO) {
|
if (geom[i].op == VT_MOVETO) {
|
||||||
size_t j;
|
size_t j;
|
||||||
@@ -386,11 +384,6 @@ static void dump(drawvec &geom) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double area = get_area(geom, i, j);
|
|
||||||
if (area != 0) {
|
|
||||||
has_area = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClipperLib::Path path;
|
ClipperLib::Path path;
|
||||||
printf("{ ClipperLib::Path path; ");
|
printf("{ ClipperLib::Path path; ");
|
||||||
|
|
||||||
@@ -515,7 +508,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int pnpoly(drawvec &vert, size_t start, size_t nvert, long long testx, long long testy) {
|
static int pnpoly(drawvec &vert, size_t start, size_t nvert, long long testx, long long testy) {
|
||||||
int i, j, c = 0;
|
size_t i, j;
|
||||||
|
bool c = false;
|
||||||
for (i = 0, j = nvert - 1; i < nvert; j = i++) {
|
for (i = 0, j = nvert - 1; i < nvert; j = i++) {
|
||||||
if (((vert[i + start].y > testy) != (vert[j + start].y > testy)) &&
|
if (((vert[i + start].y > testy) != (vert[j + start].y > testy)) &&
|
||||||
(testx < (vert[j + start].x - vert[i + start].x) * (testy - vert[i + start].y) / (double) (vert[j + start].y - vert[i + start].y) + vert[i + start].x))
|
(testx < (vert[j + start].x - vert[i + start].x) * (testy - vert[i + start].y) / (double) (vert[j + start].y - vert[i + start].y) + vert[i + start].x))
|
||||||
|
|||||||
@@ -191,14 +191,14 @@ int indexcmp(const void *v1, const void *v2) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct merge {
|
struct mergelist {
|
||||||
long long start;
|
long long start;
|
||||||
long long end;
|
long long end;
|
||||||
|
|
||||||
struct merge *next;
|
struct mergelist *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void insert(struct merge *m, struct merge **head, unsigned char *map) {
|
static void insert(struct mergelist *m, struct mergelist **head, unsigned char *map) {
|
||||||
while (*head != NULL && indexcmp(map + m->start, map + (*head)->start) > 0) {
|
while (*head != NULL && indexcmp(map + m->start, map + (*head)->start) > 0) {
|
||||||
head = &((*head)->next);
|
head = &((*head)->next);
|
||||||
}
|
}
|
||||||
@@ -207,9 +207,9 @@ static void insert(struct merge *m, struct merge **head, unsigned char *map) {
|
|||||||
*head = m;
|
*head = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void merge(struct merge *merges, int nmerges, unsigned char *map, FILE *f, int bytes, long long nrec, char *geom_map, FILE *geom_out, long long *geompos, long long *progress, long long *progress_max, long long *progress_reported) {
|
static void merge(struct mergelist *merges, int nmerges, unsigned char *map, FILE *f, int bytes, long long nrec, char *geom_map, FILE *geom_out, long long *geompos, long long *progress, long long *progress_max, long long *progress_reported) {
|
||||||
int i;
|
int i;
|
||||||
struct merge *head = NULL;
|
struct mergelist *head = NULL;
|
||||||
|
|
||||||
for (i = 0; i < nmerges; i++) {
|
for (i = 0; i < nmerges; i++) {
|
||||||
if (merges[i].start < merges[i].end) {
|
if (merges[i].start < merges[i].end) {
|
||||||
@@ -232,7 +232,7 @@ static void merge(struct merge *merges, int nmerges, unsigned char *map, FILE *f
|
|||||||
fwrite_check(map + head->start, bytes, 1, f, "merge temporary");
|
fwrite_check(map + head->start, bytes, 1, f, "merge temporary");
|
||||||
head->start += bytes;
|
head->start += bytes;
|
||||||
|
|
||||||
struct merge *m = head;
|
struct mergelist *m = head;
|
||||||
head = m->next;
|
head = m->next;
|
||||||
m->next = NULL;
|
m->next = NULL;
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ struct sort_arg {
|
|||||||
int task;
|
int task;
|
||||||
int cpus;
|
int cpus;
|
||||||
long long indexpos;
|
long long indexpos;
|
||||||
struct merge *merges;
|
struct mergelist *merges;
|
||||||
int indexfd;
|
int indexfd;
|
||||||
int nmerges;
|
int nmerges;
|
||||||
long long unit;
|
long long unit;
|
||||||
@@ -556,8 +556,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
|||||||
madvise(geommap, geomst.st_size, MADV_SEQUENTIAL);
|
madvise(geommap, geomst.st_size, MADV_SEQUENTIAL);
|
||||||
madvise(geommap, geomst.st_size, MADV_WILLNEED);
|
madvise(geommap, geomst.st_size, MADV_WILLNEED);
|
||||||
|
|
||||||
long long a;
|
for (size_t a = 0; a < indexst.st_size / sizeof(struct index); a++) {
|
||||||
for (a = 0; a < indexst.st_size / sizeof(struct index); a++) {
|
|
||||||
struct index ix = indexmap[a];
|
struct index ix = indexmap[a];
|
||||||
unsigned long long which = (ix.index << prefix) >> (64 - splitbits);
|
unsigned long long which = (ix.index << prefix) >> (64 - splitbits);
|
||||||
long long pos = sub_geompos[which];
|
long long pos = sub_geompos[which];
|
||||||
@@ -629,7 +628,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (indexst.st_size > 0) {
|
if (indexst.st_size > 0) {
|
||||||
if (indexst.st_size > sizeof(struct index) && indexst.st_size + geomst.st_size < mem) {
|
if (indexst.st_size + geomst.st_size < mem) {
|
||||||
long long indexpos = indexst.st_size;
|
long long indexpos = indexst.st_size;
|
||||||
int bytes = sizeof(struct index);
|
int bytes = sizeof(struct index);
|
||||||
|
|
||||||
@@ -644,7 +643,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
|||||||
unit = ((unit + page - 1) / page) * page;
|
unit = ((unit + page - 1) / page) * page;
|
||||||
|
|
||||||
int nmerges = (indexpos + unit - 1) / unit;
|
int nmerges = (indexpos + unit - 1) / unit;
|
||||||
struct merge merges[nmerges];
|
struct mergelist merges[nmerges];
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
for (a = 0; a < nmerges; a++) {
|
for (a = 0; a < nmerges; a++) {
|
||||||
@@ -723,8 +722,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
|||||||
madvise(geommap, geomst.st_size, MADV_RANDOM);
|
madvise(geommap, geomst.st_size, MADV_RANDOM);
|
||||||
madvise(geommap, geomst.st_size, MADV_WILLNEED);
|
madvise(geommap, geomst.st_size, MADV_WILLNEED);
|
||||||
|
|
||||||
long long a;
|
for (size_t a = 0; a < indexst.st_size / sizeof(struct index); a++) {
|
||||||
for (a = 0; a < indexst.st_size / sizeof(struct index); a++) {
|
|
||||||
struct index ix = indexmap[a];
|
struct index ix = indexmap[a];
|
||||||
long long pos = *geompos_out;
|
long long pos = *geompos_out;
|
||||||
|
|
||||||
@@ -964,7 +962,7 @@ int read_input(std::vector<source> &sources, char *fname, const char *layername,
|
|||||||
initialized[i] = initial_x[i] = initial_y[i] = 0;
|
initialized[i] = initial_x[i] = initial_y[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nlayers;
|
size_t nlayers;
|
||||||
if (layername != NULL) {
|
if (layername != NULL) {
|
||||||
nlayers = 1;
|
nlayers = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -974,7 +972,7 @@ int read_input(std::vector<source> &sources, char *fname, const char *layername,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nsources = sources.size();
|
size_t nsources = sources.size();
|
||||||
if (nsources == 0) {
|
if (nsources == 0) {
|
||||||
nsources = 1;
|
nsources = 1;
|
||||||
}
|
}
|
||||||
@@ -982,8 +980,7 @@ int read_input(std::vector<source> &sources, char *fname, const char *layername,
|
|||||||
std::vector<std::set<type_and_string> > file_keys;
|
std::vector<std::set<type_and_string> > file_keys;
|
||||||
long overall_offset = 0;
|
long overall_offset = 0;
|
||||||
|
|
||||||
int source;
|
for (size_t source = 0; source < nsources; source++) {
|
||||||
for (source = 0; source < nsources; source++) {
|
|
||||||
file_keys.push_back(std::set<type_and_string>());
|
file_keys.push_back(std::set<type_and_string>());
|
||||||
std::string reading;
|
std::string reading;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -1178,17 +1175,17 @@ int read_input(std::vector<source> &sources, char *fname, const char *layername,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> layernames;
|
std::vector<std::string> layernames;
|
||||||
for (i = 0; i < nlayers; i++) {
|
for (size_t l = 0; l < nlayers; l++) {
|
||||||
if (layername != NULL) {
|
if (layername != NULL) {
|
||||||
layernames.push_back(std::string(layername));
|
layernames.push_back(std::string(layername));
|
||||||
} else {
|
} else {
|
||||||
const char *src;
|
const char *src;
|
||||||
if (sources.size() < 1) {
|
if (sources.size() < 1) {
|
||||||
src = fname;
|
src = fname;
|
||||||
} else if (sources[i].layer.size() != 0) {
|
} else if (sources[l].layer.size() != 0) {
|
||||||
src = sources[i].layer.c_str();
|
src = sources[l].layer.c_str();
|
||||||
} else {
|
} else {
|
||||||
src = sources[i].file.c_str();
|
src = sources[l].file.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the last component of the pathname
|
// Find the last component of the pathname
|
||||||
@@ -1213,15 +1210,15 @@ int read_input(std::vector<source> &sources, char *fname, const char *layername,
|
|||||||
|
|
||||||
// Trim out characters that can't be part of selector
|
// Trim out characters that can't be part of selector
|
||||||
std::string out;
|
std::string out;
|
||||||
for (cp = 0; cp < trunc.size(); cp++) {
|
for (size_t p = 0; p < trunc.size(); p++) {
|
||||||
if (isalpha(trunc[cp]) || isdigit(trunc[cp]) || trunc[cp] == '_') {
|
if (isalpha(trunc[p]) || isdigit(trunc[p]) || trunc[p] == '_') {
|
||||||
out.append(trunc, cp, 1);
|
out.append(trunc, p, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layernames.push_back(out);
|
layernames.push_back(out);
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
fprintf(stderr, "For layer %d, using name \"%s\"\n", i, out.c_str());
|
fprintf(stderr, "For layer %d, using name \"%s\"\n", (int) l, out.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::vector<std:
|
|||||||
mvt_feature outfeature;
|
mvt_feature outfeature;
|
||||||
int matched = 0;
|
int matched = 0;
|
||||||
|
|
||||||
for (int t = 0; t + 1 < feat.tags.size(); t += 2) {
|
for (size_t t = 0; t + 1 < feat.tags.size(); t += 2) {
|
||||||
const char *key = layer.keys[feat.tags[t]].c_str();
|
const char *key = layer.keys[feat.tags[t]].c_str();
|
||||||
mvt_value &val = layer.values[feat.tags[t + 1]];
|
mvt_value &val = layer.values[feat.tags[t + 1]];
|
||||||
std::string value;
|
std::string value;
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
|||||||
|
|
||||||
std::vector<struct partial> partials;
|
std::vector<struct partial> partials;
|
||||||
std::vector<std::vector<coalesce> > features;
|
std::vector<std::vector<coalesce> > features;
|
||||||
for (size_t i = 0; i < nlayers; i++) {
|
for (int i = 0; i < nlayers; i++) {
|
||||||
features.push_back(std::vector<coalesce>());
|
features.push_back(std::vector<coalesce>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user