Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Clean code: trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
emi420 committed Mar 6, 2024
1 parent d6f0c07 commit 17c7ab5
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 38 deletions.
16 changes: 8 additions & 8 deletions src/bootstrap/bootstrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Bootstrap::allTasksQueries(std::shared_ptr<std::vector<BootstrapTask>> tasks) {
return queries;
}

void
void
Bootstrap::start(const underpassconfig::UnderpassConfig &config) {
std::cout << "Connecting to the database ... " << std::endl;
db = std::make_shared<Pq>();
Expand Down Expand Up @@ -97,14 +97,14 @@ Bootstrap::start(const underpassconfig::UnderpassConfig &config) {

}

void
void
Bootstrap::processWays() {

std::vector<std::string> tables = {
QueryRaw::polyTable,
QueryRaw::lineTable
};

for (auto table_it = tables.begin(); table_it != tables.end(); ++table_it) {
std::cout << std::endl << "Processing ways ... ";
long int total = queryraw->getCount(*table_it);
Expand Down Expand Up @@ -138,7 +138,7 @@ Bootstrap::processWays() {
std::ref(ways),
};
std::cout << "\r" << "Processing " << *table_it << ": " << count << "/" << total << " (" << percentage << "%)";

boost::asio::post(pool, boost::bind(&Bootstrap::threadBootstrapWayTask, this, wayTask));
}

Expand All @@ -157,9 +157,9 @@ Bootstrap::processWays() {

}

void
void
Bootstrap::processNodes() {

std::cout << "Processing nodes ... ";
long int total = queryraw->getCount("nodes");
long int count = 0;
Expand Down Expand Up @@ -205,9 +205,9 @@ Bootstrap::processNodes() {

}

void
void
Bootstrap::processRelations() {

std::cout << "Processing relations ... ";
long int total = queryraw->getCount("relations");
long int count = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/data/pq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Pq::escapedString(const std::string &s)
return sdb->esc(newstr);
}

std::string
std::string
Pq::escapedJSON(const std::string &s) {
std::ostringstream o;
for (auto c = s.cbegin(); c != s.cend(); c++) {
Expand Down
2 changes: 1 addition & 1 deletion src/osm/osmchange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ OsmChange::dump(void)
}
}
std::cerr << "Final timestamp: " << to_simple_string(final_entry) << std::endl;

}

void
Expand Down
10 changes: 4 additions & 6 deletions src/raw/queryraw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ QueryRaw::applyChange(const OsmWay &way) const
ss << std::setprecision(12) << boost::geometry::wkt(way.linestring);
}
std::string geostring = ss.str();

if (way.refs.size() > 2
&& (way.action == osmobjects::create || way.action == osmobjects::modify)) {
if ((way.refs.front() != way.refs.back() && way.refs.size() == boost::geometry::num_points(way.linestring)) ||
Expand Down Expand Up @@ -306,7 +306,7 @@ QueryRaw::applyChange(const OsmRelation &relation) const
// TODO: support for both multipolygon & multilinestring
// ss << std::setprecision(12) << boost::geometry::wkt(relation.multilinestring);
std::string geostring = ss.str();

if (relation.action == osmobjects::create || relation.action == osmobjects::modify) {

query = "INSERT INTO relations as r (osm_id, tags, refs, geom, timestamp, version, \"user\", uid, changeset) VALUES(";
Expand Down Expand Up @@ -568,7 +568,6 @@ void QueryRaw::buildGeometries(std::shared_ptr<OsmChangeFile> osmchanges, const
} else {
osmchanges->waycache.insert(std::make_pair(way->id, std::make_shared<osmobjects::OsmWay>(*way)));
}

}
}
}
Expand Down Expand Up @@ -657,8 +656,7 @@ void QueryRaw::buildGeometries(std::shared_ptr<OsmChangeFile> osmchanges, const
}
}
}
}

}
}

void
Expand Down Expand Up @@ -838,7 +836,7 @@ QueryRaw::getWaysFromDBWithoutRefs(long lastid, int pageSize, const std::string
} else {
waysQuery += ", tags FROM " + tableName + " order by osm_id desc limit " + std::to_string(pageSize) + ";";
}

auto ways_result = dbconn->query(waysQuery);
// Fill vector of OsmWay objects
auto ways = std::make_shared<std::vector<OsmWay>>();
Expand Down
4 changes: 2 additions & 2 deletions src/replicator/threads.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ threadOsmChange(OsmChangeTask osmChangeTask)

try {
osmchanges->nodecache.clear();
osmchanges->readXML(changes_xml);
osmchanges->readXML(changes_xml);
if (osmchanges->changes.size() > 0) {
task.timestamp = osmchanges->changes.back()->final_entry;
log_debug("OsmChange final_entry: %1%", task.timestamp);
Expand Down Expand Up @@ -496,7 +496,7 @@ threadOsmChange(OsmChangeTask osmChangeTask)
auto removed_ways = std::make_shared<std::vector<long>>();
auto removed_relations = std::make_shared<std::vector<long>>();
auto validation_removals = std::make_shared<std::vector<long>>();

// Raw data and validation
if (!config->disable_validation || !config->disable_raw) {
for (auto it = std::begin(osmchanges->changes); it != std::end(osmchanges->changes); ++it) {
Expand Down
2 changes: 1 addition & 1 deletion src/stats/querystats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ QueryStats::applyChange(const changesets::ChangeSet &change) const
}

query += ", bbox=" + bbox.substr(2) + ")'));";

return query;

}
Expand Down
8 changes: 4 additions & 4 deletions src/testsuite/libunderpass.all/geo-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ main(int argc, char* argv[])
dbglogfile.setWriteDisk(true);
dbglogfile.setLogFilename("geo-test.log");
dbglogfile.setVerbosity(3);

TestGU tgu;

std::string test_data_dir(DATADIR);
Expand All @@ -59,15 +59,15 @@ main(int argc, char* argv[])
} else {
runtest.fail("Read file with bad relative path");
return 1;
}
}

