Merge pull request #52 from mapbox/indentstyle

Consistent indent style with clang-format
This commit is contained in:
Eric Fischer
2015-06-03 11:26:25 -07:00
14 changed files with 127 additions and 134 deletions
+4
View File
@@ -17,6 +17,7 @@ vector_tile.pb.cc vector_tile.pb.h: vector_tile.proto
PG= PG=
H = $(shell find . '(' -name '*.h' -o -name '*.hh' ')') H = $(shell find . '(' -name '*.h' -o -name '*.hh' ')')
C = $(shell find . '(' -name '*.c' -o -name '*.cc' ')')
INCLUDES = -I/usr/local/include INCLUDES = -I/usr/local/include
LIBS = -L/usr/local/lib LIBS = -L/usr/local/lib
@@ -42,3 +43,6 @@ libjsonpull.a: jsonpull.o
clean: clean:
rm tippecanoe *.o rm tippecanoe *.o
indent:
for i in $(C) $(H); do clang-format -i -style="{BasedOnStyle: Google, IndentWidth: 8, UseTab: Always, AllowShortIfStatementsOnASingleLine: false, ColumnLimit: 0, ContinuationIndentWidth: 8, SpaceAfterCStyleCast: true, IndentCaseLabels: false, AllowShortBlocksOnASingleLine: false, AllowShortFunctionsOnASingleLine: false}" $$i; done
+1 -3
View File
@@ -13,9 +13,7 @@ extern "C" {
// 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
inline bool is_compressed(std::string const &data) { inline bool is_compressed(std::string const &data) {
return data.size() > 2 && return data.size() > 2 && (((uint8_t) data[0] == 0x78 && (uint8_t) data[1] == 0x9C) || ((uint8_t) data[0] == 0x1F && (uint8_t) data[1] == 0x8B));
(((uint8_t)data[0] == 0x78 && (uint8_t)data[1] == 0x9C) ||
((uint8_t)data[0] == 0x1F && (uint8_t)data[1] == 0x8B));
} }
// 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
+5 -18
View File
@@ -34,12 +34,7 @@ int min_detail = 7;
#define GEOM_TYPES 6 #define GEOM_TYPES 6
const char *geometry_names[GEOM_TYPES] = { const char *geometry_names[GEOM_TYPES] = {
"Point", "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon",
"MultiPoint",
"LineString",
"MultiLineString",
"Polygon",
"MultiPolygon",
}; };
int geometry_within[GEOM_TYPES] = { int geometry_within[GEOM_TYPES] = {
@@ -52,12 +47,7 @@ int geometry_within[GEOM_TYPES] = {
}; };
int mb_geometry[GEOM_TYPES] = { int mb_geometry[GEOM_TYPES] = {
VT_POINT, VT_POINT, VT_POINT, VT_LINE, VT_LINE, VT_POLYGON, VT_POLYGON,
VT_POINT,
VT_LINE,
VT_LINE,
VT_POLYGON,
VT_POLYGON,
}; };
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname) { size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname) {
@@ -601,8 +591,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
for (minzoom = 0; minzoom < 31; minzoom++) { for (minzoom = 0; minzoom < 31; minzoom++) {
unsigned mask = 1 << (32 - (minzoom + 1)); unsigned mask = 1 << (32 - (minzoom + 1));
if (((bbox[0] & mask) != (bbox[2] & mask)) || if (((bbox[0] & mask) != (bbox[2] & mask)) || ((bbox[1] & mask) != (bbox[3] & mask))) {
((bbox[1] & mask) != (bbox[3] & mask))) {
break; break;
} }
} }
@@ -1042,14 +1031,12 @@ int main(int argc, char **argv) {
gamma = atof(optarg); gamma = atof(optarg);
break; break;
case 'p': case 'p': {
{
char *cp; char *cp;
for (cp = optarg; *cp != '\0'; cp++) { for (cp = optarg; *cp != '\0'; cp++) {
prevent[*cp & 0xFF] = 1; prevent[*cp & 0xFF] = 1;
} }
} } break;
break;
case 'v': case 'v':
fprintf(stderr, VERSION); fprintf(stderr, VERSION);
+1 -3
View File
@@ -551,9 +551,7 @@ static void douglas_peucker(drawvec &geom, int start, int n, double e) {
// find index idx of element with max_distance // find index idx of element with max_distance
int i; int i;
for (i = first + 1; i < second; i++) { for (i = first + 1; i < second; i++) {
double temp_dist = square_distance_from_line(geom[start + i].x, geom[start + i].y, double temp_dist = square_distance_from_line(geom[start + i].x, geom[start + i].y, geom[start + first].x, geom[start + first].y, geom[start + second].x, geom[start + second].y);
geom[start + first].x, geom[start + first].y,
geom[start + second].x, geom[start + second].y);
double distance = fabs(temp_dist); double distance = fabs(temp_dist);
+2 -1
View File
@@ -10,7 +10,8 @@ struct draw {
this->y = y; this->y = y;
} }
draw() { } draw() {
}
}; };
typedef std::vector<draw> drawvec; typedef std::vector<draw> drawvec;
+12 -3
View File
@@ -1,12 +1,21 @@
typedef enum json_type { typedef enum json_type {
// These types can be returned by json_read() // These types can be returned by json_read()
JSON_HASH, JSON_ARRAY, JSON_NUMBER, JSON_STRING, JSON_TRUE, JSON_FALSE, JSON_NULL, JSON_HASH,
JSON_ARRAY,
JSON_NUMBER,
JSON_STRING,
JSON_TRUE,
JSON_FALSE,
JSON_NULL,
// These and JSON_HASH and JSON_ARRAY can be called back by json_read_with_separators() // These and JSON_HASH and JSON_ARRAY can be called back by json_read_with_separators()
JSON_COMMA, JSON_COLON, JSON_COMMA,
JSON_COLON,
// These are only used internally as expectations of what comes next // These are only used internally as expectations of what comes next
JSON_ITEM, JSON_KEY, JSON_VALUE, JSON_ITEM,
JSON_KEY,
JSON_VALUE,
} json_type; } json_type;
typedef struct json_object { typedef struct json_object {
-1
View File
@@ -62,7 +62,6 @@ int is_pooled(struct pool *p, char *s, int type) {
return 0; return 0;
} }
struct pool_val *pool(struct pool *p, char *s, int type) { struct pool_val *pool(struct pool *p, char *s, int type) {
return pool1(p, s, type, strcmp); return pool1(p, s, type, strcmp);
} }
-1
View File
@@ -17,7 +17,6 @@ struct pool {
int n; int n;
}; };
struct pool_val *pool(struct pool *p, char *s, int type); struct pool_val *pool(struct pool *p, char *s, int type);
void pool_free(struct pool *p); void pool_free(struct pool *p);
void pool_free_strings(struct pool *p); void pool_free_strings(struct pool *p);
-1
View File
@@ -53,7 +53,6 @@ unsigned long long encode(unsigned int wx, unsigned int wy) {
out |= v; out |= v;
} }
return out; return out;
} }
-1
View File
@@ -710,4 +710,3 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
fprintf(stderr, "could not make tile %d/%u/%u small enough\n", z, tx, ty); fprintf(stderr, "could not make tile %d/%u/%u small enough\n", z, tx, ty);
return -1; return -1;
} }