Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Sep 24, 2012
1 parent 814d423 commit d392f20
Show file tree
Hide file tree
Showing 30 changed files with 55 additions and 54 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions examples/nodedensity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class NodeDensityHandler : public Osmium::Handler::Base {
}

void node(const shared_ptr<Osmium::OSM::Node const>& 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;
Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You should have received a copy of the Licenses along with Osmium. If not, see
# include <osmium/handler/endtime.hpp>
#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) {
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_find_bbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_mpdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DumpHandler : public Osmium::Handler::Base {
typedef Osmium::Storage::ById::SparseTable<Osmium::OSM::Position> storage_sparsetable_t;
typedef Osmium::Storage::ById::MmapFile<Osmium::OSM::Position> 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) {
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_progress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_range_from_history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You should have received a copy of the Licenses along with Osmium. If not, see
#include <osmium/handler/endtime.hpp>
#include <osmium/handler/range_from_history.hpp>

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);
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_relation_members.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class DebugRelationsAssembler : public Osmium::Relations::Assembler<DebugRelatio

};

int main(int argc, char *argv[]) {
int main(int argc, char* argv[]) {
std::ios_base::sync_with_stdio(false);

if (argc != 2) {
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_store_and_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You should have received a copy of the Licenses along with Osmium. If not, see
#include <osmium/handler/debug.hpp>
#include <osmium/storage/objectstore.hpp>

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);
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_to_postgis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down
10 changes: 5 additions & 5 deletions examples/osmium_toogr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ 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);
}

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);
}
Expand All @@ -114,15 +114,15 @@ 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);
}

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);
}
Expand Down Expand Up @@ -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'},
Expand Down
4 changes: 2 additions & 2 deletions examples/osmium_toogr2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ class OGROutHandler : public Osmium::Handler::Base {
typedef Osmium::Storage::ById::SparseTable<Osmium::OSM::Position> storage_sparsetable_t;
typedef Osmium::Storage::ById::MmapFile<Osmium::OSM::Position> 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);
Expand Down
2 changes: 1 addition & 1 deletion examples/osmium_toshape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/export/shapefile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/handler/coordinates_for_ways.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace Osmium {
void node(const shared_ptr<Osmium::OSM::Node const>& 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());
}
Expand Down
22 changes: 11 additions & 11 deletions include/osmium/input/pbf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions include/osmium/input/xml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<char>(attrs[count+1][0]);
Expand Down
8 changes: 4 additions & 4 deletions include/osmium/javascript/template.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,22 @@ namespace Osmium {
*/
template <class TWrapped, v8::Handle<v8::Value> (func)(TWrapped*)>
static v8::Handle<v8::Value> accessor_getter(v8::Local<v8::String>, const v8::AccessorInfo &info) {
static v8::Handle<v8::Value> accessor_getter(v8::Local<v8::String>, const v8::AccessorInfo& info) {
return func(reinterpret_cast<TWrapped*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()));
}

template <class TWrapped, v8::Handle<v8::Value> func(v8::Local<v8::String>, TWrapped*)>
static v8::Handle<v8::Value> named_property_getter(v8::Local<v8::String> property, const v8::AccessorInfo &info) {
static v8::Handle<v8::Value> named_property_getter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
return func(property, reinterpret_cast<TWrapped*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()));
}

template <class TWrapped, v8::Handle<v8::Value> func(uint32_t, TWrapped*)>
static v8::Handle<v8::Value> indexed_property_getter(uint32_t index, const v8::AccessorInfo &info) {
static v8::Handle<v8::Value> indexed_property_getter(uint32_t index, const v8::AccessorInfo& info) {
return func(index, reinterpret_cast<TWrapped*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()));
}

template <class TWrapped, v8::Handle<v8::Array> func(TWrapped*)>
static v8::Handle<v8::Array> property_enumerator(const v8::AccessorInfo &info) {
static v8::Handle<v8::Array> property_enumerator(const v8::AccessorInfo& info) {
return func(reinterpret_cast<TWrapped*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()));
}

Expand Down
4 changes: 2 additions & 2 deletions include/osmium/javascript/wrapper/osm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ namespace Osmium {
struct OSMWay : public OSMObject {

static v8::Handle<v8::Value> nodes(Osmium::OSM::Way* way) {
return OSMWayNodeList::get<OSMWayNodeList>().create_instance((void *)&(way->nodes()));
return OSMWayNodeList::get<OSMWayNodeList>().create_instance((void*)&(way->nodes()));
}

static v8::Handle<v8::Value> geom(Osmium::OSM::Way* way) {
Expand Down Expand Up @@ -284,7 +284,7 @@ namespace Osmium {
struct OSMRelation : public OSMObject {

static v8::Handle<v8::Value> members(Osmium::OSM::Relation* relation) {
return OSMRelationMemberList::get<OSMRelationMemberList>().create_instance((void *)&(relation->members()));
return OSMRelationMemberList::get<OSMRelationMemberList>().create_instance((void*)&(relation->members()));
}

OSMRelation() :
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/multipolygon/builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions include/osmium/osm/area.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ 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.
Area(const Way& way) :
Object(way),
m_node_list(way.nodes()),
m_geos_geometry() {
id( id() * 2 );
id(id() * 2);
}

Area(const Area& area) :
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/osm/object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/osm/relation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Osmium {
m_members() {
}

Relation(const Relation &relation) :
Relation(const Relation& relation) :
Object(relation),
m_members(relation.members()) {
}
Expand Down
4 changes: 2 additions & 2 deletions include/osmium/output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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;
}

Expand Down
Loading

0 comments on commit d392f20

Please sign in to comment.