diff --git a/Makefile b/Makefile index f55f003..c4bdbd4 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,8 @@ test: (cd test && ./run_tests.sh) indent: - astyle --style=java --indent-namespaces --indent-switches --pad-header --suffix=none --recursive include/\*.hpp examples/\*.cpp examples/\*.hpp osmjs/\*.cpp test/\*.cpp + astyle --style=java --indent-namespaces --indent-switches --pad-header --lineend=linux --suffix=none --recursive include/\*.hpp examples/\*.cpp examples/\*.hpp osmjs/\*.cpp test/\*.cpp +# astyle --style=java --indent-namespaces --indent-switches --pad-header --unpad-paren --align-pointer=type --lineend=linux --suffix=none --recursive include/\*.hpp examples/\*.cpp examples/\*.hpp osmjs/\*.cpp test/\*.cpp doc: doc/html/files.html Doxyfile diff --git a/examples/nodedensity.cpp b/examples/nodedensity.cpp index b7e77e7..797c246 100644 --- a/examples/nodedensity.cpp +++ b/examples/nodedensity.cpp @@ -62,8 +62,8 @@ class NodeDensityHandler : public Osmium::Handler::Base { } void node(const shared_ptr& node) { - int x = int( (180 + node->position().lon()) * m_factor ); - int y = int( ( 90 - node->position().lat()) * m_factor ); + int x = int((180 + node->position().lon()) * m_factor); + int y = int(( 90 - node->position().lat()) * m_factor); if (x < 0) x = 0; if (x >= m_xsize) x = m_xsize-1; if (y < 0) y = 0; @@ -104,7 +104,7 @@ class NodeDensityHandler : public Osmium::Handler::Base { /* ================================================== */ -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { if (argc != 5) { std::cerr << "Usage: " << argv[0] << " OSMFILE SIZE MIN MAX\n\n"; std::cerr << " OSMFILE - OSM file of any type.\n"; diff --git a/examples/osmium_convert.cpp b/examples/osmium_convert.cpp index 82b9ddc..ea3b2a6 100644 --- a/examples/osmium_convert.cpp +++ b/examples/osmium_convert.cpp @@ -55,7 +55,7 @@ void print_help() { << " -t, --to-format=FORMAT Output format\n"; } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { static struct option long_options[] = { {"debug", no_argument, 0, 'd'}, {"help", no_argument, 0, 'h'}, diff --git a/examples/osmium_debug.cpp b/examples/osmium_debug.cpp index 8a8bc35..988357f 100644 --- a/examples/osmium_debug.cpp +++ b/examples/osmium_debug.cpp @@ -40,7 +40,7 @@ You should have received a copy of the Licenses along with Osmium. If not, see # include #endif // OSMIUM_DEBUG_WITH_ENDTIME -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { std::ios_base::sync_with_stdio(false); if (argc != 2) { diff --git a/examples/osmium_find_bbox.cpp b/examples/osmium_find_bbox.cpp index 4ceb082..253ce4d 100644 --- a/examples/osmium_find_bbox.cpp +++ b/examples/osmium_find_bbox.cpp @@ -35,7 +35,7 @@ You should have received a copy of the Licenses along with Osmium. If not, see /* ================================================== */ -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { if (argc != 2) { std::cerr << "Usage: " << argv[0] << " OSMFILE" << std::endl; exit(1); diff --git a/examples/osmium_mpdump.cpp b/examples/osmium_mpdump.cpp index a4d63e7..9bf364a 100644 --- a/examples/osmium_mpdump.cpp +++ b/examples/osmium_mpdump.cpp @@ -71,7 +71,7 @@ class DumpHandler : public Osmium::Handler::Base { typedef Osmium::Storage::ById::SparseTable storage_sparsetable_t; typedef Osmium::Storage::ById::MmapFile storage_mmap_t; -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { std::ios_base::sync_with_stdio(false); if (argc != 2) { diff --git a/examples/osmium_progress.cpp b/examples/osmium_progress.cpp index 86dbde1..2db8dbf 100644 --- a/examples/osmium_progress.cpp +++ b/examples/osmium_progress.cpp @@ -35,7 +35,7 @@ You should have received a copy of the Licenses along with Osmium. If not, see /* ================================================== */ -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { if (argc != 2) { std::cerr << "Usage: " << argv[0] << " OSMFILE" << std::endl; exit(1); diff --git a/examples/osmium_range_from_history.cpp b/examples/osmium_range_from_history.cpp index 90cbc35..467de47 100644 --- a/examples/osmium_range_from_history.cpp +++ b/examples/osmium_range_from_history.cpp @@ -37,7 +37,7 @@ You should have received a copy of the Licenses along with Osmium. If not, see #include #include -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { if (argc != 3) { std::cerr << "Usage: " << argv[0] << " INFILE OUTFILE\n"; exit(1); diff --git a/examples/osmium_relation_members.cpp b/examples/osmium_relation_members.cpp index 33b8aa1..2a25098 100644 --- a/examples/osmium_relation_members.cpp +++ b/examples/osmium_relation_members.cpp @@ -104,7 +104,7 @@ class DebugRelationsAssembler : public Osmium::Relations::Assembler #include -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { if (argc != 3) { std::cerr << "Usage: " << argv[0] << " OSM-CHANGE-FILE OSM-FILE\n"; exit(1); diff --git a/examples/osmium_time.cpp b/examples/osmium_time.cpp index d334234..4724f74 100644 --- a/examples/osmium_time.cpp +++ b/examples/osmium_time.cpp @@ -64,7 +64,7 @@ class MyTimerHandler : public Osmium::Handler::Base { /* ================================================== */ -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { time_t t0 = time(NULL); if (argc != 2) { diff --git a/examples/osmium_to_postgis.cpp b/examples/osmium_to_postgis.cpp index f70db9d..c0eacb8 100644 --- a/examples/osmium_to_postgis.cpp +++ b/examples/osmium_to_postgis.cpp @@ -133,7 +133,7 @@ void print_help() { << " -d, --debug Enable debugging output\n"; } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { static struct option long_options[] = { {"debug", no_argument, 0, 'd'}, {"help", no_argument, 0, 'h'}, diff --git a/examples/osmium_toogr.cpp b/examples/osmium_toogr.cpp index e1d3476..9f893b2 100644 --- a/examples/osmium_toogr.cpp +++ b/examples/osmium_toogr.cpp @@ -88,7 +88,7 @@ class MyOGRHandler : public Osmium::Handler::Base { OGRFieldDefn layer_point_field_id("id", OFTInteger); layer_point_field_id.SetWidth(10); - if (m_layer_point->CreateField(&layer_point_field_id) != OGRERR_NONE ) { + if (m_layer_point->CreateField(&layer_point_field_id) != OGRERR_NONE) { std::cerr << "Creating id field failed.\n"; exit(1); } @@ -96,7 +96,7 @@ class MyOGRHandler : public Osmium::Handler::Base { OGRFieldDefn layer_point_field_operator("operator", OFTString); layer_point_field_operator.SetWidth(30); - if (m_layer_point->CreateField(&layer_point_field_operator) != OGRERR_NONE ) { + if (m_layer_point->CreateField(&layer_point_field_operator) != OGRERR_NONE) { std::cerr << "Creating operator field failed.\n"; exit(1); } @@ -114,7 +114,7 @@ class MyOGRHandler : public Osmium::Handler::Base { OGRFieldDefn layer_linestring_field_id("id", OFTInteger); layer_linestring_field_id.SetWidth(10); - if (m_layer_linestring->CreateField(&layer_linestring_field_id) != OGRERR_NONE ) { + if (m_layer_linestring->CreateField(&layer_linestring_field_id) != OGRERR_NONE) { std::cerr << "Creating id field failed.\n"; exit(1); } @@ -122,7 +122,7 @@ class MyOGRHandler : public Osmium::Handler::Base { OGRFieldDefn layer_linestring_field_type("type", OFTString); layer_linestring_field_type.SetWidth(30); - if (m_layer_linestring->CreateField(&layer_linestring_field_type) != OGRERR_NONE ) { + if (m_layer_linestring->CreateField(&layer_linestring_field_type) != OGRERR_NONE) { std::cerr << "Creating type field failed.\n"; exit(1); } @@ -220,7 +220,7 @@ void print_help() { << " -f, --format=FORMAT Output OGR format (Default: 'SQLite')\n"; } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { static struct option long_options[] = { {"debug", no_argument, 0, 'd'}, {"help", no_argument, 0, 'h'}, diff --git a/examples/osmium_toogr2.cpp b/examples/osmium_toogr2.cpp index b1d4c92..8619210 100644 --- a/examples/osmium_toogr2.cpp +++ b/examples/osmium_toogr2.cpp @@ -83,7 +83,7 @@ class OGROutHandler : public Osmium::Handler::Base { OGRFieldDefn layer_mp_field_id("id", OFTInteger); layer_mp_field_id.SetWidth(10); - if (m_layer_mp->CreateField(&layer_mp_field_id) != OGRERR_NONE ) { + if (m_layer_mp->CreateField(&layer_mp_field_id) != OGRERR_NONE) { std::cerr << "Creating id field failed.\n"; exit(1); } @@ -125,7 +125,7 @@ class OGROutHandler : public Osmium::Handler::Base { typedef Osmium::Storage::ById::SparseTable storage_sparsetable_t; typedef Osmium::Storage::ById::MmapFile storage_mmap_t; -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { if (argc != 2) { std::cerr << "Usage: " << argv[0] << " OSMFILE" << std::endl; exit(1); diff --git a/examples/osmium_toshape.cpp b/examples/osmium_toshape.cpp index ef79be2..6fd87db 100644 --- a/examples/osmium_toshape.cpp +++ b/examples/osmium_toshape.cpp @@ -111,7 +111,7 @@ class MyShapeHandler : public Osmium::Handler::Base { /* ================================================== */ -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { if (argc != 2) { std::cerr << "Usage: " << argv[0] << " OSMFILE" << std::endl; exit(1); diff --git a/include/osmium/export/shapefile.hpp b/include/osmium/export/shapefile.hpp index 3fdc69c..7586f8f 100644 --- a/include/osmium/export/shapefile.hpp +++ b/include/osmium/export/shapefile.hpp @@ -219,7 +219,7 @@ namespace Osmium { } } - void add_attribute(const int field, const char *value) const { + void add_attribute(const int field, const char* value) const { int ok = DBFWriteStringAttribute(m_dbf_handle, m_current_shape, field, value); if (!ok) { throw std::runtime_error("Can't add char* to field"); diff --git a/include/osmium/handler/coordinates_for_ways.hpp b/include/osmium/handler/coordinates_for_ways.hpp index e67f1ca..69ae5d2 100644 --- a/include/osmium/handler/coordinates_for_ways.hpp +++ b/include/osmium/handler/coordinates_for_ways.hpp @@ -52,7 +52,7 @@ namespace Osmium { void node(const shared_ptr& node) { int64_t id = node->id(); if (id >= 0) { - m_storage_pos.set( id, node->position()); + m_storage_pos.set(id, node->position()); } else { m_storage_neg.set(-id, node->position()); } diff --git a/include/osmium/input/pbf.hpp b/include/osmium/input/pbf.hpp index ba5d0e2..2033c0d 100644 --- a/include/osmium/input/pbf.hpp +++ b/include/osmium/input/pbf.hpp @@ -199,13 +199,13 @@ namespace Osmium { Osmium::OSM::TagList& tags = node.tags(); for (int tag=0; tag < pbf_node.keys_size(); ++tag) { - tags.add(stringtable.s( pbf_node.keys( tag ) ).data(), - stringtable.s( pbf_node.vals( tag ) ).data()); + tags.add(stringtable.s(pbf_node.keys(tag)).data(), + stringtable.s(pbf_node.vals(tag)).data()); } node.position(Osmium::OSM::Position( - ( pbf_node.lon() * m_pbf_primitive_block.granularity() + m_pbf_primitive_block.lon_offset() ) / (OSMPBF::lonlat_resolution / Osmium::OSM::coordinate_precision), - ( pbf_node.lat() * m_pbf_primitive_block.granularity() + m_pbf_primitive_block.lat_offset() ) / (OSMPBF::lonlat_resolution / Osmium::OSM::coordinate_precision))); + (pbf_node.lon() * m_pbf_primitive_block.granularity() + m_pbf_primitive_block.lon_offset()) / (OSMPBF::lonlat_resolution / Osmium::OSM::coordinate_precision), + (pbf_node.lat() * m_pbf_primitive_block.granularity() + m_pbf_primitive_block.lat_offset()) / (OSMPBF::lonlat_resolution / Osmium::OSM::coordinate_precision))); this->call_node_on_handler(); } } @@ -237,8 +237,8 @@ namespace Osmium { Osmium::OSM::TagList& tags = way.tags(); for (int tag=0; tag < pbf_way.keys_size(); ++tag) { - tags.add(stringtable.s( pbf_way.keys( tag ) ).data(), - stringtable.s( pbf_way.vals( tag ) ).data()); + tags.add(stringtable.s(pbf_way.keys(tag)).data(), + stringtable.s(pbf_way.vals(tag)).data()); } uint64_t ref = 0; @@ -278,8 +278,8 @@ namespace Osmium { Osmium::OSM::TagList& tags = relation.tags(); for (int tag=0; tag < pbf_relation.keys_size(); ++tag) { - tags.add(stringtable.s( pbf_relation.keys(tag) ).data(), - stringtable.s( pbf_relation.vals(tag) ).data()); + tags.add(stringtable.s(pbf_relation.keys(tag)).data(), + stringtable.s(pbf_relation.vals(tag)).data()); } uint64_t ref = 0; @@ -297,7 +297,7 @@ namespace Osmium { break; } ref += pbf_relation.memids(i); - relation.add_member(type, ref, stringtable.s( pbf_relation.roles_sid( i ) ).data()); + relation.add_member(type, ref, stringtable.s(pbf_relation.roles_sid(i)).data()); } this->call_relation_on_handler(); @@ -348,8 +348,8 @@ namespace Osmium { last_dense_latitude += dense.lat(entity); last_dense_longitude += dense.lon(entity); node.position(Osmium::OSM::Position( - ( last_dense_longitude * m_pbf_primitive_block.granularity() + m_pbf_primitive_block.lon_offset() ) / (OSMPBF::lonlat_resolution / Osmium::OSM::coordinate_precision), - ( last_dense_latitude * m_pbf_primitive_block.granularity() + m_pbf_primitive_block.lat_offset() ) / (OSMPBF::lonlat_resolution / Osmium::OSM::coordinate_precision))); + (last_dense_longitude * m_pbf_primitive_block.granularity() + m_pbf_primitive_block.lon_offset()) / (OSMPBF::lonlat_resolution / Osmium::OSM::coordinate_precision), + (last_dense_latitude * m_pbf_primitive_block.granularity() + m_pbf_primitive_block.lat_offset()) / (OSMPBF::lonlat_resolution / Osmium::OSM::coordinate_precision))); while (last_dense_tag < dense.keys_vals_size()) { int tag_key_pos = dense.keys_vals(last_dense_tag); diff --git a/include/osmium/input/xml.hpp b/include/osmium/input/xml.hpp index 303273f..427ba2e 100644 --- a/include/osmium/input/xml.hpp +++ b/include/osmium/input/xml.hpp @@ -95,7 +95,7 @@ namespace Osmium { XML_Error errorCode = XML_GetErrorCode(parser); long errorLine = XML_GetCurrentLineNumber(parser); long errorCol = XML_GetCurrentColumnNumber(parser); - const XML_LChar *errorString = XML_ErrorString(errorCode); + const XML_LChar* errorString = XML_ErrorString(errorCode); std::stringstream errorDesc; errorDesc << "XML parsing error at line " << errorLine << ":" << errorCol; @@ -252,7 +252,7 @@ namespace Osmium { if (!strcmp(element, "member")) { char type = 'x'; uint64_t ref = 0; - const char *role = ""; + const char* role = ""; for (int count = 0; attrs[count]; count += 2) { if (!strcmp(attrs[count], "type")) { type = static_cast(attrs[count+1][0]); diff --git a/include/osmium/javascript/template.hpp b/include/osmium/javascript/template.hpp index eab8dad..bb94817 100644 --- a/include/osmium/javascript/template.hpp +++ b/include/osmium/javascript/template.hpp @@ -96,22 +96,22 @@ namespace Osmium { */ template (func)(TWrapped*)> - static v8::Handle accessor_getter(v8::Local, const v8::AccessorInfo &info) { + static v8::Handle accessor_getter(v8::Local, const v8::AccessorInfo& info) { return func(reinterpret_cast(v8::Local::Cast(info.Holder()->GetInternalField(0))->Value())); } template func(v8::Local, TWrapped*)> - static v8::Handle named_property_getter(v8::Local property, const v8::AccessorInfo &info) { + static v8::Handle named_property_getter(v8::Local property, const v8::AccessorInfo& info) { return func(property, reinterpret_cast(v8::Local::Cast(info.Holder()->GetInternalField(0))->Value())); } template func(uint32_t, TWrapped*)> - static v8::Handle indexed_property_getter(uint32_t index, const v8::AccessorInfo &info) { + static v8::Handle indexed_property_getter(uint32_t index, const v8::AccessorInfo& info) { return func(index, reinterpret_cast(v8::Local::Cast(info.Holder()->GetInternalField(0))->Value())); } template func(TWrapped*)> - static v8::Handle property_enumerator(const v8::AccessorInfo &info) { + static v8::Handle property_enumerator(const v8::AccessorInfo& info) { return func(reinterpret_cast(v8::Local::Cast(info.Holder()->GetInternalField(0))->Value())); } diff --git a/include/osmium/javascript/wrapper/osm.hpp b/include/osmium/javascript/wrapper/osm.hpp index 819022f..bd72f24 100644 --- a/include/osmium/javascript/wrapper/osm.hpp +++ b/include/osmium/javascript/wrapper/osm.hpp @@ -238,7 +238,7 @@ namespace Osmium { struct OSMWay : public OSMObject { static v8::Handle nodes(Osmium::OSM::Way* way) { - return OSMWayNodeList::get().create_instance((void *)&(way->nodes())); + return OSMWayNodeList::get().create_instance((void*)&(way->nodes())); } static v8::Handle geom(Osmium::OSM::Way* way) { @@ -284,7 +284,7 @@ namespace Osmium { struct OSMRelation : public OSMObject { static v8::Handle members(Osmium::OSM::Relation* relation) { - return OSMRelationMemberList::get().create_instance((void *)&(relation->members())); + return OSMRelationMemberList::get().create_instance((void*)&(relation->members())); } OSMRelation() : diff --git a/include/osmium/multipolygon/builder.hpp b/include/osmium/multipolygon/builder.hpp index 98d2335..606ea56 100644 --- a/include/osmium/multipolygon/builder.hpp +++ b/include/osmium/multipolygon/builder.hpp @@ -246,7 +246,7 @@ namespace Osmium { if (object == NULL) return true; BOOST_FOREACH(const Osmium::OSM::Tag& tag, object->tags()) { - if (!ignore_tag(tag.key()) ) { + if (!ignore_tag(tag.key())) { return false; } } diff --git a/include/osmium/osm/area.hpp b/include/osmium/osm/area.hpp index 4e6bd88..77945cb 100644 --- a/include/osmium/osm/area.hpp +++ b/include/osmium/osm/area.hpp @@ -72,7 +72,7 @@ namespace Osmium { Object(relation), m_node_list(), m_geos_geometry() { - id( (id() * 2) + sgn(id()) ); + id((id() * 2) + sgn(id())); } /// Construct an Area object from a Way object. @@ -80,7 +80,7 @@ namespace Osmium { Object(way), m_node_list(way.nodes()), m_geos_geometry() { - id( id() * 2 ); + id(id() * 2); } Area(const Area& area) : diff --git a/include/osmium/osm/object.hpp b/include/osmium/osm/object.hpp index fd60595..c20c648 100644 --- a/include/osmium/osm/object.hpp +++ b/include/osmium/osm/object.hpp @@ -274,7 +274,7 @@ namespace Osmium { m_tags() { } - Object(const Object &o) : + Object(const Object& o) : m_id(o.m_id), m_version(o.m_version), m_changeset(o.m_changeset), diff --git a/include/osmium/osm/relation.hpp b/include/osmium/osm/relation.hpp index e1b7972..2211690 100644 --- a/include/osmium/osm/relation.hpp +++ b/include/osmium/osm/relation.hpp @@ -40,7 +40,7 @@ namespace Osmium { m_members() { } - Relation(const Relation &relation) : + Relation(const Relation& relation) : Object(relation), m_members(relation.members()) { } diff --git a/include/osmium/output.hpp b/include/osmium/output.hpp index fc88c5c..32721f5 100644 --- a/include/osmium/output.hpp +++ b/include/osmium/output.hpp @@ -78,7 +78,7 @@ namespace Osmium { public: - typedef Osmium::Output::Base* (*create_output_t)(const Osmium::OSMFile&); + typedef Osmium::Output::Base*(*create_output_t)(const Osmium::OSMFile&); private: @@ -98,7 +98,7 @@ namespace Osmium { return m_callbacks.insert(encoding2create_t::value_type(encoding, create_function)).second; } - bool unregister_output_format(Osmium::OSMFile::FileEncoding* encoding ) { + bool unregister_output_format(Osmium::OSMFile::FileEncoding* encoding) { return m_callbacks.erase(encoding) == 1; } diff --git a/include/osmium/storage/byid/vector.hpp b/include/osmium/storage/byid/vector.hpp index a23a2d4..2280840 100644 --- a/include/osmium/storage/byid/vector.hpp +++ b/include/osmium/storage/byid/vector.hpp @@ -64,7 +64,7 @@ namespace Osmium { } bool operator!=(const item_t& other) const { - return ! (*this == other); + return !(*this == other); } }; diff --git a/osmjs/osmjs.cpp b/osmjs/osmjs.cpp index ef0ef1d..4937c59 100644 --- a/osmjs/osmjs.cpp +++ b/osmjs/osmjs.cpp @@ -92,7 +92,7 @@ std::string find_include_file(std::string filename) { exit(1); } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { std::ios_base::sync_with_stdio(false); bool two_passes = false; diff --git a/test/t/osm/test_way_node_list.cpp b/test/t/osm/test_way_node_list.cpp index f9ff223..c554017 100644 --- a/test/t/osm/test_way_node_list.cpp +++ b/test/t/osm/test_way_node_list.cpp @@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(closed_or_not) { wnl.add(8); BOOST_CHECK(!wnl.is_closed()); wnl.add(5); - BOOST_CHECK( wnl.is_closed()); + BOOST_CHECK(wnl.is_closed()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/t/tags/test_tag.cpp b/test/t/tags/test_tag.cpp index 609aafc..d85caf5 100644 --- a/test/t/tags/test_tag.cpp +++ b/test/t/tags/test_tag.cpp @@ -14,7 +14,7 @@ BOOST_AUTO_TEST_CASE(tag) { Osmium::OSM::Tag t2("foo", "bar"); Osmium::OSM::Tag t3("foo", "baz"); Osmium::OSM::Tag t4("x", "y"); - + BOOST_CHECK_EQUAL(t1, t2); BOOST_CHECK(t1 != t3); BOOST_CHECK(t1 != t4);