From 6978a0e1024fca82868ec06fe7dae60ffa0524fc Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Thu, 28 Jul 2022 11:19:30 -0700 Subject: [PATCH] Reindent with clang-format (#3) --- geobuf.cpp | 2 +- geojson-loop.cpp | 7 ++++++- geojson.cpp | 2 +- geometry.cpp | 4 ++-- json_logger.cpp | 2 +- json_logger.hpp | 5 ++--- main.cpp | 8 +++++--- mvt.cpp | 4 ++-- read_json.cpp | 20 +++++++++++++++----- read_json.hpp | 4 ++-- tile.cpp | 16 ++++++++-------- 11 files changed, 45 insertions(+), 29 deletions(-) diff --git a/geobuf.cpp b/geobuf.cpp index b67257c..cde7e61 100644 --- a/geobuf.cpp +++ b/geobuf.cpp @@ -190,7 +190,7 @@ drawvec readMultiPolygon(std::vector &coords, std::vector &lengt } } - dv.push_back(draw(VT_CLOSEPATH, 0, 0)); // mark that the next ring is outer + dv.push_back(draw(VT_CLOSEPATH, 0, 0)); // mark that the next ring is outer } return dv; diff --git a/geojson-loop.cpp b/geojson-loop.cpp index feebe69..f7b62fe 100644 --- a/geojson-loop.cpp +++ b/geojson-loop.cpp @@ -16,7 +16,12 @@ // XXX duplicated #define GEOM_TYPES 6 static const char *geometry_names[GEOM_TYPES] = { - "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "Point", + "MultiPoint", + "LineString", + "MultiLineString", + "Polygon", + "MultiPolygon", }; // XXX duplicated diff --git a/geojson.cpp b/geojson.cpp index 0eae17c..be66053 100644 --- a/geojson.cpp +++ b/geojson.cpp @@ -223,7 +223,7 @@ int serialize_geojson_feature(struct serialization_state *sst, json_object *geom sf.has_tippecanoe_maxzoom = (tippecanoe_maxzoom != -1); sf.tippecanoe_maxzoom = tippecanoe_maxzoom; sf.geometry = dv; - sf.feature_minzoom = 0; // Will be filled in during index merging + sf.feature_minzoom = 0; // Will be filled in during index merging sf.seq = *(sst->layer_seq); if (tippecanoe_layername.size() != 0) { diff --git a/geometry.cpp b/geometry.cpp index 24aeb7e..f24f4a3 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1100,7 +1100,7 @@ static int clip(double *x0, double *y0, double *x1, double *y1, double xmin, dou // Now find the intersection point; // use formulas y = y0 + slope * (x - x0), x = x0 + (1 / slope) * (y - y0) - if (outcodeOut & TOP) { // point is above the clip rectangle + if (outcodeOut & TOP) { // point is above the clip rectangle x = *x0 + (*x1 - *x0) * (ymax - *y0) / (*y1 - *y0); y = ymax; } else if (outcodeOut & BOTTOM) { // point is below the clip rectangle @@ -1109,7 +1109,7 @@ static int clip(double *x0, double *y0, double *x1, double *y1, double xmin, dou } else if (outcodeOut & RIGHT) { // point is to the right of clip rectangle y = *y0 + (*y1 - *y0) * (xmax - *x0) / (*x1 - *x0); x = xmax; - } else if (outcodeOut & LEFT) { // point is to the left of clip rectangle + } else if (outcodeOut & LEFT) { // point is to the left of clip rectangle y = *y0 + (*y1 - *y0) * (xmin - *x0) / (*x1 - *x0); x = xmin; } diff --git a/json_logger.cpp b/json_logger.cpp index 0c3fbae..7a9f938 100644 --- a/json_logger.cpp +++ b/json_logger.cpp @@ -4,5 +4,5 @@ #include "json_logger.hpp" void json_logger::progress_tile(double progress) { - fprintf(stderr,"{\"progress\":%3.1f}\n",progress); + fprintf(stderr, "{\"progress\":%3.1f}\n", progress); } diff --git a/json_logger.hpp b/json_logger.hpp index 50f8489..1214f5c 100644 --- a/json_logger.hpp +++ b/json_logger.hpp @@ -3,11 +3,10 @@ #ifndef LOGGING_HPP #define LOGGING_HPP - struct json_logger { - bool json_enabled = false; + bool json_enabled = false; - void progress_tile(double progress); + void progress_tile(double progress); }; #endif \ No newline at end of file diff --git a/main.cpp b/main.cpp index dcdebf4..6ffbec2 100644 --- a/main.cpp +++ b/main.cpp @@ -1046,7 +1046,7 @@ void radix(std::vector &readers, int nreaders, FILE *geomfile, FI mem = 8192; } - long long availfiles = MAX_FILES - 2 * nreaders // each reader has a geom and an index + long long availfiles = MAX_FILES - 2 * nreaders // each reader has a geom and an index - 4 // pool, meta, mbtiles, mbtiles journal - 4 // top-level geom and index output, both FILE and fd - 3; // stdin, stdout, stderr @@ -3246,7 +3246,7 @@ int main(int argc, char **argv) { if (sources.size() == 0) { struct source src; src.layer = ""; - src.file = ""; // standard input + src.file = ""; // standard input sources.push_back(src); } @@ -3258,7 +3258,9 @@ int main(int argc, char **argv) { long long file_bbox[4] = {UINT_MAX, UINT_MAX, 0, 0}; - ret = read_input(sources, name ? name : out_mbtiles ? out_mbtiles : out_dir, maxzoom, minzoom, basezoom, basezoom_marker_width, outdb, out_dir, &exclude, &include, exclude_all, filter, droprate, buffer, tmpdir, gamma, read_parallel, forcetable, attribution, gamma != 0, file_bbox, prefilter, postfilter, description, guess_maxzoom, &attribute_types, argv[0], &attribute_accum, attribute_descriptions, commandline); + ret = read_input(sources, name ? name : out_mbtiles ? out_mbtiles + : out_dir, + maxzoom, minzoom, basezoom, basezoom_marker_width, outdb, out_dir, &exclude, &include, exclude_all, filter, droprate, buffer, tmpdir, gamma, read_parallel, forcetable, attribution, gamma != 0, file_bbox, prefilter, postfilter, description, guess_maxzoom, &attribute_types, argv[0], &attribute_accum, attribute_descriptions, commandline); if (outdb != NULL) { mbtiles_close(outdb, argv[0]); diff --git a/mvt.cpp b/mvt.cpp index 27486f8..29ee950 100644 --- a/mvt.cpp +++ b/mvt.cpp @@ -306,8 +306,8 @@ std::string mvt_tile::encode() { protozero::pbf_writer layer_writer(layer_string); layer_writer.add_uint32(15, layers[i].version); /* version */ - layer_writer.add_string(1, layers[i].name); /* name */ - layer_writer.add_uint32(5, layers[i].extent); /* extent */ + layer_writer.add_string(1, layers[i].name); /* name */ + layer_writer.add_uint32(5, layers[i].extent); /* extent */ for (size_t j = 0; j < layers[i].keys.size(); j++) { layer_writer.add_string(3, layers[i].keys[j]); /* key */ diff --git a/read_json.cpp b/read_json.cpp index b534314..2f4037f 100644 --- a/read_json.cpp +++ b/read_json.cpp @@ -14,20 +14,30 @@ #include "milo/dtoa_milo.h" const char *geometry_names[GEOM_TYPES] = { - "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "Point", + "MultiPoint", + "LineString", + "MultiLineString", + "Polygon", + "MultiPolygon", }; int geometry_within[GEOM_TYPES] = { -1, /* point */ - GEOM_POINT, /* multipoint */ - GEOM_POINT, /* linestring */ + GEOM_POINT, /* multipoint */ + GEOM_POINT, /* linestring */ GEOM_LINESTRING, /* multilinestring */ GEOM_LINESTRING, /* polygon */ - GEOM_POLYGON, /* multipolygon */ + GEOM_POLYGON, /* multipolygon */ }; int mb_geometry[GEOM_TYPES] = { - VT_POINT, VT_POINT, VT_LINE, VT_LINE, VT_POLYGON, VT_POLYGON, + VT_POINT, + VT_POINT, + VT_LINE, + VT_LINE, + VT_POLYGON, + VT_POLYGON, }; void json_context(json_object *j) { diff --git a/read_json.hpp b/read_json.hpp index 559329e..539497e 100644 --- a/read_json.hpp +++ b/read_json.hpp @@ -1,8 +1,8 @@ -#define GEOM_POINT 0 /* array of positions */ +#define GEOM_POINT 0 /* array of positions */ #define GEOM_MULTIPOINT 1 /* array of arrays of positions */ #define GEOM_LINESTRING 2 /* array of arrays of positions */ #define GEOM_MULTILINESTRING 3 /* array of arrays of arrays of positions */ -#define GEOM_POLYGON 4 /* array of arrays of arrays of positions */ +#define GEOM_POLYGON 4 /* array of arrays of arrays of positions */ #define GEOM_MULTIPOLYGON 5 /* array of arrays of arrays of arrays of positions */ #define GEOM_TYPES 6 diff --git a/tile.cpp b/tile.cpp index 339cc32..b77ac51 100644 --- a/tile.cpp +++ b/tile.cpp @@ -464,7 +464,7 @@ void *partial_feature_worker(void *v) { } if ((t == VT_LINE || t == VT_POLYGON) && !(prevent[P_SIMPLIFY] || (z == maxzoom && prevent[P_SIMPLIFY_LOW]) || (z < maxzoom && additional[A_GRID_LOW_ZOOMS]))) { - if (1 /* !reduced */) { // XXX why did this not simplify if reduced? + if (1 /* !reduced */) { // XXX why did this not simplify if reduced? if (t == VT_LINE) { geom = remove_noop(geom, t, 32 - z - line_detail); } @@ -1792,7 +1792,7 @@ long long write_tile(FILE *geoms, std::atomic *geompos_in, char *meta pid_t prefilter_pid = 0; FILE *prefilter_fp = NULL; pthread_t prefilter_writer; - run_prefilter_args rpa; // here so it stays in scope until joined + run_prefilter_args rpa; // here so it stays in scope until joined FILE *prefilter_read_fp = NULL; json_pull *prefilter_jp = NULL; @@ -2345,7 +2345,7 @@ long long write_tile(FILE *geoms, std::atomic *geompos_in, char *meta if (!quiet) { fprintf(stderr, "Going to try merging %0.2f%% of the polygons to make it fit\n", 100 - merge_fraction * 100); } - line_detail++; // to keep it the same when the loop decrements it + line_detail++; // to keep it the same when the loop decrements it continue; } else if (additional[A_INCREASE_GAMMA_AS_NEEDED] && gamma < 10) { if (gamma < 1) { @@ -2362,7 +2362,7 @@ long long write_tile(FILE *geoms, std::atomic *geompos_in, char *meta if (!quiet) { fprintf(stderr, "Going to try gamma of %0.3f to make it fit\n", gamma); } - line_detail++; // to keep it the same when the loop decrements it + line_detail++; // to keep it the same when the loop decrements it continue; } else if (mingap < ULONG_MAX && (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED])) { mingap_fraction = mingap_fraction * max_tile_features / totalsize * 0.90; @@ -2413,7 +2413,7 @@ long long write_tile(FILE *geoms, std::atomic *geompos_in, char *meta } else if (prevent[P_DYNAMIC_DROP]) { arg->still_dropping = true; } - line_detail++; // to keep it the same when the loop decrements it + line_detail++; // to keep it the same when the loop decrements it continue; } else { fprintf(stderr, "Try using --drop-fraction-as-needed or --drop-densest-as-needed.\n"); @@ -2440,7 +2440,7 @@ long long write_tile(FILE *geoms, std::atomic *geompos_in, char *meta if (!quiet) { fprintf(stderr, "Going to try merging %0.2f%% of the polygons to make it fit\n", 100 - merge_fraction * 100); } - line_detail++; // to keep it the same when the loop decrements it + line_detail++; // to keep it the same when the loop decrements it } else if (additional[A_INCREASE_GAMMA_AS_NEEDED] && gamma < 10) { if (gamma < 1) { gamma = 1; @@ -2456,7 +2456,7 @@ long long write_tile(FILE *geoms, std::atomic *geompos_in, char *meta if (!quiet) { fprintf(stderr, "Going to try gamma of %0.3f to make it fit\n", gamma); } - line_detail++; // to keep it the same when the loop decrements it + line_detail++; // to keep it the same when the loop decrements it } else if (mingap < ULONG_MAX && (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED])) { mingap_fraction = mingap_fraction * max_tile_size / compressed.size() * 0.90; unsigned long long mg = choose_mingap(indices, mingap_fraction); @@ -2511,7 +2511,7 @@ long long write_tile(FILE *geoms, std::atomic *geompos_in, char *meta } else if (prevent[P_DYNAMIC_DROP]) { arg->still_dropping = true; } - line_detail++; // to keep it the same when the loop decrements it + line_detail++; // to keep it the same when the loop decrements it } } else { if (pass == 1) {