more style fixes

nominatim-release-3.5.1
Sarah Hoffmann 2019-11-16 10:31:22 +01:00
parent 96a2d06053
commit 1142f20929
4 changed files with 31 additions and 33 deletions

View File

@ -20,8 +20,9 @@ public:
file_t(std::string const &filename, bool remove_on_construct = true)
: m_filename(filename)
{
if (remove_on_construct)
if (remove_on_construct) {
delete_file(false);
}
}
~file_t() noexcept { delete_file(true); }

View File

@ -6,20 +6,20 @@
# Then the tablespace can be owned by the current user.
if [ "x$PG_CLUSTER_CONF_ROOT" != "x" ]; then
BASEDIR=`pwd`
BASEDIR=`pwd`
TBLDIR=${BASEDIR}/osm2pgsql-test-tablespace
TBLDIR=${BASEDIR}/osm2pgsql-test-tablespace
if [ -d "$TBLDIR" ]; then
echo "Tablespace directory already exists. Cleaning up."
if [ -d "$TBLDIR" ]; then
echo "Tablespace directory already exists. Cleaning up."
if find $TBLDIR -maxdepth 1 -mindepth 1 -type d -name 'PG*'; then
rm -r $TBLDIR/PG*
if find $TBLDIR -maxdepth 1 -mindepth 1 -type d -name 'PG*'; then
rm -r $TBLDIR/PG*
fi
else
mkdir $TBLDIR
chmod 777 $TBLDIR
fi
else
mkdir $TBLDIR
chmod 777 $TBLDIR
fi
psql -c "CREATE TABLESPACE tablespacetest LOCATION '$TBLDIR'" postgres
psql -c "CREATE TABLESPACE tablespacetest LOCATION '$TBLDIR'" postgres
fi

View File

@ -19,26 +19,31 @@ public:
return ((z == other.z) && (x == other.x) && (y == other.y));
}
bool operator<(const xyz &other) const
bool operator<(xyz const &other) const
{
if (z < other.z)
if (z < other.z) {
return true;
if (z > other.z)
}
if (z > other.z) {
return false;
if (x < other.x)
}
if (x < other.x) {
return true;
if (x > other.x)
}
if (x > other.x) {
return false;
if (y < other.y)
}
if (y < other.y) {
return true;
}
return false;
}
void to_centroid(double &cx, double &cy) const
{
const double datum = 0.5 * (1 << z);
const double scale = EARTH_CIRCUMFERENCE / (1 << z);
double const datum = 0.5 * (1U << z);
double const scale = EARTH_CIRCUMFERENCE / (1U << z);
cx = ((x + 0.5) - datum) * scale;
cy = (datum - (y + 0.5)) * scale;
}
@ -54,19 +59,10 @@ struct tile_output_set
bool operator==(tile_output_set const &other) const
{
if (tiles.size() != other.tiles.size())
return false;
auto this_itr = tiles.cbegin();
auto o_itr = other.tiles.cbegin();
while (this_itr != tiles.end())
if (!(*(this_itr++) == *(o_itr++)))
return false;
return true;
return tiles == other.tiles;
}
tile_output_set &operator+=(const tile_output_set &other)
tile_output_set &operator+=(tile_output_set const &other)
{
tiles.insert(other.tiles.cbegin(), other.tiles.cend());
return *this;
@ -89,7 +85,7 @@ struct tile_output_set
static tile_output_set generate_random(uint32_t zoom, size_t count)
{
tile_output_set set;
const int cmask = (1 << zoom) - 1;
int const cmask = (1 << zoom) - 1;
do {
set.output_dirty_tile(rand() & cmask, rand() & cmask, zoom);

View File

@ -61,8 +61,9 @@ TEST_CASE("Projection setup")
options_t options((int)option_params.size(), (char **)option_params.data());
if (proj_name)
if (proj_name) {
CHECK(strcmp(options.projection->target_desc(), proj_name) == 0);
}
db.run_import(options, "n1 Tamenity=bar x0 y0");