if (tgu.readFile("/etc/underpass/priority.geojson")) {
runtest.pass("Read file with absolute path");
} else {
runtest.fail("Read file with absolute path");
return 1;
}
}

};

// local Variables:
Expand Down
4 changes: 2 additions & 2 deletions src/testsuite/libunderpass.all/planetreplicator-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void testPath(underpassconfig::UnderpassConfig config) {
TestCO change;
if (boost::filesystem::exists(osmchange->filespec)) {
change.readChanges(osmchange->filespec);
} else {
} else {
TestPlanet planet;
auto data = planet.downloadFile(osmchange->getURL()).data;
auto xml = planet.processData(osmchange->filespec, *data);
Expand Down Expand Up @@ -128,7 +128,7 @@ main(int argc, char *argv[]) {
}
}
}

}

// local Variables:
Expand Down
4 changes: 2 additions & 2 deletions src/testsuite/libunderpass.all/under-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ int
main(int argc, char* argv[])
{
std::string basedir = DATADIR;

Underpass under("underpass");

if (under.sdb->is_open()) {
runtest.pass("Underpass::connect");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/testsuite/libunderpass.all/yaml-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ main(int argc, char *argv[])
std::string filespec = DATADIR;
filespec += "/testsuite/libunderpass.all/test.yaml";
yaml.read(filespec);

if (yaml.get("tags").children.size() > 0) {
runtest.pass("Yaml::get().children");
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/underpass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ main(int argc, char *argv[])
} else {
config.concurrency = std::thread::hardware_concurrency();
}

if (vm.count("timestamp") || vm.count("url")) {
// Planet server
if (vm.count("planet")) {
Expand Down Expand Up @@ -335,7 +335,7 @@ main(int argc, char *argv[])
exit(0);

}

if (vm.count("bootstrap")){
std::thread bootstrapThread;
std::cout << "Starting bootstrapping process ..." << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/geoutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GeoUtil::readFile(const std::string &filespec)
if (!std::filesystem::exists(boundary_file)) {
log_error("File not found: %1%", boundary_file);
return false;
}
}
log_debug("Opening geo data file: %1%", boundary_file);
std::string foo = boundary_file.string();
GDALDataset *poDS = (GDALDataset *)GDALOpenEx(foo.c_str(), GDAL_OF_VECTOR, NULL, NULL, NULL);
Expand Down
8 changes: 4 additions & 4 deletions src/validate/geospatial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Geospatial::checkWay(const osmobjects::OsmWay &way, const std::string &type, yam
}

auto config = tests.get("config");
bool check_badgeom = config.get_value("badgeom") == "yes";
bool check_badgeom = config.get_value("badgeom") == "yes";
// bool check_overlapping = config.get_value("overlapping") == "yes";
// bool check_duplicate = config.get_value("duplicate") == "yes";

Expand Down Expand Up @@ -96,7 +96,7 @@ Geospatial::checkWay(const osmobjects::OsmWay &way, const std::string &type, yam
return status;
}

bool
bool
Geospatial::overlaps(const std::list<std::shared_ptr<osmobjects::OsmWay>> &allways, osmobjects::OsmWay &way) {
#ifdef TIMING_DEBUG_X
boost::timer::auto_cpu_timer timer("validate::overlaps: took %w seconds\n");
Expand All @@ -116,7 +116,7 @@ Geospatial::overlaps(const std::list<std::shared_ptr<osmobjects::OsmWay>> &allwa
return false;
}

bool
bool
Geospatial::duplicate(const std::list<std::shared_ptr<osmobjects::OsmWay>> &allways, osmobjects::OsmWay &way) {
#ifdef TIMING_DEBUG_X
boost::timer::auto_cpu_timer timer("validate::duplicate: took %w seconds\n");
Expand All @@ -143,7 +143,7 @@ Geospatial::duplicate(const std::list<std::shared_ptr<osmobjects::OsmWay>> &allw
return false;
}

bool
bool
Geospatial::unsquared(
const linestring_t &way,
double min_angle,
Expand Down
4 changes: 2 additions & 2 deletions src/validate/semantic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Semantic::checkWay(const osmobjects::OsmWay &way, const std::string &type, yaml:
yaml::Node required_tags;
if (check_incomplete) {
required_tags = tests.get("required_tags");
}
}

// List of valid tags to be validated
yaml::Node tags;
Expand Down Expand Up @@ -237,7 +237,7 @@ Semantic::checkRelation(const osmobjects::OsmRelation &relation, const std::stri
yaml::Node required_tags;
if (check_incomplete) {
required_tags = tests.get("required_tags");
}
}

// List of valid tags to be validated
yaml::Node tags;
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/python.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ std::string dumpJSON(ValidateStatus& self) {

BOOST_PYTHON_MODULE(underpass)
{
//
//
// using namespace defaultvalidation;
// class_<DefaultValidation, boost::noncopyable>("Validate")
// // .def("checkTag", &DefaultValidation::checkTag)
Expand Down

0 comments on commit 17c7ab5

Please sign in to comment.