From e61128056fb829acb09bc1f33ce6b945aedd1ef3 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Mon, 14 Jul 2025 14:49:23 +0100 Subject: [PATCH] clang-format - +QualifierAlignment: Right +Standard: c++20 --- .clang-format | 6 +- benchmark/include/bench_framework.hpp | 6 +- benchmark/include/compare_images.hpp | 4 +- benchmark/src/test_rendering.cpp | 6 +- benchmark/src/test_rendering_shared_map.cpp | 8 +- demo/c++/rundemo.cpp | 4 +- demo/viewer/layerdelegate.cpp | 2 +- demo/viewer/layerdelegate.hpp | 4 +- demo/viewer/layerlistmodel.cpp | 2 +- demo/viewer/layerlistmodel.hpp | 6 +- demo/viewer/layerwidget.cpp | 4 +- demo/viewer/layerwidget.hpp | 4 +- demo/viewer/styles_model.cpp | 4 +- demo/viewer/styles_model.hpp | 4 +- .../sparsehash/internal/densehashtable.h | 134 +++++------ .../sparsehash/internal/hashtable-common.h | 18 +- .../internal/libc_allocator_with_realloc.h | 16 +- deps/mapnik/sparsehash/template_util.h | 4 +- deps/mapnik/sparsehash/type_traits.h | 38 +-- include/mapnik/agg/render_polygon_pattern.hpp | 6 +- include/mapnik/agg_renderer.hpp | 6 +- include/mapnik/attribute_collector.hpp | 4 +- include/mapnik/cairo/cairo_context.hpp | 4 +- include/mapnik/cairo/cairo_image_util.hpp | 4 +- .../mapnik/cairo/render_polygon_pattern.hpp | 8 +- include/mapnik/color.hpp | 2 +- include/mapnik/config_error.hpp | 2 +- include/mapnik/coord.hpp | 2 +- .../mapnik/css/css_color_grammar_x3_def.hpp | 46 ++-- include/mapnik/css/css_grammar_x3_def.hpp | 8 +- include/mapnik/datasource.hpp | 4 +- include/mapnik/datasource_cache.hpp | 2 +- include/mapnik/datasource_plugin.hpp | 2 +- include/mapnik/debug.hpp | 12 +- include/mapnik/enumeration.hpp | 8 +- include/mapnik/expression_grammar_x3_def.hpp | 48 ++-- include/mapnik/expression_node.hpp | 4 +- include/mapnik/expression_node_types.hpp | 30 +-- include/mapnik/factory.hpp | 2 +- include/mapnik/feature.hpp | 2 +- .../mapnik/feature_style_processor_impl.hpp | 4 +- include/mapnik/geometry/boost_adapters.hpp | 2 +- .../geometry/boost_spirit_karma_adapter.hpp | 4 +- include/mapnik/geometry/box2d.hpp | 2 +- include/mapnik/global.hpp | 12 +- include/mapnik/grid/grid.hpp | 4 +- include/mapnik/grid/grid_pixel.hpp | 36 +-- include/mapnik/grid/grid_pixfmt.hpp | 66 +++--- include/mapnik/grid/grid_renderer.hpp | 2 +- include/mapnik/grid/grid_view.hpp | 2 +- include/mapnik/grid_vertex_converter.hpp | 14 +- include/mapnik/group/group_rule.hpp | 16 +- include/mapnik/hextree.hpp | 10 +- include/mapnik/image_filter.hpp | 8 +- .../mapnik/image_filter_grammar_x3_def.hpp | 12 +- include/mapnik/image_impl.hpp | 10 +- include/mapnik/image_null.hpp | 4 +- include/mapnik/image_reader.hpp | 2 +- include/mapnik/image_util.hpp | 2 +- include/mapnik/image_view_null.hpp | 6 +- include/mapnik/jpeg_io.hpp | 2 +- .../mapnik/json/feature_grammar_x3_def.hpp | 6 +- .../json/generic_json_grammar_x3_def.hpp | 14 +- .../mapnik/json/geojson_grammar_x3_def.hpp | 16 +- .../mapnik/json/positions_grammar_x3_def.hpp | 2 +- .../mapnik/json/topojson_grammar_x3_def.hpp | 30 +-- .../json/unicode_string_grammar_x3_def.hpp | 10 +- include/mapnik/map.hpp | 4 +- include/mapnik/memory_datasource.hpp | 2 +- include/mapnik/octree.hpp | 6 +- include/mapnik/palette.hpp | 4 +- include/mapnik/path.hpp | 2 +- .../mapnik/path_expression_grammar_x3_def.hpp | 4 +- include/mapnik/pixel_types.hpp | 24 +- include/mapnik/plugin.hpp | 2 +- include/mapnik/png_io.hpp | 8 +- include/mapnik/pool.hpp | 2 +- include/mapnik/proj_transform_cache.hpp | 2 +- include/mapnik/projection.hpp | 4 +- include/mapnik/quad_tree.hpp | 4 +- include/mapnik/raster_colorizer.hpp | 2 +- .../process_point_symbolizer.hpp | 20 +- include/mapnik/rule.hpp | 2 +- include/mapnik/safe_cast.hpp | 12 +- include/mapnik/simplify_converter.hpp | 4 +- include/mapnik/span_image_filter.hpp | 12 +- include/mapnik/sql_utils.hpp | 4 +- .../svg/output/svg_output_attributes.hpp | 26 +- include/mapnik/svg/output/svg_renderer.hpp | 2 +- include/mapnik/svg/svg_parser_exception.hpp | 2 +- include/mapnik/svg/svg_path_adapter.hpp | 10 +- include/mapnik/svg/svg_path_parser.hpp | 12 +- include/mapnik/symbolizer.hpp | 4 +- include/mapnik/symbolizer_base.hpp | 2 +- include/mapnik/symbolizer_utils.hpp | 22 +- include/mapnik/text/face.hpp | 2 +- include/mapnik/text/font_feature_settings.hpp | 4 +- include/mapnik/text/harfbuzz_shaper.hpp | 6 +- include/mapnik/text/placement_finder.hpp | 2 +- include/mapnik/text/properties_util.hpp | 12 +- include/mapnik/text/scrptrun.hpp | 24 +- include/mapnik/tiff_io.hpp | 6 +- include/mapnik/unicode.hpp | 2 +- include/mapnik/util/conversions.hpp | 10 +- include/mapnik/util/geometry_to_svg.hpp | 2 +- include/mapnik/util/geometry_to_wkb.hpp | 2 +- include/mapnik/util/mapped_memory_file.hpp | 2 +- include/mapnik/util/name_to_int.hpp | 2 +- include/mapnik/util/path_iterator.hpp | 4 +- include/mapnik/util/singleton.hpp | 6 +- include/mapnik/value/error.hpp | 2 +- include/mapnik/vertex_adapters.hpp | 2 +- include/mapnik/vertex_converters.hpp | 4 +- include/mapnik/vertex_vector.hpp | 2 +- include/mapnik/view_transform.hpp | 14 +- include/mapnik/webp_io.hpp | 12 +- include/mapnik/well_known_srs.hpp | 4 +- include/mapnik/wkt/wkt_grammar_x3_def.hpp | 4 +- include/mapnik/xml_attribute_cast.hpp | 2 +- include/mapnik/xml_node.hpp | 12 +- plugins/input/csv/csv_datasource.cpp | 10 +- plugins/input/csv/csv_datasource.hpp | 2 +- plugins/input/csv/csv_featureset.cpp | 2 +- plugins/input/csv/csv_featureset.hpp | 2 +- plugins/input/csv/csv_index_featureset.cpp | 2 +- plugins/input/csv/csv_inline_featureset.hpp | 2 +- plugins/input/gdal/gdal_datasource.cpp | 4 +- plugins/input/gdal/gdal_datasource.hpp | 2 +- plugins/input/gdal/gdal_featureset.cpp | 12 +- plugins/input/geobuf/geobuf.hpp | 2 +- plugins/input/geobuf/geobuf_datasource.cpp | 6 +- plugins/input/geobuf/geobuf_datasource.hpp | 2 +- plugins/input/geobuf/geobuf_featureset.hpp | 2 +- plugins/input/geojson/geojson_datasource.cpp | 12 +- plugins/input/geojson/geojson_datasource.hpp | 4 +- plugins/input/geojson/geojson_featureset.hpp | 2 +- .../geojson/geojson_index_featureset.cpp | 4 +- .../geojson_memory_index_featureset.cpp | 2 +- .../geojson_memory_index_featureset.hpp | 2 +- plugins/input/ogr/ogr_datasource.cpp | 24 +- plugins/input/ogr/ogr_datasource.hpp | 2 +- plugins/input/ogr/ogr_featureset.cpp | 4 +- plugins/input/ogr/ogr_featureset.hpp | 4 +- plugins/input/ogr/ogr_index.hpp | 20 +- plugins/input/ogr/ogr_index_featureset.cpp | 2 +- plugins/input/ogr/ogr_index_featureset.hpp | 4 +- plugins/input/ogr/ogr_layer_ptr.hpp | 4 +- plugins/input/ogr/ogr_utils.cpp | 2 +- plugins/input/ogr/ogr_utils.hpp | 2 +- .../input/pgraster/pgraster_datasource.cpp | 36 +-- .../input/pgraster/pgraster_datasource.hpp | 22 +- .../input/pgraster/pgraster_featureset.cpp | 8 +- .../input/pgraster/pgraster_featureset.hpp | 2 +- .../input/pgraster/pgraster_wkb_reader.cpp | 12 +- .../input/pgraster/pgraster_wkb_reader.hpp | 6 +- plugins/input/postgis/asyncresultset.hpp | 10 +- plugins/input/postgis/connection_manager.hpp | 6 +- plugins/input/postgis/cursorresultset.hpp | 10 +- plugins/input/postgis/numeric2string.hpp | 2 +- plugins/input/postgis/postgis_datasource.cpp | 46 ++-- plugins/input/postgis/postgis_datasource.hpp | 20 +- plugins/input/postgis/postgis_featureset.cpp | 8 +- plugins/input/postgis/postgis_featureset.hpp | 2 +- plugins/input/postgis/resultset.hpp | 20 +- plugins/input/raster/raster_datasource.cpp | 26 +- plugins/input/raster/raster_datasource.hpp | 6 +- plugins/input/raster/raster_featureset.hpp | 24 +- plugins/input/raster/raster_info.cpp | 4 +- plugins/input/raster/raster_info.hpp | 6 +- plugins/input/shape/dbfile.cpp | 10 +- plugins/input/shape/shape_datasource.cpp | 24 +- plugins/input/shape/shape_datasource.hpp | 4 +- plugins/input/shape/shape_featureset.hpp | 2 +- .../input/shape/shape_index_featureset.hpp | 2 +- plugins/input/shape/shape_io.cpp | 8 +- plugins/input/shape/shape_io.hpp | 8 +- plugins/input/shape/shapefile.hpp | 2 +- plugins/input/sqlite/sqlite_connection.hpp | 14 +- plugins/input/sqlite/sqlite_datasource.cpp | 22 +- plugins/input/sqlite/sqlite_datasource.hpp | 8 +- plugins/input/sqlite/sqlite_featureset.cpp | 8 +- plugins/input/sqlite/sqlite_featureset.hpp | 2 +- plugins/input/sqlite/sqlite_prepared.hpp | 4 +- plugins/input/sqlite/sqlite_resultset.hpp | 14 +- plugins/input/sqlite/sqlite_utils.hpp | 30 +-- plugins/input/tiles/mbtiles_source.hpp | 2 +- plugins/input/tiles/mvt_io.cpp | 16 +- plugins/input/tiles/mvt_io.hpp | 8 +- plugins/input/tiles/pmtiles_source.hpp | 38 +-- plugins/input/tiles/tiles_datasource.cpp | 2 +- plugins/input/tiles/tiles_datasource.hpp | 2 +- .../input/tiles/vector_tiles_featureset.cpp | 2 +- .../input/topojson/topojson_datasource.cpp | 8 +- .../input/topojson/topojson_datasource.hpp | 2 +- .../input/topojson/topojson_featureset.hpp | 2 +- src/agg/process_dot_symbolizer.cpp | 12 +- src/agg/process_line_pattern_symbolizer.cpp | 8 +- src/agg/process_line_symbolizer.cpp | 26 +- src/agg/process_polygon_symbolizer.cpp | 2 +- src/agg/process_shield_symbolizer.cpp | 16 +- src/agg/process_text_symbolizer.cpp | 14 +- src/cairo/cairo_context.cpp | 6 +- src/cairo/cairo_renderer.cpp | 12 +- src/cairo/process_line_pattern_symbolizer.cpp | 10 +- src/cairo_io.cpp | 2 +- src/conversions_numeric.cpp | 10 +- src/datasource_cache.cpp | 6 +- src/datasource_cache_static.cpp | 2 +- src/debug.cpp | 4 +- src/geometry/interior.cpp | 22 +- src/geometry/polylabel.cpp | 2 +- src/glibc_workaround.cpp | 4 +- src/grid/grid.cpp | 2 +- src/grid/process_line_pattern_symbolizer.cpp | 22 +- src/group/group_rule.cpp | 8 +- src/image_any.cpp | 2 +- src/image_compositing.cpp | 2 +- src/image_reader.cpp | 4 +- src/image_scaling.cpp | 2 +- src/image_util.cpp | 24 +- src/jpeg_reader.cpp | 12 +- src/json/feature_from_geojson.cpp | 4 +- src/json/geometry_from_geojson.cpp | 4 +- src/json/mapnik_geometry_to_geojson.cpp | 2 +- src/libxml2_loader.cpp | 22 +- src/load_map.cpp | 12 +- src/memory_datasource.cpp | 4 +- src/palette.cpp | 2 +- src/plugin.cpp | 2 +- src/png_reader.cpp | 8 +- src/proj_transform.cpp | 4 +- src/projection.cpp | 6 +- src/rapidxml_loader.cpp | 2 +- src/raster_colorizer.cpp | 4 +- src/save_map.cpp | 2 +- src/scale_denominator.cpp | 2 +- src/simplify.cpp | 2 +- src/svg/output/process_symbolizers.cpp | 6 +- src/svg/output/svg_generator.cpp | 4 +- src/svg/output/svg_output_attributes.cpp | 4 +- src/svg/svg_parser.cpp | 18 +- src/svg/svg_path_parser.cpp | 4 +- src/svg/svg_points_parser.cpp | 4 +- src/svg/svg_transform_parser.cpp | 4 +- src/symbolizer_keys.cpp | 2 +- src/text/face.cpp | 2 +- src/text/formatting/format.cpp | 4 +- src/text/placement_finder.cpp | 4 +- src/text/placements/registry.cpp | 2 +- src/text/placements/simple.cpp | 2 +- src/text/renderer.cpp | 6 +- src/text/scrptrun.cpp | 10 +- src/text/symbolizer_helpers.cpp | 10 +- src/text/text_properties.cpp | 4 +- src/tiff_reader.cpp | 4 +- src/tiff_reader.hpp | 72 +++--- src/twkb.cpp | 4 +- src/unicode.cpp | 2 +- src/util/mapped_memory_file.cpp | 2 +- src/value.cpp | 4 +- src/warp.cpp | 10 +- src/webp_reader.cpp | 4 +- src/well_known_srs.cpp | 6 +- src/wkb.cpp | 6 +- src/wkt/geometry_to_wkt.cpp | 4 +- src/xml_tree.cpp | 22 +- test/catch.hpp | 224 +++++++++--------- .../agg_rasterizer_integer_overflow_test.cpp | 2 +- test/standalone/map_xml_test.cpp | 4 +- test/unit/datasource/csv.cpp | 2 +- test/unit/datasource/gdal.cpp | 2 +- test/unit/datasource/geobuf.cpp | 2 +- test/unit/datasource/geojson.cpp | 2 +- test/unit/datasource/ogr.cpp | 4 +- test/unit/datasource/shapeindex.cpp | 4 +- test/unit/geometry/grid_vertex_converter.cpp | 8 +- test/unit/imaging/image.cpp | 8 +- test/unit/imaging/image_view.cpp | 4 +- test/unit/map/background.cpp | 8 +- test/unit/projection/proj_transform.cpp | 6 +- .../renderer/buffer_size_scale_factor.cpp | 4 +- .../unit/renderer/feature_style_processor.cpp | 6 +- test/unit/serialization/wkb_formats_test.cpp | 12 +- test/unit/serialization/xml_parser_trim.cpp | 2 +- test/unit/svg/util.hpp | 2 +- test/unit/util/char_array_buffer.cpp | 2 +- test/unit/vertex_adapter/line_offset_test.cpp | 18 +- test/unit/vertex_adapter/offset_converter.cpp | 12 +- test/visual/renderer.hpp | 38 +-- test/visual/report.cpp | 4 +- test/visual/runner.hpp | 12 +- utils/mapnik-index/mapnik-index.cpp | 4 +- .../mapnik-index/process_geojson_file_x3.cpp | 2 +- utils/ogrindex/ogrindex.cpp | 12 +- utils/pgsql2sqlite/pgsql2sqlite.hpp | 8 +- utils/pgsql2sqlite/sqlite.hpp | 6 +- utils/shapeindex/shapeindex.cpp | 6 +- 297 files changed, 1384 insertions(+), 1384 deletions(-) diff --git a/.clang-format b/.clang-format index cd8e8ef25..7fd7b4578 100644 --- a/.clang-format +++ b/.clang-format @@ -64,16 +64,16 @@ KeepEmptyLinesAtTheStartOfBlocks: false LambdaBodyIndentation: Signature MaxEmptyLinesToKeep: 1 NamespaceIndentation: None -PackConstructorInitializers: Never # only clang-format > 14 +PackConstructorInitializers: Never PointerAlignment: Left -#QualifierAlignment: Left # only clang-format > 14 +QualifierAlignment: Right ReferenceAlignment: Left ReflowComments: true SortIncludes: Never SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false SpaceBeforeInheritanceColon: true -Standard: c++14 +Standard: c++20 BinPackParameters: false BreakBeforeInheritanceComma: false IncludeCategories: diff --git a/benchmark/include/bench_framework.hpp b/benchmark/include/bench_framework.hpp index 0c4d5686b..78bae4229 100644 --- a/benchmark/include/bench_framework.hpp +++ b/benchmark/include/bench_framework.hpp @@ -54,7 +54,7 @@ inline int parse_args(int argc, char** argv, mapnik::parameters& params) { for (int i = 1; i < argc; ++i) { - const char* opt = argv[i]; + char const* opt = argv[i]; if (opt[0] != '-') { // non-option argument, return its index @@ -145,14 +145,14 @@ struct big_number_fmt { int w; double v; - const char* u; + char const* u; big_number_fmt(int width, double value, int base = 1000) : w(width), v(value), u("") { - static const char* suffixes = "\0\0k\0M\0G\0T\0P\0E\0Z\0Y\0\0"; + static char const* suffixes = "\0\0k\0M\0G\0T\0P\0E\0Z\0Y\0\0"; u = suffixes; while (v > 1 && std::log10(std::round(v)) >= width && u[2]) diff --git a/benchmark/include/compare_images.hpp b/benchmark/include/compare_images.hpp index 21f34732a..53ac9508a 100644 --- a/benchmark/include/compare_images.hpp +++ b/benchmark/include/compare_images.hpp @@ -21,8 +21,8 @@ bool compare_images(std::string const& src_fn, std::string const& dest_fn) throw mapnik::image_reader_exception("Failed to load: " + src_fn); } - const mapnik::image_any desc_any = reader1->read(0, 0, reader1->width(), reader1->height()); - const mapnik::image_any src_any = reader2->read(0, 0, reader2->width(), reader2->height()); + mapnik::image_any const desc_any = reader1->read(0, 0, reader1->width(), reader1->height()); + mapnik::image_any const src_any = reader2->read(0, 0, reader2->width(), reader2->height()); mapnik::image_rgba8 const& dest = mapnik::util::get(desc_any); mapnik::image_rgba8 const& src = mapnik::util::get(src_any); diff --git a/benchmark/src/test_rendering.cpp b/benchmark/src/test_rendering.cpp index b03d5f4a1..c226bd08f 100644 --- a/benchmark/src/test_rendering.cpp +++ b/benchmark/src/test_rendering.cpp @@ -26,14 +26,14 @@ class test : public benchmark::test_case scale_factor_(*params.get("scale_factor", 1.0)), preview_(*params.get("preview", "")) { - const auto map = params.get("map"); + auto const map = params.get("map"); if (!map) { throw std::runtime_error("please provide a --map arg"); } xml_ = *map; - const auto ext = params.get("extent"); + auto const ext = params.get("extent"); if (ext && !ext->empty()) { if (!extent_.from_string(*ext)) @@ -101,7 +101,7 @@ int main(int argc, char** argv) { mapnik::parameters params; benchmark::handle_args(argc, argv, params); - const auto name = params.get("name"); + auto const name = params.get("name"); if (!name) { std::clog << "please provide a name for this test\n"; diff --git a/benchmark/src/test_rendering_shared_map.cpp b/benchmark/src/test_rendering_shared_map.cpp index effb8f0a2..1b28a47a6 100644 --- a/benchmark/src/test_rendering_shared_map.cpp +++ b/benchmark/src/test_rendering_shared_map.cpp @@ -64,7 +64,7 @@ class test : public benchmark::test_case preview_(*params.get("preview", "")), im_(m_->width(), m_->height()) { - const auto map = params.get("map"); + auto const map = params.get("map"); if (!map) { throw std::runtime_error("please provide a --map= arg"); @@ -133,8 +133,8 @@ class test : public benchmark::test_case mapnik::image_rgba8 const& src = im_; for (unsigned int y = 0; y < height_; ++y) { - const unsigned int* row_from = src.get_row(y); - const unsigned int* row_to = dest.get_row(y); + unsigned int const* row_from = src.get_row(y); + unsigned int const* row_to = dest.get_row(y); for (unsigned int x = 0; x < width_; ++x) { if (row_from[x] != row_to[x]) @@ -156,7 +156,7 @@ int main(int argc, char** argv) { mapnik::parameters params; benchmark::handle_args(argc, argv, params); - const auto name = params.get("name"); + auto const name = params.get("name"); if (!name) { std::clog << "please provide a name for this test\n"; diff --git a/demo/c++/rundemo.cpp b/demo/c++/rundemo.cpp index 4d1420b1c..b09bf432c 100644 --- a/demo/c++/rundemo.cpp +++ b/demo/c++/rundemo.cpp @@ -49,9 +49,9 @@ int main(int, char**) { using namespace mapnik; - const std::string srs_lcc = + std::string const srs_lcc = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs"; - const std::string srs_merc = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 " + std::string const srs_merc = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 " "+units=m +nadgrids=@null +wktext +no_defs +over"; mapnik::setup(); try diff --git a/demo/viewer/layerdelegate.cpp b/demo/viewer/layerdelegate.cpp index e527254d8..7c95597dc 100644 --- a/demo/viewer/layerdelegate.cpp +++ b/demo/viewer/layerdelegate.cpp @@ -42,7 +42,7 @@ void LayerDelegate::paint(QPainter* painter, QStyleOptionViewItem const& option, painter->setBrush(QBrush(QColor(255, 120, 0, 127))); } -QSize LayerDelegate::sizeHint(const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const +QSize LayerDelegate::sizeHint(QStyleOptionViewItem const& /* option */, QModelIndex const& /* index */) const { return QSize(120, 24); } diff --git a/demo/viewer/layerdelegate.hpp b/demo/viewer/layerdelegate.hpp index 02b7ff7f8..8be965d48 100644 --- a/demo/viewer/layerdelegate.hpp +++ b/demo/viewer/layerdelegate.hpp @@ -35,8 +35,8 @@ class LayerDelegate : public QAbstractItemDelegate public: LayerDelegate(QObject* parent = 0); - void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; - QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; + void paint(QPainter* painter, QStyleOptionViewItem const& option, QModelIndex const& index) const; + QSize sizeHint(QStyleOptionViewItem const& option, QModelIndex const& index) const; }; #endif // LAYER_DELEGATE_HPP diff --git a/demo/viewer/layerlistmodel.cpp b/demo/viewer/layerlistmodel.cpp index eb06e963d..616e16b95 100644 --- a/demo/viewer/layerlistmodel.cpp +++ b/demo/viewer/layerlistmodel.cpp @@ -87,7 +87,7 @@ QVariant LayerListModel::headerData(int section, Qt::Orientation orientation, in return QString("TODO Row %1").arg(section); } -bool LayerListModel::setData(const QModelIndex& index, const QVariant& value, int role) +bool LayerListModel::setData(QModelIndex const& index, QVariant const& value, int role) { if (!map_) return false; diff --git a/demo/viewer/layerlistmodel.hpp b/demo/viewer/layerlistmodel.hpp index 1f8712a4f..54d298a88 100644 --- a/demo/viewer/layerlistmodel.hpp +++ b/demo/viewer/layerlistmodel.hpp @@ -33,10 +33,10 @@ class LayerListModel : public QAbstractListModel Q_OBJECT public: LayerListModel(std::shared_ptr map, QObject* parent = 0); - int rowCount(const QModelIndex& parent = QModelIndex()) const; - QVariant data(const QModelIndex& index, int role) const; + int rowCount(QModelIndex const& parent = QModelIndex()) const; + QVariant data(QModelIndex const& index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); + bool setData(QModelIndex const& index, QVariant const& value, int role = Qt::EditRole); Qt::ItemFlags flags(QModelIndex const& index) const; boost::optional map_layer(int i); diff --git a/demo/viewer/layerwidget.cpp b/demo/viewer/layerwidget.cpp index ddfccab29..54c7c4b1c 100644 --- a/demo/viewer/layerwidget.cpp +++ b/demo/viewer/layerwidget.cpp @@ -40,13 +40,13 @@ void LayerTab::paintEvent(QPaintEvent* e) QListView::paintEvent(e); } -void LayerTab::dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles) +void LayerTab::dataChanged(QModelIndex const& topLeft, QModelIndex const& bottomRight, QVector const& roles) { emit update_mapwidget(); QListView::dataChanged(topLeft, bottomRight, roles); } -void LayerTab::selectionChanged(const QItemSelection& selected, const QItemSelection&) +void LayerTab::selectionChanged(QItemSelection const& selected, QItemSelection const&) { QModelIndexList list = selected.indexes(); if (list.size() != 0) diff --git a/demo/viewer/layerwidget.hpp b/demo/viewer/layerwidget.hpp index b3a597cbb..a6503a240 100644 --- a/demo/viewer/layerwidget.hpp +++ b/demo/viewer/layerwidget.hpp @@ -37,8 +37,8 @@ class LayerTab : public QListView void layerInfo(); void layerInfo2(QModelIndex const&); protected slots: - void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles); - void selectionChanged(const QItemSelection& selected, const QItemSelection&); + void dataChanged(QModelIndex const& topLeft, QModelIndex const& bottomRight, QVector const& roles); + void selectionChanged(QItemSelection const& selected, QItemSelection const&); }; class StyleTab : public QTreeView diff --git a/demo/viewer/styles_model.cpp b/demo/viewer/styles_model.cpp index 41075944d..00ff4f2fa 100644 --- a/demo/viewer/styles_model.cpp +++ b/demo/viewer/styles_model.cpp @@ -92,7 +92,7 @@ class node : private mapnik::util::noncopyable ~node() { qDeleteAll(children_); } private: - const std::unique_ptr impl_; + std::unique_ptr const impl_; QList children_; node* parent_; }; @@ -360,7 +360,7 @@ int StyleModel::columnCount(QModelIndex const&) const return 1; } -QVariant StyleModel::data(const QModelIndex& index, int role) const +QVariant StyleModel::data(QModelIndex const& index, int role) const { // qDebug("data index::internalId() = %lld", index.internalId()); if (!index.isValid()) diff --git a/demo/viewer/styles_model.hpp b/demo/viewer/styles_model.hpp index 398d1e23d..4799468d9 100644 --- a/demo/viewer/styles_model.hpp +++ b/demo/viewer/styles_model.hpp @@ -38,11 +38,11 @@ class StyleModel : public QAbstractItemModel QModelIndex parent(QModelIndex const& child) const; int rowCount(QModelIndex const& parent = QModelIndex()) const; int columnCount(QModelIndex const& parent = QModelIndex()) const; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; + QVariant data(QModelIndex const& index, int role = Qt::DisplayRole) const; private: // std::shared_ptr map_; - const std::unique_ptr root_; + std::unique_ptr const root_; }; #endif // STYLE_MODEL_HPP diff --git a/deps/mapnik/sparsehash/internal/densehashtable.h b/deps/mapnik/sparsehash/internal/densehashtable.h index 1da0b4494..f7bcaf00c 100644 --- a/deps/mapnik/sparsehash/internal/densehashtable.h +++ b/deps/mapnik/sparsehash/internal/densehashtable.h @@ -163,7 +163,7 @@ struct dense_hashtable_iterator typedef typename value_alloc_type::pointer pointer; // "Real" constructor and default constructor - dense_hashtable_iterator(const dense_hashtable* h, + dense_hashtable_iterator(dense_hashtable const* h, pointer it, pointer it_end, bool advance) @@ -204,11 +204,11 @@ struct dense_hashtable_iterator } // Comparison. - bool operator==(const iterator& it) const { return pos == it.pos; } - bool operator!=(const iterator& it) const { return pos != it.pos; } + bool operator==(iterator const& it) const { return pos == it.pos; } + bool operator!=(iterator const& it) const { return pos != it.pos; } // The actual data - const dense_hashtable* ht; + dense_hashtable const* ht; pointer pos, end; }; @@ -231,7 +231,7 @@ struct dense_hashtable_const_iterator typedef typename value_alloc_type::const_pointer pointer; // "Real" constructor and default constructor - dense_hashtable_const_iterator(const dense_hashtable* h, + dense_hashtable_const_iterator(dense_hashtable const* h, pointer it, pointer it_end, bool advance) @@ -248,7 +248,7 @@ struct dense_hashtable_const_iterator end(pointer()) {} // This lets us convert regular iterators to const iterators - dense_hashtable_const_iterator(const iterator& it) + dense_hashtable_const_iterator(iterator const& it) : ht(it.ht), pos(it.pos), end(it.end) @@ -282,11 +282,11 @@ struct dense_hashtable_const_iterator } // Comparison. - bool operator==(const const_iterator& it) const { return pos == it.pos; } - bool operator!=(const const_iterator& it) const { return pos != it.pos; } + bool operator==(const_iterator const& it) const { return pos == it.pos; } + bool operator!=(const_iterator const& it) const { return pos != it.pos; } // The actual data - const dense_hashtable* ht; + dense_hashtable const* ht; pointer pos, end; }; @@ -320,23 +320,23 @@ class dense_hashtable // How full we let the table get before we resize, by default. // Knuth says .8 is good -- higher causes us to probe too much, // though it saves memory. - static const int HT_OCCUPANCY_PCT; // defined at the bottom of this file + static int const HT_OCCUPANCY_PCT; // defined at the bottom of this file // How empty we let the table get before we resize lower, by default. // (0.0 means never resize lower.) // It should be less than OCCUPANCY_PCT / 2 or we thrash resizing - static const int HT_EMPTY_PCT; // defined at the bottom of this file + static int const HT_EMPTY_PCT; // defined at the bottom of this file // Minimum size we're willing to let hashtables be. // Must be a power of two, and at least 4. // Note, however, that for a given hashtable, the initial size is a // function of the first constructor arg, and may be >HT_MIN_BUCKETS. - static const size_type HT_MIN_BUCKETS = 4; + static size_type const HT_MIN_BUCKETS = 4; // By default, if you don't specify a hashtable size at // construction-time, we use this size. Must be a power of two, and // at least HT_MIN_BUCKETS. - static const size_type HT_DEFAULT_STARTING_BUCKETS = 32; + static size_type const HT_DEFAULT_STARTING_BUCKETS = 32; // ITERATOR FUNCTIONS iterator begin() { return iterator(this, table, table + num_buckets, true); } @@ -411,14 +411,14 @@ class dense_hashtable // Test if the given key is the deleted indicator. Requires // num_deleted > 0, for correctness of read(), and because that // guarantees that key_info.delkey is valid. - bool test_deleted_key(const key_type& key) const + bool test_deleted_key(key_type const& key) const { assert(num_deleted > 0); return equals(key_info.delkey, key); } public: - void set_deleted_key(const key_type& key) + void set_deleted_key(key_type const& key) { // the empty indicator (if specified) and the deleted indicator // must be different @@ -448,13 +448,13 @@ class dense_hashtable assert(settings.use_deleted() || num_deleted == 0); return num_deleted > 0 && test_deleted_key(get_key(table[bucknum])); } - bool test_deleted(const iterator& it) const + bool test_deleted(iterator const& it) const { // Invariant: !use_deleted() implies num_deleted is 0. assert(settings.use_deleted() || num_deleted == 0); return num_deleted > 0 && test_deleted_key(get_key(*it)); } - bool test_deleted(const const_iterator& it) const + bool test_deleted(const_iterator const& it) const { // Invariant: !use_deleted() implies num_deleted is 0. assert(settings.use_deleted() || num_deleted == 0); @@ -462,7 +462,7 @@ class dense_hashtable } private: - void check_use_deleted(const char* caller) + void check_use_deleted(char const* caller) { (void)caller; // could log it if the assert failed assert(settings.use_deleted()); @@ -518,12 +518,12 @@ class dense_hashtable assert(settings.use_empty()); // we always need to know what's empty! return equals(get_key(val_info.emptyval), get_key(table[bucknum])); } - bool test_empty(const iterator& it) const + bool test_empty(iterator const& it) const { assert(settings.use_empty()); // we always need to know what's empty! return equals(get_key(val_info.emptyval), get_key(*it)); } - bool test_empty(const const_iterator& it) const + bool test_empty(const_iterator const& it) const { assert(settings.use_empty()); // we always need to know what's empty! return equals(get_key(val_info.emptyval), get_key(*it)); @@ -576,7 +576,7 @@ class dense_hashtable private: // Because of the above, size_type(-1) is never legal; use it for errors - static const size_type ILLEGAL_BUCKET = size_type(-1); + static size_type const ILLEGAL_BUCKET = size_type(-1); // Used after a string of deletes. Returns true if we actually shrunk. // TODO(csilvers): take a delta so we can take into account inserts @@ -593,11 +593,11 @@ class dense_hashtable // shrink below HT_DEFAULT_STARTING_BUCKETS. Otherwise, something // like "dense_hash_set x; x.insert(4); x.erase(4);" will // shrink us down to HT_MIN_BUCKETS buckets, which is too small. - const size_type num_remain = num_elements - num_deleted; - const size_type shrink_threshold = settings.shrink_threshold(); + size_type const num_remain = num_elements - num_deleted; + size_type const shrink_threshold = settings.shrink_threshold(); if (shrink_threshold > 0 && num_remain < shrink_threshold && bucket_count() > HT_DEFAULT_STARTING_BUCKETS) { - const float shrink_factor = settings.shrink_factor(); + float const shrink_factor = settings.shrink_factor(); size_type sz = bucket_count() / 2; // find how much we should shrink while (sz > HT_DEFAULT_STARTING_BUCKETS && num_remain < sz * shrink_factor) { @@ -635,7 +635,7 @@ class dense_hashtable // are currently taking up room). But later, when we decide what // size to resize to, *don't* count deleted buckets, since they // get discarded during the resize. - const size_type needed_size = settings.min_buckets(num_elements + delta, 0); + size_type const needed_size = settings.min_buckets(num_elements + delta, 0); if (needed_size <= bucket_count()) // we have enough buckets return did_resize; @@ -651,7 +651,7 @@ class dense_hashtable // insert. Might as well grow now, since we're already going // through the trouble of copying (in order to purge the // deleted elements). - const size_type target = static_cast(settings.shrink_size(resize_to * 2)); + size_type const target = static_cast(settings.shrink_size(resize_to * 2)); if (num_elements - num_deleted + delta >= target) { // Good, we won't be below the shrink threshhold even if we double. @@ -676,7 +676,7 @@ class dense_hashtable } // Used to actually do the rehashing when we grow/shrink a hashtable - void copy_from(const dense_hashtable& ht, size_type min_buckets_wanted) + void copy_from(dense_hashtable const& ht, size_type min_buckets_wanted) { clear_to_size(settings.min_buckets(ht.size(), min_buckets_wanted)); @@ -688,7 +688,7 @@ class dense_hashtable { size_type num_probes = 0; // how many times we've probed size_type bucknum; - const size_type bucket_count_minus_one = bucket_count() - 1; + size_type const bucket_count_minus_one = bucket_count() - 1; for (bucknum = hash(get_key(*it)) & bucket_count_minus_one; !test_empty(bucknum); // not empty bucknum = (bucknum + JUMP_(key, num_probes)) & bucket_count_minus_one) { @@ -734,11 +734,11 @@ class dense_hashtable // and key extractor. We also define a copy constructor and =. // DESTRUCTOR -- needs to free the table explicit dense_hashtable(size_type expected_max_items_in_table = 0, - const HashFcn& hf = HashFcn(), - const EqualKey& eql = EqualKey(), - const ExtractKey& ext = ExtractKey(), - const SetKey& set = SetKey(), - const Alloc& alloc = Alloc()) + HashFcn const& hf = HashFcn(), + EqualKey const& eql = EqualKey(), + ExtractKey const& ext = ExtractKey(), + SetKey const& set = SetKey(), + Alloc const& alloc = Alloc()) : settings(hf), key_info(ext, set, eql), num_deleted(0), @@ -755,7 +755,7 @@ class dense_hashtable // As a convenience for resize(), we allow an optional second argument // which lets you make this new hashtable a different size than ht - dense_hashtable(const dense_hashtable& ht, size_type min_buckets_wanted = HT_DEFAULT_STARTING_BUCKETS) + dense_hashtable(dense_hashtable const& ht, size_type min_buckets_wanted = HT_DEFAULT_STARTING_BUCKETS) : settings(ht.settings), key_info(ht.key_info), num_deleted(0), @@ -776,7 +776,7 @@ class dense_hashtable copy_from(ht, min_buckets_wanted); // copy_from() ignores deleted entries } - dense_hashtable& operator=(const dense_hashtable& ht) + dense_hashtable& operator=(dense_hashtable const& ht) { if (&ht == this) return *this; // don't copy onto ourselves @@ -858,7 +858,7 @@ class dense_hashtable { // If the table is already empty, and the number of buckets is // already as we desire, there's nothing to do. - const size_type new_num_buckets = settings.min_buckets(0, 0); + size_type const new_num_buckets = settings.min_buckets(0, 0); if (num_elements == 0 && new_num_buckets == num_buckets) { return; @@ -890,10 +890,10 @@ class dense_hashtable // if object is not found; 2nd is ILLEGAL_BUCKET if it is. // Note: because of deletions where-to-insert is not trivial: it's the // first deleted bucket we see, as long as we don't find the key later - std::pair find_position(const key_type& key) const + std::pair find_position(key_type const& key) const { size_type num_probes = 0; // how many times we've probed - const size_type bucket_count_minus_one = bucket_count() - 1; + size_type const bucket_count_minus_one = bucket_count() - 1; size_type bucknum = hash(key) & bucket_count_minus_one; size_type insert_pos = ILLEGAL_BUCKET; // where we would insert while (1) @@ -922,7 +922,7 @@ class dense_hashtable public: - iterator find(const key_type& key) + iterator find(key_type const& key) { if (size() == 0) return end(); @@ -933,7 +933,7 @@ class dense_hashtable return iterator(this, table + pos.first, table + num_buckets, false); } - const_iterator find(const key_type& key) const + const_iterator find(key_type const& key) const { if (size() == 0) return end(); @@ -946,21 +946,21 @@ class dense_hashtable // This is a tr1 method: the bucket a given key is in, or what bucket // it would be put in, if it were to be inserted. Shrug. - size_type bucket(const key_type& key) const + size_type bucket(key_type const& key) const { std::pair pos = find_position(key); return pos.first == ILLEGAL_BUCKET ? pos.second : pos.first; } // Counts how many elements have key key. For maps, it's either 0 or 1. - size_type count(const key_type& key) const + size_type count(key_type const& key) const { std::pair pos = find_position(key); return pos.first == ILLEGAL_BUCKET ? 0 : 1; } // Likewise, equal_range doesn't really make sense for us. Oh well. - std::pair equal_range(const key_type& key) + std::pair equal_range(key_type const& key) { iterator pos = find(key); // either an iterator or end if (pos == end()) @@ -969,11 +969,11 @@ class dense_hashtable } else { - const iterator startpos = pos++; + iterator const startpos = pos++; return std::pair(startpos, pos); } } - std::pair equal_range(const key_type& key) const + std::pair equal_range(key_type const& key) const { const_iterator pos = find(key); // either an iterator or end if (pos == end()) @@ -982,7 +982,7 @@ class dense_hashtable } else { - const const_iterator startpos = pos++; + const_iterator const startpos = pos++; return std::pair(startpos, pos); } } @@ -1019,7 +1019,7 @@ class dense_hashtable assert((!settings.use_empty() || !equals(get_key(obj), get_key(val_info.emptyval))) && "Inserting the empty key"); assert((!settings.use_deleted() || !equals(get_key(obj), key_info.delkey)) && "Inserting the deleted key"); - const std::pair pos = find_position(get_key(obj)); + std::pair const pos = find_position(get_key(obj)); if (pos.first != ILLEGAL_BUCKET) { // object was already there return std::pair(iterator(this, table + pos.first, table + num_buckets, false), @@ -1075,12 +1075,12 @@ class dense_hashtable // DefaultValue is a functor that takes a key and returns a value_type // representing the default value to be inserted if none is found. template - value_type& find_or_insert(const key_type& key) + value_type& find_or_insert(key_type const& key) { // First, double-check we're not inserting emptykey or delkey assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) && "Inserting the empty key"); assert((!settings.use_deleted() || !equals(key, key_info.delkey)) && "Inserting the deleted key"); - const std::pair pos = find_position(key); + std::pair const pos = find_position(key); DefaultValue default_value; if (pos.first != ILLEGAL_BUCKET) { // object was already there @@ -1098,7 +1098,7 @@ class dense_hashtable } // DELETION ROUTINES - size_type erase(const key_type& key) + size_type erase(key_type const& key) { // First, double-check we're not trying to erase delkey or emptyval. assert((!settings.use_empty() || !equals(key, get_key(val_info.emptyval))) && "Erasing the empty key"); @@ -1166,7 +1166,7 @@ class dense_hashtable } // COMPARISON - bool operator==(const dense_hashtable& ht) const + bool operator==(dense_hashtable const& ht) const { if (size() != ht.size()) { @@ -1191,7 +1191,7 @@ class dense_hashtable return true; } } - bool operator!=(const dense_hashtable& ht) const { return !(*this == ht); } + bool operator!=(dense_hashtable const& ht) const { return !(*this == ht); } // I/O // We support reading and writing hashtables to disk. Alas, since @@ -1200,7 +1200,7 @@ class dense_hashtable private: // Every time the disk format changes, this should probably change too typedef unsigned long MagicNumberType; - static const MagicNumberType MAGIC_NUMBER = 0x13578642; + static MagicNumberType const MAGIC_NUMBER = 0x13578642; public: // I/O -- this is an add-on for writing hash table to disk @@ -1296,7 +1296,7 @@ class dense_hashtable typedef typename A::size_type size_type; // Convert a normal allocator to one that has realloc_or_die() - alloc_impl(const A& a) + alloc_impl(A const& a) : A(a) {} @@ -1321,7 +1321,7 @@ class dense_hashtable typedef typename libc_allocator_with_realloc::pointer pointer; typedef typename libc_allocator_with_realloc::size_type size_type; - alloc_impl(const libc_allocator_with_realloc& a) + alloc_impl(libc_allocator_with_realloc const& a) : libc_allocator_with_realloc(a) {} @@ -1350,11 +1350,11 @@ class dense_hashtable public: typedef typename alloc_impl::value_type value_type; - ValInfo(const alloc_impl& a) + ValInfo(alloc_impl const& a) : alloc_impl(a), emptyval() {} - ValInfo(const ValInfo& v) + ValInfo(ValInfo const& v) : alloc_impl(v), emptyval(v.emptyval) {} @@ -1368,7 +1368,7 @@ class dense_hashtable // different classes. struct Settings : sparsehash_internal::sh_hashtable_settings { - explicit Settings(const hasher& hf) + explicit Settings(hasher const& hf) : sparsehash_internal::sh_hashtable_settings( hf, HT_OCCUPANCY_PCT / 100.0f, @@ -1382,7 +1382,7 @@ class dense_hashtable public EqualKey { public: - KeyInfo(const ExtractKey& ek, const SetKey& sk, const EqualKey& eq) + KeyInfo(ExtractKey const& ek, SetKey const& sk, EqualKey const& eq) : ExtractKey(ek), SetKey(sk), EqualKey(eq) @@ -1390,8 +1390,8 @@ class dense_hashtable // We want to return the exact same type as ExtractKey: Key or const Key& typename ExtractKey::result_type get_key(const_reference v) const { return ExtractKey::operator()(v); } - void set_key(pointer v, const key_type& k) const { SetKey::operator()(v, k); } - bool equals(const key_type& a, const key_type& b) const { return EqualKey::operator()(a, b); } + void set_key(pointer v, key_type const& k) const { SetKey::operator()(v, k); } + bool equals(key_type const& a, key_type const& b) const { return EqualKey::operator()(a, b); } // Which key marks deleted entries. // TODO(csilvers): make a pointer, and get rid of use_deleted (benchmark!) @@ -1399,10 +1399,10 @@ class dense_hashtable }; // Utility functions to access the templated operators - size_type hash(const key_type& v) const { return settings.hash(v); } - bool equals(const key_type& a, const key_type& b) const { return key_info.equals(a, b); } + size_type hash(key_type const& v) const { return settings.hash(v); } + bool equals(key_type const& a, key_type const& b) const { return key_info.equals(a, b); } typename ExtractKey::result_type get_key(const_reference v) const { return key_info.get_key(v); } - void set_key(pointer v, const key_type& k) const { key_info.set_key(v, k); } + void set_key(pointer v, key_type const& k) const { key_info.set_key(v, k); } private: // Actual data @@ -1426,7 +1426,7 @@ inline void swap(dense_hashtable& x, dense_hashtabl #undef JUMP_ template -const typename dense_hashtable::size_type +typename dense_hashtable::size_type const dense_hashtable::ILLEGAL_BUCKET; // How full we let the table get before we resize. Knuth says .8 is @@ -1436,12 +1436,12 @@ const typename dense_hashtable::size_type // Feel free to play around with different values, though, via // max_load_factor() and/or set_resizing_parameters(). template -const int dense_hashtable::HT_OCCUPANCY_PCT = 50; +int const dense_hashtable::HT_OCCUPANCY_PCT = 50; // How empty we let the table get before we resize lower. // It should be less than OCCUPANCY_PCT / 2 or we thrash resizing. template -const int dense_hashtable::HT_EMPTY_PCT = +int const dense_hashtable::HT_EMPTY_PCT = static_cast(0.4 * dense_hashtable::HT_OCCUPANCY_PCT); _END_GOOGLE_NAMESPACE_ diff --git a/deps/mapnik/sparsehash/internal/hashtable-common.h b/deps/mapnik/sparsehash/internal/hashtable-common.h index 9566df613..fd13905b0 100644 --- a/deps/mapnik/sparsehash/internal/hashtable-common.h +++ b/deps/mapnik/sparsehash/internal/hashtable-common.h @@ -86,7 +86,7 @@ inline bool read_data_internal(Ignored*, FILE* fp, void* data, size_t length) } template -inline bool write_data_internal(Ignored*, FILE* fp, const void* data, size_t length) +inline bool write_data_internal(Ignored*, FILE* fp, void const* data, size_t length) { return fwrite(data, length, 1, fp) == 1; } @@ -109,12 +109,12 @@ inline bool read_data_internal(Ignored*, std::istream* fp, void* data, size_t le } template -inline bool write_data_internal_for_ostream(OSTREAM* fp, const void* data, size_t length) +inline bool write_data_internal_for_ostream(OSTREAM* fp, void const* data, size_t length) { - return fp->write(reinterpret_cast(data), length).good(); + return fp->write(reinterpret_cast(data), length).good(); } template -inline bool write_data_internal(Ignored*, std::ostream* fp, const void* data, size_t length) +inline bool write_data_internal(Ignored*, std::ostream* fp, void const* data, size_t length) { return write_data_internal_for_ostream(fp, data, length); } @@ -132,7 +132,7 @@ inline bool read_data_internal(INPUT* fp, void*, void* data, size_t length) // The OUTPUT type needs to support a Write() operation that takes // a buffer and a length and returns the number of bytes written. template -inline bool write_data_internal(OUTPUT* fp, void*, const void* data, size_t length) +inline bool write_data_internal(OUTPUT* fp, void*, void const* data, size_t length) { return static_cast(fp->Write(data, length)) == length; } @@ -146,7 +146,7 @@ inline bool read_data(INPUT* fp, void* data, size_t length) } template -inline bool write_data(OUTPUT* fp, const void* data, size_t length) +inline bool write_data(OUTPUT* fp, void const* data, size_t length) { return write_data_internal(fp, fp, data, length); } @@ -199,7 +199,7 @@ struct pod_serializer } template - bool operator()(OUTPUT* fp, const value_type& value) const + bool operator()(OUTPUT* fp, value_type const& value) const { return write_data(fp, &value, sizeof(value)); } @@ -226,7 +226,7 @@ class sh_hashtable_settings : public HashFunc typedef SizeType size_type; public: - sh_hashtable_settings(const hasher& hf, const float ht_occupancy_flt, const float ht_empty_flt) + sh_hashtable_settings(hasher const& hf, float const ht_occupancy_flt, float const ht_empty_flt) : hasher(hf), enlarge_threshold_(0), shrink_threshold_(0), @@ -239,7 +239,7 @@ class sh_hashtable_settings : public HashFunc set_shrink_factor(ht_empty_flt); } - size_type hash(const key_type& v) const + size_type hash(key_type const& v) const { // We munge the hash value when we don't trust hasher::operator(). return hash_munger::MungedHash(hasher::operator()(v)); diff --git a/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h b/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h index dcf095dae..a9bceeca4 100644 --- a/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h +++ b/deps/mapnik/sparsehash/internal/libc_allocator_with_realloc.h @@ -48,12 +48,12 @@ class libc_allocator_with_realloc typedef ptrdiff_t difference_type; typedef T* pointer; - typedef const T* const_pointer; + typedef T const* const_pointer; typedef T& reference; - typedef const T& const_reference; + typedef T const& const_reference; libc_allocator_with_realloc() {} - libc_allocator_with_realloc(const libc_allocator_with_realloc&) {} + libc_allocator_with_realloc(libc_allocator_with_realloc const&) {} ~libc_allocator_with_realloc() {} pointer address(reference r) const { return &r; } @@ -65,11 +65,11 @@ class libc_allocator_with_realloc size_type max_size() const { return static_cast(-1) / sizeof(value_type); } - void construct(pointer p, const value_type& val) { new (p) value_type(val); } + void construct(pointer p, value_type const& val) { new (p) value_type(val); } void destroy(pointer p) { p->~value_type(); } template - libc_allocator_with_realloc(const libc_allocator_with_realloc&) + libc_allocator_with_realloc(libc_allocator_with_realloc const&) {} template @@ -88,7 +88,7 @@ class libc_allocator_with_realloc typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; - typedef const void* const_pointer; + typedef void const* const_pointer; template struct rebind @@ -98,13 +98,13 @@ class libc_allocator_with_realloc }; template -inline bool operator==(const libc_allocator_with_realloc&, const libc_allocator_with_realloc&) +inline bool operator==(libc_allocator_with_realloc const&, libc_allocator_with_realloc const&) { return true; } template -inline bool operator!=(const libc_allocator_with_realloc&, const libc_allocator_with_realloc&) +inline bool operator!=(libc_allocator_with_realloc const&, libc_allocator_with_realloc const&) { return false; } diff --git a/deps/mapnik/sparsehash/template_util.h b/deps/mapnik/sparsehash/template_util.h index 35b4c798e..d3b2bd8c9 100644 --- a/deps/mapnik/sparsehash/template_util.h +++ b/deps/mapnik/sparsehash/template_util.h @@ -76,13 +76,13 @@ struct identity_ template struct integral_constant { - static const T value = v; + static T const value = v; typedef T value_type; typedef integral_constant type; }; template -const T integral_constant::value; +T const integral_constant::value; // Abbreviations: true_type and false_type are structs that represent boolean // true and false values. Also define the boost::mpl versions of those names, diff --git a/deps/mapnik/sparsehash/type_traits.h b/deps/mapnik/sparsehash/type_traits.h index d93004219..fb57ecd49 100644 --- a/deps/mapnik/sparsehash/type_traits.h +++ b/deps/mapnik/sparsehash/type_traits.h @@ -163,13 +163,13 @@ struct is_integral : true_type {}; #endif template -struct is_integral : is_integral +struct is_integral : is_integral {}; template -struct is_integral : is_integral +struct is_integral : is_integral {}; template -struct is_integral : is_integral +struct is_integral : is_integral {}; // is_floating_point is false except for the built-in floating-point types. @@ -187,13 +187,13 @@ template<> struct is_floating_point : true_type {}; template -struct is_floating_point : is_floating_point +struct is_floating_point : is_floating_point {}; template -struct is_floating_point : is_floating_point +struct is_floating_point : is_floating_point {}; template -struct is_floating_point : is_floating_point +struct is_floating_point : is_floating_point {}; // is_pointer is false except for pointer types. A cv-qualified type (e.g. @@ -206,13 +206,13 @@ template struct is_pointer : true_type {}; template -struct is_pointer : is_pointer +struct is_pointer : is_pointer {}; template -struct is_pointer : is_pointer +struct is_pointer : is_pointer {}; template -struct is_pointer : is_pointer +struct is_pointer : is_pointer {}; #if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) @@ -226,7 +226,7 @@ struct is_class_or_union static small_ tester(void (U::*)()); template static big_ tester(...); - static const bool value = sizeof(tester(0)) == sizeof(small_); + static bool const value = sizeof(tester(0)) == sizeof(small_); }; // is_convertible chokes if the first argument is an array. That's why @@ -264,13 +264,13 @@ struct is_enum {}; template -struct is_enum : is_enum +struct is_enum : is_enum {}; template -struct is_enum : is_enum +struct is_enum : is_enum {}; template -struct is_enum : is_enum +struct is_enum : is_enum {}; #endif @@ -297,13 +297,13 @@ struct is_pod : integral_constant::value)> {}; template -struct is_pod : is_pod +struct is_pod : is_pod {}; template -struct is_pod : is_pod +struct is_pod : is_pod {}; template -struct is_pod : is_pod +struct is_pod : is_pod {}; // We can't get has_trivial_constructor right without compiler help, so @@ -322,7 +322,7 @@ template struct has_trivial_constructor : has_trivial_constructor {}; template -struct has_trivial_constructor : has_trivial_constructor +struct has_trivial_constructor : has_trivial_constructor {}; // We can't get has_trivial_copy right without compiler help, so fail @@ -341,7 +341,7 @@ template struct has_trivial_copy : has_trivial_copy {}; template -struct has_trivial_copy : has_trivial_copy +struct has_trivial_copy : has_trivial_copy {}; // We can't get has_trivial_assign right without compiler help, so fail @@ -375,7 +375,7 @@ template struct has_trivial_destructor : has_trivial_destructor {}; template -struct has_trivial_destructor : has_trivial_destructor +struct has_trivial_destructor : has_trivial_destructor {}; // Specified by TR1 [4.7.1] diff --git a/include/mapnik/agg/render_polygon_pattern.hpp b/include/mapnik/agg/render_polygon_pattern.hpp index 888112d3b..292ce188d 100644 --- a/include/mapnik/agg/render_polygon_pattern.hpp +++ b/include/mapnik/agg/render_polygon_pattern.hpp @@ -129,9 +129,9 @@ struct agg_polygon_pattern : agg_pattern_base agg::render_scanlines(ras, sl, rp); } - const bool clip_; - const box2d clip_box_; - const agg::trans_affine tr_; + bool const clip_; + box2d const clip_box_; + agg::trans_affine const tr_; VertexConverter converter_; }; diff --git a/include/mapnik/agg_renderer.hpp b/include/mapnik/agg_renderer.hpp index e5cec95a1..382feebd1 100644 --- a/include/mapnik/agg_renderer.hpp +++ b/include/mapnik/agg_renderer.hpp @@ -100,8 +100,8 @@ class buffer_stack T& top() const { return *position_; } private: - const std::size_t width_; - const std::size_t height_; + std::size_t const width_; + std::size_t const height_; std::deque buffers_; typename std::deque::iterator position_; }; @@ -189,7 +189,7 @@ class MAPNIK_DECL agg_renderer : public feature_style_processor std::stack> buffers_; buffer_stack internal_buffers_; std::unique_ptr inflated_buffer_; - const std::unique_ptr ras_ptr; + std::unique_ptr const ras_ptr; gamma_method_enum gamma_method_; double gamma_; renderer_common common_; diff --git a/include/mapnik/attribute_collector.hpp b/include/mapnik/attribute_collector.hpp index 102f959b8..2c2518dc0 100644 --- a/include/mapnik/attribute_collector.hpp +++ b/include/mapnik/attribute_collector.hpp @@ -175,14 +175,14 @@ struct symbolizer_attributes void operator()(raster_symbolizer const& sym) { - const auto filter_factor = get_optional(sym, keys::filter_factor); + auto const filter_factor = get_optional(sym, keys::filter_factor); if (filter_factor) { filter_factor_ = *filter_factor; } else { - const auto scaling_method = get_optional(sym, keys::scaling); + auto const scaling_method = get_optional(sym, keys::scaling); if (scaling_method && *scaling_method != SCALING_NEAR) { filter_factor_ = 2; diff --git a/include/mapnik/cairo/cairo_context.hpp b/include/mapnik/cairo/cairo_context.hpp index a60d400c4..458112cc9 100644 --- a/include/mapnik/cairo/cairo_context.hpp +++ b/include/mapnik/cairo/cairo_context.hpp @@ -159,8 +159,8 @@ class cairo_pattern : private util::noncopyable explicit cairo_pattern(image_rgba8 const& data, double opacity = 1.0) { std::size_t pixels = data.width() * data.height(); - const unsigned int* in_ptr = data.data(); - const unsigned int* in_end = in_ptr + pixels; + unsigned int const* in_ptr = data.data(); + unsigned int const* in_end = in_ptr + pixels; unsigned int* out_ptr; surface_ = cairo_surface_ptr(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, diff --git a/include/mapnik/cairo/cairo_image_util.hpp b/include/mapnik/cairo/cairo_image_util.hpp index 91608f588..5db887e3d 100644 --- a/include/mapnik/cairo/cairo_image_util.hpp +++ b/include/mapnik/cairo/cairo_image_util.hpp @@ -47,8 +47,8 @@ static inline void cairo_image_to_rgba8(mapnik::image_rgba8& data, cairo_surface int stride = cairo_image_surface_get_stride(&*surface) / 4; - const std::unique_ptr out_row(new unsigned int[data.width()]); - const unsigned int* in_row = (const unsigned int*)cairo_image_surface_get_data(&*surface); + std::unique_ptr const out_row(new unsigned int[data.width()]); + unsigned int const* in_row = (unsigned int const*)cairo_image_surface_get_data(&*surface); for (unsigned int row = 0; row < data.height(); row++, in_row += stride) { diff --git a/include/mapnik/cairo/render_polygon_pattern.hpp b/include/mapnik/cairo/render_polygon_pattern.hpp index dbc062675..d5747af18 100644 --- a/include/mapnik/cairo/render_polygon_pattern.hpp +++ b/include/mapnik/cairo/render_polygon_pattern.hpp @@ -101,7 +101,7 @@ struct cairo_renderer_process_visitor_p } agg::trans_affine const& image_tr_; - const double opacity_; + double const opacity_; }; struct cairo_pattern_base @@ -193,9 +193,9 @@ struct cairo_polygon_pattern : cairo_pattern_base context.fill(); } - const bool clip_; - const box2d clip_box_; - const agg::trans_affine tr_; + bool const clip_; + box2d const clip_box_; + agg::trans_affine const tr_; VertexConverter converter_; }; diff --git a/include/mapnik/color.hpp b/include/mapnik/color.hpp index 5aa91805b..58d3c3e2b 100644 --- a/include/mapnik/color.hpp +++ b/include/mapnik/color.hpp @@ -78,7 +78,7 @@ class MAPNIK_DECL color : boost::equality_comparable {} // copy ctor - color(const color& rhs) + color(color const& rhs) : red_(rhs.red_), green_(rhs.green_), blue_(rhs.blue_), diff --git a/include/mapnik/config_error.hpp b/include/mapnik/config_error.hpp index c18330dd8..8b10d1b03 100644 --- a/include/mapnik/config_error.hpp +++ b/include/mapnik/config_error.hpp @@ -39,7 +39,7 @@ class config_error : public std::exception config_error(std::string const& what, xml_node const& node); config_error(std::string const& what, unsigned line_number, std::string const& filename); virtual ~config_error() {} - virtual const char* what() const noexcept; + virtual char const* what() const noexcept; void append_context(std::string const& ctx) const; void append_context(std::string const& ctx, xml_node const& node) const; void append_context(xml_node const& node) const; diff --git a/include/mapnik/coord.hpp b/include/mapnik/coord.hpp index b1ceaac96..20112cffe 100644 --- a/include/mapnik/coord.hpp +++ b/include/mapnik/coord.hpp @@ -86,7 +86,7 @@ struct coord } template - coord& operator=(const coord& rhs) + coord& operator=(coord const& rhs) { coord tmp(rhs); swap(rhs); diff --git a/include/mapnik/css/css_color_grammar_x3_def.hpp b/include/mapnik/css/css_color_grammar_x3_def.hpp index 25d15c801..0bc92a0c7 100644 --- a/include/mapnik/css/css_color_grammar_x3_def.hpp +++ b/include/mapnik/css/css_color_grammar_x3_def.hpp @@ -214,9 +214,9 @@ struct named_colors_ : x3::symbols } } const named_colors; -const x3::uint_parser hex2; -const x3::uint_parser hex1; -const x3::uint_parser dec3; +x3::uint_parser const hex2; +x3::uint_parser const hex1; +x3::uint_parser const dec3; // rules x3::rule const hex2_color("hex2_color"); @@ -243,67 +243,67 @@ struct percent_converter static std::uint8_t call(double val) { return safe_cast(std::lround((255.0 * val) / 100.0)); } }; -const auto dec_red = [](auto& ctx) { +auto const dec_red = [](auto& ctx) { _val(ctx).red_ = _attr(ctx); }; -const auto dec_green = [](auto& ctx) { +auto const dec_green = [](auto& ctx) { _val(ctx).green_ = _attr(ctx); }; -const auto dec_blue = [](auto& ctx) { +auto const dec_blue = [](auto& ctx) { _val(ctx).blue_ = _attr(ctx); }; -const auto opacity = [](auto& ctx) { +auto const opacity = [](auto& ctx) { _val(ctx).alpha_ = uint8_t((255.0 * clip_opacity::call(_attr(ctx))) + 0.5); }; -const auto percent_red = [](auto& ctx) { +auto const percent_red = [](auto& ctx) { _val(ctx).red_ = percent_converter::call(_attr(ctx)); }; -const auto percent_green = [](auto& ctx) { +auto const percent_green = [](auto& ctx) { _val(ctx).green_ = percent_converter::call(_attr(ctx)); }; -const auto percent_blue = [](auto& ctx) { +auto const percent_blue = [](auto& ctx) { _val(ctx).blue_ = percent_converter::call(_attr(ctx)); }; -const auto hex1_red = [](auto& ctx) { +auto const hex1_red = [](auto& ctx) { _val(ctx).red_ = _attr(ctx) | _attr(ctx) << 4; }; -const auto hex1_green = [](auto& ctx) { +auto const hex1_green = [](auto& ctx) { _val(ctx).green_ = _attr(ctx) | _attr(ctx) << 4; }; -const auto hex1_blue = [](auto& ctx) { +auto const hex1_blue = [](auto& ctx) { _val(ctx).blue_ = _attr(ctx) | _attr(ctx) << 4; }; -const auto hex1_opacity = [](auto& ctx) { +auto const hex1_opacity = [](auto& ctx) { _val(ctx).alpha_ = _attr(ctx) | _attr(ctx) << 4; }; -const auto hex2_red = [](auto& ctx) { +auto const hex2_red = [](auto& ctx) { _val(ctx).red_ = _attr(ctx); }; -const auto hex2_green = [](auto& ctx) { +auto const hex2_green = [](auto& ctx) { _val(ctx).green_ = _attr(ctx); }; -const auto hex2_blue = [](auto& ctx) { +auto const hex2_blue = [](auto& ctx) { _val(ctx).blue_ = _attr(ctx); }; -const auto hex2_opacity = [](auto& ctx) { +auto const hex2_opacity = [](auto& ctx) { _val(ctx).alpha_ = _attr(ctx); }; -const auto hsl_to_rgba = [](auto& ctx) { +auto const hsl_to_rgba = [](auto& ctx) { double h = std::get<0>(_attr(ctx)); double s = std::get<1>(_attr(ctx)); double l = std::get<2>(_attr(ctx)); @@ -323,10 +323,10 @@ const auto hsl_to_rgba = [](auto& ctx) { } m1 = l * 2 - m2; - const double r = hue_to_rgb(m1, m2, h + 1.0 / 3.0); - const double g = hue_to_rgb(m1, m2, h); - const double b = hue_to_rgb(m1, m2, h - 1.0 / 3.0); - const uint8_t alpha = uint8_t((255.0 * clip_opacity::call(std::get<3>(_attr(ctx)))) + 0.5); + double const r = hue_to_rgb(m1, m2, h + 1.0 / 3.0); + double const g = hue_to_rgb(m1, m2, h); + double const b = hue_to_rgb(m1, m2, h - 1.0 / 3.0); + uint8_t const alpha = uint8_t((255.0 * clip_opacity::call(std::get<3>(_attr(ctx)))) + 0.5); _val(ctx) = color(safe_cast(std::lround(255.0 * r)), safe_cast(std::lround(255.0 * g)), safe_cast(std::lround(255.0 * b)), diff --git a/include/mapnik/css/css_grammar_x3_def.hpp b/include/mapnik/css/css_grammar_x3_def.hpp index 69c03dd88..2d3cf46c4 100644 --- a/include/mapnik/css/css_grammar_x3_def.hpp +++ b/include/mapnik/css/css_grammar_x3_def.hpp @@ -157,20 +157,20 @@ using x3::raw; using x3::standard::space; // import unicode string rule -const auto css_string = mapnik::json::grammar::unicode_string; +auto const css_string = mapnik::json::grammar::unicode_string; -const auto assign_def = [](auto const& ctx) { +auto const assign_def = [](auto const& ctx) { for (auto const& k : std::get<0>(_attr(ctx))) { _val(ctx).emplace(k, std::get<1>(_attr(ctx))); } }; -const auto assign_key = [](auto const& ctx) { +auto const assign_key = [](auto const& ctx) { _val(ctx).first = std::move(_attr(ctx)); }; -const auto assign_value = [](auto const& ctx) { +auto const assign_value = [](auto const& ctx) { _val(ctx).second = std::move(_attr(ctx)); }; diff --git a/include/mapnik/datasource.hpp b/include/mapnik/datasource.hpp index cb93355bf..9906581c1 100644 --- a/include/mapnik/datasource.hpp +++ b/include/mapnik/datasource.hpp @@ -51,7 +51,7 @@ class MAPNIK_DECL datasource_exception : public std::exception ~datasource_exception() {} - virtual const char* what() const noexcept { return message_.c_str(); } + virtual char const* what() const noexcept { return message_.c_str(); } private: std::string message_; @@ -103,7 +103,7 @@ class MAPNIK_DECL datasource : private util::noncopyable parameters params_; }; -using datasource_name = const char* (*)(); +using datasource_name = char const* (*)(); using create_ds = datasource* (*)(parameters const&); using destroy_ds = void (*)(datasource*); diff --git a/include/mapnik/datasource_cache.hpp b/include/mapnik/datasource_cache.hpp index c0d9516bf..faf494789 100644 --- a/include/mapnik/datasource_cache.hpp +++ b/include/mapnik/datasource_cache.hpp @@ -48,7 +48,7 @@ class MAPNIK_DECL datasource_cache : public singleton; public: - bool plugin_registered(const std::string& plugin_name) const; + bool plugin_registered(std::string const& plugin_name) const; std::vector plugin_names() const; std::string plugin_directories(); bool register_datasources(std::string const& path, bool recurse = false); diff --git a/include/mapnik/datasource_plugin.hpp b/include/mapnik/datasource_plugin.hpp index ee6f7a854..4f409f6ed 100644 --- a/include/mapnik/datasource_plugin.hpp +++ b/include/mapnik/datasource_plugin.hpp @@ -12,7 +12,7 @@ class MAPNIK_DECL datasource_plugin virtual ~datasource_plugin() = default; virtual void after_load() const = 0; virtual void before_unload() const = 0; - virtual const char* name() const = 0; + virtual char const* name() const = 0; virtual datasource_ptr create(parameters const& params) const = 0; }; } // namespace mapnik diff --git a/include/mapnik/debug.hpp b/include/mapnik/debug.hpp index 90242b0cb..2e2c67b99 100644 --- a/include/mapnik/debug.hpp +++ b/include/mapnik/debug.hpp @@ -171,7 +171,7 @@ class base_log : public util::noncopyable base_log() {} #ifdef MAPNIK_LOG - base_log(const char* object_name) + base_log(char const* object_name) { if (object_name != nullptr) { @@ -179,7 +179,7 @@ class base_log : public util::noncopyable } } #else - base_log(const char* /*object_name*/) {} + base_log(char const* /*object_name*/) {} #endif ~base_log() @@ -230,7 +230,7 @@ class base_log_always : public util::noncopyable base_log_always() {} - base_log_always(const char* object_name) + base_log_always(char const* object_name) { if (object_name != nullptr) { @@ -273,7 +273,7 @@ class MAPNIK_DECL warn : public detail::base_log_warn warn() : detail::base_log_warn() {} - warn(const char* object_name) + warn(char const* object_name) : detail::base_log_warn(object_name) {} }; @@ -284,7 +284,7 @@ class MAPNIK_DECL debug : public detail::base_log_debug debug() : detail::base_log_debug() {} - debug(const char* object_name) + debug(char const* object_name) : detail::base_log_debug(object_name) {} }; @@ -295,7 +295,7 @@ class MAPNIK_DECL error : public detail::base_log_error error() : detail::base_log_error() {} - error(const char* object_name) + error(char const* object_name) : detail::base_log_error(object_name) {} }; diff --git a/include/mapnik/enumeration.hpp b/include/mapnik/enumeration.hpp index 758452057..a1a86c7fe 100644 --- a/include/mapnik/enumeration.hpp +++ b/include/mapnik/enumeration.hpp @@ -52,10 +52,10 @@ class illegal_enum_value : public std::exception {} virtual ~illegal_enum_value() {} - virtual const char* what() const noexcept { return what_.c_str(); } + virtual char const* what() const noexcept { return what_.c_str(); } protected: - const std::string what_; + std::string const what_; }; namespace detail { @@ -89,7 +89,7 @@ constexpr EnumT EnumGetKey(EnumMapT const& map, char const* value, std template (*F_LOOKUP)()> struct MAPNIK_DECL enumeration { @@ -105,7 +105,7 @@ struct MAPNIK_DECL enumeration : value_(v) {} - void from_string(const std::string& str) { value_ = F_FROM_STRING(str.c_str()); } + void from_string(std::string const& str) { value_ = F_FROM_STRING(str.c_str()); } std::string as_string() const { return F_TO_STRING(value_); } static std::map lookupMap() { return F_LOOKUP(); } diff --git a/include/mapnik/expression_grammar_x3_def.hpp b/include/mapnik/expression_grammar_x3_def.hpp index e25b86b1b..14e6c62d1 100644 --- a/include/mapnik/expression_grammar_x3_def.hpp +++ b/include/mapnik/expression_grammar_x3_def.hpp @@ -61,7 +61,7 @@ using x3::no_case; using x3::no_skip; x3::uint_parser const hex2{}; -const auto escaped_unicode = json::grammar::escaped_unicode; +auto const escaped_unicode = json::grammar::escaped_unicode; template inline mapnik::transcoder const& extract_transcoder(Context const& ctx) @@ -69,19 +69,19 @@ inline mapnik::transcoder const& extract_transcoder(Context const& ctx) return x3::get(ctx); } -const auto append = [](auto const& ctx) { +auto const append = [](auto const& ctx) { _val(ctx) += _attr(ctx); }; -const auto do_assign = [](auto const& ctx) { +auto const do_assign = [](auto const& ctx) { _val(ctx) = std::move(_attr(ctx)); }; -const auto do_negate = [](auto const& ctx) { +auto const do_negate = [](auto const& ctx) { _val(ctx) = std::move(unary_node(_attr(ctx))); }; -const auto do_attribute = [](auto const& ctx) { +auto const do_attribute = [](auto const& ctx) { auto const& attr = _attr(ctx); if (attr == "mapnik::geometry_type") { @@ -93,84 +93,84 @@ const auto do_attribute = [](auto const& ctx) { } }; -const auto do_global_attribute = [](auto const& ctx) { +auto const do_global_attribute = [](auto const& ctx) { _val(ctx) = std::move(global_attribute(_attr(ctx))); }; -const auto do_add = [](auto const& ctx) { +auto const do_add = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_subt = [](auto const& ctx) { +auto const do_subt = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_mult = [](auto const& ctx) { +auto const do_mult = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_div = [](auto const& ctx) { +auto const do_div = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_mod = [](auto const& ctx) { +auto const do_mod = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_unicode = [](auto const& ctx) { +auto const do_unicode = [](auto const& ctx) { auto const& tr = extract_transcoder(ctx); _val(ctx) = std::move(tr.transcode(_attr(ctx).c_str())); }; -const auto do_null = [](auto const& ctx) { +auto const do_null = [](auto const& ctx) { _val(ctx) = std::move(mapnik::value_null()); }; -const auto do_not = [](auto const& ctx) { +auto const do_not = [](auto const& ctx) { mapnik::unary_node node(_attr(ctx)); _val(ctx) = std::move(node); }; -const auto do_and = [](auto const& ctx) { +auto const do_and = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_or = [](auto const& ctx) { +auto const do_or = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_equal = [](auto const& ctx) { +auto const do_equal = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_not_equal = [](auto const& ctx) { +auto const do_not_equal = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_less = [](auto const& ctx) { +auto const do_less = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_less_equal = [](auto const& ctx) { +auto const do_less_equal = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_greater = [](auto const& ctx) { +auto const do_greater = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_greater_equal = [](auto const& ctx) { +auto const do_greater_equal = [](auto const& ctx) { _val(ctx) = std::move(mapnik::binary_node(std::move(_val(ctx)), std::move(_attr(ctx)))); }; // regex -const auto do_regex_match = [](auto const& ctx) { +auto const do_regex_match = [](auto const& ctx) { auto const& tr = extract_transcoder(ctx); _val(ctx) = std::move(mapnik::regex_match_node(tr, std::move(_val(ctx)), std::move(_attr(ctx)))); }; -const auto do_regex_replace = [](auto const& ctx) { +auto const do_regex_replace = [](auto const& ctx) { auto const& tr = extract_transcoder(ctx); auto const& pair = _attr(ctx); auto const& pattern = std::get<0>(pair); diff --git a/include/mapnik/expression_node.hpp b/include/mapnik/expression_node.hpp index 978013686..0a424b898 100644 --- a/include/mapnik/expression_node.hpp +++ b/include/mapnik/expression_node.hpp @@ -127,7 +127,7 @@ struct unary_node : expr(a) {} - static const char* type() { return Tag::str(); } + static char const* type() { return Tag::str(); } expr_node expr; }; @@ -145,7 +145,7 @@ struct binary_node right(b) {} - static const char* type() { return Tag::str(); } + static char const* type() { return Tag::str(); } expr_node left, right; }; diff --git a/include/mapnik/expression_node_types.hpp b/include/mapnik/expression_node_types.hpp index ad6b23f51..b52f7eccf 100644 --- a/include/mapnik/expression_node_types.hpp +++ b/include/mapnik/expression_node_types.hpp @@ -33,77 +33,77 @@ namespace mapnik { namespace tags { struct negate { - static const char* str() { return "-"; } + static char const* str() { return "-"; } }; struct plus { - static const char* str() { return "+"; } + static char const* str() { return "+"; } }; struct minus { - static const char* str() { return "-"; } + static char const* str() { return "-"; } }; struct mult { - static const char* str() { return "*"; } + static char const* str() { return "*"; } }; struct div { - static const char* str() { return "/"; } + static char const* str() { return "/"; } }; struct mod { - static const char* str() { return "%"; } + static char const* str() { return "%"; } }; struct less { - static const char* str() { return "<"; } + static char const* str() { return "<"; } }; struct less_equal { - static const char* str() { return "<="; } + static char const* str() { return "<="; } }; struct greater { - static const char* str() { return ">"; } + static char const* str() { return ">"; } }; struct greater_equal { - static const char* str() { return ">="; } + static char const* str() { return ">="; } }; struct equal_to { - static const char* str() { return "="; } + static char const* str() { return "="; } }; struct not_equal_to { - static const char* str() { return "!="; } + static char const* str() { return "!="; } }; struct logical_not { - static const char* str() { return "not "; } + static char const* str() { return "not "; } }; struct logical_and { - static const char* str() { return " and "; } + static char const* str() { return " and "; } }; struct logical_or { - static const char* str() { return " or "; } + static char const* str() { return " or "; } }; } // namespace tags diff --git a/include/mapnik/factory.hpp b/include/mapnik/factory.hpp index 2b55a302d..c46f2d856 100644 --- a/include/mapnik/factory.hpp +++ b/include/mapnik/factory.hpp @@ -47,7 +47,7 @@ class factory : public singleton> return map_.insert(typename product_map::value_type(key, creator)).second; } - bool unregister_product(const key_type& key) { return map_.erase(key) == 1; } + bool unregister_product(key_type const& key) { return map_.erase(key) == 1; } product_type* create_object(key_type const& key, Args... args) { diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index f58627385..0057a98c7 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -89,7 +89,7 @@ class context : private util::noncopyable using context_type = context>; using context_ptr = std::shared_ptr; -static const value default_feature_value{}; +static value const default_feature_value{}; class MAPNIK_DECL feature_impl : private util::noncopyable { diff --git a/include/mapnik/feature_style_processor_impl.hpp b/include/mapnik/feature_style_processor_impl.hpp index c8af1a0bb..6b48850b0 100644 --- a/include/mapnik/feature_style_processor_impl.hpp +++ b/include/mapnik/feature_style_processor_impl.hpp @@ -248,7 +248,7 @@ void feature_style_processor::prepare_layer(layer_rendering_material& box2d buffered_query_ext(query_ext); // buffered double buffer_padding = 2.0 * scale * p.scale_factor(); - const auto layer_buffer_size = lay.buffer_size(); + auto const layer_buffer_size = lay.buffer_size(); if (layer_buffer_size) // if layer overrides buffer size, use this value to compute buffered extent { buffer_padding *= *layer_buffer_size; @@ -268,7 +268,7 @@ void feature_style_processor::prepare_layer(layer_rendering_material& } box2d layer_ext = lay.envelope(); - const box2d buffered_query_ext_map_srs = buffered_query_ext; + box2d const buffered_query_ext_map_srs = buffered_query_ext; bool fw_success = false; bool early_return = false; diff --git a/include/mapnik/geometry/boost_adapters.hpp b/include/mapnik/geometry/boost_adapters.hpp index a2663a959..2ebd3bd5a 100644 --- a/include/mapnik/geometry/boost_adapters.hpp +++ b/include/mapnik/geometry/boost_adapters.hpp @@ -191,7 +191,7 @@ struct tag> template struct point_order> { - static const order_selector value = counterclockwise; + static order_selector const value = counterclockwise; }; template diff --git a/include/mapnik/geometry/boost_spirit_karma_adapter.hpp b/include/mapnik/geometry/boost_spirit_karma_adapter.hpp index 01a3d73d3..413d02ba1 100644 --- a/include/mapnik/geometry/boost_spirit_karma_adapter.hpp +++ b/include/mapnik/geometry/boost_spirit_karma_adapter.hpp @@ -82,13 +82,13 @@ struct index; template struct index> { - static const std::size_t value = 0; + static std::size_t const value = 0; }; template struct index> { - static const std::size_t value = 1 + index>::value; + static std::size_t const value = 1 + index>::value; }; } // namespace detail diff --git a/include/mapnik/geometry/box2d.hpp b/include/mapnik/geometry/box2d.hpp index b78c31a61..7771fcd80 100644 --- a/include/mapnik/geometry/box2d.hpp +++ b/include/mapnik/geometry/box2d.hpp @@ -137,7 +137,7 @@ class MAPNIK_DECL box2d : boost::equality_comparable< }; template -inline std::basic_ostream& operator<<(std::basic_ostream& out, const box2d& e) +inline std::basic_ostream& operator<<(std::basic_ostream& out, box2d const& e) { out << e.to_string(); return out; diff --git a/include/mapnik/global.hpp b/include/mapnik/global.hpp index b958d82d1..ee5675919 100644 --- a/include/mapnik/global.hpp +++ b/include/mapnik/global.hpp @@ -68,37 +68,37 @@ namespace mapnik { } while (0) // read int16_t NDR (little endian) -inline void read_int16_ndr(const char* data, std::int16_t& val) +inline void read_int16_ndr(char const* data, std::int16_t& val) { std::memcpy(&val, data, 2); } // read int32_t NDR (little endian) -inline void read_int32_ndr(const char* data, std::int32_t& val) +inline void read_int32_ndr(char const* data, std::int32_t& val) { std::memcpy(&val, data, 4); } // read double NDR (little endian) -inline void read_double_ndr(const char* data, double& val) +inline void read_double_ndr(char const* data, double& val) { std::memcpy(&val, &data[0], 8); } // read int16_t XDR (big endian) -inline void read_int16_xdr(const char* data, std::int16_t& val) +inline void read_int16_xdr(char const* data, std::int16_t& val) { val = static_cast((data[3] & 0xff) | ((data[2] & 0xff) << 8)); } // read int32_t XDR (big endian) -inline void read_int32_xdr(const char* data, std::int32_t& val) +inline void read_int32_xdr(char const* data, std::int32_t& val) { val = (data[3] & 0xff) | ((data[2] & 0xff) << 8) | ((data[1] & 0xff) << 16) | ((data[0] & 0xff) << 24); } // read double XDR (big endian) -inline void read_double_xdr(const char* data, double& val) +inline void read_double_xdr(char const* data, double& val) { std::int64_t bits = (static_cast(data[7]) & 0xff) | (static_cast(data[6]) & 0xff) << 8 | diff --git a/include/mapnik/grid/grid.hpp b/include/mapnik/grid/grid.hpp index 311ebb4fa..60d552bea 100644 --- a/include/mapnik/grid/grid.hpp +++ b/include/mapnik/grid/grid.hpp @@ -54,7 +54,7 @@ class MAPNIK_DECL hit_grid // mapping between pixel id and key using feature_key_type = std::map; using feature_type = std::map; - static const value_type base_mask; + static value_type const base_mask; private: std::size_t width_; @@ -117,7 +117,7 @@ class MAPNIK_DECL hit_grid inline bool checkBounds(std::size_t x, std::size_t y) const { return (x < width_ && y < height_); } - hit_grid& operator=(const hit_grid&); + hit_grid& operator=(hit_grid const&); public: inline void setPixel(std::size_t x, std::size_t y, value_type feature_id) diff --git a/include/mapnik/grid/grid_pixel.hpp b/include/mapnik/grid/grid_pixel.hpp index c56f2ea04..5efb7b745 100644 --- a/include/mapnik/grid/grid_pixel.hpp +++ b/include/mapnik/grid/grid_pixel.hpp @@ -49,7 +49,7 @@ struct gray16 {} //-------------------------------------------------------------------- - gray16(const self_type& c, unsigned a_) + gray16(self_type const& c, unsigned a_) : v(c.v), a(value_type(a_)) {} @@ -58,14 +58,14 @@ struct gray16 void clear() { v = a = 0; } //-------------------------------------------------------------------- - const self_type& transparent() + self_type const& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- - const self_type& premultiply() + self_type const& premultiply() { if (a == base_mask) return *this; @@ -79,7 +79,7 @@ struct gray16 } //-------------------------------------------------------------------- - const self_type& premultiply(unsigned a_) + self_type const& premultiply(unsigned a_) { if (a == base_mask && a_ >= base_mask) return *this; @@ -95,7 +95,7 @@ struct gray16 } //-------------------------------------------------------------------- - const self_type& demultiply() + self_type const& demultiply() { if (a == base_mask) return *this; @@ -120,7 +120,7 @@ struct gray16 } //-------------------------------------------------------------------- - AGG_INLINE void add(const self_type& c, unsigned cover) + AGG_INLINE void add(self_type const& c, unsigned cover) { calc_type cv, ca; if (cover == agg::cover_mask) @@ -177,7 +177,7 @@ struct gray32 {} //-------------------------------------------------------------------- - gray32(const self_type& c, unsigned a_) + gray32(self_type const& c, unsigned a_) : v(c.v), a(value_type(a_)) {} @@ -186,14 +186,14 @@ struct gray32 void clear() { v = a = 0; } //-------------------------------------------------------------------- - const self_type& transparent() + self_type const& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- - const self_type& premultiply() + self_type const& premultiply() { if (a == base_mask) return *this; @@ -207,7 +207,7 @@ struct gray32 } //-------------------------------------------------------------------- - const self_type& premultiply(unsigned a_) + self_type const& premultiply(unsigned a_) { if (a == base_mask && a_ >= base_mask) return *this; @@ -223,7 +223,7 @@ struct gray32 } //-------------------------------------------------------------------- - const self_type& demultiply() + self_type const& demultiply() { if (a == base_mask) return *this; @@ -248,7 +248,7 @@ struct gray32 } //-------------------------------------------------------------------- - AGG_INLINE void add(const self_type& c, unsigned cover) + AGG_INLINE void add(self_type const& c, unsigned cover) { calc_type cv, ca; if (cover == agg::cover_mask) @@ -305,7 +305,7 @@ struct gray64 {} //-------------------------------------------------------------------- - gray64(const self_type& c, unsigned a_) + gray64(self_type const& c, unsigned a_) : v(c.v), a(value_type(a_)) {} @@ -314,14 +314,14 @@ struct gray64 void clear() { v = a = 0; } //-------------------------------------------------------------------- - const self_type& transparent() + self_type const& transparent() { a = 0; return *this; } //-------------------------------------------------------------------- - const self_type& premultiply() + self_type const& premultiply() { if (a == base_mask) return *this; @@ -335,7 +335,7 @@ struct gray64 } //-------------------------------------------------------------------- - const self_type& premultiply(unsigned a_) + self_type const& premultiply(unsigned a_) { if (a == base_mask && a_ >= base_mask) return *this; @@ -351,7 +351,7 @@ struct gray64 } //-------------------------------------------------------------------- - const self_type& demultiply() + self_type const& demultiply() { if (a == base_mask) return *this; @@ -376,7 +376,7 @@ struct gray64 } //-------------------------------------------------------------------- - AGG_INLINE void add(const self_type& c, unsigned cover) + AGG_INLINE void add(self_type const& c, unsigned cover) { calc_type cv, ca; if (cover == agg::cover_mask) diff --git a/include/mapnik/grid/grid_pixfmt.hpp b/include/mapnik/grid/grid_pixfmt.hpp index b6f4bb518..8531c9b41 100644 --- a/include/mapnik/grid/grid_pixfmt.hpp +++ b/include/mapnik/grid/grid_pixfmt.hpp @@ -57,14 +57,14 @@ class apply_gamma_dir_gray public: using value_type = typename ColorT::value_type; - apply_gamma_dir_gray(const GammaLut& gamma) + apply_gamma_dir_gray(GammaLut const& gamma) : m_gamma(gamma) {} AGG_INLINE void operator()(value_type* p) { *p = m_gamma.dir(*p); } private: - const GammaLut& m_gamma; + GammaLut const& m_gamma; }; //=====================================================apply_gamma_inv_gray @@ -74,14 +74,14 @@ class apply_gamma_inv_gray public: using value_type = typename ColorT::value_type; - apply_gamma_inv_gray(const GammaLut& gamma) + apply_gamma_inv_gray(GammaLut const& gamma) : m_gamma(gamma) {} AGG_INLINE void operator()(value_type* p) { *p = m_gamma.inv(*p); } private: - const GammaLut& m_gamma; + GammaLut const& m_gamma; }; //=================================================pixfmt_alpha_blend_gray @@ -107,7 +107,7 @@ class pixfmt_alpha_blend_gray private: //-------------------------------------------------------------------- - static AGG_INLINE void copy_or_blend_pix(value_type* p, const color_type& c, unsigned cover) + static AGG_INLINE void copy_or_blend_pix(value_type* p, color_type const& c, unsigned cover) { if (c.a) { @@ -123,7 +123,7 @@ class pixfmt_alpha_blend_gray } } - static AGG_INLINE void copy_or_blend_pix(value_type* p, const color_type& c) + static AGG_INLINE void copy_or_blend_pix(value_type* p, color_type const& c) { if (c.a) { @@ -166,15 +166,15 @@ class pixfmt_alpha_blend_gray //-------------------------------------------------------------------- agg::int8u* row_ptr(int y) { return m_rbuf->row_ptr(y); } - const agg::int8u* row_ptr(int y) const { return m_rbuf->row_ptr(y); } + agg::int8u const* row_ptr(int y) const { return m_rbuf->row_ptr(y); } row_data row(int y) const { return m_rbuf->row(y); } - const agg::int8u* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + x * Step + Offset; } + agg::int8u const* pix_ptr(int x, int y) const { return m_rbuf->row_ptr(y) + x * Step + Offset; } agg::int8u* pix_ptr(int x, int y) { return m_rbuf->row_ptr(y) + x * Step + Offset; } //-------------------------------------------------------------------- - AGG_INLINE static void make_pix(agg::int8u* p, const color_type& c) { *(value_type*)p = c.v; } + AGG_INLINE static void make_pix(agg::int8u* p, color_type const& c) { *(value_type*)p = c.v; } //-------------------------------------------------------------------- AGG_INLINE color_type pixel(int x, int y) const @@ -184,19 +184,19 @@ class pixfmt_alpha_blend_gray } //-------------------------------------------------------------------- - AGG_INLINE void copy_pixel(int x, int y, const color_type& c) + AGG_INLINE void copy_pixel(int x, int y, color_type const& c) { *((value_type*)m_rbuf->row_ptr(x, y, 1) + x * Step + Offset) = c.v; } //-------------------------------------------------------------------- - AGG_INLINE void blend_pixel(int x, int y, const color_type& c, agg::int8u cover) + AGG_INLINE void blend_pixel(int x, int y, color_type const& c, agg::int8u cover) { copy_or_blend_pix((value_type*)m_rbuf->row_ptr(x, y, 1) + x * Step + Offset, c, cover); } //-------------------------------------------------------------------- - AGG_INLINE void copy_hline(int x, int y, unsigned len, const color_type& c) + AGG_INLINE void copy_hline(int x, int y, unsigned len, color_type const& c) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x * Step + Offset; @@ -208,7 +208,7 @@ class pixfmt_alpha_blend_gray } //-------------------------------------------------------------------- - AGG_INLINE void copy_vline(int x, int y, unsigned len, const color_type& c) + AGG_INLINE void copy_vline(int x, int y, unsigned len, color_type const& c) { do { @@ -219,7 +219,7 @@ class pixfmt_alpha_blend_gray } //-------------------------------------------------------------------- - void blend_hline(int x, int y, unsigned len, const color_type& c, agg::int8u /*cover*/) + void blend_hline(int x, int y, unsigned len, color_type const& c, agg::int8u /*cover*/) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x * Step + Offset; do @@ -256,7 +256,7 @@ class pixfmt_alpha_blend_gray } //-------------------------------------------------------------------- - void blend_vline(int x, int y, unsigned len, const color_type& c, agg::int8u cover) + void blend_vline(int x, int y, unsigned len, color_type const& c, agg::int8u cover) { if (c.a) { @@ -284,7 +284,7 @@ class pixfmt_alpha_blend_gray } //-------------------------------------------------------------------- - void blend_solid_hspan(int x, int y, unsigned len, const color_type& c, const agg::int8u* covers) + void blend_solid_hspan(int x, int y, unsigned len, color_type const& c, agg::int8u const* covers) { if (c.a) { @@ -308,7 +308,7 @@ class pixfmt_alpha_blend_gray } //-------------------------------------------------------------------- - void blend_solid_vspan(int x, int y, unsigned len, const color_type& c, const agg::int8u* covers) + void blend_solid_vspan(int x, int y, unsigned len, color_type const& c, agg::int8u const* covers) { if (c.a) { @@ -332,7 +332,7 @@ class pixfmt_alpha_blend_gray } //-------------------------------------------------------------------- - void copy_color_hspan(int x, int y, unsigned len, const color_type* colors) + void copy_color_hspan(int x, int y, unsigned len, color_type const* colors) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x * Step + Offset; @@ -345,7 +345,7 @@ class pixfmt_alpha_blend_gray } //-------------------------------------------------------------------- - void copy_color_vspan(int x, int y, unsigned len, const color_type* colors) + void copy_color_vspan(int x, int y, unsigned len, color_type const* colors) { do { @@ -359,8 +359,8 @@ class pixfmt_alpha_blend_gray void blend_color_hspan(int x, int y, unsigned len, - const color_type* colors, - const agg::int8u* covers, + color_type const* colors, + agg::int8u const* covers, agg::int8u cover) { value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x * Step + Offset; @@ -406,8 +406,8 @@ class pixfmt_alpha_blend_gray void blend_color_vspan(int x, int y, unsigned len, - const color_type* colors, - const agg::int8u* covers, + color_type const* colors, + agg::int8u const* covers, agg::int8u cover) { value_type* p; @@ -475,23 +475,23 @@ class pixfmt_alpha_blend_gray //-------------------------------------------------------------------- template - void apply_gamma_dir(const GammaLut& g) + void apply_gamma_dir(GammaLut const& g) { for_each_pixel(apply_gamma_dir_gray(g)); } //-------------------------------------------------------------------- template - void apply_gamma_inv(const GammaLut& g) + void apply_gamma_inv(GammaLut const& g) { for_each_pixel(apply_gamma_inv_gray(g)); } //-------------------------------------------------------------------- template - void copy_from(const RenBuf2& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) + void copy_from(RenBuf2 const& from, int xdst, int ydst, int xsrc, int ysrc, unsigned len) { - const agg::int8u* p = from.row_ptr(ysrc); + agg::int8u const* p = from.row_ptr(ysrc); if (p) { memmove(m_rbuf->row_ptr(xdst, ydst, len) + xdst * pix_width, p + xsrc * pix_width, len * pix_width); @@ -500,8 +500,8 @@ class pixfmt_alpha_blend_gray //-------------------------------------------------------------------- template - void blend_from_color(const SrcPixelFormatRenderer& from, - const color_type& color, + void blend_from_color(SrcPixelFormatRenderer const& from, + color_type const& color, int xdst, int ydst, int /*xsrc*/, @@ -510,7 +510,7 @@ class pixfmt_alpha_blend_gray agg::int8u cover) { using src_value_type = typename SrcPixelFormatRenderer::value_type; - const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); + src_value_type const* psrc = (src_value_type*)from.row_ptr(ysrc); if (psrc) { value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; @@ -525,8 +525,8 @@ class pixfmt_alpha_blend_gray //-------------------------------------------------------------------- template - void blend_from_lut(const SrcPixelFormatRenderer& from, - const color_type* color_lut, + void blend_from_lut(SrcPixelFormatRenderer const& from, + color_type const* color_lut, int xdst, int ydst, int /*xsrc*/, @@ -535,7 +535,7 @@ class pixfmt_alpha_blend_gray agg::int8u cover) { using src_value_type = typename SrcPixelFormatRenderer::value_type; - const src_value_type* psrc = (src_value_type*)from.row_ptr(ysrc); + src_value_type const* psrc = (src_value_type*)from.row_ptr(ysrc); if (psrc) { value_type* pdst = (value_type*)m_rbuf->row_ptr(xdst, ydst, len) + xdst; diff --git a/include/mapnik/grid/grid_renderer.hpp b/include/mapnik/grid/grid_renderer.hpp index 7ce55d2bd..c6c1921cb 100644 --- a/include/mapnik/grid/grid_renderer.hpp +++ b/include/mapnik/grid/grid_renderer.hpp @@ -118,7 +118,7 @@ class MAPNIK_DECL grid_renderer : public feature_style_processor ras_ptr; + std::unique_ptr const ras_ptr; renderer_common common_; void setup(Map const& m); }; diff --git a/include/mapnik/grid/grid_view.hpp b/include/mapnik/grid/grid_view.hpp index 22d5a21aa..c56e7b493 100644 --- a/include/mapnik/grid/grid_view.hpp +++ b/include/mapnik/grid/grid_view.hpp @@ -115,7 +115,7 @@ class hit_grid_view inline T const& data() const { return data_; } - inline const unsigned char* raw_data() const { return data_.bytes(); } + inline unsigned char const* raw_data() const { return data_.bytes(); } inline std::set const& get_fields() const { return names_; } diff --git a/include/mapnik/grid_vertex_converter.hpp b/include/mapnik/grid_vertex_converter.hpp index cb7fcda2b..4c05a4f25 100644 --- a/include/mapnik/grid_vertex_converter.hpp +++ b/include/mapnik/grid_vertex_converter.hpp @@ -84,7 +84,7 @@ class spiral_iterator void rewind() { i_ = x_ = y_ = 0; } private: - const unsigned end_; + unsigned const end_; unsigned i_; int x_, y_; }; @@ -162,7 +162,7 @@ struct grid_vertex_converter // Polygon with huge area can lead to excessive memory allocation. // This is more or less arbitrarily chosen limit for the maximum bitmap resolution. // Bitmap bigger than this limit is scaled down to fit into this resolution. - const std::size_t max_size = 8192 * 8192; + std::size_t const max_size = 8192 * 8192; if (size > max_size) { return std::sqrt(max_size / size); @@ -220,11 +220,11 @@ struct grid_vertex_converter return vertex_processor.polygon_; } - const double hit_bitmap_scale_; - const T dx_, dy_; - const view_transform vt_; - const image_gray8 hit_bitmap_; - const mapnik::geometry::point interior_; + double const hit_bitmap_scale_; + T const dx_, dy_; + view_transform const vt_; + image_gray8 const hit_bitmap_; + mapnik::geometry::point const interior_; spiral_iterator si_; }; diff --git a/include/mapnik/group/group_rule.hpp b/include/mapnik/group/group_rule.hpp index b77f45e8d..d5330062c 100644 --- a/include/mapnik/group/group_rule.hpp +++ b/include/mapnik/group/group_rule.hpp @@ -43,25 +43,25 @@ struct MAPNIK_DECL group_rule { using symbolizers = std::vector; - group_rule(const expression_ptr& filter = std::make_shared(true), - const expression_ptr& repeat_key = expression_ptr()); + group_rule(expression_ptr const& filter = std::make_shared(true), + expression_ptr const& repeat_key = expression_ptr()); - group_rule& operator=(const group_rule& rhs); - bool operator==(const group_rule& rhs) const; + group_rule& operator=(group_rule const& rhs); + bool operator==(group_rule const& rhs) const; - void append(const symbolizer&); + void append(symbolizer const&); - const symbolizers& get_symbolizers() const { return symbolizers_; } + symbolizers const& get_symbolizers() const { return symbolizers_; } inline symbolizers::const_iterator begin() const { return symbolizers_.begin(); } inline symbolizers::const_iterator end() const { return symbolizers_.end(); } - inline void set_filter(const expression_ptr& filter) { filter_ = filter; } + inline void set_filter(expression_ptr const& filter) { filter_ = filter; } inline expression_ptr const& get_filter() const { return filter_; } - inline void set_repeat_key(const expression_ptr& repeat_key) { repeat_key_ = repeat_key; } + inline void set_repeat_key(expression_ptr const& repeat_key) { repeat_key_ = repeat_key; } inline expression_ptr const& get_repeat_key() const { return repeat_key_; } diff --git a/include/mapnik/hextree.hpp b/include/mapnik/hextree.hpp index e30f3e9af..e809e9d1f 100644 --- a/include/mapnik/hextree.hpp +++ b/include/mapnik/hextree.hpp @@ -38,9 +38,9 @@ namespace mapnik { struct RGBAPolicy { - const static unsigned MAX_LEVELS = 6; - const static unsigned MIN_ALPHA = 5; - const static unsigned MAX_ALPHA = 250; + static unsigned const MAX_LEVELS = 6; + static unsigned const MIN_ALPHA = 5; + static unsigned const MAX_ALPHA = 250; inline static unsigned index_from_level(unsigned level, rgba const& c) { unsigned shift = 7 - level; @@ -99,7 +99,7 @@ class hextree : private util::noncopyable // highest reduce_cost first struct node_rev_cmp { - bool operator()(const node* lhs, const node* rhs) const + bool operator()(node const* lhs, node const* rhs) const { if (lhs->reduce_cost != rhs->reduce_cost) { @@ -113,7 +113,7 @@ class hextree : private util::noncopyable unsigned colors_; // flag indicating existance of invisible pixels (a < InsertPolicy::MIN_ALPHA) bool has_holes_; - const std::unique_ptr root_; + std::unique_ptr const root_; // working palette for quantization, sorted on mean(r,g,b,a) for easier searching NN std::vector sorted_pal_; // index remaping of sorted_pal_ indexes to indexes of returned image palette diff --git a/include/mapnik/image_filter.hpp b/include/mapnik/image_filter.hpp index 602fbd1b4..348d37119 100644 --- a/include/mapnik/image_filter.hpp +++ b/include/mapnik/image_filter.hpp @@ -135,10 +135,10 @@ namespace mapnik { namespace filter { namespace detail { -static const float blur_matrix[] = {0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f}; -static const float emboss_matrix[] = {-2, -1, 0, -1, 1, 1, 0, 1, 2}; -static const float sharpen_matrix[] = {0, -1, 0, -1, 5, -1, 0, -1, 0}; -static const float edge_detect_matrix[] = {0, 1, 0, 1, -4, 1, 0, 1, 0}; +static float const blur_matrix[] = {0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f, 0.1111f}; +static float const emboss_matrix[] = {-2, -1, 0, -1, 1, 1, 0, 1, 2}; +static float const sharpen_matrix[] = {0, -1, 0, -1, 5, -1, 0, -1, 0}; +static float const edge_detect_matrix[] = {0, 1, 0, 1, -4, 1, 0, 1, 0}; } // namespace detail diff --git a/include/mapnik/image_filter_grammar_x3_def.hpp b/include/mapnik/image_filter_grammar_x3_def.hpp index 21521bc56..3b056552e 100644 --- a/include/mapnik/image_filter_grammar_x3_def.hpp +++ b/include/mapnik/image_filter_grammar_x3_def.hpp @@ -62,30 +62,30 @@ using x3::lit; using x3::symbols; using x3::uint_parser; -const auto push_back = [](auto& ctx) { +auto const push_back = [](auto& ctx) { _val(ctx).push_back(_attr(ctx)); }; -const auto set_rx_ry = [](auto& ctx) { +auto const set_rx_ry = [](auto& ctx) { _val(ctx).rx = _val(ctx).ry = _attr(ctx); }; -const auto set_ry = [](auto& ctx) { +auto const set_ry = [](auto& ctx) { _val(ctx).ry = _attr(ctx); }; -const auto offset_value = [](auto& ctx) { +auto const offset_value = [](auto& ctx) { _val(ctx) = _attr(ctx); }; -const auto percent = [](auto& ctx) { +auto const percent = [](auto& ctx) { double val = std::abs(_val(ctx) / 100.0); if (val > 1.0) val = 1.0; _val(ctx) = val; }; -const x3::uint_parser radius; +x3::uint_parser const radius; // Import the expression rule namespace { diff --git a/include/mapnik/image_impl.hpp b/include/mapnik/image_impl.hpp index c664e2810..296ebeec0 100644 --- a/include/mapnik/image_impl.hpp +++ b/include/mapnik/image_impl.hpp @@ -158,7 +158,7 @@ inline typename image::pixel_type& image::operator()(std::size_t i, std::s } template -inline const typename image::pixel_type& image::operator()(std::size_t i, std::size_t j) const +inline typename image::pixel_type const& image::operator()(std::size_t i, std::size_t j) const { assert(i < dimensions_.width() && j < dimensions_.height()); return *get_row(j, i); @@ -195,9 +195,9 @@ inline void image::set(pixel_type const& t) } template -inline const typename image::pixel_type* image::data() const +inline typename image::pixel_type const* image::data() const { - return reinterpret_cast(buffer_.data()); + return reinterpret_cast(buffer_.data()); } template @@ -207,7 +207,7 @@ inline typename image::pixel_type* image::data() } template -inline const unsigned char* image::bytes() const +inline unsigned char const* image::bytes() const { return buffer_.data(); } @@ -250,7 +250,7 @@ inline typename image::pixel_type const* image::get_row(std::size_t row) c } template -inline const typename image::pixel_type* image::get_row(std::size_t row, std::size_t x0) const +inline typename image::pixel_type const* image::get_row(std::size_t row, std::size_t x0) const { return data() + row * dimensions_.width() + x0; } diff --git a/include/mapnik/image_null.hpp b/include/mapnik/image_null.hpp index 367fc6c6a..b68bee4d9 100644 --- a/include/mapnik/image_null.hpp +++ b/include/mapnik/image_null.hpp @@ -38,7 +38,7 @@ class MAPNIK_DECL image { public: using pixel_type = null_t::type; - static const image_dtype dtype = null_t::id; + static image_dtype const dtype = null_t::id; private: public: @@ -65,7 +65,7 @@ class MAPNIK_DECL image { throw std::runtime_error("Can not get or set values for null image"); } - unsigned const char* bytes() const { return nullptr; } + unsigned char const* bytes() const { return nullptr; } unsigned char* bytes() { return nullptr; } double get_offset() const { return 0.0; } void set_offset(double) {} diff --git a/include/mapnik/image_reader.hpp b/include/mapnik/image_reader.hpp index 353474fb6..192ffff3b 100644 --- a/include/mapnik/image_reader.hpp +++ b/include/mapnik/image_reader.hpp @@ -48,7 +48,7 @@ class image_reader_exception : public std::exception ~image_reader_exception() {} - virtual const char* what() const noexcept { return message_.c_str(); } + virtual char const* what() const noexcept { return message_.c_str(); } }; struct MAPNIK_DECL image_reader : private util::noncopyable diff --git a/include/mapnik/image_util.hpp b/include/mapnik/image_util.hpp index 6c0cf460a..82d0913b2 100644 --- a/include/mapnik/image_util.hpp +++ b/include/mapnik/image_util.hpp @@ -63,7 +63,7 @@ class image_writer_exception : public std::exception ~image_writer_exception() {} - virtual const char* what() const noexcept { return message_.c_str(); } + virtual char const* what() const noexcept { return message_.c_str(); } }; template diff --git a/include/mapnik/image_view_null.hpp b/include/mapnik/image_view_null.hpp index a8e2d93d3..dc508567c 100644 --- a/include/mapnik/image_view_null.hpp +++ b/include/mapnik/image_view_null.hpp @@ -35,7 +35,7 @@ class MAPNIK_DECL image_view { public: using pixel_type = image_null::pixel_type; - static const image_dtype dtype = image_null::dtype; + static image_dtype const dtype = image_null::dtype; image_view() {} ~image_view(){}; @@ -55,8 +55,8 @@ class MAPNIK_DECL image_view } std::size_t size() const { return 0; } std::size_t row_size() const { return 0; } - const pixel_type* get_row(std::size_t) const { return nullptr; } - const pixel_type* get_row(std::size_t, std::size_t) const { return nullptr; } + pixel_type const* get_row(std::size_t) const { return nullptr; } + pixel_type const* get_row(std::size_t, std::size_t) const { return nullptr; } bool get_premultiplied() const { return false; } double get_offset() const { return 0.0; } double get_scaling() const { return 1.0; } diff --git a/include/mapnik/jpeg_io.hpp b/include/mapnik/jpeg_io.hpp index 22dec8ec9..8084989b2 100644 --- a/include/mapnik/jpeg_io.hpp +++ b/include/mapnik/jpeg_io.hpp @@ -111,7 +111,7 @@ void save_as_jpeg(T1& file, int quality, T2 const& image) JSAMPLE* row = reinterpret_cast(::operator new(sizeof(JSAMPLE) * width * 3)); while (cinfo.next_scanline < cinfo.image_height) { - const unsigned* imageRow = image.get_row(cinfo.next_scanline); + unsigned const* imageRow = image.get_row(cinfo.next_scanline); int index = 0; for (int i = 0; i < width; ++i) { diff --git a/include/mapnik/json/feature_grammar_x3_def.hpp b/include/mapnik/json/feature_grammar_x3_def.hpp index c05224cba..3fc885547 100644 --- a/include/mapnik/json/feature_grammar_x3_def.hpp +++ b/include/mapnik/json/feature_grammar_x3_def.hpp @@ -158,10 +158,10 @@ struct geometry_type_ : x3::symbols namespace { -const auto assign_name = [](auto const& ctx) { +auto const assign_name = [](auto const& ctx) { std::get<0>(_val(ctx)) = std::move(_attr(ctx)); }; -const auto assign_value = [](auto const& ctx) { +auto const assign_value = [](auto const& ctx) { std::get<1>(_val(ctx)) = std::move(_attr(ctx)); }; @@ -207,7 +207,7 @@ auto const assign_collection = [](auto const& ctx) { std::get<2>(_val(ctx)) = std::move(_attr(ctx)); }; -const auto assign_property = [](auto const& ctx) { +auto const assign_property = [](auto const& ctx) { mapnik::feature_impl& feature = x3::get(ctx); mapnik::transcoder const& tr = x3::get(ctx); feature.put_new(std::get<0>(_attr(ctx)), diff --git a/include/mapnik/json/generic_json_grammar_x3_def.hpp b/include/mapnik/json/generic_json_grammar_x3_def.hpp index 381d7747a..7f48baec6 100644 --- a/include/mapnik/json/generic_json_grammar_x3_def.hpp +++ b/include/mapnik/json/generic_json_grammar_x3_def.hpp @@ -35,27 +35,27 @@ namespace x3 = boost::spirit::x3; namespace { -const auto make_null = [](auto const& ctx) { +auto const make_null = [](auto const& ctx) { _val(ctx) = mapnik::value_null{}; }; -const auto make_true = [](auto const& ctx) { +auto const make_true = [](auto const& ctx) { _val(ctx) = true; }; -const auto make_false = [](auto const& ctx) { +auto const make_false = [](auto const& ctx) { _val(ctx) = false; }; -const auto assign = [](auto const& ctx) { +auto const assign = [](auto const& ctx) { _val(ctx) = std::move(_attr(ctx)); }; -const auto assign_key = [](auto const& ctx) { +auto const assign_key = [](auto const& ctx) { std::get<0>(_val(ctx)) = std::move(_attr(ctx)); }; -const auto assign_value = [](auto const& ctx) { +auto const assign_value = [](auto const& ctx) { std::get<1>(_val(ctx)) = std::move(_attr(ctx)); }; @@ -64,7 +64,7 @@ const auto assign_value = [](auto const& ctx) { using x3::lit; // import unicode string rule -const auto json_string = mapnik::json::grammar::unicode_string; +auto const json_string = mapnik::json::grammar::unicode_string; // rules x3::rule const object("JSON Object"); diff --git a/include/mapnik/json/geojson_grammar_x3_def.hpp b/include/mapnik/json/geojson_grammar_x3_def.hpp index c497c65d2..d272d2fb8 100644 --- a/include/mapnik/json/geojson_grammar_x3_def.hpp +++ b/include/mapnik/json/geojson_grammar_x3_def.hpp @@ -35,30 +35,30 @@ namespace grammar { namespace x3 = boost::spirit::x3; -const auto make_null = [](auto const& ctx) { +auto const make_null = [](auto const& ctx) { _val(ctx) = mapnik::value_null{}; }; -const auto make_true = [](auto const& ctx) { +auto const make_true = [](auto const& ctx) { _val(ctx) = true; }; -const auto make_false = [](auto const& ctx) { +auto const make_false = [](auto const& ctx) { _val(ctx) = false; }; -const auto assign = [](auto const& ctx) { +auto const assign = [](auto const& ctx) { _val(ctx) = std::move(_attr(ctx)); }; -const auto assign_key = [](auto const& ctx) { +auto const assign_key = [](auto const& ctx) { std::string const& name = _attr(ctx); keys_map& keys = x3::get(ctx); auto result = keys.insert(keys_map::value_type(name, keys.size() + 1)); std::get<0>(_val(ctx)) = result.first->right; }; -const auto assign_value = [](auto const& ctx) { +auto const assign_value = [](auto const& ctx) { std::get<1>(_val(ctx)) = std::move(_attr(ctx)); }; @@ -95,9 +95,9 @@ auto const geojson_double = x3::real_parser(); // import unicode string rule -const auto geojson_string = unicode_string; +auto const geojson_string = unicode_string; // import positions rule -const auto positions_rule = positions; +auto const positions_rule = positions; // GeoJSON types // clang-format off diff --git a/include/mapnik/json/positions_grammar_x3_def.hpp b/include/mapnik/json/positions_grammar_x3_def.hpp index b687fbd15..cee094814 100644 --- a/include/mapnik/json/positions_grammar_x3_def.hpp +++ b/include/mapnik/json/positions_grammar_x3_def.hpp @@ -35,7 +35,7 @@ using x3::double_; using x3::lit; using x3::omit; -const auto assign_helper = [](auto const& ctx) { +auto const assign_helper = [](auto const& ctx) { _val(ctx) = std::move(_attr(ctx)); }; diff --git a/include/mapnik/json/topojson_grammar_x3_def.hpp b/include/mapnik/json/topojson_grammar_x3_def.hpp index 54dd56a96..c64eb8972 100644 --- a/include/mapnik/json/topojson_grammar_x3_def.hpp +++ b/include/mapnik/json/topojson_grammar_x3_def.hpp @@ -169,7 +169,7 @@ struct create_multi_polygon } }; -const auto create_geometry = [](auto const& ctx) { +auto const create_geometry = [](auto const& ctx) { auto const geom_type = std::get<0>(_attr(ctx)); auto const& coord = std::get<1>(_attr(ctx)); auto const& arcs = std::get<2>(_attr(ctx)); @@ -199,27 +199,27 @@ const auto create_geometry = [](auto const& ctx) { _val(ctx) = std::move(geom); }; -const auto assign_bbox = [](auto const& ctx) { +auto const assign_bbox = [](auto const& ctx) { _val(ctx).bbox = std::move(_attr(ctx)); }; -const auto assign_transform = [](auto const& ctx) { +auto const assign_transform = [](auto const& ctx) { _val(ctx).tr = std::move(_attr(ctx)); }; -const auto assign_arcs = [](auto const& ctx) { +auto const assign_arcs = [](auto const& ctx) { _val(ctx).arcs = std::move(_attr(ctx)); }; -const auto assign_objects = [](auto const& ctx) { +auto const assign_objects = [](auto const& ctx) { _val(ctx).geometries = std::move(_attr(ctx)); }; -const auto push_geometry = [](auto const& ctx) { +auto const push_geometry = [](auto const& ctx) { _val(ctx).push_back(std::move(_attr(ctx))); }; -const auto push_collection = [](auto const& ctx) { +auto const push_collection = [](auto const& ctx) { auto& dest = _val(ctx); auto& src = _attr(ctx); if (dest.empty()) @@ -231,27 +231,27 @@ const auto push_collection = [](auto const& ctx) { } }; -const auto assign_geometry_type = [](auto const& ctx) { +auto const assign_geometry_type = [](auto const& ctx) { std::get<0>(_val(ctx)) = _attr(ctx); }; -const auto assign_coordinates = [](auto const& ctx) { +auto const assign_coordinates = [](auto const& ctx) { std::get<1>(_val(ctx)) = std::move(_attr(ctx)); }; -const auto assign_rings = [](auto const& ctx) { +auto const assign_rings = [](auto const& ctx) { std::get<2>(_val(ctx)) = std::move(_attr(ctx)); }; -const auto assign_properties = [](auto const& ctx) { +auto const assign_properties = [](auto const& ctx) { std::get<3>(_val(ctx)) = std::move(_attr(ctx)); }; -const auto assign_prop_name = [](auto const& ctx) { +auto const assign_prop_name = [](auto const& ctx) { std::get<0>(_val(ctx)) = std::move(_attr(ctx)); }; -const auto assign_prop_value = [](auto const& ctx) { +auto const assign_prop_value = [](auto const& ctx) { std::get<1>(_val(ctx)) = std::move(_attr(ctx)); }; @@ -263,9 +263,9 @@ using x3::lit; using x3::omit; // import unicode string rule -const auto json_string = json::grammar::unicode_string; +auto const json_string = json::grammar::unicode_string; // json value -const auto json_value = json::grammar::value; +auto const json_value = json::grammar::value; using coordinates_type = util::variant>; using arcs_type = util::variant, diff --git a/include/mapnik/json/unicode_string_grammar_x3_def.hpp b/include/mapnik/json/unicode_string_grammar_x3_def.hpp index 89ff0f881..be71c83e9 100644 --- a/include/mapnik/json/unicode_string_grammar_x3_def.hpp +++ b/include/mapnik/json/unicode_string_grammar_x3_def.hpp @@ -35,7 +35,7 @@ namespace x3 = boost::spirit::x3; using uchar = std::uint32_t; // a unicode code point -const auto append = [](auto const& ctx) { +auto const append = [](auto const& ctx) { _val(ctx) += _attr(ctx); }; @@ -50,15 +50,15 @@ static inline void push_utf8_impl(std::string& str, uchar code_point) } } // namespace detail -const auto push_char = [](auto const& ctx) { +auto const push_char = [](auto const& ctx) { _val(ctx).push_back(_attr(ctx)); }; -const auto push_utf8 = [](auto const& ctx) { +auto const push_utf8 = [](auto const& ctx) { detail::push_utf8_impl(_val(ctx), _attr(ctx)); }; -const auto push_utf16 = [](auto const& ctx) { +auto const push_utf16 = [](auto const& ctx) { using iterator_type = std::vector::const_iterator; auto const& utf16 = _attr(ctx); try @@ -76,7 +76,7 @@ const auto push_utf16 = [](auto const& ctx) { } }; -const auto push_esc = [](auto const& ctx) { +auto const push_esc = [](auto const& ctx) { std::string& utf8 = _val(ctx); char c = _attr(ctx); switch (c) diff --git a/include/mapnik/map.hpp b/include/mapnik/map.hpp index 053d7c144..f80944cef 100644 --- a/include/mapnik/map.hpp +++ b/include/mapnik/map.hpp @@ -75,8 +75,8 @@ class MAPNIK_DECL Map : boost::equality_comparable }; private: - static const unsigned MIN_MAPSIZE = 16; - static const unsigned MAX_MAPSIZE = MIN_MAPSIZE << 10; + static unsigned const MIN_MAPSIZE = 16; + static unsigned const MAX_MAPSIZE = MIN_MAPSIZE << 10; unsigned width_; unsigned height_; std::string srs_; diff --git a/include/mapnik/memory_datasource.hpp b/include/mapnik/memory_datasource.hpp index bfb82e290..81a8718ce 100644 --- a/include/mapnik/memory_datasource.hpp +++ b/include/mapnik/memory_datasource.hpp @@ -40,7 +40,7 @@ class MAPNIK_DECL memory_datasource : public datasource public: memory_datasource(parameters const& params); - static const char* name(); + static char const* name(); virtual ~memory_datasource(); virtual datasource::datasource_t type() const; virtual featureset_ptr features(query const& q) const; diff --git a/include/mapnik/octree.hpp b/include/mapnik/octree.hpp index 2ef57663b..25f9fef45 100644 --- a/include/mapnik/octree.hpp +++ b/include/mapnik/octree.hpp @@ -37,8 +37,8 @@ namespace mapnik { struct RGBPolicy { - const static unsigned MAX_LEVELS = 6; - const static unsigned MIN_LEVELS = 2; + static unsigned const MAX_LEVELS = 6; + static unsigned const MIN_LEVELS = 2; inline static unsigned index_from_level(unsigned level, rgb const& c) { unsigned shift = 7 - level; @@ -88,7 +88,7 @@ class octree : private util::noncopyable }; struct node_cmp { - bool operator()(const node* lhs, const node* rhs) const { return lhs->reduce_cost < rhs->reduce_cost; } + bool operator()(node const* lhs, node const* rhs) const { return lhs->reduce_cost < rhs->reduce_cost; } }; std::deque reducible_[InsertPolicy::MAX_LEVELS]; diff --git a/include/mapnik/palette.hpp b/include/mapnik/palette.hpp index 9319eb22d..35a4464a4 100644 --- a/include/mapnik/palette.hpp +++ b/include/mapnik/palette.hpp @@ -68,7 +68,7 @@ struct MAPNIK_DECL rgb {} rgb(rgba const& c); - inline bool operator==(const rgb& y) const { return r == y.r && g == y.g && b == y.b; } + inline bool operator==(rgb const& y) const { return r == y.r && g == y.g && b == y.b; } }; struct MAPNIK_DECL rgba @@ -104,7 +104,7 @@ struct MAPNIK_DECL rgba // ordering by mean(a,r,g,b), a, r, g, b struct MAPNIK_DECL mean_sort_cmp { - bool operator()(const rgba& x, const rgba& y) const; + bool operator()(rgba const& x, rgba const& y) const; }; inline bool operator<(rgba const& y) const { return std::tie(r, g, b, a) < std::tie(y.r, y.g, y.b, y.a); } diff --git a/include/mapnik/path.hpp b/include/mapnik/path.hpp index ccd06cef2..b134abaa2 100644 --- a/include/mapnik/path.hpp +++ b/include/mapnik/path.hpp @@ -35,7 +35,7 @@ template class Container = vertex_vector> class path : private util::noncopyable { public: - static const std::uint8_t geometry_bits = 7; + static std::uint8_t const geometry_bits = 7; enum types : std::uint8_t { Unknown = 0x00, Point = 0x01, diff --git a/include/mapnik/path_expression_grammar_x3_def.hpp b/include/mapnik/path_expression_grammar_x3_def.hpp index e450dd01a..848934fc9 100644 --- a/include/mapnik/path_expression_grammar_x3_def.hpp +++ b/include/mapnik/path_expression_grammar_x3_def.hpp @@ -32,10 +32,10 @@ namespace grammar { namespace x3 = boost::spirit::x3; using x3::lexeme; using x3::standard_wide::char_; -const auto create_string = [](auto& ctx) { +auto const create_string = [](auto& ctx) { _val(ctx).push_back(_attr(ctx)); }; -const auto create_attribute = [](auto& ctx) { +auto const create_attribute = [](auto& ctx) { _val(ctx).push_back(mapnik::attribute(_attr(ctx))); }; // rules diff --git a/include/mapnik/pixel_types.hpp b/include/mapnik/pixel_types.hpp index 3c28cef51..92894669e 100644 --- a/include/mapnik/pixel_types.hpp +++ b/include/mapnik/pixel_types.hpp @@ -46,62 +46,62 @@ enum image_dtype : std::uint8_t { struct null_t { using type = std::uint8_t; - static const image_dtype id = image_dtype_null; + static image_dtype const id = image_dtype_null; }; struct rgba8_t { using type = std::uint32_t; - static const image_dtype id = image_dtype_rgba8; + static image_dtype const id = image_dtype_rgba8; }; struct gray8_t { using type = std::uint8_t; - static const image_dtype id = image_dtype_gray8; + static image_dtype const id = image_dtype_gray8; }; struct gray8s_t { using type = std::int8_t; - static const image_dtype id = image_dtype_gray8s; + static image_dtype const id = image_dtype_gray8s; }; struct gray16_t { using type = std::uint16_t; - static const image_dtype id = image_dtype_gray16; + static image_dtype const id = image_dtype_gray16; }; struct gray16s_t { using type = std::int16_t; - static const image_dtype id = image_dtype_gray16s; + static image_dtype const id = image_dtype_gray16s; }; struct gray32_t { using type = std::uint32_t; - static const image_dtype id = image_dtype_gray32; + static image_dtype const id = image_dtype_gray32; }; struct gray32s_t { using type = std::int32_t; - static const image_dtype id = image_dtype_gray32s; + static image_dtype const id = image_dtype_gray32s; }; struct gray32f_t { using type = float; - static const image_dtype id = image_dtype_gray32f; + static image_dtype const id = image_dtype_gray32f; }; struct gray64_t { using type = std::uint64_t; - static const image_dtype id = image_dtype_gray64; + static image_dtype const id = image_dtype_gray64; }; struct gray64s_t { using type = std::int64_t; - static const image_dtype id = image_dtype_gray64s; + static image_dtype const id = image_dtype_gray64s; }; struct gray64f_t { using type = double; - static const image_dtype id = image_dtype_gray64f; + static image_dtype const id = image_dtype_gray64f; }; } // namespace mapnik diff --git a/include/mapnik/plugin.hpp b/include/mapnik/plugin.hpp index 4aa12f9e3..40fa6ebf8 100644 --- a/include/mapnik/plugin.hpp +++ b/include/mapnik/plugin.hpp @@ -37,7 +37,7 @@ using mapnik_lib_t = struct _mapnik_lib_t; class PluginInfo : util::noncopyable { public: - using callable_returning_string = const char* (*)(); + using callable_returning_string = char const* (*)(); using callable_returning_void = void (*)(); PluginInfo(std::string const& filename, std::string const& library_name); ~PluginInfo(); diff --git a/include/mapnik/png_io.hpp b/include/mapnik/png_io.hpp index 5d0db8001..d482a839b 100644 --- a/include/mapnik/png_io.hpp +++ b/include/mapnik/png_io.hpp @@ -129,10 +129,10 @@ void save_as_png(T1& file, T2 const& image, png_options const& opts) PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - const std::unique_ptr row_pointers(new png_bytep[image.height()]); + std::unique_ptr const row_pointers(new png_bytep[image.height()]); for (unsigned int i = 0; i < image.height(); ++i) { - row_pointers[i] = const_cast(reinterpret_cast(image.get_row(i))); + row_pointers[i] = const_cast(reinterpret_cast(image.get_row(i))); } png_set_rows(png_ptr, info_ptr, row_pointers.get()); png_write_png(png_ptr, @@ -313,7 +313,7 @@ void save_as_png(T& file, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - png_color* pal = const_cast(reinterpret_cast(&palette[0])); + png_color* pal = const_cast(reinterpret_cast(&palette[0])); png_set_PLTE(png_ptr, info_ptr, pal, static_cast(palette.size())); // make transparent lowest indexes, so tRNS is small @@ -350,7 +350,7 @@ void save_as_png8_oct(T1& file, T2 const& image, png_options const& opts) { // number of alpha ranges in png8 format; 2 results in smallest image with binary transparency // 3 is minimum for semitransparency, 4 is recommended, anything else is worse - const unsigned TRANSPARENCY_LEVELS = (opts.trans_mode == 2 || opts.trans_mode < 0) ? MAX_OCTREE_LEVELS : 2; + unsigned const TRANSPARENCY_LEVELS = (opts.trans_mode == 2 || opts.trans_mode < 0) ? MAX_OCTREE_LEVELS : 2; unsigned width = image.width(); unsigned height = image.height(); unsigned alphaHist[256]; // transparency histogram diff --git a/include/mapnik/pool.hpp b/include/mapnik/pool.hpp index 7c2a881db..c84f33f11 100644 --- a/include/mapnik/pool.hpp +++ b/include/mapnik/pool.hpp @@ -52,7 +52,7 @@ class Pool : private util::noncopyable #endif public: - Pool(const Creator& creator, unsigned initialSize, unsigned maxSize) + Pool(Creator const& creator, unsigned initialSize, unsigned maxSize) : creator_(creator), initialSize_(initialSize), maxSize_(maxSize) diff --git a/include/mapnik/proj_transform_cache.hpp b/include/mapnik/proj_transform_cache.hpp index 80694b97b..665704ea3 100644 --- a/include/mapnik/proj_transform_cache.hpp +++ b/include/mapnik/proj_transform_cache.hpp @@ -31,7 +31,7 @@ class proj_transform; // fwd decl namespace proj_transform_cache { MAPNIK_DECL void init(std::string const& source, std::string const& dest); -MAPNIK_DECL proj_transform const* get(std::string const& source, std::string const& dest); +MAPNIK_DECL const proj_transform* get(std::string const& source, std::string const& dest); } // namespace proj_transform_cache } // namespace mapnik diff --git a/include/mapnik/projection.hpp b/include/mapnik/projection.hpp index b936cb652..d0ee5d5b4 100644 --- a/include/mapnik/projection.hpp +++ b/include/mapnik/projection.hpp @@ -69,8 +69,8 @@ class MAPNIK_DECL projection ~projection(); projection& operator=(projection const& rhs); - bool operator==(const projection& other) const; - bool operator!=(const projection& other) const; + bool operator==(projection const& other) const; + bool operator!=(projection const& other) const; bool is_initialized() const; bool is_geographic() const; std::optional well_known() const; diff --git a/include/mapnik/quad_tree.hpp b/include/mapnik/quad_tree.hpp index 4a3762bb6..ef9ea97d3 100644 --- a/include/mapnik/quad_tree.hpp +++ b/include/mapnik/quad_tree.hpp @@ -309,8 +309,8 @@ class quad_tree : util::noncopyable } } - const unsigned int max_depth_; - const double ratio_; + unsigned int const max_depth_; + double const ratio_; result_type query_result_; nodes_type nodes_; node* root_; diff --git a/include/mapnik/raster_colorizer.hpp b/include/mapnik/raster_colorizer.hpp index ea8d0aecf..8ea242750 100644 --- a/include/mapnik/raster_colorizer.hpp +++ b/include/mapnik/raster_colorizer.hpp @@ -198,7 +198,7 @@ class MAPNIK_DECL raster_colorizer //! \brief Set the epsilon value for exact mode //! \param[in] e The epsilon value - inline void set_epsilon(const float e) + inline void set_epsilon(float const e) { if (e > 0) epsilon_ = e; diff --git a/include/mapnik/renderer_common/process_point_symbolizer.hpp b/include/mapnik/renderer_common/process_point_symbolizer.hpp index 24a95cdd8..90c5febbe 100644 --- a/include/mapnik/renderer_common/process_point_symbolizer.hpp +++ b/include/mapnik/renderer_common/process_point_symbolizer.hpp @@ -52,25 +52,25 @@ void render_point_symbolizer(point_symbolizer const& sym, if (!mark->is()) { - const value_double opacity = get(sym, feature, common.vars_); - const value_bool allow_overlap = get(sym, feature, common.vars_); - const value_bool ignore_placement = get(sym, feature, common.vars_); - const point_placement_enum placement = + value_double const opacity = get(sym, feature, common.vars_); + value_bool const allow_overlap = get(sym, feature, common.vars_); + value_bool const ignore_placement = get(sym, feature, common.vars_); + point_placement_enum const placement = get(sym, feature, common.vars_); - const box2d& bbox = mark->bounding_box(); - const coord2d center = bbox.center(); + box2d const& bbox = mark->bounding_box(); + coord2d const center = bbox.center(); agg::trans_affine tr; - const auto image_transform = get_optional(sym, keys::image_transform); + auto const image_transform = get_optional(sym, keys::image_transform); if (image_transform) evaluate_transform(tr, feature, common.vars_, *image_transform, common.scale_factor_); - const agg::trans_affine_translation recenter(-center.x, -center.y); - const agg::trans_affine recenter_tr = recenter * tr; + agg::trans_affine_translation const recenter(-center.x, -center.y); + agg::trans_affine const recenter_tr = recenter * tr; box2d label_ext = bbox * recenter_tr * agg::trans_affine_scaling(common.scale_factor_); - const mapnik::geometry::geometry& geometry = feature.get_geometry(); + mapnik::geometry::geometry const& geometry = feature.get_geometry(); mapnik::geometry::point pt; geometry::geometry_types type = geometry::geometry_type(geometry); if (placement == point_placement_enum::CENTROID_POINT_PLACEMENT || type == geometry::geometry_types::Point || diff --git a/include/mapnik/rule.hpp b/include/mapnik/rule.hpp index e79d806d2..6eb75087b 100644 --- a/include/mapnik/rule.hpp +++ b/include/mapnik/rule.hpp @@ -54,7 +54,7 @@ class MAPNIK_DECL rule rule(std::string const& name, double min_scale_denominator = 0, double max_scale_denominator = std::numeric_limits::infinity()); - rule(const rule& rhs); + rule(rule const& rhs); rule(rule&& rhs); rule& operator=(rule rhs); bool operator==(rule const& rhs) const; diff --git a/include/mapnik/safe_cast.hpp b/include/mapnik/safe_cast.hpp index db6d7384c..e6bcb3c97 100644 --- a/include/mapnik/safe_cast.hpp +++ b/include/mapnik/safe_cast.hpp @@ -121,16 +121,16 @@ struct numeric_compare struct bounds { - static const T lowest() { return static_cast(-std::numeric_limits::max()); } - static const T highest() { return std::numeric_limits::max(); } + static T const lowest() { return static_cast(-std::numeric_limits::max()); } + static T const highest() { return std::numeric_limits::max(); } }; // integers template struct bounds::is_integer>::type> { - static const T lowest() { return std::numeric_limits::min(); } - static const T highest() { return std::numeric_limits::max(); } + static T const lowest() { return std::numeric_limits::min(); } + static T const highest() { return std::numeric_limits::max(); } }; } // namespace detail @@ -138,8 +138,8 @@ struct bounds::is_integer>::ty template inline T safe_cast(S s) { - static const auto max_val = detail::bounds::highest(); - static const auto min_val = detail::bounds::lowest(); + static auto const max_val = detail::bounds::highest(); + static auto const min_val = detail::bounds::lowest(); if (detail::numeric_compare::greater(s, max_val)) { diff --git a/include/mapnik/simplify_converter.hpp b/include/mapnik/simplify_converter.hpp index 69950838f..746858854 100644 --- a/include/mapnik/simplify_converter.hpp +++ b/include/mapnik/simplify_converter.hpp @@ -46,7 +46,7 @@ struct weighted_vertex : private util::noncopyable struct ascending_sort { - bool operator()(const weighted_vertex* a, const weighted_vertex* b) const { return b->weight > a->weight; } + bool operator()(weighted_vertex const* a, weighted_vertex const* b) const { return b->weight > a->weight; } }; }; @@ -477,7 +477,7 @@ struct simplify_converter return status_ = process; } - void RDP(std::vector& vertices, const size_t first, const size_t last) + void RDP(std::vector& vertices, size_t const first, size_t const last) { // Squared length of a vector auto sqlen = [](vertex2d const& vec) { diff --git a/include/mapnik/span_image_filter.hpp b/include/mapnik/span_image_filter.hpp index efbb62169..127061163 100644 --- a/include/mapnik/span_image_filter.hpp +++ b/include/mapnik/span_image_filter.hpp @@ -68,7 +68,7 @@ class span_image_resample_gray_affine : public agg::span_image_resample_affine> 1; int len_x_lr = (diameter * base_type::m_rx + agg::image_subpixel_mask) >> agg::image_subpixel_shift; - const agg::int16* weight_array = base_type::filter().weight_array(); + agg::int16 const* weight_array = base_type::filter().weight_array(); do { @@ -78,7 +78,7 @@ class span_image_resample_gray_affine : public agg::span_image_resample_affine> agg::image_subpixel_shift; int src_y = y >> agg::image_subpixel_shift; - const value_type* pix = reinterpret_cast(base_type::source().span(src_x, src_y, 1)); + value_type const* pix = reinterpret_cast(base_type::source().span(src_x, src_y, 1)); if (*nodata_value_ == *pix) { span->v = *nodata_value_; @@ -103,8 +103,8 @@ class span_image_resample_gray_affine : public agg::span_image_resample_affine(base_type::source().span(x_lr, y_lr, len_x_lr)); + value_type const* fg_ptr = + reinterpret_cast(base_type::source().span(x_lr, y_lr, len_x_lr)); for (;;) { int weight_y = weight_array[y_hr]; @@ -120,12 +120,12 @@ class span_image_resample_gray_affine : public agg::span_image_resample_affine= filter_scale) break; - fg_ptr = reinterpret_cast(base_type::source().next_x()); + fg_ptr = reinterpret_cast(base_type::source().next_x()); } y_hr += base_type::m_ry_inv; if (y_hr >= filter_scale) break; - fg_ptr = reinterpret_cast(base_type::source().next_y()); + fg_ptr = reinterpret_cast(base_type::source().next_y()); } if (total_weight == 0) diff --git a/include/mapnik/sql_utils.hpp b/include/mapnik/sql_utils.hpp index 900e83279..cb8ac93bc 100644 --- a/include/mapnik/sql_utils.hpp +++ b/include/mapnik/sql_utils.hpp @@ -125,9 +125,9 @@ inline std::string unquote_copy(char quot, std::string const& str) s << ",\"" << field << "\""; } -const std::regex re_from{"\\bFROM\\b", std::regex::icase}; +std::regex const re_from{"\\bFROM\\b", std::regex::icase}; -const std::regex re_table_name{"\\s*(\\w+|(\"[^\"]*\")+)" // $1 = schema +std::regex const re_table_name{"\\s*(\\w+|(\"[^\"]*\")+)" // $1 = schema "(\\.(\\w+|(\"[^\"]*\")+))?" // $4 = table "\\s*"}; diff --git a/include/mapnik/svg/output/svg_output_attributes.hpp b/include/mapnik/svg/output/svg_output_attributes.hpp index 2e1ad24e5..3d88481c2 100644 --- a/include/mapnik/svg/output/svg_output_attributes.hpp +++ b/include/mapnik/svg/output/svg_output_attributes.hpp @@ -122,10 +122,10 @@ struct rect_output_attributes fill_color_("#000000") {} - rect_output_attributes(const int x, - const int y, - const unsigned width, - const unsigned height, + rect_output_attributes(int const x, + int const y, + unsigned const width, + unsigned const height, color const& _fill_color) : x_(x), y_(y), @@ -134,10 +134,10 @@ struct rect_output_attributes fill_color_(_fill_color.to_hex_string()) {} - void set_x(const int x); - void set_y(const int y); - void set_width(const unsigned width); - void set_height(const unsigned height); + void set_x(int const x); + void set_y(int const y); + void set_width(unsigned const width); + void set_height(unsigned const height); void set_fill_color(color const& fill_color); int x() const; @@ -174,10 +174,10 @@ struct root_output_attributes { root_output_attributes(); - root_output_attributes(const unsigned width, const unsigned height); + root_output_attributes(unsigned const width, unsigned const height); - void set_width(const unsigned width); - void set_height(const unsigned height); + void set_width(unsigned const width); + void set_height(unsigned const height); void set_svg_version(double svg_version); void set_svg_namespace_url(std::string const& svg_namespace_url); @@ -192,9 +192,9 @@ struct root_output_attributes void reset(); // SVG version to which the generated document will be compliant. - static const double SVG_VERSION; + static double const SVG_VERSION; // SVG XML namespace url. - static const std::string SVG_NAMESPACE_URL; + static std::string const SVG_NAMESPACE_URL; // private: unsigned width_; diff --git a/include/mapnik/svg/output/svg_renderer.hpp b/include/mapnik/svg/output/svg_renderer.hpp index 978e8e910..e26acf813 100644 --- a/include/mapnik/svg/output/svg_renderer.hpp +++ b/include/mapnik/svg/output/svg_renderer.hpp @@ -123,7 +123,7 @@ class MAPNIK_DECL svg_renderer : public feature_style_processor - void transform(const Trans& trans, unsigned path_id = 0) + void transform(Trans const& trans, unsigned path_id = 0) { unsigned num_ver = vertices_.total_vertices(); for (; path_id < num_ver; path_id++) @@ -227,7 +227,7 @@ class path_adapter : util::noncopyable //-------------------------------------------------------------------- template - void transform_all_paths(const Trans& trans) + void transform_all_paths(Trans const& trans) { unsigned idx; unsigned num_ver = vertices_.total_vertices(); @@ -355,7 +355,7 @@ void path_adapter::arc_to(double rx, { if (vertices_.total_vertices() && is_vertex(vertices_.last_command())) { - const double epsilon = 1e-30; + double const epsilon = 1e-30; double x0 = 0.0; double y0 = 0.0; vertices_.last_vertex(&x0, &y0); @@ -899,7 +899,7 @@ class vertex_stl_adapter : util::noncopyable unsigned vertex(unsigned idx, double* x, double* y) const { - const vertex_type& v = vertices_[idx]; + vertex_type const& v = vertices_[idx]; *x = v.x; *y = v.y; return v.cmd; diff --git a/include/mapnik/svg/svg_path_parser.hpp b/include/mapnik/svg/svg_path_parser.hpp index d4acb619b..703c7b19b 100644 --- a/include/mapnik/svg/svg_path_parser.hpp +++ b/include/mapnik/svg/svg_path_parser.hpp @@ -33,18 +33,18 @@ namespace mapnik { namespace svg { template -bool parse_path(const char* wkt, PathType& p); +bool parse_path(char const* wkt, PathType& p); template -bool parse_points(const char* wkt, PathType& p); +bool parse_points(char const* wkt, PathType& p); template -bool parse_svg_transform(const char* wkt, TransformType& tr); +bool parse_svg_transform(char const* wkt, TransformType& tr); // -extern template bool MAPNIK_DECL parse_path(const char*, svg_converter_type&); -extern template bool MAPNIK_DECL parse_points(const char*, svg_converter_type&); -extern template bool MAPNIK_DECL parse_svg_transform(const char*, agg::trans_affine&); +extern template bool MAPNIK_DECL parse_path(char const*, svg_converter_type&); +extern template bool MAPNIK_DECL parse_points(char const*, svg_converter_type&); +extern template bool MAPNIK_DECL parse_svg_transform(char const*, agg::trans_affine&); } // namespace svg } // namespace mapnik diff --git a/include/mapnik/symbolizer.hpp b/include/mapnik/symbolizer.hpp index deefc9850..0fa359e00 100644 --- a/include/mapnik/symbolizer.hpp +++ b/include/mapnik/symbolizer.hpp @@ -383,8 +383,8 @@ struct extract_raw_value } }; -using property_meta_type = std::tuple, property_types>; -MAPNIK_DECL property_meta_type const& get_meta(mapnik::keys key); +using property_meta_type = std::tuple, property_types>; +MAPNIK_DECL const property_meta_type& get_meta(mapnik::keys key); MAPNIK_DECL mapnik::keys get_key(std::string const& name); template diff --git a/include/mapnik/symbolizer_base.hpp b/include/mapnik/symbolizer_base.hpp index be57f85cd..2927c06c5 100644 --- a/include/mapnik/symbolizer_base.hpp +++ b/include/mapnik/symbolizer_base.hpp @@ -101,7 +101,7 @@ struct strict_value : value_base_type { strict_value() = default; - strict_value(const char* val) noexcept(false) + strict_value(char const* val) noexcept(false) : value_base_type(std::string(val)) {} diff --git a/include/mapnik/symbolizer_utils.hpp b/include/mapnik/symbolizer_utils.hpp index 9dd96f9d7..5a45b7734 100644 --- a/include/mapnik/symbolizer_utils.hpp +++ b/include/mapnik/symbolizer_utils.hpp @@ -384,14 +384,14 @@ struct set_symbolizer_property_impl using value_type = T; try { - const auto val = node.get_opt_attr(name); + auto const val = node.get_opt_attr(name); if (val) put(sym, key, *val); } catch (config_error const& ex) { // try parsing as an expression - const auto val = node.get_opt_attr(name); + auto const val = node.get_opt_attr(name); if (val) { // first try pre-evaluate expressions which don't have dynamic properties @@ -419,7 +419,7 @@ struct set_symbolizer_property_impl { static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node) { - const auto transform = node.get_opt_attr(name); + auto const transform = node.get_opt_attr(name); if (transform) put(sym, key, mapnik::parse_transform(*transform)); } @@ -430,7 +430,7 @@ struct set_symbolizer_property_impl { static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node) { - const auto str = node.get_opt_attr(name); + auto const str = node.get_opt_attr(name); if (str) { dash_array dash; @@ -440,11 +440,11 @@ struct set_symbolizer_property_impl } else { - const auto val = node.get_opt_attr(name); + auto const val = node.get_opt_attr(name); if (val) { // first try pre-evaluate expressions which don't have dynamic properties - const auto [value, is_evaluated] = pre_evaluate_expression(*val); + auto const [value, is_evaluated] = pre_evaluate_expression(*val); if (is_evaluated) { set_property_from_value(sym, key, value); @@ -471,24 +471,24 @@ struct set_symbolizer_property_impl static void apply(Symbolizer& sym, keys key, std::string const& name, xml_node const& node) { using value_type = T; - const auto enum_str = node.get_opt_attr(name); + auto const enum_str = node.get_opt_attr(name); if (enum_str) { - const auto enum_val = detail::enum_traits::from_string(*enum_str); + auto const enum_val = detail::enum_traits::from_string(*enum_str); if (enum_val) { put(sym, key, *enum_val); } else { - const auto val = node.get_opt_attr(name); + auto const val = node.get_opt_attr(name); if (val) { // first try pre-evaluating expression - const auto [result_value, is_evaluated] = pre_evaluate_expression(*val); + auto const [result_value, is_evaluated] = pre_evaluate_expression(*val); if (is_evaluated) { - const auto enum_val2 = detail::enum_traits::from_string(result_value.to_string()); + auto const enum_val2 = detail::enum_traits::from_string(result_value.to_string()); if (enum_val2) { put(sym, key, *enum_val); diff --git a/include/mapnik/text/face.hpp b/include/mapnik/text/face.hpp index f33e770a4..9a4673e8f 100644 --- a/include/mapnik/text/face.hpp +++ b/include/mapnik/text/face.hpp @@ -70,7 +70,7 @@ class MAPNIK_DECL font_face : util::noncopyable bool init_color_font(); FT_Face face_; - const bool color_font_; + bool const color_font_; }; using face_ptr = std::shared_ptr; diff --git a/include/mapnik/text/font_feature_settings.hpp b/include/mapnik/text/font_feature_settings.hpp index 22d40cd67..b9fea00dc 100644 --- a/include/mapnik/text/font_feature_settings.hpp +++ b/include/mapnik/text/font_feature_settings.hpp @@ -62,7 +62,7 @@ class MAPNIK_DECL font_feature_settings void append(std::string const& feature); void append(font_feature const& feature) { features_.push_back(feature); } - const font_feature* get_features() const { return features_.data(); } + font_feature const* get_features() const { return features_.data(); } feature_vector::size_type count() const { return features_.size(); } feature_vector const& features() const { return features_; } @@ -84,7 +84,7 @@ inline bool operator==(font_feature_settings const& lhs, font_feature_settings c } constexpr unsigned int font_feature_range_global_start = 0u; -static const unsigned int font_feature_range_global_end = std::numeric_limits::max(); +static unsigned int const font_feature_range_global_end = std::numeric_limits::max(); #include MAPNIK_DISABLE_WARNING_PUSH diff --git a/include/mapnik/text/harfbuzz_shaper.hpp b/include/mapnik/text/harfbuzz_shaper.hpp index 1243e9b74..321450970 100644 --- a/include/mapnik/text/harfbuzz_shaper.hpp +++ b/include/mapnik/text/harfbuzz_shaper.hpp @@ -55,12 +55,12 @@ static inline hb_script_t _icu_script_to_script(UScriptCode script) return hb_script_from_string(uscript_getShortName(script), -1); } -static inline const uint16_t* uchar_to_utf16(const UChar* src) +static inline uint16_t const* uchar_to_utf16(UChar const* src) { static_assert(sizeof(UChar) == sizeof(uint16_t), "UChar is eq size to uint16_t"); #if defined(_MSC_VER) || (U_ICU_VERSION_MAJOR_NUM >= 59) // ^^ http://site.icu-project.org/download/59#TOC-ICU4C-char16_t1 - return reinterpret_cast(src); + return reinterpret_cast(src); #else return src; #endif @@ -241,7 +241,7 @@ struct harfbuzz_shaper auto hb_buffer_deleter = [](hb_buffer_t* buffer) { hb_buffer_destroy(buffer); }; - const std::unique_ptr buffer(hb_buffer_create(), hb_buffer_deleter); + std::unique_ptr const buffer(hb_buffer_create(), hb_buffer_deleter); hb_buffer_pre_allocate(buffer.get(), safe_cast(length)); mapnik::value_unicode_string const& text = itemizer.text(); for (auto const& text_item : list) diff --git a/include/mapnik/text/placement_finder.hpp b/include/mapnik/text/placement_finder.hpp index 43c6eb358..0e5526a3d 100644 --- a/include/mapnik/text/placement_finder.hpp +++ b/include/mapnik/text/placement_finder.hpp @@ -70,7 +70,7 @@ class placement_finder : util::noncopyable // Adjusts user defined spacing to place an integer number of labels. double get_spacing(double path_length, double layout_width) const; // Checks for collision. - bool collision(box2d const& box, const value_unicode_string& repeat_key, bool line_placement) const; + bool collision(box2d const& box, value_unicode_string const& repeat_key, bool line_placement) const; // Adds marker to glyph_positions and to collision detector. Returns false if there is a collision. bool add_marker(glyph_positions_ptr& glyphs, pixel_position const& pos, std::vector>& bboxes) const; // Maps upright==auto, left-only and right-only to left,right to simplify processing. diff --git a/include/mapnik/text/properties_util.hpp b/include/mapnik/text/properties_util.hpp index 0c929eba6..ef8dc6ffa 100644 --- a/include/mapnik/text/properties_util.hpp +++ b/include/mapnik/text/properties_util.hpp @@ -60,13 +60,13 @@ struct set_property_from_xml_impl { try { - const auto val_ = node.get_opt_attr(name); + auto const val_ = node.get_opt_attr(name); if (val_) val = *val_; } catch (config_error const& ex) { - const auto val_ = node.get_opt_attr(name); + auto const val_ = node.get_opt_attr(name); if (val_) val = *val_; else @@ -86,14 +86,14 @@ struct set_property_from_xml_impl { try { - const auto val_ = node.get_opt_attr(name); + auto const val_ = node.get_opt_attr(name); if (!val_) throw config_error("Failed to extract property"); val = *val_; } catch (config_error const& ex) { - const auto val_ = node.get_opt_attr(name); + auto const val_ = node.get_opt_attr(name); if (val_) { val = *val_; @@ -115,7 +115,7 @@ struct set_property_from_xml_impl { try { - const auto enum_str = node.get_opt_attr(name); + auto const enum_str = node.get_opt_attr(name); if (enum_str) { target_enum_type e; @@ -125,7 +125,7 @@ struct set_property_from_xml_impl } catch (...) { - const auto expr = node.get_opt_attr(name); + auto const expr = node.get_opt_attr(name); if (expr) val = *expr; else diff --git a/include/mapnik/text/scrptrun.hpp b/include/mapnik/text/scrptrun.hpp index 651affe85..4c7635d00 100644 --- a/include/mapnik/text/scrptrun.hpp +++ b/include/mapnik/text/scrptrun.hpp @@ -49,15 +49,15 @@ class MAPNIK_DECL ScriptRun : public icu::UObject public: ScriptRun(); - ScriptRun(const UChar chars[], int32_t length); + ScriptRun(UChar const chars[], int32_t length); - ScriptRun(const UChar chars[], int32_t start, int32_t length); + ScriptRun(UChar const chars[], int32_t start, int32_t length); void reset(); void reset(int32_t start, int32_t count); - void reset(const UChar chars[], int32_t start, int32_t length); + void reset(UChar const chars[], int32_t start, int32_t length); int32_t getScriptStart(); @@ -87,7 +87,7 @@ class MAPNIK_DECL ScriptRun : public icu::UObject int32_t charStart; int32_t charLimit; - const UChar* charArray; + UChar const* charArray; int32_t scriptStart; int32_t scriptEnd; @@ -100,17 +100,17 @@ class MAPNIK_DECL ScriptRun : public icu::UObject static int32_t getPairIndex(UChar32 ch); static UChar32 pairedChars[]; - static const int32_t pairedCharCount; - static const int32_t pairedCharPower; - static const int32_t pairedCharExtra; + static int32_t const pairedCharCount; + static int32_t const pairedCharPower; + static int32_t const pairedCharExtra; /** * The address of this static class variable serves as this class's ID * for ICU "poor man's RTTI". */ - static const char fgClassID; + static char const fgClassID; // initial stack size - const unsigned int STACK_SIZE = 1 << 4; // 2^n + unsigned int const STACK_SIZE = 1 << 4; // 2^n }; inline ScriptRun::ScriptRun() @@ -119,13 +119,13 @@ inline ScriptRun::ScriptRun() reset(nullptr, 0, 0); } -inline ScriptRun::ScriptRun(const UChar chars[], int32_t length) +inline ScriptRun::ScriptRun(UChar const chars[], int32_t length) { parenStack.reserve(STACK_SIZE); reset(chars, 0, length); } -inline ScriptRun::ScriptRun(const UChar chars[], int32_t start, int32_t length) +inline ScriptRun::ScriptRun(UChar const chars[], int32_t start, int32_t length) { parenStack.reserve(STACK_SIZE); reset(chars, start, length); @@ -162,7 +162,7 @@ inline void ScriptRun::reset(int32_t start, int32_t length) reset(); } -inline void ScriptRun::reset(const UChar chars[], int32_t start, int32_t length) +inline void ScriptRun::reset(UChar const chars[], int32_t start, int32_t length) { charArray = chars; diff --git a/include/mapnik/tiff_io.hpp b/include/mapnik/tiff_io.hpp index 38b90bd0f..eb0d1ab9b 100644 --- a/include/mapnik/tiff_io.hpp +++ b/include/mapnik/tiff_io.hpp @@ -56,7 +56,7 @@ static inline tsize_t tiff_write_proc(thandle_t fd, tdata_t buf, tsize_t size) std::streamsize request_size = size; if (static_cast(request_size) != size) return static_cast(-1); - out->write(reinterpret_cast(buf), size); + out->write(reinterpret_cast(buf), size); if (static_cast(pos) == -1) { @@ -376,8 +376,8 @@ void save_as_tiff(T1& file, T2 const& image, tiff_config const& config) { using pixel_type = typename T2::pixel_type; - const int width = image.width(); - const int height = image.height(); + int const width = image.width(); + int const height = image.height(); TIFF* output = RealTIFFOpen("mapnik_tiff_stream", "wm", diff --git a/include/mapnik/unicode.hpp b/include/mapnik/unicode.hpp index 890f8abe3..cafb81dbb 100644 --- a/include/mapnik/unicode.hpp +++ b/include/mapnik/unicode.hpp @@ -48,7 +48,7 @@ class MAPNIK_DECL transcoder : private util::noncopyable { public: explicit transcoder(std::string const& encoding); - mapnik::value_unicode_string transcode(const char* data, std::int32_t length = -1) const; + mapnik::value_unicode_string transcode(char const* data, std::int32_t length = -1) const; ~transcoder(); private: diff --git a/include/mapnik/util/conversions.hpp b/include/mapnik/util/conversions.hpp index d2e1667db..95ca3d1be 100644 --- a/include/mapnik/util/conversions.hpp +++ b/include/mapnik/util/conversions.hpp @@ -41,21 +41,21 @@ by many other headers inside mapnik. */ MAPNIK_DECL bool string2bool(std::string const& value, bool& result); -MAPNIK_DECL bool string2bool(const char* iter, const char* end, bool& result); +MAPNIK_DECL bool string2bool(char const* iter, char const* end, bool& result); MAPNIK_DECL bool string2int(std::string const& value, int& result); -MAPNIK_DECL bool string2int(const char* iter, const char* end, int& result); +MAPNIK_DECL bool string2int(char const* iter, char const* end, int& result); #ifdef BIGINT MAPNIK_DECL bool string2int(std::string const& value, mapnik::value_integer& result); -MAPNIK_DECL bool string2int(const char* iter, const char* end, mapnik::value_integer& result); +MAPNIK_DECL bool string2int(char const* iter, char const* end, mapnik::value_integer& result); #endif MAPNIK_DECL bool string2double(std::string const& value, double& result); -MAPNIK_DECL bool string2double(const char* iter, const char* end, double& result); +MAPNIK_DECL bool string2double(char const* iter, char const* end, double& result); MAPNIK_DECL bool string2float(std::string const& value, float& result); -MAPNIK_DECL bool string2float(const char* iter, const char* end, float& result); +MAPNIK_DECL bool string2float(char const* iter, char const* end, float& result); MAPNIK_DECL bool to_string(std::string& str, int value); #ifdef BIGINT diff --git a/include/mapnik/util/geometry_to_svg.hpp b/include/mapnik/util/geometry_to_svg.hpp index 66fc16442..8d00277a3 100644 --- a/include/mapnik/util/geometry_to_svg.hpp +++ b/include/mapnik/util/geometry_to_svg.hpp @@ -40,7 +40,7 @@ inline bool to_svg(std::string& svg, mapnik::geometry_type const& geom) using sink_type = std::back_insert_iterator; sink_type sink(svg); mapnik::vertex_adapter va(geom); - static const svg::svg_path_generator generator; + static svg::svg_path_generator const generator; bool result = karma::generate(sink, generator, geom); return result; } diff --git a/include/mapnik/util/geometry_to_wkb.hpp b/include/mapnik/util/geometry_to_wkb.hpp index 1b246b9b4..364b5fb37 100644 --- a/include/mapnik/util/geometry_to_wkb.hpp +++ b/include/mapnik/util/geometry_to_wkb.hpp @@ -41,7 +41,7 @@ namespace mapnik { namespace util { namespace detail { -std::string to_hex(const char* blob, std::size_t size) +std::string to_hex(char const* blob, std::size_t size) { std::string buf; buf.reserve(size * 2); diff --git a/include/mapnik/util/mapped_memory_file.hpp b/include/mapnik/util/mapped_memory_file.hpp index a070f4d0c..6a4197866 100644 --- a/include/mapnik/util/mapped_memory_file.hpp +++ b/include/mapnik/util/mapped_memory_file.hpp @@ -68,7 +68,7 @@ class MAPNIK_DECL mapped_memory_file : public noncopyable static void deleteFile(std::string const& file_name); protected: - const std::string file_name_; + std::string const file_name_; #ifdef MAPNIK_MEMORY_MAPPED_FILE mapnik::mapped_region_ptr mapped_region_; #endif diff --git a/include/mapnik/util/name_to_int.hpp b/include/mapnik/util/name_to_int.hpp index dd7884bde..e782b8e96 100644 --- a/include/mapnik/util/name_to_int.hpp +++ b/include/mapnik/util/name_to_int.hpp @@ -23,7 +23,7 @@ namespace mapnik { namespace util { -constexpr unsigned name_to_int(const char* str, unsigned off = 0) +constexpr unsigned name_to_int(char const* str, unsigned off = 0) { return !str[off] ? 5381 : (name_to_int(str, off + 1) * 33) ^ static_cast(str[off]); } diff --git a/include/mapnik/util/path_iterator.hpp b/include/mapnik/util/path_iterator.hpp index 8c150b6dc..29975ae28 100644 --- a/include/mapnik/util/path_iterator.hpp +++ b/include/mapnik/util/path_iterator.hpp @@ -70,7 +70,7 @@ class path_iterator : public boost::iterator_facade, value_type const& dereference() const { return v_; } value_type v_; - const path_type* vertices_; + path_type const* vertices_; }; // specialization for mapnik::path_type - vertex interface has been removed @@ -110,7 +110,7 @@ class path_iterator : public boost::iterator_facade~T(); } + static void destroy(T volatile* obj) { obj->~T(); } }; #ifdef __GNUC__ @@ -82,8 +82,8 @@ class singleton friend class CreatePolicy; static std::atomic pInstance_; static std::atomic destroyed_; - singleton(const singleton& rhs); - singleton& operator=(const singleton&); + singleton(singleton const& rhs); + singleton& operator=(singleton const&); static void onDeadReference() { throw std::runtime_error("dead reference!"); } diff --git a/include/mapnik/value/error.hpp b/include/mapnik/value/error.hpp index c14c5482d..a91feff92 100644 --- a/include/mapnik/value/error.hpp +++ b/include/mapnik/value/error.hpp @@ -43,7 +43,7 @@ class value_error : public std::exception virtual ~value_error() {} - virtual const char* what() const noexcept { return what_.c_str(); } + virtual char const* what() const noexcept { return what_.c_str(); } void append_context(std::string const& ctx) const { what_ += " " + ctx; } diff --git a/include/mapnik/vertex_adapters.hpp b/include/mapnik/vertex_adapters.hpp index 3d79e4a85..1dde5601f 100644 --- a/include/mapnik/vertex_adapters.hpp +++ b/include/mapnik/vertex_adapters.hpp @@ -52,7 +52,7 @@ struct line_string_vertex_adapter geometry_types type() const; line_string const& line_; mutable std::size_t current_index_; - const std::size_t end_index_; + std::size_t const end_index_; }; template diff --git a/include/mapnik/vertex_converters.hpp b/include/mapnik/vertex_converters.hpp index 4ff9d1814..d2e7af005 100644 --- a/include/mapnik/vertex_converters.hpp +++ b/include/mapnik/vertex_converters.hpp @@ -155,7 +155,7 @@ struct converter_traits template void set_join_caps(Symbolizer const& sym, PathType& stroke, Feature const& feature, attributes const& vars) { - const line_join_enum join = get(sym, feature, vars); + line_join_enum const join = get(sym, feature, vars); switch (join) { case line_join_enum::MITER_JOIN: @@ -171,7 +171,7 @@ void set_join_caps(Symbolizer const& sym, PathType& stroke, Feature const& featu stroke.generator().line_join(agg::bevel_join); } - const line_cap_enum cap = get(sym, feature, vars); + line_cap_enum const cap = get(sym, feature, vars); switch (cap) { case line_cap_enum::BUTT_CAP: diff --git a/include/mapnik/vertex_vector.hpp b/include/mapnik/vertex_vector.hpp index 316166ac3..95b43ec4d 100644 --- a/include/mapnik/vertex_vector.hpp +++ b/include/mapnik/vertex_vector.hpp @@ -102,7 +102,7 @@ class vertex_vector : private util::noncopyable if (pos >= pos_) return SEG_END; size_type block = pos >> block_shift; - const coordinate_type* vertex = vertices_[block] + ((pos & block_mask) << 1); + coordinate_type const* vertex = vertices_[block] + ((pos & block_mask) << 1); *x = (*vertex++); *y = (*vertex); return commands_[block][pos & block_mask]; diff --git a/include/mapnik/view_transform.hpp b/include/mapnik/view_transform.hpp index 58fe460ef..5bb698efe 100644 --- a/include/mapnik/view_transform.hpp +++ b/include/mapnik/view_transform.hpp @@ -33,13 +33,13 @@ namespace mapnik { class view_transform { private: - const int width_; - const int height_; - const box2d extent_; - const double sx_; - const double sy_; - const double offset_x_; - const double offset_y_; + int const width_; + int const height_; + box2d const extent_; + double const sx_; + double const sy_; + double const offset_x_; + double const offset_y_; int offset_; public: diff --git a/include/mapnik/webp_io.hpp b/include/mapnik/webp_io.hpp index 8c1338de2..89f498438 100644 --- a/include/mapnik/webp_io.hpp +++ b/include/mapnik/webp_io.hpp @@ -44,10 +44,10 @@ MAPNIK_DISABLE_WARNING_POP namespace mapnik { template -int webp_stream_write(const uint8_t* data, size_t data_size, const WebPPicture* picture) +int webp_stream_write(uint8_t const* data, size_t data_size, WebPPicture const* picture) { T* out = static_cast(picture->custom_ptr); - out->write(reinterpret_cast(data), data_size); + out->write(reinterpret_cast(data), data_size); return true; } @@ -143,19 +143,19 @@ void save_as_webp(T1& file, T2 const& image, WebPConfig const& config, bool alph if (WebPPictureAlloc(&pic)) { ok = 1; - const int width = pic.width; - const int height = pic.height; + int const width = pic.width; + int const height = pic.height; for (int y = 0; y < height; ++y) { typename T2::pixel_type const* row = image.get_row(y); for (int x = 0; x < width; ++x) { - const unsigned rgba = row[x]; + unsigned const rgba = row[x]; unsigned a = (rgba >> 24) & 0xff; unsigned r = rgba & 0xff; unsigned g = (rgba >> 8) & 0xff; unsigned b = (rgba >> 16) & 0xff; - const uint32_t argb = (a << 24) | (r << 16) | (g << 8) | (b); + uint32_t const argb = (a << 24) | (r << 16) | (g << 8) | (b); pic.argb[x + y * pic.argb_stride] = argb; } } diff --git a/include/mapnik/well_known_srs.hpp b/include/mapnik/well_known_srs.hpp index 4f84c55da..d60062ca7 100644 --- a/include/mapnik/well_known_srs.hpp +++ b/include/mapnik/well_known_srs.hpp @@ -43,8 +43,8 @@ constexpr double MERC_MAX_EXTENT = EARTH_RADIUS * util::pi; constexpr double MERC_MAX_LATITUDE = 85.0511287798065923778; // MERC_MAX_LATITUDE = degrees(2 * atan(exp(pi)) - pi / 2) -extern MAPNIK_DECL std::string const MAPNIK_GEOGRAPHIC_PROJ; -extern MAPNIK_DECL std::string const MAPNIK_WEBMERCATOR_PROJ; +extern MAPNIK_DECL const std::string MAPNIK_GEOGRAPHIC_PROJ; +extern MAPNIK_DECL const std::string MAPNIK_WEBMERCATOR_PROJ; MAPNIK_DECL std::optional is_known_geographic(std::string const& srs); MAPNIK_DECL std::optional is_well_known_srs(std::string const& srs); diff --git a/include/mapnik/wkt/wkt_grammar_x3_def.hpp b/include/mapnik/wkt/wkt_grammar_x3_def.hpp index 6d396a3c8..6f28db8ba 100644 --- a/include/mapnik/wkt/wkt_grammar_x3_def.hpp +++ b/include/mapnik/wkt/wkt_grammar_x3_def.hpp @@ -52,11 +52,11 @@ using x3::lit; using x3::no_case; // functors -const auto make_empty = [](auto const& ctx) { +auto const make_empty = [](auto const& ctx) { _val(ctx) = geometry::geometry_empty(); }; -const auto add_ring = [](auto const& ctx) { +auto const add_ring = [](auto const& ctx) { auto& ring = reinterpret_cast&>(_attr(ctx)); _val(ctx).push_back(std::move(ring)); }; diff --git a/include/mapnik/xml_attribute_cast.hpp b/include/mapnik/xml_attribute_cast.hpp index b9981dc20..2c873338b 100644 --- a/include/mapnik/xml_attribute_cast.hpp +++ b/include/mapnik/xml_attribute_cast.hpp @@ -159,7 +159,7 @@ struct do_xml_attribute_cast // specialization for mapnik::enumeration<...> template (*F_LOOKUP)()> struct do_xml_attribute_cast> { diff --git a/include/mapnik/xml_node.hpp b/include/mapnik/xml_node.hpp index aa735a37b..159966760 100644 --- a/include/mapnik/xml_node.hpp +++ b/include/mapnik/xml_node.hpp @@ -39,7 +39,7 @@ class MAPNIK_DECL xml_tree; class MAPNIK_DECL xml_attribute { public: - xml_attribute(const char* value_); + xml_attribute(char const* value_); std::string value; mutable bool processed; }; @@ -48,7 +48,7 @@ class MAPNIK_DECL node_not_found : public std::exception { public: node_not_found(std::string const& node_name); - virtual const char* what() const noexcept; + virtual char const* what() const noexcept; ~node_not_found(); private: @@ -62,7 +62,7 @@ class MAPNIK_DECL attribute_not_found : public std::exception { public: attribute_not_found(std::string const& node_name, std::string const& attribute_name); - virtual const char* what() const noexcept; + virtual char const* what() const noexcept; ~attribute_not_found(); private: @@ -77,7 +77,7 @@ class MAPNIK_DECL more_than_one_child : public std::exception { public: more_than_one_child(std::string const& node_name); - virtual const char* what() const noexcept; + virtual char const* what() const noexcept; ~more_than_one_child(); private: @@ -100,8 +100,8 @@ class MAPNIK_DECL xml_node bool is_text() const; bool is(std::string const& name) const; - xml_node& add_child(const char* name, unsigned line = 0, bool is_text = false); - void add_attribute(const char* name, const char* value); + xml_node& add_child(char const* name, unsigned line = 0, bool is_text = false); + void add_attribute(char const* name, char const* value); attribute_map const& get_attributes() const; bool ignore() const; diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 1cfab32a1..ce3dcd45a 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -96,23 +96,23 @@ csv_datasource::csv_datasource(parameters const& params) separator_ = val.front(); } - const auto ext = params.get("extent"); + auto const ext = params.get("extent"); if (ext && !ext->empty()) { extent_initialized_ = extent_.from_string(*ext); } - const auto inline_string = params.get("inline"); + auto const inline_string = params.get("inline"); if (inline_string) { inline_string_ = *inline_string; } else { - const auto file = params.get("file"); + auto const file = params.get("file"); if (!file) throw mapnik::datasource_exception("CSV Plugin: missing parameter"); - const auto base = params.get("base"); + auto const base = params.get("base"); if (base) filename_ = *base + "/" + *file; else @@ -234,7 +234,7 @@ void csv_datasource::add_feature(mapnik::value_integer index, mapnik::csv_line c } } -const char* csv_datasource::name() +char const* csv_datasource::name() { return "csv"; } diff --git a/plugins/input/csv/csv_datasource.hpp b/plugins/input/csv/csv_datasource.hpp index 437bf5d11..8a42a2174 100644 --- a/plugins/input/csv/csv_datasource.hpp +++ b/plugins/input/csv/csv_datasource.hpp @@ -91,7 +91,7 @@ class csv_datasource : public mapnik::datasource, csv_datasource(mapnik::parameters const& params); virtual ~csv_datasource(); mapnik::datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); mapnik::featureset_ptr features(mapnik::query const& q) const override; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override; mapnik::box2d envelope() const override; diff --git a/plugins/input/csv/csv_featureset.cpp b/plugins/input/csv/csv_featureset.cpp index cfc9f52ea..d3bbc5dc0 100644 --- a/plugins/input/csv/csv_featureset.cpp +++ b/plugins/input/csv/csv_featureset.cpp @@ -57,7 +57,7 @@ csv_featureset::csv_featureset(std::string const& filename, tr_("utf8") { #if defined(MAPNIK_MEMORY_MAPPED_FILE) - const auto memory = mapnik::mapped_memory_cache::instance().find(filename, true); + auto const memory = mapnik::mapped_memory_cache::instance().find(filename, true); if (memory.has_value()) { mapped_region_ = *memory; diff --git a/plugins/input/csv/csv_featureset.hpp b/plugins/input/csv/csv_featureset.hpp index f3c0343f7..68fa46778 100644 --- a/plugins/input/csv/csv_featureset.hpp +++ b/plugins/input/csv/csv_featureset.hpp @@ -67,7 +67,7 @@ class csv_featureset : public mapnik::Featureset char separator_; char quote_; std::vector const& headers_; - const array_type index_array_; + array_type const index_array_; array_type::const_iterator index_itr_; array_type::const_iterator index_end_; mapnik::context_ptr ctx_; diff --git a/plugins/input/csv/csv_index_featureset.cpp b/plugins/input/csv/csv_index_featureset.cpp index e6e4d5fd8..9122191de 100644 --- a/plugins/input/csv/csv_index_featureset.cpp +++ b/plugins/input/csv/csv_index_featureset.cpp @@ -59,7 +59,7 @@ csv_index_featureset::csv_index_featureset(std::string const& filename, { #if defined(MAPNIK_MEMORY_MAPPED_FILE) - const auto memory = mapnik::mapped_memory_cache::instance().find(filename, true); + auto const memory = mapnik::mapped_memory_cache::instance().find(filename, true); if (memory.has_value()) { mapped_region_ = *memory; diff --git a/plugins/input/csv/csv_inline_featureset.hpp b/plugins/input/csv/csv_inline_featureset.hpp index b40ba8f87..ec04ece0a 100644 --- a/plugins/input/csv/csv_inline_featureset.hpp +++ b/plugins/input/csv/csv_inline_featureset.hpp @@ -51,7 +51,7 @@ class csv_inline_featureset : public mapnik::Featureset char separator_; char quote_; std::vector headers_; - const array_type index_array_; + array_type const index_array_; array_type::const_iterator index_itr_; array_type::const_iterator index_end_; mapnik::context_ptr ctx_; diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index a23c9fd96..62b299ff4 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -118,7 +118,7 @@ gdal_datasource::gdal_datasource(parameters const& params) double tr[6]; bool bbox_override = false; - const auto bbox_s = params.get("extent"); + auto const bbox_s = params.get("extent"); if (bbox_s.has_value()) { MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s; @@ -200,7 +200,7 @@ datasource::datasource_t gdal_datasource::type() const return datasource::Raster; } -const char* gdal_datasource::name() +char const* gdal_datasource::name() { return "gdal"; } diff --git a/plugins/input/gdal/gdal_datasource.hpp b/plugins/input/gdal/gdal_datasource.hpp index b4ad60b2e..64527b13b 100644 --- a/plugins/input/gdal/gdal_datasource.hpp +++ b/plugins/input/gdal/gdal_datasource.hpp @@ -50,7 +50,7 @@ class gdal_datasource : public mapnik::datasource gdal_datasource(mapnik::parameters const& params); virtual ~gdal_datasource(); mapnik::datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); mapnik::featureset_ptr features(mapnik::query const& q) const override; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override; mapnik::box2d envelope() const override; diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index 05e1bd0b3..3c35b5d97 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -233,11 +233,11 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) // loop through overviews -- snap up in resolution to closest overview // if necessary we find an image size that most resembles // the resolution of our output image. - const double width_res = std::get<0>(q.resolution()); - const double height_res = std::get<1>(q.resolution()); - const int ideal_raster_width = + double const width_res = std::get<0>(q.resolution()); + double const height_res = std::get<1>(q.resolution()); + int const ideal_raster_width = static_cast(std::floor(raster_extent_.width() * width_res * filter_factor) + .5); - const int ideal_raster_height = + int const ideal_raster_height = static_cast(std::floor(raster_extent_.height() * height_res * filter_factor) + .5); if (band_ > 0 && band_ < nbands_) @@ -521,7 +521,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) for (int j = 0; j < count; j++) { - const GDALColorEntry* ce = color_table->GetColorEntry(j); + GDALColorEntry const* ce = color_table->GetColorEntry(j); if (!ce) continue; MAPNIK_LOG_DEBUG(gdal) @@ -794,7 +794,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) for (unsigned x = 0; x < image.width(); ++x) { unsigned value = row[x] & 0xff; - const GDALColorEntry* ce = color_table->GetColorEntry(value); + GDALColorEntry const* ce = color_table->GetColorEntry(value); if (ce) { row[x] = (ce->c4 << 24) | (ce->c3 << 16) | (ce->c2 << 8) | (ce->c1); diff --git a/plugins/input/geobuf/geobuf.hpp b/plugins/input/geobuf/geobuf.hpp index c4638cd2d..b091859b6 100644 --- a/plugins/input/geobuf/geobuf.hpp +++ b/plugins/input/geobuf/geobuf.hpp @@ -90,7 +90,7 @@ struct geobuf : util::noncopyable protozero::pbf_reader reader_; FeatureCallback& callback_; context_ptr ctx_; - const std::unique_ptr tr_; + std::unique_ptr const tr_; public: // ctor diff --git a/plugins/input/geobuf/geobuf_datasource.cpp b/plugins/input/geobuf/geobuf_datasource.cpp index bf9d53a0e..f04010b19 100644 --- a/plugins/input/geobuf/geobuf_datasource.cpp +++ b/plugins/input/geobuf/geobuf_datasource.cpp @@ -79,11 +79,11 @@ geobuf_datasource::geobuf_datasource(parameters const& params) features_(), tree_(nullptr) { - const auto file = params.get("file"); + auto const file = params.get("file"); if (!file.has_value()) throw mapnik::datasource_exception("Geobuf Plugin: missing parameter"); - const auto base = params.get("base"); + auto const base = params.get("base"); if (base.has_value()) filename_ = *base + "/" + *file; else @@ -154,7 +154,7 @@ void geobuf_datasource::parse_geobuf(char const* data, std::size_t size) geobuf_datasource::~geobuf_datasource() {} -const char* geobuf_datasource::name() +char const* geobuf_datasource::name() { return "geobuf"; } diff --git a/plugins/input/geobuf/geobuf_datasource.hpp b/plugins/input/geobuf/geobuf_datasource.hpp index acb7ebecb..7bf012770 100644 --- a/plugins/input/geobuf/geobuf_datasource.hpp +++ b/plugins/input/geobuf/geobuf_datasource.hpp @@ -95,7 +95,7 @@ class geobuf_datasource : public mapnik::datasource geobuf_datasource(mapnik::parameters const& params); virtual ~geobuf_datasource(); mapnik::datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); mapnik::featureset_ptr features(mapnik::query const& q) const override; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override; mapnik::box2d envelope() const override; diff --git a/plugins/input/geobuf/geobuf_featureset.hpp b/plugins/input/geobuf/geobuf_featureset.hpp index 6ef475dcb..4f826a706 100644 --- a/plugins/input/geobuf/geobuf_featureset.hpp +++ b/plugins/input/geobuf/geobuf_featureset.hpp @@ -40,7 +40,7 @@ class geobuf_featureset : public mapnik::Featureset private: std::vector const& features_; - const array_type index_array_; + array_type const index_array_; array_type::const_iterator index_itr_; array_type::const_iterator index_end_; mapnik::context_ptr ctx_; diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index e20e8bd36..ba764dfbd 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -101,14 +101,14 @@ geojson_datasource::geojson_datasource(parameters const& params) num_features_to_query_( std::max(mapnik::value_integer(1), *params.get("num_features_to_query", 5))) { - const auto inline_string = params.get("inline"); + auto const inline_string = params.get("inline"); if (!inline_string) { - const auto file = params.get("file"); + auto const file = params.get("file"); if (!file) throw mapnik::datasource_exception("GeoJSON Plugin: missing parameter"); - const auto base = params.get("base"); + auto const base = params.get("base"); if (base) filename_ = *base + "/" + *file; else @@ -143,7 +143,7 @@ geojson_datasource::geojson_datasource(parameters const& params) char const* start = file_buffer.c_str(); char const* end = (count == 1) ? start + file_buffer.length() : start; #else - const auto mapped_region = mapnik::mapped_memory_cache::instance().find(filename_, false); + auto const mapped_region = mapnik::mapped_memory_cache::instance().find(filename_, false); if (!mapped_region.has_value()) { throw std::runtime_error("could not get file mapping for " + filename_); @@ -168,7 +168,7 @@ namespace { using box_type = box2d; using boxes_type = std::vector>>; using base_iterator_type = char const*; -const mapnik::transcoder geojson_datasource_static_tr("utf8"); +mapnik::transcoder const geojson_datasource_static_tr("utf8"); } // namespace @@ -419,7 +419,7 @@ void geojson_datasource::parse_geojson(Iterator start, Iterator end) geojson_datasource::~geojson_datasource() {} -const char* geojson_datasource::name() +char const* geojson_datasource::name() { return "geojson"; } diff --git a/plugins/input/geojson/geojson_datasource.hpp b/plugins/input/geojson/geojson_datasource.hpp index 25b734e2d..54a3e02a4 100644 --- a/plugins/input/geojson/geojson_datasource.hpp +++ b/plugins/input/geojson/geojson_datasource.hpp @@ -95,7 +95,7 @@ class geojson_datasource : public mapnik::datasource geojson_datasource(mapnik::parameters const& params); virtual ~geojson_datasource(); mapnik::datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); mapnik::featureset_ptr features(mapnik::query const& q) const override; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override; mapnik::box2d envelope() const override; @@ -118,7 +118,7 @@ class geojson_datasource : public mapnik::datasource std::unique_ptr tree_; bool cache_features_ = true; bool has_disk_index_ = false; - const std::size_t num_features_to_query_; + std::size_t const num_features_to_query_; }; #endif // GEOJSON_DATASOURCE_HPP diff --git a/plugins/input/geojson/geojson_featureset.hpp b/plugins/input/geojson/geojson_featureset.hpp index 4904ae364..3d4cbdef2 100644 --- a/plugins/input/geojson/geojson_featureset.hpp +++ b/plugins/input/geojson/geojson_featureset.hpp @@ -39,7 +39,7 @@ class geojson_featureset : public mapnik::Featureset private: std::vector const& features_; - const array_type index_array_; + array_type const index_array_; array_type::const_iterator index_itr_; array_type::const_iterator index_end_; }; diff --git a/plugins/input/geojson/geojson_index_featureset.cpp b/plugins/input/geojson/geojson_index_featureset.cpp index 3e6a7c465..8bab30b1a 100644 --- a/plugins/input/geojson/geojson_index_featureset.cpp +++ b/plugins/input/geojson/geojson_index_featureset.cpp @@ -48,7 +48,7 @@ geojson_index_featureset::geojson_index_featureset(std::string const& filename, ctx_(std::make_shared()) { #if defined(MAPNIK_MEMORY_MAPPED_FILE) - const auto memory = mapnik::mapped_memory_cache::instance().find(filename, true); + auto const memory = mapnik::mapped_memory_cache::instance().find(filename, true); if (memory.has_value()) { mapped_region_ = *memory; @@ -97,7 +97,7 @@ mapnik::feature_ptr geojson_index_featureset::next() auto const* start = record.data(); auto const* end = (count == 1) ? start + record.size() : start; #endif - static const mapnik::transcoder tr("utf8"); + static mapnik::transcoder const tr("utf8"); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_, feature_id_++)); using mapnik::json::grammar::iterator_type; mapnik::json::parse_feature(start, end, *feature, tr); // throw on failure diff --git a/plugins/input/geojson/geojson_memory_index_featureset.cpp b/plugins/input/geojson/geojson_memory_index_featureset.cpp index 1eef01f86..4327ff0c7 100644 --- a/plugins/input/geojson/geojson_memory_index_featureset.cpp +++ b/plugins/input/geojson/geojson_memory_index_featureset.cpp @@ -65,7 +65,7 @@ mapnik::feature_ptr geojson_memory_index_featureset::next() using chr_iterator_type = char const*; chr_iterator_type start = json.data(); chr_iterator_type end = (count == 1) ? start + json.size() : start; - static const mapnik::transcoder tr("utf8"); + static mapnik::transcoder const tr("utf8"); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_, feature_id_++)); mapnik::json::parse_feature(start, end, *feature, tr); // throw on failure // skip empty geometries diff --git a/plugins/input/geojson/geojson_memory_index_featureset.hpp b/plugins/input/geojson/geojson_memory_index_featureset.hpp index dd96f4809..f15a42567 100644 --- a/plugins/input/geojson/geojson_memory_index_featureset.hpp +++ b/plugins/input/geojson/geojson_memory_index_featureset.hpp @@ -42,7 +42,7 @@ class geojson_memory_index_featureset : public mapnik::Featureset private: file_ptr file_; mapnik::value_integer feature_id_ = 1; - const array_type index_array_; + array_type const index_array_; array_type::const_iterator index_itr_; array_type::const_iterator index_end_; mapnik::context_ptr ctx_; diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index 28465033c..b6163ffab 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -100,7 +100,7 @@ void ogr_datasource::init(mapnik::parameters const& params) mapnik::progress_timer __stats__(std::clog, "ogr_datasource::init"); #endif - const auto file = params.get("file"); + auto const file = params.get("file"); auto string = params.get("string"); if (!string) string = params.get("inline"); @@ -115,7 +115,7 @@ void ogr_datasource::init(mapnik::parameters const& params) } else { - const auto base = params.get("base"); + auto const base = params.get("base"); if (base) { dataset_name_ = *base + "/" + *file; @@ -134,7 +134,7 @@ void ogr_datasource::init(mapnik::parameters const& params) if (!driver.empty()) { unsigned int nOpenFlags = GDAL_OF_READONLY | GDAL_OF_VECTOR; - const char* papszAllowedDrivers[] = {driver.c_str(), nullptr}; + char const* papszAllowedDrivers[] = {driver.c_str(), nullptr}; dataset_ = reinterpret_cast( GDALOpenEx(dataset_name_.c_str(), nOpenFlags, papszAllowedDrivers, open_options, nullptr)); @@ -151,7 +151,7 @@ void ogr_datasource::init(mapnik::parameters const& params) if (!dataset_) { - const std::string err = CPLGetLastErrorMsg(); + std::string const err = CPLGetLastErrorMsg(); if (err.size() == 0) { throw datasource_exception("OGR Plugin: connection failed: " + dataset_name_ + @@ -164,9 +164,9 @@ void ogr_datasource::init(mapnik::parameters const& params) } // initialize layer - const auto layer_by_name = params.get("layer"); - const auto layer_by_index = params.get("layer_by_index"); - const auto layer_by_sql = params.get("layer_by_sql"); + auto const layer_by_name = params.get("layer"); + auto const layer_by_index = params.get("layer_by_index"); + auto const layer_by_sql = params.get("layer_by_sql"); int passed_parameters = 0; passed_parameters += layer_by_name.has_value() ? 1 : 0; @@ -267,7 +267,7 @@ void ogr_datasource::init(mapnik::parameters const& params) OGRLayer* layer = layer_.layer(); // initialize envelope - const auto ext = params.get("extent"); + auto const ext = params.get("extent"); if (ext.has_value() && !ext->empty()) { extent_.from_string(*ext); @@ -333,13 +333,13 @@ void ogr_datasource::init(mapnik::parameters const& params) OGRFeatureDefn* def = layer->GetLayerDefn(); if (def != 0) { - const int fld_count = def->GetFieldCount(); + int const fld_count = def->GetFieldCount(); for (int i = 0; i < fld_count; i++) { OGRFieldDefn* fld = def->GetFieldDefn(i); - const std::string fld_name = fld->GetNameRef(); - const OGRFieldType type_oid = fld->GetType(); + std::string const fld_name = fld->GetNameRef(); + OGRFieldType const type_oid = fld->GetType(); switch (type_oid) { case OFTInteger: @@ -387,7 +387,7 @@ void ogr_datasource::init(mapnik::parameters const& params) CPLFree(srs_output); } -const char* ogr_datasource::name() +char const* ogr_datasource::name() { return "ogr"; } diff --git a/plugins/input/ogr/ogr_datasource.hpp b/plugins/input/ogr/ogr_datasource.hpp index 049e357ae..e1713279c 100644 --- a/plugins/input/ogr/ogr_datasource.hpp +++ b/plugins/input/ogr/ogr_datasource.hpp @@ -51,7 +51,7 @@ class ogr_datasource : public mapnik::datasource ogr_datasource(mapnik::parameters const& params); virtual ~ogr_datasource(); mapnik::datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); mapnik::featureset_ptr features(mapnik::query const& q) const override; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override; mapnik::box2d envelope() const override; diff --git a/plugins/input/ogr/ogr_featureset.cpp b/plugins/input/ogr/ogr_featureset.cpp index 734623ba2..7dea22b13 100644 --- a/plugins/input/ogr/ogr_featureset.cpp +++ b/plugins/input/ogr/ogr_featureset.cpp @@ -112,8 +112,8 @@ feature_ptr ogr_featureset::next() for (int i = 0; i < fld_count; i++) { OGRFieldDefn* fld = layerdef_->GetFieldDefn(i); - const OGRFieldType type_oid = fld->GetType(); - const std::string fld_name = fld->GetNameRef(); + OGRFieldType const type_oid = fld->GetType(); + std::string const fld_name = fld->GetNameRef(); switch (type_oid) { diff --git a/plugins/input/ogr/ogr_featureset.hpp b/plugins/input/ogr/ogr_featureset.hpp index 6aeaea128..e833ed09d 100644 --- a/plugins/input/ogr/ogr_featureset.hpp +++ b/plugins/input/ogr/ogr_featureset.hpp @@ -52,8 +52,8 @@ class ogr_featureset : public mapnik::Featureset mapnik::context_ptr ctx_; OGRLayer& layer_; OGRFeatureDefn* layerdef_; - const std::unique_ptr tr_; - const char* fidcolumn_; + std::unique_ptr const tr_; + char const* fidcolumn_; mutable int count_; }; diff --git a/plugins/input/ogr/ogr_index.hpp b/plugins/input/ogr/ogr_index.hpp index a6d30bdfa..c0649c845 100644 --- a/plugins/input/ogr/ogr_index.hpp +++ b/plugins/input/ogr/ogr_index.hpp @@ -38,34 +38,34 @@ template class ogr_index { public: - static void query(const filterT& filter, IStream& file, std::vector& pos); + static void query(filterT const& filter, IStream& file, std::vector& pos); private: ogr_index(); ~ogr_index(); - ogr_index(const ogr_index&); - ogr_index& operator=(const ogr_index&); + ogr_index(ogr_index const&); + ogr_index& operator=(ogr_index const&); static int read_ndr_integer(IStream& in); static void read_envelope(IStream& in, box2d& envelope); - static void query_node(const filterT& filter, IStream& in, std::vector& pos); + static void query_node(filterT const& filter, IStream& in, std::vector& pos); }; template -void ogr_index::query(const filterT& filter, IStream& file, std::vector& pos) +void ogr_index::query(filterT const& filter, IStream& file, std::vector& pos) { file.seekg(16, std::ios::beg); query_node(filter, file, pos); } template -void ogr_index::query_node(const filterT& filter, IStream& file, std::vector& ids) +void ogr_index::query_node(filterT const& filter, IStream& file, std::vector& ids) { - const int offset = read_ndr_integer(file); + int const offset = read_ndr_integer(file); box2d node_ext; read_envelope(file, node_ext); - const int num_shapes = read_ndr_integer(file); + int const num_shapes = read_ndr_integer(file); if (!filter.pass(node_ext)) { @@ -75,11 +75,11 @@ void ogr_index::query_node(const filterT& filter, IStream& fil for (int i = 0; i < num_shapes; ++i) { - const int id = read_ndr_integer(file); + int const id = read_ndr_integer(file); ids.push_back(id); } - const int children = read_ndr_integer(file); + int const children = read_ndr_integer(file); for (int j = 0; j < children; ++j) { diff --git a/plugins/input/ogr/ogr_index_featureset.cpp b/plugins/input/ogr/ogr_index_featureset.cpp index eda8c19c1..e27f6819a 100644 --- a/plugins/input/ogr/ogr_index_featureset.cpp +++ b/plugins/input/ogr/ogr_index_featureset.cpp @@ -70,7 +70,7 @@ ogr_index_featureset::ogr_index_featureset(mapnik::context_ptr const& c feature_envelope_() { #if defined(MAPNIK_MEMORY_MAPPED_FILE) - const auto memory = mapnik::mapped_memory_cache::instance().find(index_file, true); + auto const memory = mapnik::mapped_memory_cache::instance().find(index_file, true); if (memory.has_value()) { boost::interprocess::ibufferstream file(static_cast((*memory)->get_address()), (*memory)->get_size()); diff --git a/plugins/input/ogr/ogr_index_featureset.hpp b/plugins/input/ogr/ogr_index_featureset.hpp index b176785d8..29df02405 100644 --- a/plugins/input/ogr/ogr_index_featureset.hpp +++ b/plugins/input/ogr/ogr_index_featureset.hpp @@ -49,8 +49,8 @@ class ogr_index_featureset : public mapnik::Featureset filterT filter_; std::vector ids_; std::vector::iterator itr_; - const std::unique_ptr tr_; - const char* fidcolumn_; + std::unique_ptr const tr_; + char const* fidcolumn_; OGREnvelope feature_envelope_; }; diff --git a/plugins/input/ogr/ogr_layer_ptr.hpp b/plugins/input/ogr/ogr_layer_ptr.hpp index 676235fd4..100313563 100644 --- a/plugins/input/ogr/ogr_layer_ptr.hpp +++ b/plugins/input/ogr/ogr_layer_ptr.hpp @@ -118,7 +118,7 @@ class ogr_layer_ptr // http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc OGRGeometry* spatial_filter = nullptr; - const char* sql_dialect = nullptr; + char const* sql_dialect = nullptr; OGRLayer* ogr_layer = datasource_->ExecuteSQL(layer_sql.c_str(), spatial_filter, sql_dialect); if (ogr_layer) @@ -152,7 +152,7 @@ class ogr_layer_ptr { if (!is_valid_) { - const std::string err = CPLGetLastErrorMsg(); + std::string const err = CPLGetLastErrorMsg(); if (err.size() == 0) { MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: Error getting layer"; diff --git a/plugins/input/ogr/ogr_utils.cpp b/plugins/input/ogr/ogr_utils.cpp index f2bffee3b..f71956d57 100644 --- a/plugins/input/ogr/ogr_utils.cpp +++ b/plugins/input/ogr/ogr_utils.cpp @@ -23,7 +23,7 @@ #include "ogr_utils.hpp" #include -std::vector ogr_utils::split_open_options(const std::string& options) +std::vector ogr_utils::split_open_options(std::string const& options) { size_t i; bool escaped = false; // if previous character was a backslash to escape a backslash or space diff --git a/plugins/input/ogr/ogr_utils.hpp b/plugins/input/ogr/ogr_utils.hpp index 5acaf8ea8..da91d8971 100644 --- a/plugins/input/ogr/ogr_utils.hpp +++ b/plugins/input/ogr/ogr_utils.hpp @@ -32,7 +32,7 @@ namespace ogr_utils { using option_ptr = std::unique_ptr>; -std::vector split_open_options(const std::string& options); +std::vector split_open_options(std::string const& options); char** open_options_for_ogr(std::vector& options); diff --git a/plugins/input/pgraster/pgraster_datasource.cpp b/plugins/input/pgraster/pgraster_datasource.cpp index b53141240..5934477af 100644 --- a/plugins/input/pgraster/pgraster_datasource.cpp +++ b/plugins/input/pgraster/pgraster_datasource.cpp @@ -56,9 +56,9 @@ DATASOURCE_PLUGIN_EXPORT(pgraster_datasource_plugin); DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(pgraster_datasource_plugin); DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(pgraster_datasource_plugin); -const std::string pgraster_datasource::RASTER_COLUMNS = "raster_columns"; -const std::string pgraster_datasource::RASTER_OVERVIEWS = "raster_overviews"; -const std::string pgraster_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; +std::string const pgraster_datasource::RASTER_COLUMNS = "raster_columns"; +std::string const pgraster_datasource::RASTER_OVERVIEWS = "raster_overviews"; +std::string const pgraster_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; using mapnik::attribute_descriptor; using mapnik::value_integer; @@ -102,7 +102,7 @@ pgraster_datasource::pgraster_datasource(parameters const& params) throw mapnik::datasource_exception("Pgraster Plugin: missing parameter"); } - const auto ext = params.get("extent"); + auto const ext = params.get("extent"); if (ext.has_value() && !ext->empty()) { extent_initialized_ = extent_.from_string(*ext); @@ -122,8 +122,8 @@ pgraster_datasource::pgraster_datasource(parameters const& params) asynchronous_request_ = true; } - const auto initial_size = params.get("initial_size", 1); - const auto autodetect_key_field = params.get("autodetect_key_field", false); + auto const initial_size = params.get("initial_size", 1); + auto const autodetect_key_field = params.get("autodetect_key_field", false); ConnectionManager::instance().registerPool(creator_, *initial_size, pool_max_size_); CnxPool_ptr pool = ConnectionManager::instance().getPool(creator_.id()); @@ -232,11 +232,11 @@ pgraster_datasource::pgraster_datasource(parameters const& params) } if (srid_ == 0) { - const char* srid_c = rs->getValue("srid"); + char const* srid_c = rs->getValue("srid"); if (srid_c != nullptr) { int result = 0; - const char* end = srid_c + std::strlen(srid_c); + char const* end = srid_c + std::strlen(srid_c); if (mapnik::util::string2int(srid_c, end, result)) { srid_ = result; @@ -273,11 +273,11 @@ pgraster_datasource::pgraster_datasource(parameters const& params) shared_ptr rs = conn->executeQuery(s.str()); if (rs->next()) { - const char* srid_c = rs->getValue("srid"); + char const* srid_c = rs->getValue("srid"); if (srid_c != nullptr) { int result = 0; - const char* end = srid_c + std::strlen(srid_c); + char const* end = srid_c + std::strlen(srid_c); if (mapnik::util::string2int(srid_c, end, result)) { srid_ = result; @@ -388,7 +388,7 @@ pgraster_datasource::pgraster_datasource(parameters const& params) bool is_int = (std::string(rs_key->getValue(3)) == "t"); if (is_int) { - const char* key_field_string = rs_key->getValue(0); + char const* key_field_string = rs_key->getValue(0); if (key_field_string) { key_field_ = std::string(key_field_string); @@ -573,7 +573,7 @@ pgraster_datasource::~pgraster_datasource() } } -const char* pgraster_datasource::name() +char const* pgraster_datasource::name() { return "pgraster"; } @@ -830,8 +830,8 @@ featureset_ptr pgraster_datasource::features_with_context(query const& q, proces throw mapnik::datasource_exception(s_error.str()); } - const double px_gw = 1.0 / std::get<0>(q.resolution()); - const double px_gh = 1.0 / std::get<1>(q.resolution()); + double const px_gw = 1.0 / std::get<0>(q.resolution()); + double const px_gh = 1.0 / std::get<1>(q.resolution()); MAPNIK_LOG_DEBUG(pgraster) << "pgraster_datasource: px_gw=" << px_gw << " px_gh=" << px_gh; @@ -844,11 +844,11 @@ featureset_ptr pgraster_datasource::features_with_context(query const& q, proces std::string sch = overviews_[0].schema; std::string tab = overviews_[0].table; col = overviews_[0].column; - const double scale = std::min(px_gw, px_gh); + double const scale = std::min(px_gw, px_gh); std::vector::const_reverse_iterator i; for (i = overviews_.rbegin(); i != overviews_.rend(); ++i) { - const pgraster_overview& o = *i; + pgraster_overview const& o = *i; if (o.scale < scale) { sch = o.schema; @@ -895,7 +895,7 @@ featureset_ptr pgraster_datasource::features_with_context(query const& q, proces if (prescale_rasters_) { - const double scale = std::min(px_gw, px_gh); + double const scale = std::min(px_gw, px_gh); s << ", least(1.0, abs(ST_ScaleX(" << identifier(col) << "))::float8/" << scale << "), least(1.0, abs(ST_ScaleY(" << identifier(col) << "))::float8/" << scale << "))"; // TODO: if band_ is given, we'll interpret as indexed so @@ -1067,7 +1067,7 @@ box2d pgraster_datasource::envelope() const if (!overviews_.empty()) { // query from highest-factor overview instead - const pgraster_overview& o = overviews_.back(); + pgraster_overview const& o = overviews_.back(); sch = o.schema; tab = o.table; col = o.column; diff --git a/plugins/input/pgraster/pgraster_datasource.hpp b/plugins/input/pgraster/pgraster_datasource.hpp index dc51ef5a2..4b26cb414 100644 --- a/plugins/input/pgraster/pgraster_datasource.hpp +++ b/plugins/input/pgraster/pgraster_datasource.hpp @@ -78,10 +78,10 @@ DATASOURCE_PLUGIN_DEF(pgraster_datasource_plugin, pgraster); class pgraster_datasource : public datasource { public: - pgraster_datasource(const parameters& params); + pgraster_datasource(parameters const& params); ~pgraster_datasource(); mapnik::datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); processor_context_ptr get_context(feature_style_context_map&) const override; featureset_ptr features_with_context(query const& q, processor_context_ptr ctx) const override; featureset_ptr features(query const& q) const override; @@ -104,17 +104,17 @@ class pgraster_datasource : public datasource std::string const& sql, CnxPool_ptr const& pool, processor_context_ptr ctx = processor_context_ptr()) const; - static const std::string RASTER_COLUMNS; - static const std::string RASTER_OVERVIEWS; - static const std::string SPATIAL_REF_SYS; + static std::string const RASTER_COLUMNS; + static std::string const RASTER_OVERVIEWS; + static std::string const SPATIAL_REF_SYS; - const std::string uri_; - const std::string username_; - const std::string password_; + std::string const uri_; + std::string const username_; + std::string const password_; // table name (schema qualified or not) or subquery - const std::string table_; - const std::string raster_table_; // possibly schema-qualified - const std::string raster_field_; + std::string const table_; + std::string const raster_table_; // possibly schema-qualified + std::string const raster_field_; std::string parsed_schema_; // extracted from raster_table_ or table_ std::string parsed_table_; // extracted from raster_table_ or table_ std::string key_field_; diff --git a/plugins/input/pgraster/pgraster_featureset.cpp b/plugins/input/pgraster/pgraster_featureset.cpp index d4acb7642..7867e2376 100644 --- a/plugins/input/pgraster/pgraster_featureset.cpp +++ b/plugins/input/pgraster/pgraster_featureset.cpp @@ -83,7 +83,7 @@ feature_ptr pgraster_featureset::next() } // create feature with user driven id from attribute int oid = rs_->getTypeOID(pos); - const char* buf = rs_->getValue(pos); + char const* buf = rs_->getValue(pos); // validation happens of this type at initialization mapnik::value_integer val; @@ -128,7 +128,7 @@ feature_ptr pgraster_featureset::next() // parse geometry int size = rs_->getFieldLength(0); - const uint8_t* data = (const uint8_t*)rs_->getValue(0); + uint8_t const* data = (uint8_t const*)rs_->getValue(0); mapnik::raster_ptr raster = pgraster_wkb_reader::read(data, size, band_); if (!raster) @@ -150,8 +150,8 @@ feature_ptr pgraster_featureset::next() // since it is equivalent to the attribute not existing if (!rs_->isNull(pos)) { - const char* buf = rs_->getValue(pos); - const int oid = rs_->getTypeOID(pos); + char const* buf = rs_->getValue(pos); + int const oid = rs_->getTypeOID(pos); switch (oid) { case 16: // bool diff --git a/plugins/input/pgraster/pgraster_featureset.hpp b/plugins/input/pgraster/pgraster_featureset.hpp index 5dd34e1d6..3e9953e77 100644 --- a/plugins/input/pgraster/pgraster_featureset.hpp +++ b/plugins/input/pgraster/pgraster_featureset.hpp @@ -62,7 +62,7 @@ class pgraster_featureset : public mapnik::Featureset private: std::shared_ptr rs_; context_ptr ctx_; - const std::unique_ptr tr_; + std::unique_ptr const tr_; mapnik::value_integer feature_id_; bool key_field_; int band_; diff --git a/plugins/input/pgraster/pgraster_wkb_reader.cpp b/plugins/input/pgraster/pgraster_wkb_reader.cpp index bc2b55525..231db6e45 100644 --- a/plugins/input/pgraster/pgraster_wkb_reader.cpp +++ b/plugins/input/pgraster/pgraster_wkb_reader.cpp @@ -42,12 +42,12 @@ namespace { -uint8_t read_uint8(const uint8_t** from) +uint8_t read_uint8(uint8_t const** from) { return *(*from)++; } -uint16_t read_uint16(const uint8_t** from, uint8_t littleEndian) +uint16_t read_uint16(uint8_t const** from, uint8_t littleEndian) { uint16_t ret = 0; @@ -73,7 +73,7 @@ read_int16(const uint8_t** from, uint8_t littleEndian) { } */ -double read_float64(const uint8_t** from, uint8_t littleEndian) +double read_float64(uint8_t const** from, uint8_t littleEndian) { union { double d; @@ -100,7 +100,7 @@ double read_float64(const uint8_t** from, uint8_t littleEndian) return ret.d; } -uint32_t read_uint32(const uint8_t** from, uint8_t littleEndian) +uint32_t read_uint32(uint8_t const** from, uint8_t littleEndian) { uint32_t ret = 0; @@ -120,12 +120,12 @@ uint32_t read_uint32(const uint8_t** from, uint8_t littleEndian) return ret; } -int32_t read_int32(const uint8_t** from, uint8_t littleEndian) +int32_t read_int32(uint8_t const** from, uint8_t littleEndian) { return read_uint32(from, littleEndian); } -float read_float32(const uint8_t** from, uint8_t littleEndian) +float read_float32(uint8_t const** from, uint8_t littleEndian) { union { float f; diff --git a/plugins/input/pgraster/pgraster_wkb_reader.hpp b/plugins/input/pgraster/pgraster_wkb_reader.hpp index a51094a17..d43cd8f97 100644 --- a/plugins/input/pgraster/pgraster_wkb_reader.hpp +++ b/plugins/input/pgraster/pgraster_wkb_reader.hpp @@ -47,7 +47,7 @@ class pgraster_wkb_reader { public: - pgraster_wkb_reader(const uint8_t* wkb, int size, int bnd = 0) + pgraster_wkb_reader(uint8_t const* wkb, int size, int bnd = 0) : ptr_(wkb), bandno_(bnd) {} @@ -60,7 +60,7 @@ class pgraster_wkb_reader /// Any other value results in pixel /// values being copied verbatim into the returned raster /// for interpretation by the caller. - static mapnik::raster_ptr read(const uint8_t* wkb, int size, int bnd = 0) + static mapnik::raster_ptr read(uint8_t const* wkb, int size, int bnd = 0) { pgraster_wkb_reader reader(wkb, size, bnd); return reader.get_raster(); @@ -74,7 +74,7 @@ class pgraster_wkb_reader // int wkbsize_; // const uint8_t* wkb_; // const uint8_t* wkbend_; - const uint8_t* ptr_; + uint8_t const* ptr_; uint8_t endian_; int bandno_; uint16_t numBands_; diff --git a/plugins/input/postgis/asyncresultset.hpp b/plugins/input/postgis/asyncresultset.hpp index 106068f19..dc089b4ec 100644 --- a/plugins/input/postgis/asyncresultset.hpp +++ b/plugins/input/postgis/asyncresultset.hpp @@ -114,21 +114,21 @@ class AsyncResultSet : public IResultSet, return next_res; } - virtual const char* getFieldName(int index) const { return rs_->getFieldName(index); } + virtual char const* getFieldName(int index) const { return rs_->getFieldName(index); } virtual int getFieldLength(int index) const { return rs_->getFieldLength(index); } - virtual int getFieldLength(const char* name) const { return rs_->getFieldLength(name); } + virtual int getFieldLength(char const* name) const { return rs_->getFieldLength(name); } virtual int getTypeOID(int index) const { return rs_->getTypeOID(index); } - virtual int getTypeOID(const char* name) const { return rs_->getTypeOID(name); } + virtual int getTypeOID(char const* name) const { return rs_->getTypeOID(name); } virtual bool isNull(int index) const { return rs_->isNull(index); } - virtual const char* getValue(int index) const { return rs_->getValue(index); } + virtual char const* getValue(int index) const { return rs_->getValue(index); } - virtual const char* getValue(const char* name) const { return rs_->getValue(name); } + virtual char const* getValue(char const* name) const { return rs_->getValue(name); } private: postgis_processor_context_ptr ctx_; diff --git a/plugins/input/postgis/connection_manager.hpp b/plugins/input/postgis/connection_manager.hpp index e4b6c5264..33d0d030c 100644 --- a/plugins/input/postgis/connection_manager.hpp +++ b/plugins/input/postgis/connection_manager.hpp @@ -153,15 +153,15 @@ class ConnectionManager : public singleton { return itr->second; } - static const std::shared_ptr emptyPool; + static std::shared_ptr const emptyPool; return emptyPool; } ConnectionManager() {} private: - ConnectionManager(const ConnectionManager&); - ConnectionManager& operator=(const ConnectionManager); + ConnectionManager(ConnectionManager const&); + ConnectionManager& operator=(ConnectionManager const); }; #endif // POSTGIS_CONNECTION_MANAGER_HPP diff --git a/plugins/input/postgis/cursorresultset.hpp b/plugins/input/postgis/cursorresultset.hpp index 905868e92..f467a2033 100644 --- a/plugins/input/postgis/cursorresultset.hpp +++ b/plugins/input/postgis/cursorresultset.hpp @@ -80,21 +80,21 @@ class CursorResultSet : public IResultSet, } } - virtual const char* getFieldName(int index) const { return rs_->getFieldName(index); } + virtual char const* getFieldName(int index) const { return rs_->getFieldName(index); } virtual int getFieldLength(int index) const { return rs_->getFieldLength(index); } - virtual int getFieldLength(const char* name) const { return rs_->getFieldLength(name); } + virtual int getFieldLength(char const* name) const { return rs_->getFieldLength(name); } virtual int getTypeOID(int index) const { return rs_->getTypeOID(index); } - virtual int getTypeOID(const char* name) const { return rs_->getTypeOID(name); } + virtual int getTypeOID(char const* name) const { return rs_->getTypeOID(name); } virtual bool isNull(int index) const { return rs_->isNull(index); } - virtual const char* getValue(int index) const { return rs_->getValue(index); } + virtual char const* getValue(int index) const { return rs_->getValue(index); } - virtual const char* getValue(const char* name) const { return rs_->getValue(name); } + virtual char const* getValue(char const* name) const { return rs_->getValue(name); } private: void getNextResultSet() diff --git a/plugins/input/postgis/numeric2string.hpp b/plugins/input/postgis/numeric2string.hpp index 3f82e2b49..4a204a4ab 100644 --- a/plugins/input/postgis/numeric2string.hpp +++ b/plugins/input/postgis/numeric2string.hpp @@ -29,7 +29,7 @@ #include #include -static inline std::string numeric2string(const char* buf) +static inline std::string numeric2string(char const* buf) { std::int16_t ndigits = int2net(buf); std::int16_t weight = int2net(buf + 2); diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index eb5df8805..45813b76e 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -53,8 +53,8 @@ DATASOURCE_PLUGIN_EXPORT(postgis_datasource_plugin); DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(postgis_datasource_plugin); DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(postgis_datasource_plugin); -const std::string postgis_datasource::GEOMETRY_COLUMNS = "geometry_columns"; -const std::string postgis_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; +std::string const postgis_datasource::GEOMETRY_COLUMNS = "geometry_columns"; +std::string const postgis_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; using mapnik::attribute_descriptor; using mapnik::sql_utils::identifier; @@ -104,7 +104,7 @@ postgis_datasource::postgis_datasource(parameters const& params) throw mapnik::datasource_exception("Postgis Plugin: missing
parameter"); } - const auto ext = params.get("extent"); + auto const ext = params.get("extent"); if (ext.has_value() && !ext->empty()) { extent_initialized_ = extent_.from_string(*ext); @@ -124,17 +124,17 @@ postgis_datasource::postgis_datasource(parameters const& params) asynchronous_request_ = true; } - const auto initial_size = params.get("initial_size", 1); - const auto autodetect_key_field = params.get("autodetect_key_field", false); - const auto estimate_extent = params.get("estimate_extent", false); + auto const initial_size = params.get("initial_size", 1); + auto const autodetect_key_field = params.get("autodetect_key_field", false); + auto const estimate_extent = params.get("estimate_extent", false); estimate_extent_ = estimate_extent && *estimate_extent; - const auto simplify_opt = params.get("simplify_geometries", false); + auto const simplify_opt = params.get("simplify_geometries", false); simplify_geometries_ = simplify_opt && *simplify_opt; - const auto twkb_opt = params.get("twkb_encoding", false); + auto const twkb_opt = params.get("twkb_encoding", false); twkb_encoding_ = twkb_opt && *twkb_opt; - const auto simplify_preserve_opt = params.get("simplify_dp_preserve", false); + auto const simplify_preserve_opt = params.get("simplify_dp_preserve", false); simplify_dp_preserve_ = simplify_preserve_opt && *simplify_preserve_opt; ConnectionManager::instance().registerPool(creator_, *initial_size, pool_max_size_); @@ -191,11 +191,11 @@ postgis_datasource::postgis_datasource(parameters const& params) // user has not provided as option if (srid_ == 0) { - const char* srid_c = rs->getValue("srid"); + char const* srid_c = rs->getValue("srid"); if (srid_c != nullptr) { int result = 0; - const char* end = srid_c + std::strlen(srid_c); + char const* end = srid_c + std::strlen(srid_c); if (mapnik::util::string2int(srid_c, end, result)) { srid_ = result; @@ -233,11 +233,11 @@ postgis_datasource::postgis_datasource(parameters const& params) shared_ptr rs = conn->executeQuery(s.str()); if (rs->next()) { - const char* srid_c = rs->getValue("srid"); + char const* srid_c = rs->getValue("srid"); if (srid_c != nullptr) { int result = 0; - const char* end = srid_c + std::strlen(srid_c); + char const* end = srid_c + std::strlen(srid_c); if (mapnik::util::string2int(srid_c, end, result)) { srid_ = result; @@ -283,7 +283,7 @@ postgis_datasource::postgis_datasource(parameters const& params) bool is_int = (std::string(rs_key->getValue(3)) == "t"); if (is_int) { - const char* key_field_string = rs_key->getValue(0); + char const* key_field_string = rs_key->getValue(0); if (key_field_string) { key_field_ = std::string(key_field_string); @@ -481,7 +481,7 @@ postgis_datasource::~postgis_datasource() } } -const char* postgis_datasource::name() +char const* postgis_datasource::name() { return "postgis"; } @@ -752,9 +752,9 @@ featureset_ptr postgis_datasource::features_with_context(query const& q, process std::ostringstream s; - const double px_gw = 1.0 / std::get<0>(q.resolution()); - const double px_gh = 1.0 / std::get<1>(q.resolution()); - const double px_sz = std::min(px_gw, px_gh); + double const px_gw = 1.0 / std::get<0>(q.resolution()); + double const px_gh = 1.0 / std::get<1>(q.resolution()); + double const px_sz = std::min(px_gw, px_gh); if (twkb_encoding_) { @@ -764,9 +764,9 @@ featureset_ptr postgis_datasource::features_with_context(query const& q, process // (c) a ST_AsTWKB implementation // What number of decimals of rounding does the pixel size imply? - const int twkb_rounding = -1 * std::lround(log10(px_sz) + twkb_rounding_adjustment_) + 1; + int const twkb_rounding = -1 * std::lround(log10(px_sz) + twkb_rounding_adjustment_) + 1; // And what's that in map units? - const double twkb_tolerance = pow(10.0, -1.0 * twkb_rounding); + double const twkb_tolerance = pow(10.0, -1.0 * twkb_rounding); s << "SELECT ST_AsTWKB("; s << "ST_Simplify("; @@ -813,7 +813,7 @@ featureset_ptr postgis_datasource::features_with_context(query const& q, process // ! ST_SnapToGrid() if (simplify_geometries_ && simplify_snap_ratio_ > 0.0) { - const double tolerance = px_sz * simplify_snap_ratio_; + double const tolerance = px_sz * simplify_snap_ratio_; s << "," << tolerance << ")"; } @@ -826,7 +826,7 @@ featureset_ptr postgis_datasource::features_with_context(query const& q, process // ! ST_Simplify() if (simplify_geometries_) { - const double tolerance = px_sz * simplify_dp_ratio_; + double const tolerance = px_sz * simplify_dp_ratio_; s << ", " << tolerance; // Add parameter to ST_Simplify to keep collapsed geometries if (simplify_dp_preserve_) @@ -1139,7 +1139,7 @@ std::optional postgis_datasource::get_geometry_ty shared_ptr rs = conn->executeQuery(s.str()); while (rs->next() && !rs->isNull(0)) { - const char* data = rs->getValue(0); + char const* data = rs->getValue(0); if (boost::algorithm::icontains(data, "line")) { g_type = "linestring"; diff --git a/plugins/input/postgis/postgis_datasource.hpp b/plugins/input/postgis/postgis_datasource.hpp index f341b51a4..07a77cce8 100644 --- a/plugins/input/postgis/postgis_datasource.hpp +++ b/plugins/input/postgis/postgis_datasource.hpp @@ -67,10 +67,10 @@ DATASOURCE_PLUGIN_DEF(postgis_datasource_plugin, postgis); class postgis_datasource : public datasource { public: - postgis_datasource(const parameters& params); + postgis_datasource(parameters const& params); ~postgis_datasource(); mapnik::datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); processor_context_ptr get_context(feature_style_context_map&) const override; featureset_ptr features_with_context(query const& q, processor_context_ptr ctx) const override; featureset_ptr features(query const& q) const override; @@ -94,15 +94,15 @@ class postgis_datasource : public datasource std::string const& sql, CnxPool_ptr const& pool, processor_context_ptr ctx = processor_context_ptr()) const; - static const std::string GEOMETRY_COLUMNS; - static const std::string SPATIAL_REF_SYS; + static std::string const GEOMETRY_COLUMNS; + static std::string const SPATIAL_REF_SYS; - const std::string uri_; - const std::string username_; - const std::string password_; - const std::string table_; - const std::string geometry_table_; - const std::string geometry_field_; + std::string const uri_; + std::string const username_; + std::string const password_; + std::string const table_; + std::string const geometry_table_; + std::string const geometry_field_; std::string parsed_schema_; std::string parsed_table_; std::string key_field_; diff --git a/plugins/input/postgis/postgis_featureset.cpp b/plugins/input/postgis/postgis_featureset.cpp index b8fe7226f..81561b42c 100644 --- a/plugins/input/postgis/postgis_featureset.cpp +++ b/plugins/input/postgis/postgis_featureset.cpp @@ -81,7 +81,7 @@ feature_ptr postgis_featureset::next() } // create feature with user driven id from attribute int oid = rs_->getTypeOID(pos); - const char* buf = rs_->getValue(pos); + char const* buf = rs_->getValue(pos); // validation happens of this type at initialization mapnik::value_integer val; @@ -122,7 +122,7 @@ feature_ptr postgis_featureset::next() // parse geometry int size = rs_->getFieldLength(0); - const char* data = rs_->getValue(0); + char const* data = rs_->getValue(0); if (twkb_encoding_) { @@ -147,8 +147,8 @@ feature_ptr postgis_featureset::next() // since it is equivalent to the attribute not existing if (!rs_->isNull(pos)) { - const char* buf = rs_->getValue(pos); - const int oid = rs_->getTypeOID(pos); + char const* buf = rs_->getValue(pos); + int const oid = rs_->getTypeOID(pos); switch (oid) { case 16: // bool diff --git a/plugins/input/postgis/postgis_featureset.hpp b/plugins/input/postgis/postgis_featureset.hpp index 4e7f805b9..8b17d1197 100644 --- a/plugins/input/postgis/postgis_featureset.hpp +++ b/plugins/input/postgis/postgis_featureset.hpp @@ -52,7 +52,7 @@ class postgis_featureset : public mapnik::Featureset private: std::shared_ptr rs_; context_ptr ctx_; - const std::unique_ptr tr_; + std::unique_ptr const tr_; unsigned totalGeomSize_; mapnik::value_integer feature_id_; bool key_field_; diff --git a/plugins/input/postgis/resultset.hpp b/plugins/input/postgis/resultset.hpp index e29bbbae7..ac9c956fb 100644 --- a/plugins/input/postgis/resultset.hpp +++ b/plugins/input/postgis/resultset.hpp @@ -35,14 +35,14 @@ class IResultSet virtual void close() = 0; virtual int getNumFields() const = 0; virtual bool next() = 0; - virtual const char* getFieldName(int index) const = 0; + virtual char const* getFieldName(int index) const = 0; virtual int getFieldLength(int index) const = 0; - virtual int getFieldLength(const char* name) const = 0; + virtual int getFieldLength(char const* name) const = 0; virtual int getTypeOID(int index) const = 0; - virtual int getTypeOID(const char* name) const = 0; + virtual int getTypeOID(char const* name) const = 0; virtual bool isNull(int index) const = 0; - virtual const char* getValue(int index) const = 0; - virtual const char* getValue(const char* name) const = 0; + virtual char const* getValue(int index) const = 0; + virtual char const* getValue(char const* name) const = 0; }; class ResultSet : public IResultSet, @@ -72,11 +72,11 @@ class ResultSet : public IResultSet, virtual bool next() { return (++pos_ < numTuples_); } - virtual const char* getFieldName(int index) const { return PQfname(res_, index); } + virtual char const* getFieldName(int index) const { return PQfname(res_, index); } virtual int getFieldLength(int index) const { return PQgetlength(res_, pos_, index); } - virtual int getFieldLength(const char* name) const + virtual int getFieldLength(char const* name) const { int col = PQfnumber(res_, name); if (col >= 0) @@ -88,7 +88,7 @@ class ResultSet : public IResultSet, virtual int getTypeOID(int index) const { return PQftype(res_, index); } - virtual int getTypeOID(const char* name) const + virtual int getTypeOID(char const* name) const { int col = PQfnumber(res_, name); if (col >= 0) @@ -100,9 +100,9 @@ class ResultSet : public IResultSet, virtual bool isNull(int index) const { return static_cast(PQgetisnull(res_, pos_, index)); } - virtual const char* getValue(int index) const { return PQgetvalue(res_, pos_, index); } + virtual char const* getValue(int index) const { return PQgetvalue(res_, pos_, index); } - virtual const char* getValue(const char* name) const + virtual char const* getValue(char const* name) const { int col = PQfnumber(res_, name); if (col >= 0) diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index f16b75fd2..73fbb269e 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -55,11 +55,11 @@ raster_datasource::raster_datasource(parameters const& params) { MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing..."; - const auto file = params.get("file"); + auto const file = params.get("file"); if (!file) throw datasource_exception("Raster Plugin: missing parameter "); - const auto base = params.get("base"); + auto const base = params.get("base"); if (base) filename_ = *base + "/" + *file; else @@ -69,15 +69,15 @@ raster_datasource::raster_datasource(parameters const& params) tile_size_ = *params.get("tile_size", 1024); tile_stride_ = *params.get("tile_stride", 1); - const auto format_from_filename = mapnik::type_from_filename(*file); + auto const format_from_filename = mapnik::type_from_filename(*file); format_ = *params.get("format", format_from_filename ? (*format_from_filename) : "tiff"); - const auto lox = params.get("lox"); - const auto loy = params.get("loy"); - const auto hix = params.get("hix"); - const auto hiy = params.get("hiy"); + auto const lox = params.get("lox"); + auto const loy = params.get("loy"); + auto const hix = params.get("hix"); + auto const hiy = params.get("hiy"); - const auto ext = params.get("extent"); + auto const ext = params.get("extent"); if (lox && loy && hix && hiy) { @@ -108,8 +108,8 @@ raster_datasource::raster_datasource(parameters const& params) if (multi_tiles_) { - const auto x_width = params.get("x_width"); - const auto y_width = params.get("y_width"); + auto const x_width = params.get("x_width"); + auto const y_width = params.get("y_width"); if (!x_width) { @@ -164,7 +164,7 @@ mapnik::datasource::datasource_t raster_datasource::type() const return datasource::Raster; } -const char* raster_datasource::name() +char const* raster_datasource::name() { return "raster"; } @@ -190,8 +190,8 @@ featureset_ptr raster_datasource::features(query const& q) const mapnik::box2d intersect = extent_.intersect(q.get_bbox()); mapnik::box2d ext = t.forward(intersect); - const int width = int(ext.maxx() + 0.5) - int(ext.minx() + 0.5); - const int height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5); + int const width = int(ext.maxx() + 0.5) - int(ext.minx() + 0.5); + int const height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5); MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Box size=" << width << "," << height; diff --git a/plugins/input/raster/raster_datasource.hpp b/plugins/input/raster/raster_datasource.hpp index 3e0f006a5..f6c3a161c 100644 --- a/plugins/input/raster/raster_datasource.hpp +++ b/plugins/input/raster/raster_datasource.hpp @@ -38,11 +38,11 @@ DATASOURCE_PLUGIN_DEF(raster_datasource_plugin, raster); class raster_datasource : public mapnik::datasource { public: - raster_datasource(const mapnik::parameters& params); + raster_datasource(mapnik::parameters const& params); virtual ~raster_datasource(); datasource::datasource_t type() const override; - static const char* name(); - mapnik::featureset_ptr features(const mapnik::query& q) const override; + static char const* name(); + mapnik::featureset_ptr features(mapnik::query const& q) const override; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override; mapnik::box2d envelope() const override; std::optional get_geometry_type() const override; diff --git a/plugins/input/raster/raster_featureset.hpp b/plugins/input/raster/raster_featureset.hpp index 9d09749c9..6d000d66c 100644 --- a/plugins/input/raster/raster_featureset.hpp +++ b/plugins/input/raster/raster_featureset.hpp @@ -45,10 +45,10 @@ class single_file_policy { enum iterator_e { start, end }; bool status_; - const single_file_policy* p_; + single_file_policy const* p_; public: - explicit const_iterator(const single_file_policy* p) + explicit const_iterator(single_file_policy const* p) : status_(start), p_(p) {} @@ -57,7 +57,7 @@ class single_file_policy : status_(end) {} - const_iterator(const const_iterator& other) + const_iterator(const_iterator const& other) : status_(other.status_), p_(other.p_) {} @@ -68,20 +68,20 @@ class single_file_policy return *this; } - const raster_info& operator*() const { return p_->info_; } + raster_info const& operator*() const { return p_->info_; } - const raster_info* operator->() const { return &(p_->info_); } + raster_info const* operator->() const { return &(p_->info_); } - bool operator!=(const const_iterator& itr) { return status_ != itr.status_; } + bool operator!=(const_iterator const& itr) { return status_ != itr.status_; } }; - explicit single_file_policy(const raster_info& info) + explicit single_file_policy(raster_info const& info) : info_(info) {} const_iterator begin() { return const_iterator(this); } - const_iterator query(const box2d& box) + const_iterator query(box2d const& box) { if (box.intersects(info_.envelope())) { @@ -196,10 +196,10 @@ class tiled_multi_file_policy // intersection of query with extent => new query box2d e = bbox.intersect(extent); - const int x_min = int(std::floor((e.minx() - lox) / (tile_size * pixel_x))); - const int y_min = int(std::floor((e.miny() - loy) / (tile_size * pixel_y))); - const int x_max = int(std::ceil((e.maxx() - lox) / (tile_size * pixel_x))); - const int y_max = int(std::ceil((e.maxy() - loy) / (tile_size * pixel_y))); + int const x_min = int(std::floor((e.minx() - lox) / (tile_size * pixel_x))); + int const y_min = int(std::floor((e.miny() - loy) / (tile_size * pixel_y))); + int const x_max = int(std::ceil((e.maxx() - lox) / (tile_size * pixel_x))); + int const y_max = int(std::ceil((e.maxy() - loy) / (tile_size * pixel_y))); for (int x = x_min; x < x_max; ++x) { diff --git a/plugins/input/raster/raster_info.cpp b/plugins/input/raster/raster_info.cpp index f734e0814..c7ce4d1b6 100644 --- a/plugins/input/raster/raster_info.cpp +++ b/plugins/input/raster/raster_info.cpp @@ -34,7 +34,7 @@ raster_info::raster_info(std::string const& file, height_(height) {} -raster_info::raster_info(const raster_info& rhs) +raster_info::raster_info(raster_info const& rhs) : file_(rhs.file_), format_(rhs.format_), extent_(rhs.extent_), @@ -51,7 +51,7 @@ void raster_info::swap(raster_info& other) std::swap(height_, other.height_); } -raster_info& raster_info::operator=(const raster_info& rhs) +raster_info& raster_info::operator=(raster_info const& rhs) { raster_info tmp(rhs); swap(tmp); diff --git a/plugins/input/raster/raster_info.hpp b/plugins/input/raster/raster_info.hpp index 1d8c78cb4..1cff766ec 100644 --- a/plugins/input/raster/raster_info.hpp +++ b/plugins/input/raster/raster_info.hpp @@ -35,11 +35,11 @@ class raster_info public: raster_info(std::string const& file, std::string const& format, - const box2d& extent, + box2d const& extent, unsigned width, unsigned height); - raster_info(const raster_info& rhs); - raster_info& operator=(const raster_info& rhs); + raster_info(raster_info const& rhs); + raster_info& operator=(raster_info const& rhs); inline box2d const& envelope() const { return extent_; } inline std::string const& file() const { return file_; } inline std::string const& format() const { return format_; } diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index f3c66e696..be9513207 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -98,7 +98,7 @@ std::string dbf_file::string_value(int col) const return ""; } -const field_descriptor& dbf_file::descriptor(int col) const +field_descriptor const& dbf_file::descriptor(int col) const { assert(col >= 0 && col < num_fields_); return fields_[col]; @@ -149,8 +149,8 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, mapnik::feat if (fields_[col].dec_ > 0) { double val = 0.0; - const char* itr = record_ + fields_[col].offset_; - const char* end = itr + fields_[col].length_; + char const* itr = record_ + fields_[col].offset_; + char const* end = itr + fields_[col].length_; x3::ascii::space_type space; static x3::double_type double_; if (x3::phrase_parse(itr, end, double_, space, val)) @@ -161,8 +161,8 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, mapnik::feat else { mapnik::value_integer val = 0; - const char* itr = record_ + fields_[col].offset_; - const char* end = itr + fields_[col].length_; + char const* itr = record_ + fields_[col].offset_; + char const* end = itr + fields_[col].length_; x3::ascii::space_type space; static x3::int_parser numeric_parser; if (x3::phrase_parse(itr, end, numeric_parser, space, val)) diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index facc8c35d..8962731a9 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -72,11 +72,11 @@ shape_datasource::shape_datasource(parameters const& params) #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "shape_datasource::init"); #endif - const auto file = params.get("file"); + auto const file = params.get("file"); if (!file.has_value()) throw datasource_exception("Shape Plugin: missing parameter"); - const auto base = params.get("base"); + auto const base = params.get("base"); if (base.has_value()) shape_name_ = *base + "/" + *file; else @@ -150,7 +150,7 @@ shape_datasource::shape_datasource(parameters const& params) MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what(); throw; } - catch (const std::exception& ex) + catch (std::exception const& ex) { MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what(); throw; @@ -194,17 +194,17 @@ void shape_datasource::init(shape_io& shape) if (shape_type_ == shape_io::shape_multipatch) throw datasource_exception("Shape Plugin: shapefile multipatch type is not supported"); - const double lox = header.read_double(); - const double loy = header.read_double(); - const double hix = header.read_double(); - const double hiy = header.read_double(); + double const lox = header.read_double(); + double const loy = header.read_double(); + double const hix = header.read_double(); + double const hiy = header.read_double(); extent_.init(lox, loy, hix, hiy); #ifdef MAPNIK_LOG - const double zmin = header.read_double(); - const double zmax = header.read_double(); - const double mmin = header.read_double(); - const double mmax = header.read_double(); + double const zmin = header.read_double(); + double const zmax = header.read_double(); + double const mmin = header.read_double(); + double const mmax = header.read_double(); MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Z min/max=" << zmin << "," << zmax; MAPNIK_LOG_DEBUG(shape) << "shape_datasource: M min/max=" << mmin << "," << mmax; @@ -219,7 +219,7 @@ void shape_datasource::init(shape_io& shape) shape_datasource::~shape_datasource() {} -const char* shape_datasource::name() +char const* shape_datasource::name() { return "shape"; } diff --git a/plugins/input/shape/shape_datasource.hpp b/plugins/input/shape/shape_datasource.hpp index e6bbb26ce..3d7547405 100644 --- a/plugins/input/shape/shape_datasource.hpp +++ b/plugins/input/shape/shape_datasource.hpp @@ -54,7 +54,7 @@ class shape_datasource : public datasource shape_datasource(parameters const& params); virtual ~shape_datasource(); datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); featureset_ptr features(query const& q) const override; featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const override; box2d envelope() const override; @@ -70,7 +70,7 @@ class shape_datasource : public datasource long file_length_; box2d extent_; bool indexed_; - const int row_limit_; + int const row_limit_; layer_descriptor desc_; }; diff --git a/plugins/input/shape/shape_featureset.hpp b/plugins/input/shape/shape_featureset.hpp index 157864b52..ff6d7015b 100644 --- a/plugins/input/shape/shape_featureset.hpp +++ b/plugins/input/shape/shape_featureset.hpp @@ -59,7 +59,7 @@ class shape_featureset : public Featureset shape_io shape_; box2d query_ext_; mutable box2d feature_bbox_; - const std::unique_ptr tr_; + std::unique_ptr const tr_; long shx_file_length_; std::vector attr_ids_; mapnik::value_integer row_limit_; diff --git a/plugins/input/shape/shape_index_featureset.hpp b/plugins/input/shape/shape_index_featureset.hpp index 323461dae..7842ef37b 100644 --- a/plugins/input/shape/shape_index_featureset.hpp +++ b/plugins/input/shape/shape_index_featureset.hpp @@ -81,7 +81,7 @@ class shape_index_featureset : public Featureset filterT filter_; context_ptr ctx_; std::unique_ptr shape_ptr_; - const std::unique_ptr tr_; + std::unique_ptr const tr_; std::vector positions_; std::vector::iterator itr_; std::vector attr_ids_; diff --git a/plugins/input/shape/shape_io.cpp b/plugins/input/shape/shape_io.cpp index 0e3cc5998..f86c2daa9 100644 --- a/plugins/input/shape/shape_io.cpp +++ b/plugins/input/shape/shape_io.cpp @@ -29,10 +29,10 @@ #include using mapnik::datasource_exception; -const std::string shape_io::SHP = ".shp"; -const std::string shape_io::SHX = ".shx"; -const std::string shape_io::DBF = ".dbf"; -const std::string shape_io::INDEX = ".index"; +std::string const shape_io::SHP = ".shp"; +std::string const shape_io::SHX = ".shx"; +std::string const shape_io::DBF = ".dbf"; +std::string const shape_io::INDEX = ".index"; shape_io::shape_io(std::string const& shape_name, bool open_index) : type_(shape_null), diff --git a/plugins/input/shape/shape_io.hpp b/plugins/input/shape/shape_io.hpp index 894356c06..7944916dc 100644 --- a/plugins/input/shape/shape_io.hpp +++ b/plugins/input/shape/shape_io.hpp @@ -100,10 +100,10 @@ struct shape_io : mapnik::util::noncopyable int id_; box2d cur_extent_; - static const std::string SHP; - static const std::string SHX; - static const std::string DBF; - static const std::string INDEX; + static std::string const SHP; + static std::string const SHX; + static std::string const DBF; + static std::string const INDEX; }; #endif // SHAPE_IO_HPP diff --git a/plugins/input/shape/shapefile.hpp b/plugins/input/shape/shapefile.hpp index 62062c0d0..3400a84a1 100644 --- a/plugins/input/shape/shapefile.hpp +++ b/plugins/input/shape/shapefile.hpp @@ -57,7 +57,7 @@ struct RecordTag struct MappedRecordTag { - using data_type = const char*; + using data_type = char const*; static data_type alloc(unsigned) { return 0; } static void dealloc(data_type) {} }; diff --git a/plugins/input/sqlite/sqlite_connection.hpp b/plugins/input/sqlite/sqlite_connection.hpp index 29037ffb3..44e081997 100644 --- a/plugins/input/sqlite/sqlite_connection.hpp +++ b/plugins/input/sqlite/sqlite_connection.hpp @@ -66,9 +66,9 @@ class sqlite_connection mode |= SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_SHAREDCACHE; } #endif - const int rc = sqlite3_open_v2(file_.c_str(), &db_, mode, 0); + int const rc = sqlite3_open_v2(file_.c_str(), &db_, mode, 0); #else - const int rc = sqlite3_open(file_.c_str(), &db_); + int const rc = sqlite3_open(file_.c_str(), &db_); #endif if (rc != SQLITE_OK) { @@ -86,9 +86,9 @@ class sqlite_connection file_(file) { #if SQLITE_VERSION_NUMBER >= 3005000 - const int rc = sqlite3_open_v2(file_.c_str(), &db_, flags, 0); + int const rc = sqlite3_open_v2(file_.c_str(), &db_, flags, 0); #else - const int rc = sqlite3_open(file_.c_str(), &db_); + int const rc = sqlite3_open(file_.c_str(), &db_); #endif if (rc != SQLITE_OK) { @@ -127,7 +127,7 @@ class sqlite_connection #endif sqlite3_stmt* stmt = 0; - const int rc = sqlite3_prepare_v2(db_, sql.c_str(), -1, &stmt, 0); + int const rc = sqlite3_prepare_v2(db_, sql.c_str(), -1, &stmt, 0); if (rc != SQLITE_OK) { throw_sqlite_error(sql); @@ -142,7 +142,7 @@ class sqlite_connection mapnik::progress_timer __stats__(std::clog, std::string("sqlite_resultset::execute ") + sql); #endif - const int rc = sqlite3_exec(db_, sql.c_str(), 0, 0, 0); + int const rc = sqlite3_exec(db_, sql.c_str(), 0, 0, 0); if (rc != SQLITE_OK) { throw_sqlite_error(sql); @@ -155,7 +155,7 @@ class sqlite_connection mapnik::progress_timer __stats__(std::clog, std::string("sqlite_resultset::execute_with_code ") + sql); #endif - const int rc = sqlite3_exec(db_, sql.c_str(), 0, 0, 0); + int const rc = sqlite3_exec(db_, sql.c_str(), 0, 0, 0); return rc; } diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index 75df8f6c4..203e4e0e2 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -86,11 +86,11 @@ sqlite_datasource::sqlite_datasource(parameters const& params) mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::init"); #endif - const auto file = params.get("file"); + auto const file = params.get("file"); if (!file) throw datasource_exception("Sqlite Plugin: missing parameter"); - const auto base = params.get("base"); + auto const base = params.get("base"); if (base) dataset_name_ = *base + "/" + *file; else @@ -106,11 +106,11 @@ sqlite_datasource::sqlite_datasource(parameters const& params) // TODO - remove this option once all datasources have an indexing api bool auto_index = *params.get("auto_index", true); - const auto ext = params.get("extent"); + auto const ext = params.get("extent"); if (ext.has_value()) extent_initialized_ = extent_.from_string(*ext); - const auto wkb = params.get("wkb_format"); + auto const wkb = params.get("wkb_format"); if (wkb.has_value()) { if (*wkb == "spatialite") @@ -139,13 +139,13 @@ sqlite_datasource::sqlite_datasource(parameters const& params) // databases are relative to directory containing dataset_name_. Sqlite // will default to attaching from cwd. Typicaly usage means that the // map loader will produce full paths here. - const auto attachdb = params.get("attachdb"); + auto const attachdb = params.get("attachdb"); if (attachdb.has_value()) { parse_attachdb(*attachdb); } - const auto initdb = params.get("initdb"); + auto const initdb = params.get("initdb"); if (initdb.has_value()) { init_statements_.push_back(*initdb); @@ -154,7 +154,7 @@ sqlite_datasource::sqlite_datasource(parameters const& params) // now actually create the connection and start executing setup sql dataset_ = std::make_shared(dataset_name_); - const auto table_by_index = params.get("table_by_index"); + auto const table_by_index = params.get("table_by_index"); int passed_parameters = 0; passed_parameters += params.get("table") ? 1 : 0; @@ -407,7 +407,7 @@ void sqlite_datasource::parse_attachdb(std::string const& attachdb) const } } -const char* sqlite_datasource::name() +char const* sqlite_datasource::name() { return "sqlite"; } @@ -447,7 +447,7 @@ std::optional sqlite_datasource::get_geometry_typ while (rs->is_valid() && rs->step_next()) { int size; - const char* data = (const char*)rs->column_blob(0, size); + char const* data = (char const*)rs->column_blob(0, size); if (data) { mapnik::geometry::geometry geom; @@ -495,8 +495,8 @@ featureset_ptr sqlite_datasource::features(query const& q) const std::ostringstream s; - const double px_gw = 1.0 / std::get<0>(q.resolution()); - const double px_gh = 1.0 / std::get<1>(q.resolution()); + double const px_gw = 1.0 / std::get<0>(q.resolution()); + double const px_gh = 1.0 / std::get<1>(q.resolution()); mapnik::context_ptr ctx = std::make_shared(); diff --git a/plugins/input/sqlite/sqlite_datasource.hpp b/plugins/input/sqlite/sqlite_datasource.hpp index dc3c86bfb..6d7631bf0 100644 --- a/plugins/input/sqlite/sqlite_datasource.hpp +++ b/plugins/input/sqlite/sqlite_datasource.hpp @@ -51,7 +51,7 @@ class sqlite_datasource : public mapnik::datasource sqlite_datasource(mapnik::parameters const& params); virtual ~sqlite_datasource(); datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); mapnik::featureset_ptr features(mapnik::query const& q) const override; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override; mapnik::box2d envelope() const override; @@ -79,9 +79,9 @@ class sqlite_datasource : public mapnik::datasource int row_offset_; mapnik::value_integer row_limit_; // TODO - also add to postgis.input - const std::string intersects_token_; - const std::string pixel_width_token_; - const std::string pixel_height_token_; + std::string const intersects_token_; + std::string const pixel_width_token_; + std::string const pixel_height_token_; mapnik::layer_descriptor desc_; mapnik::wkbFormat format_; bool twkb_encoding_; diff --git a/plugins/input/sqlite/sqlite_featureset.cpp b/plugins/input/sqlite/sqlite_featureset.cpp index 270f8412f..4d960cfd6 100644 --- a/plugins/input/sqlite/sqlite_featureset.cpp +++ b/plugins/input/sqlite/sqlite_featureset.cpp @@ -69,7 +69,7 @@ feature_ptr sqlite_featureset::next() while (rs_->is_valid() && rs_->step_next()) { int size; - const char* data = (const char*)rs_->column_blob(0, size); + char const* data = (char const*)rs_->column_blob(0, size); if (data == 0) { return feature_ptr(); @@ -104,8 +104,8 @@ feature_ptr sqlite_featureset::next() for (int i = 2; i < rs_->column_count(); ++i) { - const int type_oid = rs_->column_type(i); - const char* fld_name = rs_->column_name(i); + int const type_oid = rs_->column_type(i); + char const* fld_name = rs_->column_name(i); if (!fld_name) continue; @@ -132,7 +132,7 @@ feature_ptr sqlite_featureset::next() case SQLITE_TEXT: { int text_col_size; - const char* text_data = rs_->column_text(i, text_col_size); + char const* text_data = rs_->column_text(i, text_col_size); feature->put(fld_name_str, tr_->transcode(text_data, text_col_size)); break; } diff --git a/plugins/input/sqlite/sqlite_featureset.hpp b/plugins/input/sqlite/sqlite_featureset.hpp index a8abc3228..caac77d13 100644 --- a/plugins/input/sqlite/sqlite_featureset.hpp +++ b/plugins/input/sqlite/sqlite_featureset.hpp @@ -52,7 +52,7 @@ class sqlite_featureset : public mapnik::Featureset private: std::shared_ptr rs_; mapnik::context_ptr ctx_; - const std::unique_ptr tr_; + std::unique_ptr const tr_; mapnik::box2d bbox_; mapnik::wkbFormat format_; bool twkb_encoding_; diff --git a/plugins/input/sqlite/sqlite_prepared.hpp b/plugins/input/sqlite/sqlite_prepared.hpp index bbf2c979e..a8fbc5496 100644 --- a/plugins/input/sqlite/sqlite_prepared.hpp +++ b/plugins/input/sqlite/sqlite_prepared.hpp @@ -50,7 +50,7 @@ class prepared_index_statement : mapnik::util::noncopyable : ds_(ds), stmt_(0) { - const int rc = sqlite3_prepare_v2(*(*ds_), sql.c_str(), -1, &stmt_, 0); + int const rc = sqlite3_prepare_v2(*(*ds_), sql.c_str(), -1, &stmt_, 0); if (rc != SQLITE_OK) { @@ -102,7 +102,7 @@ class prepared_index_statement : mapnik::util::noncopyable bool step_next() { - const int status = sqlite3_step(stmt_); + int const status = sqlite3_step(stmt_); if (status != SQLITE_DONE) { std::ostringstream s; diff --git a/plugins/input/sqlite/sqlite_resultset.hpp b/plugins/input/sqlite/sqlite_resultset.hpp index d9f2cc8a8..7acdedecd 100644 --- a/plugins/input/sqlite/sqlite_resultset.hpp +++ b/plugins/input/sqlite/sqlite_resultset.hpp @@ -58,7 +58,7 @@ class sqlite_resultset bool step_next() { - const int status = sqlite3_step(stmt_); + int const status = sqlite3_step(stmt_); if (status != SQLITE_ROW && status != SQLITE_DONE) { std::ostringstream s; @@ -78,7 +78,7 @@ class sqlite_resultset int column_type(int col) { return sqlite3_column_type(stmt_, col); } - const char* column_name(int col) { return sqlite3_column_name(stmt_, col); } + char const* column_name(int col) { return sqlite3_column_name(stmt_, col); } bool column_isnull(int col) { return sqlite3_column_type(stmt_, col) == SQLITE_NULL; } @@ -88,18 +88,18 @@ class sqlite_resultset double column_double(int col) { return sqlite3_column_double(stmt_, col); } - const char* column_text(int col, int& len) + char const* column_text(int col, int& len) { len = sqlite3_column_bytes(stmt_, col); - return (const char*)sqlite3_column_text(stmt_, col); + return (char const*)sqlite3_column_text(stmt_, col); } - const char* column_text(int col) { return (const char*)sqlite3_column_text(stmt_, col); } + char const* column_text(int col) { return (char const*)sqlite3_column_text(stmt_, col); } - const char* column_blob(int col, int& bytes) + char const* column_blob(int col, int& bytes) { bytes = sqlite3_column_bytes(stmt_, col); - return (const char*)sqlite3_column_blob(stmt_, col); + return (char const*)sqlite3_column_blob(stmt_, col); } sqlite3_stmt* get_statement() { return stmt_; } diff --git a/plugins/input/sqlite/sqlite_utils.hpp b/plugins/input/sqlite/sqlite_utils.hpp index 58c028ac5..edb0be9a4 100644 --- a/plugins/input/sqlite/sqlite_utils.hpp +++ b/plugins/input/sqlite/sqlite_utils.hpp @@ -63,7 +63,7 @@ class sqlite_utils { if (name.size() > 0) { - const char first = name[0]; + char const first = name[0]; if (is_quote_char(first)) { return false; @@ -76,7 +76,7 @@ class sqlite_utils return false; } - static bool is_quote_char(const char z) + static bool is_quote_char(char const z) { if (z == '"' || z == '\'' || z == '[' || z == '`') { @@ -158,16 +158,16 @@ class sqlite_utils << " ORDER BY 1"; // clang-format on sqlite3_stmt* stmt = 0; - const int rc = sqlite3_prepare_v2(*(*ds), sql.str().c_str(), -1, &stmt, 0); + int const rc = sqlite3_prepare_v2(*(*ds), sql.str().c_str(), -1, &stmt, 0); if (rc == SQLITE_OK) { std::shared_ptr rs = std::make_shared(stmt); while (rs->is_valid() && rs->step_next()) { - const int type_oid = rs->column_type(0); + int const type_oid = rs->column_type(0); if (type_oid == SQLITE_TEXT) { - const char* data = rs->column_text(0); + char const* data = rs->column_text(0); if (data) { tables.push_back(std::string(data)); @@ -183,7 +183,7 @@ class sqlite_utils while (rs->is_valid() && rs->step_next()) { int size; - const char* data = static_cast(rs->column_blob(0, size)); + char const* data = static_cast(rs->column_blob(0, size)); if (data) { mapnik::geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, mapnik::wkbAuto); @@ -262,7 +262,7 @@ class sqlite_utils while (rs->is_valid() && rs->step_next()) { int size; - const char* data = (const char*)rs->column_blob(0, size); + char const* data = (char const*)rs->column_blob(0, size); if (data) { mapnik::geometry::geometry geom = @@ -273,7 +273,7 @@ class sqlite_utils if (bbox.valid()) { ps.bind(bbox); - const int type_oid = rs->column_type(1); + int const type_oid = rs->column_type(1); if (type_oid != SQLITE_INTEGER) { std::ostringstream error_msg; @@ -282,7 +282,7 @@ class sqlite_utils << ""; throw mapnik::datasource_exception(error_msg.str()); } - const sqlite_int64 pkid = rs->column_integer64(1); + sqlite_int64 const pkid = rs->column_integer64(1); ps.bind(pkid); } else @@ -340,7 +340,7 @@ class sqlite_utils while (rs->is_valid() && rs->step_next()) { int size; - const char* data = static_cast(rs->column_blob(0, size)); + char const* data = static_cast(rs->column_blob(0, size)); if (data) { mapnik::geometry::geometry geom = mapnik::geometry_utils::from_wkb(data, size, mapnik::wkbAuto); @@ -349,7 +349,7 @@ class sqlite_utils mapnik::box2d bbox = mapnik::geometry::envelope(geom); if (bbox.valid()) { - const int type_oid = rs->column_type(1); + int const type_oid = rs->column_type(1); if (type_oid != SQLITE_INTEGER) { std::ostringstream error_msg; @@ -357,7 +357,7 @@ class sqlite_utils << "' when creating index " << "type was: " << type_oid << ""; throw mapnik::datasource_exception(error_msg.str()); } - const sqlite_int64 pkid = rs->column_integer64(1); + sqlite_int64 const pkid = rs->column_integer64(1); rtree_type entry = rtree_type(); entry.pkid = pkid; entry.bbox = bbox; @@ -545,8 +545,8 @@ class sqlite_utils for (int i = 0; i < rs->column_count(); ++i) { found = true; - const int type_oid = rs->column_type(i); - const char* fld_name = rs->column_name(i); + int const type_oid = rs->column_type(i); + char const* fld_name = rs->column_name(i); switch (type_oid) { case SQLITE_INTEGER: @@ -607,7 +607,7 @@ class sqlite_utils while (rs->is_valid() && rs->step_next()) { found_table = true; - const char* fld_name = rs->column_text(1); + char const* fld_name = rs->column_text(1); std::string fld_type(rs->column_text(2)); sqlite_int64 fld_pk = rs->column_integer64(5); std::transform(fld_type.begin(), fld_type.end(), fld_type.begin(), ::tolower); diff --git a/plugins/input/tiles/mbtiles_source.hpp b/plugins/input/tiles/mbtiles_source.hpp index 310ffdf41..7cc225c30 100644 --- a/plugins/input/tiles/mbtiles_source.hpp +++ b/plugins/input/tiles/mbtiles_source.hpp @@ -70,7 +70,7 @@ class mbtiles_source : public tiles_source result = dataset_->execute_query("SELECT value FROM metadata WHERE name = 'bounds';"); if (result->is_valid() && result->step_next() && result->column_type(0) == SQLITE_TEXT) { - const std::string extent_str = result->column_text(0); + std::string const extent_str = result->column_text(0); if (extent_str.empty()) { throw mapnik::datasource_exception("MBTiles Plugin: " + database_path_ + " has invalid extent."); diff --git a/plugins/input/tiles/mvt_io.cpp b/plugins/input/tiles/mvt_io.cpp index 5c5782429..43d7e8355 100644 --- a/plugins/input/tiles/mvt_io.cpp +++ b/plugins/input/tiles/mvt_io.cpp @@ -35,7 +35,7 @@ mvt_io::mvt_layer::mvt_layer(mvt_io& io) io_(io) {} -void mvt_io::mvt_layer::add_feature(const protozero::data_view& feature) +void mvt_io::mvt_layer::add_feature(protozero::data_view const& feature) { features_.emplace_back(feature); } @@ -81,7 +81,7 @@ mapnik::feature_ptr mvt_io::mvt_layer::next_feature() { while (feature_index_ < features_.size()) { - const protozero::data_view d(features_.at(feature_index_)); + protozero::data_view const d(features_.at(feature_index_)); protozero::pbf_reader f(d); mapnik::feature_ptr feature = mapnik::feature_factory::create(io_.context_, feature_index_); ++feature_index_; @@ -217,7 +217,7 @@ bool mvt_io::read_layer(protozero::pbf_message& pbf_layer) layer_->add_key(pbf_layer.get_string()); break; case mvt_message::layer::values: { - const auto data_view(pbf_layer.get_view()); + auto const data_view(pbf_layer.get_view()); protozero::pbf_reader val_msg(data_view); while (val_msg.next()) { @@ -254,7 +254,7 @@ bool mvt_io::read_layer(protozero::pbf_message& pbf_layer) break; } case mvt_message::layer::features: { - const auto data_view(pbf_layer.get_view()); + auto const data_view(pbf_layer.get_view()); layer_->add_feature(data_view); break; } @@ -288,9 +288,9 @@ mapnik::feature_ptr mvt_io::next() mvt_io::mvt_io(std::string&& data, mapnik::context_ptr const& ctx, - const uint32_t x, - const uint32_t y, - const uint32_t zoom, + uint32_t const x, + uint32_t const y, + uint32_t const zoom, std::string layer_name) : reader_(data), context_(ctx), @@ -303,7 +303,7 @@ mvt_io::mvt_io(std::string&& data, while (reader_.next(static_cast(mvt_message::tile::layer))) { - const auto data_view(reader_.get_view()); + auto const data_view(reader_.get_view()); protozero::pbf_message msg_layer(data_view); if (read_layer(msg_layer)) { diff --git a/plugins/input/tiles/mvt_io.hpp b/plugins/input/tiles/mvt_io.hpp index 4b235ae06..eefabd0eb 100644 --- a/plugins/input/tiles/mvt_io.hpp +++ b/plugins/input/tiles/mvt_io.hpp @@ -81,7 +81,7 @@ class mvt_io public: explicit mvt_layer(mvt_io& io); - void add_feature(const protozero::data_view& feature); + void add_feature(protozero::data_view const& feature); bool has_features() const; void add_key(std::string&& key); void add_value(pbf_attr_value_type value); @@ -107,9 +107,9 @@ class mvt_io public: explicit mvt_io(std::string&& data, mapnik::context_ptr const& ctx, - const uint32_t x, - const uint32_t y, - const uint32_t zoom, + uint32_t const x, + uint32_t const y, + uint32_t const zoom, std::string layer_name); mapnik::feature_ptr next(); }; diff --git a/plugins/input/tiles/pmtiles_source.hpp b/plugins/input/tiles/pmtiles_source.hpp index f515b2a6e..de624e96c 100644 --- a/plugins/input/tiles/pmtiles_source.hpp +++ b/plugins/input/tiles/pmtiles_source.hpp @@ -66,25 +66,25 @@ struct entryv3 namespace { struct varint_too_long_exception : std::exception { - const char* what() const noexcept override { return "varint too long exception"; } + char const* what() const noexcept override { return "varint too long exception"; } }; struct end_of_buffer_exception : std::exception { - const char* what() const noexcept override { return "end of buffer exception"; } + char const* what() const noexcept override { return "end of buffer exception"; } }; struct malformed_directory_exception : std::exception { - const char* what() const noexcept override { return "malformed directory exception"; } + char const* what() const noexcept override { return "malformed directory exception"; } }; -constexpr const int8_t max_varint_length = sizeof(uint64_t) * 8 / 7 + 1; +constexpr int8_t const max_varint_length = sizeof(uint64_t) * 8 / 7 + 1; // from https://github.com/mapbox/protozero/blob/master/include/protozero/varint.hpp -uint64_t decode_varint_impl(const char** data, const char* end) +uint64_t decode_varint_impl(char const** data, char const* end) { - const auto* begin = reinterpret_cast(*data); - const auto* iend = reinterpret_cast(end); - const int8_t* p = begin; + auto const* begin = reinterpret_cast(*data); + auto const* iend = reinterpret_cast(end); + int8_t const* p = begin; uint64_t val = 0; if (iend - begin >= max_varint_length) { // fast path @@ -168,16 +168,16 @@ uint64_t decode_varint_impl(const char** data, const char* end) val |= uint64_t(*p++) << shift; } - *data = reinterpret_cast(p); + *data = reinterpret_cast(p); return val; } -uint64_t decode_varint(const char** data, const char* end) +uint64_t decode_varint(char const** data, char const* end) { // If this is a one-byte varint, decode it here. if (end != *data && ((static_cast(**data) & 0x80U) == 0)) { - const auto val = static_cast(**data); + auto const val = static_cast(**data); ++(*data); return val; } @@ -187,17 +187,17 @@ uint64_t decode_varint(const char** data, const char* end) inline std::vector deserialize_directory(std::string const& decompressed) { - const char* t = decompressed.data(); - const char* end = t + decompressed.size(); + char const* t = decompressed.data(); + char const* end = t + decompressed.size(); - const uint64_t num_entries_64bit = decode_varint(&t, end); + uint64_t const num_entries_64bit = decode_varint(&t, end); // Sanity check to avoid excessive memory allocation attempt: // each directory entry takes at least 4 bytes if (num_entries_64bit / 4U > decompressed.size()) { throw malformed_directory_exception(); } - const size_t num_entries = static_cast(num_entries_64bit); + size_t const num_entries = static_cast(num_entries_64bit); // std::cerr << "Decompressed size" << decompressed.size() << std::endl; std::vector result; result.resize(num_entries); @@ -205,19 +205,19 @@ inline std::vector deserialize_directory(std::string const& decompresse uint64_t last_id = 0; for (std::size_t i = 0; i < num_entries; ++i) { - const uint64_t val = decode_varint(&t, end); + uint64_t const val = decode_varint(&t, end); if (val > std::numeric_limits::max() - last_id) { throw malformed_directory_exception(); } - const uint64_t tile_id = last_id + val; + uint64_t const tile_id = last_id + val; result[i].tile_id = tile_id; last_id = tile_id; } for (std::size_t i = 0; i < num_entries; ++i) { - const uint64_t val = decode_varint(&t, end); + uint64_t const val = decode_varint(&t, end); if (val > std::numeric_limits::max()) { throw malformed_directory_exception(); @@ -227,7 +227,7 @@ inline std::vector deserialize_directory(std::string const& decompresse for (size_t i = 0; i < num_entries; i++) { - const uint64_t val = decode_varint(&t, end); + uint64_t const val = decode_varint(&t, end); if (val > std::numeric_limits::max()) { throw malformed_directory_exception(); diff --git a/plugins/input/tiles/tiles_datasource.cpp b/plugins/input/tiles/tiles_datasource.cpp index 2c4a9e863..b635842e2 100644 --- a/plugins/input/tiles/tiles_datasource.cpp +++ b/plugins/input/tiles/tiles_datasource.cpp @@ -54,7 +54,7 @@ mapnik::datasource::datasource_t tiles_datasource::type() const return datasource::Vector; } -const char* tiles_datasource::name() +char const* tiles_datasource::name() { return "tiles"; } diff --git a/plugins/input/tiles/tiles_datasource.hpp b/plugins/input/tiles/tiles_datasource.hpp index 8dc307c2b..194618376 100644 --- a/plugins/input/tiles/tiles_datasource.hpp +++ b/plugins/input/tiles/tiles_datasource.hpp @@ -52,7 +52,7 @@ class tiles_datasource : public mapnik::datasource tiles_datasource(mapnik::parameters const& params); virtual ~tiles_datasource(); mapnik::datasource::datasource_t type() const; - static const char* name(); + static char const* name(); mapnik::featureset_ptr features(mapnik::query const& q) const; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; mapnik::box2d envelope() const; diff --git a/plugins/input/tiles/vector_tiles_featureset.cpp b/plugins/input/tiles/vector_tiles_featureset.cpp index 6200fb138..7d37a3cdc 100644 --- a/plugins/input/tiles/vector_tiles_featureset.cpp +++ b/plugins/input/tiles/vector_tiles_featureset.cpp @@ -29,7 +29,7 @@ vector_tiles_featureset::vector_tiles_featureset(std::shared_ptr source_ptr, mapnik::context_ptr const& ctx, - const int zoom, + int const zoom, mapnik::box2d const& extent, std::string const& layer, std::unordered_map& vector_tile_cache, diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index 44f369ccc..491dc8142 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -129,18 +129,18 @@ topojson_datasource::topojson_datasource(parameters const& params) tr_(new mapnik::transcoder(*params.get("encoding", "utf-8"))), tree_(nullptr) { - const auto inline_string = params.get("inline"); + auto const inline_string = params.get("inline"); if (inline_string) { inline_string_ = *inline_string; } else { - const auto file = params.get("file"); + auto const file = params.get("file"); if (!file) throw mapnik::datasource_exception("TopoJSON Plugin: missing parameter"); - const auto base = params.get("base"); + auto const base = params.get("base"); if (base) filename_ = *base + "/" + *file; else @@ -217,7 +217,7 @@ void topojson_datasource::parse_topojson(T const& buffer) topojson_datasource::~topojson_datasource() {} -const char* topojson_datasource::name() +char const* topojson_datasource::name() { return "topojson"; } diff --git a/plugins/input/topojson/topojson_datasource.hpp b/plugins/input/topojson/topojson_datasource.hpp index 249b4b8bb..309942048 100644 --- a/plugins/input/topojson/topojson_datasource.hpp +++ b/plugins/input/topojson/topojson_datasource.hpp @@ -65,7 +65,7 @@ class topojson_datasource : public mapnik::datasource topojson_datasource(mapnik::parameters const& params); virtual ~topojson_datasource(); mapnik::datasource::datasource_t type() const override; - static const char* name(); + static char const* name(); mapnik::featureset_ptr features(mapnik::query const& q) const override; mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const override; mapnik::box2d envelope() const override; diff --git a/plugins/input/topojson/topojson_featureset.hpp b/plugins/input/topojson/topojson_featureset.hpp index bb4d461d9..f44a210bf 100644 --- a/plugins/input/topojson/topojson_featureset.hpp +++ b/plugins/input/topojson/topojson_featureset.hpp @@ -43,7 +43,7 @@ class topojson_featureset : public mapnik::Featureset mapnik::box2d box_; mapnik::topojson::topology const& topo_; mapnik::transcoder const& tr_; - const array_type index_array_; + array_type const index_array_; array_type::const_iterator index_itr_; array_type::const_iterator index_end_; std::size_t feature_id_; diff --git a/src/agg/process_dot_symbolizer.cpp b/src/agg/process_dot_symbolizer.cpp index 97fe1a3d9..b813d3096 100644 --- a/src/agg/process_dot_symbolizer.cpp +++ b/src/agg/process_dot_symbolizer.cpp @@ -102,8 +102,8 @@ void agg_renderer::process(dot_symbolizer const& sym, { double width = 0.0; double height = 0.0; - const bool has_width = has_key(sym, keys::width); - const bool has_height = has_key(sym, keys::height); + bool const has_width = has_key(sym, keys::width); + bool const has_height = has_key(sym, keys::height); if (has_width && has_height) { width = get(sym, keys::width, feature, common_.vars_, 0.0); @@ -117,10 +117,10 @@ void agg_renderer::process(dot_symbolizer const& sym, { width = height = get(sym, keys::height, feature, common_.vars_, 0.0); } - const double rx = width / 2.0 * common_.scale_factor_; - const double ry = height / 2.0 * common_.scale_factor_; - const double opacity = get(sym, keys::opacity, feature, common_.vars_, 1.0); - const color& fill = get(sym, keys::fill, feature, common_.vars_, mapnik::color(128, 128, 128)); + double const rx = width / 2.0 * common_.scale_factor_; + double const ry = height / 2.0 * common_.scale_factor_; + double const opacity = get(sym, keys::opacity, feature, common_.vars_, 1.0); + color const& fill = get(sym, keys::fill, feature, common_.vars_, mapnik::color(128, 128, 128)); ras_ptr->reset(); if (gamma_method_ != gamma_method_enum::GAMMA_POWER || gamma_ != 1.0) { diff --git a/src/agg/process_line_pattern_symbolizer.cpp b/src/agg/process_line_pattern_symbolizer.cpp index 88f0e64e5..800cbd64f 100644 --- a/src/agg/process_line_pattern_symbolizer.cpp +++ b/src/agg/process_line_pattern_symbolizer.cpp @@ -136,10 +136,10 @@ struct warp_pattern : agg_pattern_base util::apply_visitor(vertex_processor_type(apply), feature_.get_geometry()); } - const bool clip_; - const double offset_; - const box2d clip_box_; - const agg::trans_affine tr_; + bool const clip_; + double const offset_; + box2d const clip_box_; + agg::trans_affine const tr_; vc_type converter_; }; diff --git a/src/agg/process_line_symbolizer.cpp b/src/agg/process_line_symbolizer.cpp index 0f6e34da5..490bb99ae 100644 --- a/src/agg/process_line_symbolizer.cpp +++ b/src/agg/process_line_symbolizer.cpp @@ -56,7 +56,7 @@ namespace mapnik { template void set_join_caps_aa(Symbolizer const& sym, Rasterizer& ras, Feature& feature, attributes const& vars) { - const line_join_enum join = get(sym, feature, vars); + line_join_enum const join = get(sym, feature, vars); switch (join) { case line_join_enum::MITER_JOIN: @@ -72,7 +72,7 @@ void set_join_caps_aa(Symbolizer const& sym, Rasterizer& ras, Feature& feature, ras.line_join(agg::outline_no_join); } - const line_cap_enum cap = get(sym, feature, vars); + line_cap_enum const cap = get(sym, feature, vars); switch (cap) { case line_cap_enum::BUTT_CAP: @@ -93,10 +93,10 @@ void agg_renderer::process(line_symbolizer const& sym, { color const& col = get(sym, feature, common_.vars_); - const unsigned r = col.red(); - const unsigned g = col.green(); - const unsigned b = col.blue(); - const unsigned a = col.alpha(); + unsigned const r = col.red(); + unsigned const g = col.green(); + unsigned const b = col.blue(); + unsigned const a = col.alpha(); double gamma = get(sym, feature, common_.vars_); gamma_method_enum gamma_method = get(sym, feature, common_.vars_); @@ -132,13 +132,13 @@ void agg_renderer::process(line_symbolizer const& sym, box2d clip_box = clipping_extent(common_); - const value_bool clip = get(sym, feature, common_.vars_); - const value_double width = get(sym, feature, common_.vars_); - const value_double opacity = get(sym, feature, common_.vars_); - const value_double offset = get(sym, feature, common_.vars_); - const value_double simplify_tolerance = get(sym, feature, common_.vars_); - const value_double smooth = get(sym, feature, common_.vars_); - const line_rasterizer_enum rasterizer_e = + value_bool const clip = get(sym, feature, common_.vars_); + value_double const width = get(sym, feature, common_.vars_); + value_double const opacity = get(sym, feature, common_.vars_); + value_double const offset = get(sym, feature, common_.vars_); + value_double const simplify_tolerance = get(sym, feature, common_.vars_); + value_double const smooth = get(sym, feature, common_.vars_); + line_rasterizer_enum const rasterizer_e = get(sym, feature, common_.vars_); if (clip) { diff --git a/src/agg/process_polygon_symbolizer.cpp b/src/agg/process_polygon_symbolizer.cpp index d728e60c5..fe60b1d38 100644 --- a/src/agg/process_polygon_symbolizer.cpp +++ b/src/agg/process_polygon_symbolizer.cpp @@ -55,7 +55,7 @@ void agg_renderer::process(polygon_symbolizer const& sym, vertex_converter; ras_ptr->reset(); - const double gamma = get(sym, keys::gamma, feature, common_.vars_, 1.0); + double const gamma = get(sym, keys::gamma, feature, common_.vars_, 1.0); gamma_method_enum gamma_method = get(sym, keys::gamma_method, feature, common_.vars_, gamma_method_enum::GAMMA_POWER); if (gamma != gamma_ || gamma_method != gamma_method_) diff --git a/src/agg/process_shield_symbolizer.cpp b/src/agg/process_shield_symbolizer.cpp index d75609c51..dc4cff4c9 100644 --- a/src/agg/process_shield_symbolizer.cpp +++ b/src/agg/process_shield_symbolizer.cpp @@ -37,14 +37,14 @@ void agg_renderer::process(shield_symbolizer const& sym, mapnik::feature_impl& feature, proj_transform const& prj_trans) { - const box2d clip_box = clipping_extent(common_); + box2d const clip_box = clipping_extent(common_); agg::trans_affine tr; - const auto transform = get_optional(sym, keys::geometry_transform); + auto const transform = get_optional(sym, keys::geometry_transform); if (transform) evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); if (!mapnik::get(sym, keys::text_placements_)) return; - const text_symbolizer_helper helper(sym, + text_symbolizer_helper const helper(sym, feature, common_.vars_, prj_trans, @@ -57,13 +57,13 @@ void agg_renderer::process(shield_symbolizer const& sym, clip_box, tr); - const halo_rasterizer_enum halo_rasterizer = get(sym, + halo_rasterizer_enum const halo_rasterizer = get(sym, keys::halo_rasterizer, feature, common_.vars_, halo_rasterizer_enum::HALO_RASTERIZER_FULL); - const composite_mode_e comp_op = get(sym, keys::comp_op, feature, common_.vars_, src_over); - const composite_mode_e halo_comp_op = + composite_mode_e const comp_op = get(sym, keys::comp_op, feature, common_.vars_, src_over); + composite_mode_e const halo_comp_op = get(sym, keys::halo_comp_op, feature, common_.vars_, src_over); agg_text_renderer ren(buffers_.top().get(), halo_rasterizer, @@ -72,12 +72,12 @@ void agg_renderer::process(shield_symbolizer const& sym, common_.scale_factor_, common_.font_manager_.get_stroker()); - const double opacity = get(sym, keys::opacity, feature, common_.vars_, 1.0); + double const opacity = get(sym, keys::opacity, feature, common_.vars_, 1.0); placements_list const& placements = helper.get(); for (auto const& glyphs : placements) { - const marker_info_ptr mark = glyphs->get_marker(); + marker_info_ptr const mark = glyphs->get_marker(); if (mark) { render_marker(glyphs->marker_pos(), *mark->marker_, mark->transform_, opacity, comp_op); diff --git a/src/agg/process_text_symbolizer.cpp b/src/agg/process_text_symbolizer.cpp index 69539de65..54df914e4 100644 --- a/src/agg/process_text_symbolizer.cpp +++ b/src/agg/process_text_symbolizer.cpp @@ -37,14 +37,14 @@ void agg_renderer::process(text_symbolizer const& sym, mapnik::feature_impl& feature, proj_transform const& prj_trans) { - const box2d clip_box = clipping_extent(common_); + box2d const clip_box = clipping_extent(common_); agg::trans_affine tr; - const auto transform = get_optional(sym, keys::geometry_transform); + auto const transform = get_optional(sym, keys::geometry_transform); if (transform) evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); if (!mapnik::get(sym, keys::text_placements_)) return; - const text_symbolizer_helper helper(sym, + text_symbolizer_helper const helper(sym, feature, common_.vars_, prj_trans, @@ -57,13 +57,13 @@ void agg_renderer::process(text_symbolizer const& sym, clip_box, tr); - const halo_rasterizer_enum halo_rasterizer = get(sym, + halo_rasterizer_enum const halo_rasterizer = get(sym, keys::halo_rasterizer, feature, common_.vars_, halo_rasterizer_enum::HALO_RASTERIZER_FULL); - const composite_mode_e comp_op = get(sym, keys::comp_op, feature, common_.vars_, src_over); - const composite_mode_e halo_comp_op = + composite_mode_e const comp_op = get(sym, keys::comp_op, feature, common_.vars_, src_over); + composite_mode_e const halo_comp_op = get(sym, keys::halo_comp_op, feature, common_.vars_, src_over); agg_text_renderer ren(buffers_.top().get(), halo_rasterizer, @@ -72,7 +72,7 @@ void agg_renderer::process(text_symbolizer const& sym, common_.scale_factor_, common_.font_manager_.get_stroker()); - const auto halo_transform = get_optional(sym, keys::halo_transform); + auto const halo_transform = get_optional(sym, keys::halo_transform); if (halo_transform) { agg::trans_affine halo_affine_transform; diff --git a/src/cairo/cairo_context.cpp b/src/cairo/cairo_context.cpp index 13e0de2f6..2c4eab806 100644 --- a/src/cairo/cairo_context.cpp +++ b/src/cairo/cairo_context.cpp @@ -325,7 +325,7 @@ void cairo_context::set_pattern(cairo_pattern const& pattern) check_object_status_and_throw_exception(*this); } -void cairo_context::set_gradient(cairo_gradient const& pattern, const box2d& bbox) +void cairo_context::set_gradient(cairo_gradient const& pattern, box2d const& bbox) { cairo_pattern_t* gradient = pattern.gradient(); double bx1 = bbox.minx(); @@ -449,8 +449,8 @@ void cairo_context::add_text(glyph_positions const& pos, { auto off = generate_offset(); pixel_position const& base_point = pos.get_base_point(); - const double sx = base_point.x; - const double sy = base_point.y; + double const sx = base_point.x; + double const sy = base_point.y; // render halo double halo_radius = 0; set_operator(halo_comp_op); diff --git a/src/cairo/cairo_renderer.cpp b/src/cairo/cairo_renderer.cpp index 5f3ee5279..495f77037 100644 --- a/src/cairo/cairo_renderer.cpp +++ b/src/cairo/cairo_renderer.cpp @@ -118,13 +118,13 @@ struct setup_marker_visitor void operator()(marker_rgba8 const& marker) const { mapnik::image_rgba8 const& bg_image = marker.get_data(); - const std::size_t w = bg_image.width(); - const std::size_t h = bg_image.height(); + std::size_t const w = bg_image.width(); + std::size_t const h = bg_image.height(); if (w > 0 && h > 0) { // repeat background-image both vertically and horizontally - const std::size_t x_steps = std::size_t(std::ceil(common_.width_ / double(w))); - const std::size_t y_steps = std::size_t(std::ceil(common_.height_ / double(h))); + std::size_t const x_steps = std::size_t(std::ceil(common_.width_ / double(w))); + std::size_t const y_steps = std::size_t(std::ceil(common_.height_ / double(h))); for (std::size_t x = 0; x < x_steps; ++x) { for (std::size_t y = 0; y < y_steps; ++y) @@ -144,7 +144,7 @@ struct setup_marker_visitor template void cairo_renderer::setup(Map const& map) { - const auto bg = m_.background(); + auto const bg = m_.background(); if (bg.has_value()) { cairo_save_restore guard(context_); @@ -166,7 +166,7 @@ template void cairo_renderer::start_map_processing(Map const& map) { MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer: Start map processing bbox=" << map.get_current_extent(); - const box2d bounds = common_.t_.forward(common_.t_.extent()); + box2d const bounds = common_.t_.forward(common_.t_.extent()); context_.rectangle(bounds.minx(), bounds.miny(), bounds.maxx(), bounds.maxy()); context_.clip(); } diff --git a/src/cairo/process_line_pattern_symbolizer.cpp b/src/cairo/process_line_pattern_symbolizer.cpp index 231e5c52b..72aa76acd 100644 --- a/src/cairo/process_line_pattern_symbolizer.cpp +++ b/src/cairo/process_line_pattern_symbolizer.cpp @@ -170,10 +170,10 @@ struct warp_pattern : cairo_pattern_base mapnik::util::apply_visitor(vertex_processor_type(apply), feature_.get_geometry()); } - const bool clip_; - const double offset_; - const box2d clip_box_; - const agg::trans_affine tr_; + bool const clip_; + double const offset_; + box2d const clip_box_; + agg::trans_affine const tr_; vc_type converter_; }; @@ -216,7 +216,7 @@ void cairo_renderer::process(line_pattern_symbolizer const& sym, return; } - const line_pattern_enum pattern = get(sym, feature, common_.vars_); + line_pattern_enum const pattern = get(sym, feature, common_.vars_); switch (pattern) { case line_pattern_enum::LINE_PATTERN_WARP: { diff --git a/src/cairo_io.cpp b/src/cairo_io.cpp index 70c07539b..4510a9e32 100644 --- a/src/cairo_io.cpp +++ b/src/cairo_io.cpp @@ -53,7 +53,7 @@ void save_to_cairo_file(mapnik::Map const& map, double scale_factor, double scale_denominator) { - const auto type = type_from_filename(filename); + auto const type = type_from_filename(filename); if (type.has_value()) { save_to_cairo_file(map, filename, *type, scale_factor, scale_denominator); diff --git a/src/conversions_numeric.cpp b/src/conversions_numeric.cpp index d5c694410..adc38422e 100644 --- a/src/conversions_numeric.cpp +++ b/src/conversions_numeric.cpp @@ -73,13 +73,13 @@ bool string2bool(std::string const& value, bool& result) return false; } -bool string2bool(const char* iter, const char* end, bool& result) +bool string2bool(char const* iter, char const* end, bool& result) { std::string val(iter, end); return string2bool(val, result); } -bool string2int(const char* iter, const char* end, int& result) +bool string2int(char const* iter, char const* end, int& result) { x3::ascii::space_type space; bool r = x3::phrase_parse(iter, end, INTEGER, space, result); @@ -96,7 +96,7 @@ bool string2int(std::string const& value, int& result) } #ifdef BIGINT -bool string2int(const char* iter, const char* end, mapnik::value_integer& result) +bool string2int(char const* iter, char const* end, mapnik::value_integer& result) { x3::ascii::space_type space; bool r = x3::phrase_parse(iter, end, x3::long_long, space, result); @@ -122,7 +122,7 @@ bool string2double(std::string const& value, double& result) return r && (str_beg == str_end); } -bool string2double(const char* iter, const char* end, double& result) +bool string2double(char const* iter, char const* end, double& result) { x3::ascii::space_type space; bool r = x3::phrase_parse(iter, end, DOUBLE, space, result); @@ -138,7 +138,7 @@ bool string2float(std::string const& value, float& result) return r && (str_beg == str_end); } -bool string2float(const char* iter, const char* end, float& result) +bool string2float(char const* iter, char const* end, float& result) { x3::ascii::space_type space; bool r = x3::phrase_parse(iter, end, FLOAT, space, result); diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 72341f463..d591545bb 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -59,7 +59,7 @@ datasource_cache::~datasource_cache() {} datasource_ptr datasource_cache::create(parameters const& params) { - const auto type = params.get("type"); + auto const type = params.get("type"); if (!type.has_value()) { throw config_error(std::string("Could not create datasource. Required ") + "parameter 'type' is missing"); @@ -127,8 +127,8 @@ std::string datasource_cache::plugin_directories() bool datasource_cache::plugin_registered(std::string const& plugin_name) const { #ifdef MAPNIK_STATIC_PLUGINS - const auto static_names = get_static_datasource_names(); - const auto static_it = std::find(static_names.begin(), static_names.end(), plugin_name); + auto const static_names = get_static_datasource_names(); + auto const static_it = std::find(static_names.begin(), static_names.end(), plugin_name); if (static_it != static_names.end()) return true; #endif diff --git a/src/datasource_cache_static.cpp b/src/datasource_cache_static.cpp index 16da66935..fb00db2fd 100644 --- a/src/datasource_cache_static.cpp +++ b/src/datasource_cache_static.cpp @@ -154,7 +154,7 @@ void init_datasource_cache_static() datasource_ptr create_static_datasource(parameters const& params) { - const auto type = params.get("type"); + auto const type = params.get("type"); datasource_map::iterator it = ds_map.find(*type); if (it != ds_map.end()) { diff --git a/src/debug.cpp b/src/debug.cpp index cdb8b2cae..4b040603a 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -88,7 +88,7 @@ std::string logger::str() { logger::format_env_check_ = false; - const char* log_format = std::getenv("MAPNIK_LOG_FORMAT"); + char const* log_format = std::getenv("MAPNIK_LOG_FORMAT"); if (log_format != nullptr) { logger::format_ = log_format; @@ -97,7 +97,7 @@ std::string logger::str() #endif char buf[256]; - const time_t tm = time(0); + time_t const tm = time(0); std::strftime(buf, sizeof(buf), logger::format_.c_str(), localtime(&tm)); return buf; } diff --git a/src/geometry/interior.cpp b/src/geometry/interior.cpp index f2836acc5..cff1b9d36 100644 --- a/src/geometry/interior.cpp +++ b/src/geometry/interior.cpp @@ -42,7 +42,7 @@ namespace detail { // get squared distance from a point to a segment template -T segment_dist_sq(const point& p, const point& a, const point& b) +T segment_dist_sq(point const& p, point const& a, point const& b) { auto x = a.x; auto y = a.y; @@ -73,17 +73,17 @@ T segment_dist_sq(const point& p, const point& a, const point& b) // signed distance from point to polygon outline (negative if point is outside) template -auto point_to_polygon_dist(const point& point, const polygon& polygon) +auto point_to_polygon_dist(point const& point, polygon const& polygon) { bool inside = false; auto min_dist_sq = std::numeric_limits::infinity(); - for (const auto& ring : polygon) + for (auto const& ring : polygon) { for (std::size_t i = 0, len = ring.size(), j = len - 1; i < len; j = i++) { - const auto& a = ring[i]; - const auto& b = ring[j]; + auto const& a = ring[i]; + auto const& b = ring[j]; if ((a.y > point.y) != (b.y > point.y) && (point.x < (b.x - a.x) * (point.y - a.y) / (b.y - a.y) + a.x)) inside = !inside; @@ -103,7 +103,7 @@ struct fitness_functor max_size(std::max(polygon_size.x, polygon_size.y)) {} - T operator()(const point& cell_center, T distance_polygon) const + T operator()(point const& cell_center, T distance_polygon) const { if (distance_polygon <= 0) { @@ -122,7 +122,7 @@ template struct cell { template - cell(const point& c_, T h_, const polygon& polygon, const FitnessFunc& ff) + cell(point const& c_, T h_, polygon const& polygon, FitnessFunc const& ff) : c(c_), h(h_), d(point_to_polygon_dist(c, polygon)), @@ -140,13 +140,13 @@ struct cell template point polylabel(polygon const& polygon, box2d const& bbox, T precision = 1) { - const point size{bbox.width(), bbox.height()}; + point const size{bbox.width(), bbox.height()}; - const T cell_size = std::min(size.x, size.y); + T const cell_size = std::min(size.x, size.y); T h = cell_size / 2; // a priority queue of cells in order of their "potential" (max distance to polygon) - auto compare_func = [](const cell& a, const cell& b) { + auto compare_func = [](cell const& a, cell const& b) { return a.max_fitness < b.max_fitness; }; using Queue = std::priority_queue, std::vector>, decltype(compare_func)>; @@ -215,7 +215,7 @@ bool interior(polygon const& polygon, double scale_factor, point& pt) return false; } - const box2d bbox = envelope(polygon.at(0)); + box2d const bbox = envelope(polygon.at(0)); // Let the precision be 1% of the polygon size to be independent to map scale. double precision = (std::max(bbox.width(), bbox.height()) / 100.0) * scale_factor; diff --git a/src/geometry/polylabel.cpp b/src/geometry/polylabel.cpp index 085d2e1ac..72e0c9bc6 100644 --- a/src/geometry/polylabel.cpp +++ b/src/geometry/polylabel.cpp @@ -30,7 +30,7 @@ namespace geometry { template T polylabel_precision(polygon const& polygon, double scale_factor) { - const box2d bbox = mapnik::geometry::envelope(polygon); + box2d const bbox = mapnik::geometry::envelope(polygon); // Let the precision be 1% of the polygon size to be independent to map scale. return (std::max(bbox.width(), bbox.height()) / 100.0) * scale_factor; } diff --git a/src/glibc_workaround.cpp b/src/glibc_workaround.cpp index 80825d235..55305bcf6 100644 --- a/src/glibc_workaround.cpp +++ b/src/glibc_workaround.cpp @@ -34,8 +34,8 @@ namespace std { -void __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__)); -void __throw_out_of_range_fmt(const char* err, ...) +void __throw_out_of_range_fmt(char const*, ...) __attribute__((__noreturn__)); +void __throw_out_of_range_fmt(char const* err, ...) { // Safe and over-simplified version. Ignore the format and print it as-is. __throw_out_of_range(err); diff --git a/src/grid/grid.cpp b/src/grid/grid.cpp index b478dbfb9..427a1e8f6 100644 --- a/src/grid/grid.cpp +++ b/src/grid/grid.cpp @@ -33,7 +33,7 @@ namespace mapnik { template -const typename hit_grid::value_type hit_grid::base_mask = std::numeric_limits::min(); +typename hit_grid::value_type const hit_grid::base_mask = std::numeric_limits::min(); template hit_grid::hit_grid(std::size_t width, std::size_t height, std::string const& key) diff --git a/src/grid/process_line_pattern_symbolizer.cpp b/src/grid/process_line_pattern_symbolizer.cpp index 0ec6d1fc4..c5289fbf3 100644 --- a/src/grid/process_line_pattern_symbolizer.cpp +++ b/src/grid/process_line_pattern_symbolizer.cpp @@ -54,10 +54,10 @@ void grid_renderer::process(line_pattern_symbolizer const& sym, mapnik::feature_impl& feature, proj_transform const& prj_trans) { - const std::string filename = get(sym, feature, common_.vars_); + std::string const filename = get(sym, feature, common_.vars_); if (filename.empty()) return; - const auto mark = marker_cache::instance().find(filename, true); + auto const mark = marker_cache::instance().find(filename, true); if (mark->is()) return; @@ -68,10 +68,10 @@ void grid_renderer::process(line_pattern_symbolizer const& sym, return; } - const value_bool clip = get(sym, feature, common_.vars_); - const value_double offset = get(sym, feature, common_.vars_); - const value_double simplify_tolerance = get(sym, feature, common_.vars_); - const value_double smooth = get(sym, feature, common_.vars_); + value_bool const clip = get(sym, feature, common_.vars_); + value_double const offset = get(sym, feature, common_.vars_); + value_double const simplify_tolerance = get(sym, feature, common_.vars_); + value_double const smooth = get(sym, feature, common_.vars_); using pixfmt_type = typename grid_renderer_base_type::pixfmt_type; using color_type = typename grid_renderer_base_type::pixfmt_type::color_type; @@ -88,12 +88,12 @@ void grid_renderer::process(line_pattern_symbolizer const& sym, ras_ptr->reset(); line_pattern_enum pattern = get(sym, feature, common_.vars_); - const std::size_t stroke_width = (pattern == line_pattern_enum::LINE_PATTERN_WARP) + std::size_t const stroke_width = (pattern == line_pattern_enum::LINE_PATTERN_WARP) ? mark->width() : get(sym, feature, common_.vars_); agg::trans_affine tr; - const auto transform = get_optional(sym, keys::geometry_transform); + auto const transform = get_optional(sym, keys::geometry_transform); if (transform) { evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_); @@ -102,10 +102,10 @@ void grid_renderer::process(line_pattern_symbolizer const& sym, box2d clipping_extent = common_.query_extent_; if (clip) { - const double pad_per_pixel = static_cast(common_.query_extent_.width() / common_.width_); - const double pixels = std::ceil( + double const pad_per_pixel = static_cast(common_.query_extent_.width() / common_.width_); + double const pixels = std::ceil( std::max(stroke_width / 2.0 + std::fabs(offset), (std::fabs(offset) * offset_converter_default_threshold))); - const double padding = pad_per_pixel * pixels * common_.scale_factor_; + double const padding = pad_per_pixel * pixels * common_.scale_factor_; clipping_extent.pad(padding); } diff --git a/src/group/group_rule.cpp b/src/group/group_rule.cpp index 064a3f1ee..774842b44 100644 --- a/src/group/group_rule.cpp +++ b/src/group/group_rule.cpp @@ -29,12 +29,12 @@ namespace mapnik { -group_rule::group_rule(const expression_ptr& filter, const expression_ptr& repeat_key) +group_rule::group_rule(expression_ptr const& filter, expression_ptr const& repeat_key) : filter_(filter), repeat_key_(repeat_key) {} -group_rule& group_rule::operator=(const group_rule& rhs) +group_rule& group_rule::operator=(group_rule const& rhs) { group_rule tmp(rhs); filter_.swap(tmp.filter_); @@ -42,12 +42,12 @@ group_rule& group_rule::operator=(const group_rule& rhs) return *this; } -bool group_rule::operator==(const group_rule& rhs) const +bool group_rule::operator==(group_rule const& rhs) const { return (this == &rhs); } -void group_rule::append(const mapnik::symbolizer& sym) +void group_rule::append(mapnik::symbolizer const& sym) { symbolizers_.push_back(sym); } diff --git a/src/image_any.cpp b/src/image_any.cpp index 3e6937649..19c60437a 100644 --- a/src/image_any.cpp +++ b/src/image_any.cpp @@ -162,7 +162,7 @@ image_any::image_any(int width, int height, image_dtype type, bool initialize, b : image_base(std::move(create_image_any(width, height, type, initialize, premultiplied, painted))) {} -MAPNIK_DECL unsigned char const* image_any::bytes() const +MAPNIK_DECL const unsigned char* image_any::bytes() const { return util::apply_visitor(detail::get_bytes_visitor_const(), *this); } diff --git a/src/image_compositing.cpp b/src/image_compositing.cpp index a4ec887d1..a609c9fa9 100644 --- a/src/image_compositing.cpp +++ b/src/image_compositing.cpp @@ -49,7 +49,7 @@ MAPNIK_DISABLE_WARNING_POP namespace mapnik { using comp_op_lookup_type = boost::bimap; -static const comp_op_lookup_type comp_lookup = +static comp_op_lookup_type const comp_lookup = boost::assign::list_of(clear, "clear")(src, "src")(dst, "dst")(src_over, "src-over")( dst_over, "dst-over")(src_in, "src-in")(dst_in, "dst-in")(src_out, "src-out")(dst_out, "dst-out")(src_atop, "src-atop")( diff --git a/src/image_reader.cpp b/src/image_reader.cpp index 309967f67..ece3ea588 100644 --- a/src/image_reader.cpp +++ b/src/image_reader.cpp @@ -64,7 +64,7 @@ inline std::optional type_from_bytes(char const* data, size_t size) image_reader* get_image_reader(char const* data, size_t size) { - const auto type = type_from_bytes(data, size); + auto const type = type_from_bytes(data, size); if (type.has_value()) return factory::instance().create_object(*type, data, size); else @@ -78,7 +78,7 @@ image_reader* get_image_reader(std::string const& filename, std::string const& t image_reader* get_image_reader(std::string const& filename) { - const auto type = type_from_filename(filename); + auto const type = type_from_filename(filename); if (type.has_value()) { return factory::instance().create_object(*type, filename); diff --git a/src/image_scaling.cpp b/src/image_scaling.cpp index d596f6df0..fe357409f 100644 --- a/src/image_scaling.cpp +++ b/src/image_scaling.cpp @@ -55,7 +55,7 @@ MAPNIK_DISABLE_WARNING_POP namespace mapnik { using scaling_method_lookup_type = boost::bimap; -static const scaling_method_lookup_type scaling_lookup = +static scaling_method_lookup_type const scaling_lookup = boost::assign::list_of(SCALING_NEAR, "near")(SCALING_BILINEAR, "bilinear")( SCALING_BICUBIC, "bicubic")(SCALING_SPLINE16, "spline16")(SCALING_SPLINE36, "spline36")(SCALING_HANNING, "hanning")( diff --git a/src/image_util.cpp b/src/image_util.cpp index a92f1eb50..0f081622d 100644 --- a/src/image_util.cpp +++ b/src/image_util.cpp @@ -313,7 +313,7 @@ MAPNIK_DECL void template MAPNIK_DECL void save_to_file(T const& image, std::string const& filename) { - const auto type = type_from_filename(filename); + auto const type = type_from_filename(filename); if (type.has_value()) { save_to_file(image, filename, *type); @@ -325,7 +325,7 @@ MAPNIK_DECL void save_to_file(T const& image, std::string const& filename) template MAPNIK_DECL void save_to_file(T const& image, std::string const& filename, rgba_palette const& palette) { - const auto type = type_from_filename(filename); + auto const type = type_from_filename(filename); if (type.has_value()) { save_to_file(image, filename, *type, palette); @@ -425,7 +425,7 @@ struct is_solid_visitor if (image.size() > 0) { pixel_type const first_p = *image.begin(); - const auto itr = std::find_if(/*std::execution::par_unseq,*/ // still missing on ubuntu with + auto const itr = std::find_if(/*std::execution::par_unseq,*/ // still missing on ubuntu with // clang++10/libc++ (!) image.begin(), image.end(), @@ -2132,7 +2132,7 @@ struct visitor_view_to_stream { for (std::size_t i = 0; i < view.height(); i++) { - os_.write(reinterpret_cast(view.get_row(i)), safe_cast(view.row_size())); + os_.write(reinterpret_cast(view.get_row(i)), safe_cast(view.row_size())); } } @@ -2199,8 +2199,8 @@ MAPNIK_DECL std::size_t compare(T const& im1, T const& im2, double threshold, bo std::size_t difference = 0; for (std::size_t y = 0; y < im1.height(); ++y) { - const pixel_type* row_from = im1.get_row(y); - const pixel_type* row_from2 = im2.get_row(y); + pixel_type const* row_from = im1.get_row(y); + pixel_type const* row_from2 = im2.get_row(y); for (std::size_t x = 0; x < im1.width(); ++x) { double d = std::abs(static_cast(row_from[x]) - static_cast(row_from2[x])); @@ -2254,8 +2254,8 @@ MAPNIK_DECL std::size_t { for (unsigned int y = 0; y < im1.height(); ++y) { - const pixel_type* row_from = im1.get_row(y); - const pixel_type* row_from2 = im2.get_row(y); + pixel_type const* row_from = im1.get_row(y); + pixel_type const* row_from2 = im2.get_row(y); int x = 0; for (; x < ROUND_DOWN(im1.width(), 4); x += 4) { @@ -2288,8 +2288,8 @@ MAPNIK_DECL std::size_t __m128i m_thres = _mm_set1_epi8(thres); for (unsigned int y = 0; y < im1.height(); ++y) { - const pixel_type* row_from = im1.get_row(y); - const pixel_type* row_from2 = im2.get_row(y); + pixel_type const* row_from = im1.get_row(y); + pixel_type const* row_from2 = im2.get_row(y); int x = 0; for (; x < ROUND_DOWN(im1.width(), 4); x += 4) { @@ -2341,8 +2341,8 @@ MAPNIK_DECL std::size_t #else for (unsigned int y = 0; y < im1.height(); ++y) { - const pixel_type* row_from = im1.get_row(y); - const pixel_type* row_from2 = im2.get_row(y); + pixel_type const* row_from = im1.get_row(y); + pixel_type const* row_from2 = im2.get_row(y); for (unsigned int x = 0; x < im1.width(); ++x) { unsigned rgba = row_from[x]; diff --git a/src/jpeg_reader.cpp b/src/jpeg_reader.cpp index 854d25c2f..2c5982e56 100644 --- a/src/jpeg_reader.cpp +++ b/src/jpeg_reader.cpp @@ -43,7 +43,7 @@ class jpeg_reader : public image_reader public: using source_type = T; using input_stream = std::iostream; - const static unsigned BUF_SIZE = 4096; + static unsigned const BUF_SIZE = 4096; private: struct jpeg_stream_wrapper @@ -102,8 +102,8 @@ image_reader* create_jpeg_reader2(char const* data, size_t size) } void register_jpeg_reader() { - [[maybe_unused]] const bool registered = register_image_reader("jpeg", create_jpeg_reader); - [[maybe_unused]] const bool registered2 = register_image_reader("jpeg", create_jpeg_reader2); + [[maybe_unused]] bool const registered = register_image_reader("jpeg", create_jpeg_reader); + [[maybe_unused]] bool const registered2 = register_image_reader("jpeg", create_jpeg_reader2); } // ctors @@ -289,10 +289,10 @@ void jpeg_reader::read(unsigned x0, unsigned y0, image_rgba8& image) row_stride = cinfo.output_width * cinfo.output_components; buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo, JPOOL_IMAGE, row_stride, 1); - const unsigned w = std::min(unsigned(image.width()), width_ - x0); - const unsigned h = std::min(unsigned(image.height()), height_ - y0); + unsigned const w = std::min(unsigned(image.width()), width_ - x0); + unsigned const h = std::min(unsigned(image.height()), height_ - y0); - const std::unique_ptr out_row(new unsigned int[w]); + std::unique_ptr const out_row(new unsigned int[w]); unsigned row = 0; while (cinfo.output_scanline < cinfo.output_height) { diff --git a/src/json/feature_from_geojson.cpp b/src/json/feature_from_geojson.cpp index 321d2bbfb..04379a0a1 100644 --- a/src/json/feature_from_geojson.cpp +++ b/src/json/feature_from_geojson.cpp @@ -31,8 +31,8 @@ bool from_geojson(std::string const& json, feature_impl& feature) { try { - const char* start = json.c_str(); - const char* end = start + json.length(); + char const* start = json.c_str(); + char const* end = start + json.length(); mapnik::json::parse_feature(start, end, feature); } catch (...) diff --git a/src/json/geometry_from_geojson.cpp b/src/json/geometry_from_geojson.cpp index 1d09b0670..9768b78e1 100644 --- a/src/json/geometry_from_geojson.cpp +++ b/src/json/geometry_from_geojson.cpp @@ -35,8 +35,8 @@ bool from_geojson(std::string const& json, mapnik::geometry::geometry& g auto grammar = mapnik::json::grammar::geometry_rule; try { - const char* start = json.c_str(); - const char* end = start + json.length(); + char const* start = json.c_str(); + char const* end = start + json.length(); if (!x3::phrase_parse(start, end, grammar, space_type(), geom)) { throw std::runtime_error("Can't parser GeoJSON Geometry"); diff --git a/src/json/mapnik_geometry_to_geojson.cpp b/src/json/mapnik_geometry_to_geojson.cpp index e6c32d621..be414e642 100644 --- a/src/json/mapnik_geometry_to_geojson.cpp +++ b/src/json/mapnik_geometry_to_geojson.cpp @@ -30,7 +30,7 @@ namespace util { bool to_geojson(std::string& json, mapnik::geometry::geometry const& geom) { using sink_type = std::back_insert_iterator; - static const mapnik::json::geometry_generator_grammar> grammar; + static mapnik::json::geometry_generator_grammar> const grammar; sink_type sink(json); return boost::spirit::karma::generate(sink, grammar, geom); } diff --git a/src/libxml2_loader.cpp b/src/libxml2_loader.cpp index 70ad243ff..fd7c154c1 100644 --- a/src/libxml2_loader.cpp +++ b/src/libxml2_loader.cpp @@ -55,7 +55,7 @@ namespace mapnik { class libxml2_loader : util::noncopyable { public: - libxml2_loader(const char* encoding = nullptr, int options = DEFAULT_OPTIONS, const char* url = nullptr) + libxml2_loader(char const* encoding = nullptr, int options = DEFAULT_OPTIONS, char const* url = nullptr) : ctx_(0), encoding_(encoding), options_(options), @@ -88,7 +88,7 @@ class libxml2_loader : util::noncopyable if (!doc) { - const xmlError* error = xmlCtxtGetLastError(ctx_); + xmlError const* error = xmlCtxtGetLastError(ctx_); if (error) { std::string msg("XML document not well formed:\n"); @@ -101,7 +101,7 @@ class libxml2_loader : util::noncopyable load(doc, node); } - void load(const int fd, xml_node& node) + void load(int const fd, xml_node& node) { xmlDocPtr doc = xmlCtxtReadFd(ctx_, fd, url_, encoding_, options_); load(doc, node); @@ -123,12 +123,12 @@ class libxml2_loader : util::noncopyable load(doc, node); } - void load(const xmlDocPtr doc, xml_node& node) + void load(xmlDocPtr const doc, xml_node& node) { if (!doc) { std::string msg("XML document not well formed"); - const xmlError* error = xmlCtxtGetLastError(ctx_); + xmlError const* error = xmlCtxtGetLastError(ctx_); if (error) { msg += ":\n"; @@ -165,8 +165,8 @@ class libxml2_loader : util::noncopyable { for (; attributes; attributes = attributes->next) { - node.add_attribute(reinterpret_cast(attributes->name), - reinterpret_cast(attributes->children->content)); + node.add_attribute(reinterpret_cast(attributes->name), + reinterpret_cast(attributes->children->content)); } } @@ -178,13 +178,13 @@ class libxml2_loader : util::noncopyable { case XML_ELEMENT_NODE: { xml_node& new_node = - node.add_child(reinterpret_cast(cur_node->name), cur_node->line, false); + node.add_child(reinterpret_cast(cur_node->name), cur_node->line, false); append_attributes(cur_node->properties, new_node); populate_tree(cur_node->children, new_node); } break; case XML_TEXT_NODE: { - std::string trimmed(reinterpret_cast(cur_node->content)); + std::string trimmed(reinterpret_cast(cur_node->content)); mapnik::util::trim(trimmed); if (trimmed.empty()) break; // Don't add empty text nodes @@ -200,9 +200,9 @@ class libxml2_loader : util::noncopyable } xmlParserCtxtPtr ctx_; - const char* encoding_; + char const* encoding_; int options_; - const char* url_; + char const* url_; }; void read_xml(std::string const& filename, xml_node& node) diff --git a/src/load_map.cpp b/src/load_map.cpp index d3be303a2..45e4c3737 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -552,7 +552,7 @@ void map_parser::parse_style(Map& map, xml_node const& node) if (!map.insert_style(name, std::move(style))) { - boost::optional dupe = map.find_style(name); + boost::optional dupe = map.find_style(name); if (strict_) { if (dupe) @@ -848,8 +848,8 @@ void map_parser::parse_layer(Parent& parent, xml_node const& node) } } - const auto base_param = params.get("base"); - const auto file_param = params.get("file"); + auto const base_param = params.get("base"); + auto const file_param = params.get("file"); if (base_param.has_value()) { @@ -1460,7 +1460,7 @@ void map_parser::parse_raster_symbolizer(rule& rule, xml_node const& node) } else { - const auto method = scaling_method_from_string(scaling_method); + auto const method = scaling_method_from_string(scaling_method); if (method.has_value()) { put(raster_sym, keys::scaling, *method); @@ -1561,7 +1561,7 @@ void map_parser::parse_group_symbolizer(rule& rule, xml_node const& node) put(symbol, keys::group_properties, prop); rule.append(std::move(symbol)); } - catch (const config_error& ex) + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1700,7 +1700,7 @@ void map_parser::parse_group_rule(group_symbolizer_properties& prop, xml_node co prop.add_rule(std::move(rule)); } - catch (const config_error& ex) + catch (config_error const& ex) { ex.append_context(node); throw; diff --git a/src/memory_datasource.cpp b/src/memory_datasource.cpp index ce022658e..03bf9eacb 100644 --- a/src/memory_datasource.cpp +++ b/src/memory_datasource.cpp @@ -69,7 +69,7 @@ struct accumulate_extent bool first_; }; -const char* memory_datasource::name() +char const* memory_datasource::name() { return mapnik::memory_datasource_plugin::kName; } @@ -121,7 +121,7 @@ datasource::datasource_t memory_datasource::type() const return type_; } -featureset_ptr memory_datasource::features(const query& q) const +featureset_ptr memory_datasource::features(query const& q) const { if (features_.empty()) { diff --git a/src/palette.cpp b/src/palette.cpp index 6fc0b7a49..16388c5fc 100644 --- a/src/palette.cpp +++ b/src/palette.cpp @@ -37,7 +37,7 @@ rgb::rgb(rgba const& c) {} // ordering by mean(a,r,g,b), a, r, g, b -bool rgba::mean_sort_cmp::operator()(const rgba& x, const rgba& y) const +bool rgba::mean_sort_cmp::operator()(rgba const& x, rgba const& y) const { int t1 = x.a + x.r + x.g + x.b; int t2 = y.a + y.r + y.g + y.b; diff --git a/src/plugin.cpp b/src/plugin.cpp index ed681e034..0964ad38f 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -106,7 +106,7 @@ PluginInfo::PluginInfo(std::string const& filename, std::string const& library_n } else { - const auto errcode = dlerror(); + auto const errcode = dlerror(); #ifdef _WIN32 module_->error_str = std::system_category().message(errcode); #else diff --git a/src/png_reader.cpp b/src/png_reader.cpp index 8928ada1f..5ef877f53 100644 --- a/src/png_reader.cpp +++ b/src/png_reader.cpp @@ -92,8 +92,8 @@ image_reader* create_png_reader2(char const* data, std::size_t size) void register_png_reader() { - [[maybe_unused]] const bool registered = register_image_reader("png", create_png_reader); - [[maybe_unused]] const bool registered2 = register_image_reader("png", create_png_reader2); + [[maybe_unused]] bool const registered = register_image_reader("png", create_png_reader); + [[maybe_unused]] bool const registered2 = register_image_reader("png", create_png_reader2); } void user_error_fn(png_structp /*png_ptr*/, png_const_charp error_msg) @@ -271,7 +271,7 @@ void png_reader::read(unsigned x0, unsigned y0, image_rgba8& image) png_read_update_info(png_ptr, info_ptr); // we can read whole image at once // alloc row pointers - const std::unique_ptr rows(new png_bytep[height_]); + std::unique_ptr const rows(new png_bytep[height_]); for (unsigned i = 0; i < height_; ++i) rows[i] = (png_bytep)image.get_row(i); png_read_image(png_ptr, rows.get()); @@ -282,7 +282,7 @@ void png_reader::read(unsigned x0, unsigned y0, image_rgba8& image) unsigned w = std::min(unsigned(image.width()), width_ - x0); unsigned h = std::min(unsigned(image.height()), height_ - y0); unsigned rowbytes = png_get_rowbytes(png_ptr, info_ptr); - const std::unique_ptr row(new png_byte[rowbytes]); + std::unique_ptr const row(new png_byte[rowbytes]); // START read image rows for (unsigned i = 0; i < height_; ++i) { diff --git a/src/proj_transform.cpp b/src/proj_transform.cpp index 700353235..b5d3cb2aa 100644 --- a/src/proj_transform.cpp +++ b/src/proj_transform.cpp @@ -133,8 +133,8 @@ proj_transform::proj_transform(projection const& source, projection const& dest) { is_source_longlat_ = source.is_geographic(); is_dest_longlat_ = dest.is_geographic(); - const auto src_k = source.well_known(); - const auto dest_k = dest.well_known(); + auto const src_k = source.well_known(); + auto const dest_k = dest.well_known(); bool known_trans = false; if (src_k && dest_k) { diff --git a/src/projection.cpp b/src/projection.cpp index aac4a343c..7ee9bdc91 100644 --- a/src/projection.cpp +++ b/src/projection.cpp @@ -44,7 +44,7 @@ projection::projection(std::string const& params, bool defer_proj_init) proj_(nullptr), proj_ctx_(nullptr) { - const auto is_known = is_known_geographic(params_); + auto const is_known = is_known_geographic(params_); if (is_known.has_value()) { is_geographic_ = *is_known; @@ -84,12 +84,12 @@ projection& projection::operator=(projection const& rhs) return *this; } -bool projection::operator==(const projection& other) const +bool projection::operator==(projection const& other) const { return (params_ == other.params_); } -bool projection::operator!=(const projection& other) const +bool projection::operator!=(projection const& other) const { return !(*this == other); } diff --git a/src/rapidxml_loader.cpp b/src/rapidxml_loader.cpp index a3a3a9e4c..2758301ab 100644 --- a/src/rapidxml_loader.cpp +++ b/src/rapidxml_loader.cpp @@ -89,7 +89,7 @@ class rapidxml_loader : util::noncopyable // Parse using appropriate flags // https://github.com/mapnik/mapnik/issues/1856 // const int f_tws = rapidxml::parse_normalize_whitespace; - const int f_tws = rapidxml::parse_trim_whitespace | rapidxml::parse_validate_closing_tags; + int const f_tws = rapidxml::parse_trim_whitespace | rapidxml::parse_validate_closing_tags; rapidxml::xml_document<> doc; doc.parse(&array.front()); diff --git a/src/raster_colorizer.cpp b/src/raster_colorizer.cpp index cae2c31e5..05c644e84 100644 --- a/src/raster_colorizer.cpp +++ b/src/raster_colorizer.cpp @@ -118,8 +118,8 @@ void raster_colorizer::colorize(image_rgba8& out, using image_type = T; using pixel_type = typename image_type::pixel_type; - const std::size_t width = std::min(in.width(), out.width()); - const std::size_t height = std::min(in.height(), out.height()); + std::size_t const width = std::min(in.width(), out.width()); + std::size_t const height = std::min(in.height(), out.height()); auto nodata_color = get_nodata_color(); for (std::size_t y = 0; y < height; ++y) { diff --git a/src/save_map.cpp b/src/save_map.cpp index 53257773b..691caa443 100644 --- a/src/save_map.cpp +++ b/src/save_map.cpp @@ -294,7 +294,7 @@ class serialize_group_layout bool explicit_defaults_; }; -void serialize_group_rule(ptree& parent_node, const group_rule& r, bool explicit_defaults) +void serialize_group_rule(ptree& parent_node, group_rule const& r, bool explicit_defaults) { ptree& rule_node = parent_node.push_back(ptree::value_type("GroupRule", ptree()))->second; diff --git a/src/scale_denominator.cpp b/src/scale_denominator.cpp index c0b71fe2e..09423175d 100644 --- a/src/scale_denominator.cpp +++ b/src/scale_denominator.cpp @@ -30,7 +30,7 @@ namespace mapnik { -static const double meters_per_degree = EARTH_CIRCUMFERENCE / 360; +static double const meters_per_degree = EARTH_CIRCUMFERENCE / 360; double scale_denominator(double map_scale, bool geographic) { diff --git a/src/simplify.cpp b/src/simplify.cpp index 586f11709..89ffd574c 100644 --- a/src/simplify.cpp +++ b/src/simplify.cpp @@ -11,7 +11,7 @@ MAPNIK_DISABLE_WARNING_POP namespace mapnik { using simplify_algorithm_lookup_type = boost::bimap; -static const simplify_algorithm_lookup_type simplify_lookup = +static simplify_algorithm_lookup_type const simplify_lookup = boost::assign::list_of(radial_distance, "radial-distance")( douglas_peucker, "douglas-peucker")(visvalingam_whyatt, "visvalingam-whyatt")(zhao_saalfeld, "zhao-saalfeld"); diff --git a/src/svg/output/process_symbolizers.cpp b/src/svg/output/process_symbolizers.cpp index 56cfb267d..6cbfb398d 100644 --- a/src/svg/output/process_symbolizers.cpp +++ b/src/svg/output/process_symbolizers.cpp @@ -96,9 +96,9 @@ void generate_path_impl(OutputIterator& output_iterator, { using path_dash_array_grammar = svg::svg_path_dash_array_grammar; using path_attributes_grammar = svg::svg_path_attributes_grammar; - static const path_attributes_grammar attributes_grammar; - static const path_dash_array_grammar dash_array_grammar; - static const svg::svg_path_generator svg_path_grammer; + static path_attributes_grammar const attributes_grammar; + static path_dash_array_grammar const dash_array_grammar; + static svg::svg_path_generator const svg_path_grammer; boost::spirit::karma::lit_type lit; boost::spirit::karma::generate(output_iterator, lit(" void svg_generator::generate_opening_root(root_output_attributes const& root_attributes) { using root_attributes_grammar = svg::svg_root_attributes_grammar; - static const root_attributes_grammar attributes_grammar; + static root_attributes_grammar const attributes_grammar; karma::lit_type lit; karma::generate(output_iterator_, lit("\n"), root_attributes); } @@ -77,7 +77,7 @@ template void svg_generator::generate_rect(rect_output_attributes const& rect_attributes) { using rect_attributes_grammar = svg::svg_rect_attributes_grammar; - static const rect_attributes_grammar attributes_grammar; + static rect_attributes_grammar const attributes_grammar; karma::lit_type lit; karma::generate(output_iterator_, lit("\n"), rect_attributes); } diff --git a/src/svg/output/svg_output_attributes.cpp b/src/svg/output/svg_output_attributes.cpp index 5b472a6d1..34bcdc689 100644 --- a/src/svg/output/svg_output_attributes.cpp +++ b/src/svg/output/svg_output_attributes.cpp @@ -225,8 +225,8 @@ void rect_output_attributes::reset() // rect_output_attributes -const double root_output_attributes::SVG_VERSION = 1.1; -const std::string root_output_attributes::SVG_NAMESPACE_URL = "http://www.w3.org/2000/svg"; +double const root_output_attributes::SVG_VERSION = 1.1; +std::string const root_output_attributes::SVG_NAMESPACE_URL = "http://www.w3.org/2000/svg"; root_output_attributes::root_output_attributes() : width_(400), diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index f492edfef..1bbb735b1 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -206,7 +206,7 @@ boost::property_tree::detail::rapidxml::xml_attribute const* parse_href(ra } template -mapnik::color parse_color(T& err_handler, const char* str) +mapnik::color parse_color(T& err_handler, char const* str) { mapnik::color c(100, 100, 100); try @@ -221,14 +221,14 @@ mapnik::color parse_color(T& err_handler, const char* str) } template -agg::rgba8 parse_color_agg(T& err_handler, const char* str) +agg::rgba8 parse_color_agg(T& err_handler, char const* str) { auto c = parse_color(err_handler, str); return agg::rgba8(c.red(), c.green(), c.blue(), c.alpha()); } template -double parse_double(T& err_handler, const char* str) +double parse_double(T& err_handler, char const* str) { using namespace boost::spirit::x3; double val = 0.0; @@ -246,8 +246,8 @@ double parse_svg_value(T& parser, char const* str, bool& is_percent) namespace x3 = boost::spirit::x3; double val = 0.0; css_unit_value units; - const char* cur = str; // phrase_parse mutates the first iterator - const char* end = str + std::strlen(str); + char const* cur = str; // phrase_parse mutates the first iterator + char const* end = str + std::strlen(str); double font_size = parser.font_sizes_.back(); bool is_percent_; auto apply_value = [&](auto const& ctx) { @@ -294,8 +294,8 @@ bool parse_font_size(T& parser, char const* str) std::size_t size = parser.font_sizes_.size(); double parent_font_size = size > 1 ? parser.font_sizes_[size - 2] : 16.0; // medium/16px - const char* cur = str; // phrase_parse mutates the first iterator - const char* end = str + std::strlen(str); + char const* cur = str; // phrase_parse mutates the first iterator + char const* end = str + std::strlen(str); auto apply_value = [&](auto const& ctx) { val = _attr(ctx); @@ -1669,7 +1669,7 @@ void svg_parser::parse(std::string const& filename) std::vector buffer(std::istreambuf_iterator(stream.rdbuf()), std::istreambuf_iterator()); buffer.push_back(0); - const int flags = rapidxml::parse_trim_whitespace | rapidxml::parse_validate_closing_tags; + int const flags = rapidxml::parse_trim_whitespace | rapidxml::parse_validate_closing_tags; rapidxml::xml_document<> doc; try { @@ -1690,7 +1690,7 @@ void svg_parser::parse(std::string const& filename) void svg_parser::parse_from_string(std::string const& svg) { - const int flags = rapidxml::parse_trim_whitespace | rapidxml::parse_validate_closing_tags; + int const flags = rapidxml::parse_trim_whitespace | rapidxml::parse_validate_closing_tags; rapidxml::xml_document<> doc; std::vector buffer(svg.begin(), svg.end()); buffer.push_back(0); diff --git a/src/svg/svg_path_parser.cpp b/src/svg/svg_path_parser.cpp index c7cb9768f..40fba1187 100644 --- a/src/svg/svg_path_parser.cpp +++ b/src/svg/svg_path_parser.cpp @@ -32,7 +32,7 @@ namespace mapnik { namespace svg { template -bool parse_path(const char* wkt, PathType& p) +bool parse_path(char const* wkt, PathType& p) { using namespace boost::spirit; using iterator_type = char const*; @@ -61,7 +61,7 @@ bool parse_path(const char* wkt, PathType& p) return true; } -template bool MAPNIK_DECL parse_path(const char*, svg_converter_type&); +template bool MAPNIK_DECL parse_path(char const*, svg_converter_type&); } // namespace svg } // namespace mapnik diff --git a/src/svg/svg_points_parser.cpp b/src/svg/svg_points_parser.cpp index b9e786f75..85e9d7c4c 100644 --- a/src/svg/svg_points_parser.cpp +++ b/src/svg/svg_points_parser.cpp @@ -31,7 +31,7 @@ namespace mapnik { namespace svg { template -bool parse_points(const char* wkt, PathType& p) +bool parse_points(char const* wkt, PathType& p) { using namespace boost::spirit; using iterator_type = char const*; @@ -61,7 +61,7 @@ bool parse_points(const char* wkt, PathType& p) return true; } -template bool parse_points(const char*, svg_converter_type&); +template bool parse_points(char const*, svg_converter_type&); } // namespace svg } // namespace mapnik diff --git a/src/svg/svg_transform_parser.cpp b/src/svg/svg_transform_parser.cpp index 0f256da19..2774d7baf 100644 --- a/src/svg/svg_transform_parser.cpp +++ b/src/svg/svg_transform_parser.cpp @@ -31,7 +31,7 @@ namespace mapnik { namespace svg { template -bool parse_svg_transform(const char* wkt, Transform& tr) +bool parse_svg_transform(char const* wkt, Transform& tr) { using namespace boost::spirit; using iterator_type = char const*; @@ -61,7 +61,7 @@ bool parse_svg_transform(const char* wkt, Transform& tr) return true; } -template bool MAPNIK_DECL parse_svg_transform(const char*, agg::trans_affine&); +template bool MAPNIK_DECL parse_svg_transform(char const*, agg::trans_affine&); } // namespace svg } // namespace mapnik diff --git a/src/symbolizer_keys.cpp b/src/symbolizer_keys.cpp index a05e7f202..859a7e941 100644 --- a/src/symbolizer_keys.cpp +++ b/src/symbolizer_keys.cpp @@ -32,7 +32,7 @@ namespace mapnik { static constexpr std::uint8_t const_max_key = static_cast(keys::MAX_SYMBOLIZER_KEY); // tuple -> name, default value, enumeration to string converter lambda, target property type -static const property_meta_type key_meta[const_max_key] = { +static property_meta_type const key_meta[const_max_key] = { property_meta_type{"gamma", nullptr, property_types::target_double}, property_meta_type{"gamma-method", nullptr, property_types::target_gamma_method}, property_meta_type{"opacity", nullptr, property_types::target_double}, diff --git a/src/text/face.cpp b/src/text/face.cpp index 33426f9f0..f7cd5a7f1 100644 --- a/src/text/face.cpp +++ b/src/text/face.cpp @@ -43,7 +43,7 @@ font_face::font_face(FT_Face face) bool font_face::init_color_font() { - static const uint32_t tag = FT_MAKE_TAG('C', 'B', 'D', 'T'); + static uint32_t const tag = FT_MAKE_TAG('C', 'B', 'D', 'T'); unsigned long length = 0; FT_Load_Sfnt_Table(face_, tag, 0, nullptr, &length); return length > 0; diff --git a/src/text/formatting/format.cpp b/src/text/formatting/format.cpp index 103010ada..2ad07e184 100644 --- a/src/text/formatting/format.cpp +++ b/src/text/formatting/format.cpp @@ -94,12 +94,12 @@ node_ptr format_node::from_xml(xml_node const& xml, fontset_map const& fontsets) set_property_from_xml(n->text_transform, "text-transform", xml); set_property_from_xml(n->ff_settings, "font-feature-settings", xml); - const auto face_name = xml.get_opt_attr("face-name"); + auto const face_name = xml.get_opt_attr("face-name"); if (face_name.has_value()) { n->face_name = *face_name; } - const auto fontset_name = xml.get_opt_attr("fontset-name"); + auto const fontset_name = xml.get_opt_attr("fontset-name"); if (fontset_name.has_value()) { std::map::const_iterator itr = fontsets.find(*fontset_name); diff --git a/src/text/placement_finder.cpp b/src/text/placement_finder.cpp index 6f8f52592..e9578bf75 100644 --- a/src/text/placement_finder.cpp +++ b/src/text/placement_finder.cpp @@ -443,8 +443,8 @@ double placement_finder::get_spacing(double path_length, double layout_width) co return path_length / num_labels; } -bool placement_finder::collision(const box2d& box, - const value_unicode_string& repeat_key, +bool placement_finder::collision(box2d const& box, + value_unicode_string const& repeat_key, bool line_placement) const { double margin, repeat_distance; diff --git a/src/text/placements/registry.cpp b/src/text/placements/registry.cpp index 0c78a4967..aa90cb181 100644 --- a/src/text/placements/registry.cpp +++ b/src/text/placements/registry.cpp @@ -51,7 +51,7 @@ void registry::register_name(std::string name, from_xml_function_ptr ptr, bool o text_placements_ptr registry::from_xml(std::string name, xml_node const& xml, fontset_map const& fontsets, bool is_shield) { - const auto itr = map_.find(name); + auto const itr = map_.find(name); if (itr == map_.end()) throw config_error("Unknown placement-type '" + name + "'", xml); return itr->second(xml, fontsets, is_shield); diff --git a/src/text/placements/simple.cpp b/src/text/placements/simple.cpp index b5b49e447..8d53df353 100644 --- a/src/text/placements/simple.cpp +++ b/src/text/placements/simple.cpp @@ -203,7 +203,7 @@ text_placements_ptr text_placements_simple::from_xml(xml_node const& xml, fontse { // we don't use parse_expression(placements_string) directly here to benefit from the cache in the // xml_node - const auto val = xml.get_opt_attr("placements"); + auto const val = xml.get_opt_attr("placements"); if (val.has_value()) { text_placements_ptr ptr = std::make_shared(*val); diff --git a/src/text/renderer.cpp b/src/text/renderer.cpp index 1e0b58734..b19c4701f 100644 --- a/src/text/renderer.cpp +++ b/src/text/renderer.cpp @@ -221,7 +221,7 @@ void agg_text_renderer::render(glyph_positions const& pos) { pixel_position render_pos(base_point); image_rgba8 glyph_image(render_glyph_image(glyph, bit->bitmap, transform_, render_pos)); - const constexpr std::size_t pixel_size = sizeof(image_rgba8::pixel_type); + constexpr std::size_t const pixel_size = sizeof(image_rgba8::pixel_type); render_halo(glyph_image.bytes(), glyph_image.width(), glyph_image.height(), @@ -256,7 +256,7 @@ void agg_text_renderer::render(glyph_positions const& pos) { pixel_position render_pos(base_point); image_rgba8 glyph_image(render_glyph_image(glyph, bit->bitmap, transform_, render_pos)); - const constexpr std::size_t pixel_size = sizeof(image_rgba8::pixel_type); + constexpr std::size_t const pixel_size = sizeof(image_rgba8::pixel_type); render_halo(glyph_image.bytes(), glyph_image.width(), glyph_image.height(), @@ -349,7 +349,7 @@ void grid_text_renderer::render(glyph_positions const& pos, value_integer fea { pixel_position render_pos(base_point); image_rgba8 glyph_image(render_glyph_image(glyph, bit->bitmap, transform_, render_pos)); - const constexpr std::size_t pixel_size = sizeof(image_rgba8::pixel_type); + constexpr std::size_t const pixel_size = sizeof(image_rgba8::pixel_type); render_halo_id(glyph_image.bytes(), glyph_image.width(), glyph_image.height(), diff --git a/src/text/scrptrun.cpp b/src/text/scrptrun.cpp index 9c4aeb0a5..7ef8b436b 100644 --- a/src/text/scrptrun.cpp +++ b/src/text/scrptrun.cpp @@ -24,12 +24,12 @@ MAPNIK_DISABLE_WARNING_POP #include template -constexpr std::size_t ARRAY_SIZE(const T (&array)[N]) noexcept +constexpr std::size_t ARRAY_SIZE(T const (&array)[N]) noexcept { return N; } -const char ScriptRun::fgClassID = 0; +char const ScriptRun::fgClassID = 0; UChar32 ScriptRun::pairedChars[] = {0x0028, 0x0029, // ascii paired punctuation 0x003c, 0x003e, 0x005b, 0x005d, 0x007b, 0x007d, 0x00ab, @@ -41,9 +41,9 @@ UChar32 ScriptRun::pairedChars[] = {0x0028, 0x0029, // ascii paired punctuation 0x300a, 0x300b, 0x300c, 0x300d, 0x300e, 0x300f, 0x3010, 0x3011, 0x3014, 0x3015, 0x3016, 0x3017, 0x3018, 0x3019, 0x301a, 0x301b}; -const int32_t ScriptRun::pairedCharCount = ARRAY_SIZE(pairedChars); -const int32_t ScriptRun::pairedCharPower = 1 << highBit(pairedCharCount); -const int32_t ScriptRun::pairedCharExtra = pairedCharCount - pairedCharPower; +int32_t const ScriptRun::pairedCharCount = ARRAY_SIZE(pairedChars); +int32_t const ScriptRun::pairedCharPower = 1 << highBit(pairedCharCount); +int32_t const ScriptRun::pairedCharExtra = pairedCharCount - pairedCharPower; int8_t ScriptRun::highBit(int32_t value) { diff --git a/src/text/symbolizer_helpers.cpp b/src/text/symbolizer_helpers.cpp index 91b8c76ff..906d2f14e 100644 --- a/src/text/symbolizer_helpers.cpp +++ b/src/text/symbolizer_helpers.cpp @@ -399,11 +399,11 @@ text_symbolizer_helper::text_symbolizer_helper(text_symbolizer const& sym, void text_symbolizer_helper::init_converters() { // setup vertex converter - const value_bool clip = mapnik::get(sym_, feature_, vars_); - const value_double simplify_tolerance = mapnik::get(sym_, feature_, vars_); - const value_double smooth = mapnik::get(sym_, feature_, vars_); - const value_double extend = mapnik::get(sym_, feature_, vars_); - const auto offset = get_optional(sym_, keys::offset, feature_, vars_); + value_bool const clip = mapnik::get(sym_, feature_, vars_); + value_double const simplify_tolerance = mapnik::get(sym_, feature_, vars_); + value_double const smooth = mapnik::get(sym_, feature_, vars_); + value_double const extend = mapnik::get(sym_, feature_, vars_); + auto const offset = get_optional(sym_, keys::offset, feature_, vars_); if (clip) { diff --git a/src/text/text_properties.cpp b/src/text/text_properties.cpp index 3c7a6b4f4..7096046fb 100644 --- a/src/text/text_properties.cpp +++ b/src/text/text_properties.cpp @@ -372,10 +372,10 @@ void format_properties::from_xml(xml_node const& node, fontset_map const& fontse set_property_from_xml(text_transform, "text-transform", node); set_property_from_xml(ff_settings, "font-feature-settings", node); - const auto face_name_ = node.get_opt_attr("face-name"); + auto const face_name_ = node.get_opt_attr("face-name"); if (face_name_.has_value()) face_name = *face_name_; - const auto fontset_name_ = node.get_opt_attr("fontset-name"); + auto const fontset_name_ = node.get_opt_attr("fontset-name"); if (fontset_name_.has_value()) { std::map::const_iterator itr = fontsets.find(*fontset_name_); diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 3f568fd19..20274e68a 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -120,8 +120,8 @@ image_reader* create_tiff_reader2(char const* data, std::size_t size) void register_tiff_reader() { - [[maybe_unused]] const bool registered = register_image_reader("tiff", create_tiff_reader); - [[maybe_unused]] const bool registered2 = register_image_reader("tiff", create_tiff_reader2); + [[maybe_unused]] bool const registered = register_image_reader("tiff", create_tiff_reader); + [[maybe_unused]] bool const registered2 = register_image_reader("tiff", create_tiff_reader2); } } // namespace mapnik diff --git a/src/tiff_reader.hpp b/src/tiff_reader.hpp index 3f1c7c36f..8b7e6b46c 100644 --- a/src/tiff_reader.hpp +++ b/src/tiff_reader.hpp @@ -110,8 +110,8 @@ class tiff_reader : public image_reader unsigned compression() const { return compression_; } private: - tiff_reader(const tiff_reader&); - tiff_reader& operator=(const tiff_reader&); + tiff_reader(tiff_reader const&); + tiff_reader& operator=(tiff_reader const&); void init(); template @@ -156,7 +156,7 @@ tiff_reader::tiff_reader(std::string const& filename) is_tiled_(false) { #if defined(MAPNIK_MEMORY_MAPPED_FILE) - const auto memory = mapnik::mapped_memory_cache::instance().find(filename, true); + auto const memory = mapnik::mapped_memory_cache::instance().find(filename, true); if (memory.has_value()) { @@ -286,11 +286,11 @@ void tiff_reader::init() { if (height_ > 128 * 1024 * 1024) { - const std::size_t line_size = (bands_ * width_ * bps_ + 7) / 8; + std::size_t const line_size = (bands_ * width_ * bps_ + 7) / 8; std::size_t default_strip_height = 8192 / line_size; if (default_strip_height == 0) default_strip_height = 1; - const std::size_t num_strips = height_ / default_strip_height; + std::size_t const num_strips = height_ / default_strip_height; if (num_strips > 128 * 1024 * 1024) { throw image_reader_exception("Can't allocate tiff"); @@ -362,14 +362,14 @@ image_any tiff_reader::read_any_gray(std::size_t x0, std::size_t y0, std::siz if (tif) { image_type data(width, height); - const std::size_t block_size = rows_per_strip_ > 0 ? rows_per_strip_ : tile_height_; - const std::size_t start_y = y0 - y0 % block_size; - const std::size_t end_y = std::min(y0 + height, height_); - const std::size_t start_x = x0; - const std::size_t end_x = std::min(x0 + width, width_); + std::size_t const block_size = rows_per_strip_ > 0 ? rows_per_strip_ : tile_height_; + std::size_t const start_y = y0 - y0 % block_size; + std::size_t const end_y = std::min(y0 + height, height_); + std::size_t const start_x = x0; + std::size_t const end_x = std::min(x0 + width, width_); constexpr std::size_t element_size = sizeof(pixel_type); MAPNIK_LOG_DEBUG(tiff_reader) << "SCANLINE SIZE=" << TIFFScanlineSize(tif); - const std::size_t size_to_allocate = (TIFFScanlineSize(tif) + element_size - 1) / element_size; + std::size_t const size_to_allocate = (TIFFScanlineSize(tif) + element_size - 1) / element_size; std::unique_ptr const scanline(new pixel_type[size_to_allocate]); if (planar_config_ == PLANARCONFIG_CONTIG) { @@ -436,8 +436,8 @@ image_any tiff_reader::read(unsigned x, unsigned y, unsigned width, unsigned { throw image_reader_exception("Can't allocate tiff > 10000x10000"); } - const std::size_t x0 = static_cast(x); - const std::size_t y0 = static_cast(y); + std::size_t const x0 = static_cast(x); + std::size_t const y0 = static_cast(y); switch (photometric_) { case PHOTOMETRIC_MINISBLACK: @@ -558,7 +558,7 @@ struct tiff_reader_traits std::size_t tile_width, std::size_t tile_height) { - const std::uint32_t tile_size = TIFFTileSize(tif); + std::uint32_t const tile_size = TIFFTileSize(tif); return (TIFFReadEncodedTile(tif, TIFFComputeTile(tif, x, y, 0, 0), buf, tile_size) != -1); } @@ -611,20 +611,20 @@ void tiff_reader::read_tiled(std::size_t x0, std::size_t y0, ImageData& image TIFF* tif = open(stream_); if (tif) { - const std::uint32_t tile_size = TIFFTileSize(tif); + std::uint32_t const tile_size = TIFFTileSize(tif); std::unique_ptr tile(new pixel_type[tile_size]); - const std::size_t width = image.width(); - const std::size_t height = image.height(); - const std::size_t start_y = (y0 / tile_height_) * tile_height_; - const std::size_t end_y = std::min(((y0 + height) / tile_height_ + 1) * tile_height_, height_); - const std::size_t start_x = (x0 / tile_width_) * tile_width_; - const std::size_t end_x = std::min(((x0 + width) / tile_width_ + 1) * tile_width_, width_); - const bool pick_first_band = + std::size_t const width = image.width(); + std::size_t const height = image.height(); + std::size_t const start_y = (y0 / tile_height_) * tile_height_; + std::size_t const end_y = std::min(((y0 + height) / tile_height_ + 1) * tile_height_, height_); + std::size_t const start_x = (x0 / tile_width_) * tile_width_; + std::size_t const end_x = std::min(((x0 + width) / tile_width_ + 1) * tile_width_, width_); + bool const pick_first_band = (bands_ > 1) && (tile_size / (tile_width_ * tile_height_ * sizeof(pixel_type)) == bands_); for (std::size_t y = start_y; y < end_y; y += tile_height_) { - const std::size_t ty0 = std::max(y0, y) - y; - const std::size_t ty1 = std::min(height + y0, y + tile_height_) - y; + std::size_t const ty0 = std::max(y0, y) - y; + std::size_t const ty1 = std::min(height + y0, y + tile_height_) - y; for (std::size_t x = start_x; x < end_x; x += tile_width_) { @@ -642,8 +642,8 @@ void tiff_reader::read_tiled(std::size_t x0, std::size_t y0, ImageData& image tile[n] = tile[n * bands_]; } } - const std::size_t tx0 = std::max(x0, x); - const std::size_t tx1 = std::min(width + x0, x + tile_width_); + std::size_t const tx0 = std::max(x0, x); + std::size_t const tx1 = std::min(width + x0, x + tile_width_); std::size_t row_index = y + ty0 - y0; if (detail::tiff_reader_traits::reverse) @@ -677,23 +677,23 @@ void tiff_reader::read_stripped(std::size_t x0, std::size_t y0, ImageData& im TIFF* tif = open(stream_); if (tif) { - const std::uint32_t strip_size = TIFFStripSize(tif); + std::uint32_t const strip_size = TIFFStripSize(tif); std::unique_ptr strip(new pixel_type[strip_size]); - const std::size_t width = image.width(); - const std::size_t height = image.height(); + std::size_t const width = image.width(); + std::size_t const height = image.height(); - const std::size_t start_y = (y0 / rows_per_strip_) * rows_per_strip_; - const std::size_t end_y = std::min(y0 + height, height_); - const std::size_t tx0{x0}; - const std::size_t tx1{std::min(width + x0, width_)}; + std::size_t const start_y = (y0 / rows_per_strip_) * rows_per_strip_; + std::size_t const end_y = std::min(y0 + height, height_); + std::size_t const tx0{x0}; + std::size_t const tx1{std::min(width + x0, width_)}; std::size_t row = 0; - const bool pick_first_band = + bool const pick_first_band = (bands_ > 1) && (strip_size / (width_ * rows_per_strip_ * sizeof(pixel_type)) == bands_); for (std::size_t y = start_y; y < end_y; y += rows_per_strip_) { - const std::size_t ty0 = std::max(y0, y) - y; - const std::size_t ty1 = std::min(end_y, y + rows_per_strip_) - y; + std::size_t const ty0 = std::max(y0, y) - y; + std::size_t const ty1 = std::min(end_y, y + rows_per_strip_) - y; if (!detail::tiff_reader_traits::read_strip(tif, y, rows_per_strip_, width_, strip.get())) { diff --git a/src/twkb.cpp b/src/twkb.cpp index ee80af80b..cc56d4420 100644 --- a/src/twkb.cpp +++ b/src/twkb.cpp @@ -33,7 +33,7 @@ namespace detail { struct twkb_reader : mapnik::util::noncopyable { private: - const char* twkb_; + char const* twkb_; size_t size_; unsigned int pos_; // Metadata on the geometry we are parsing @@ -383,7 +383,7 @@ struct twkb_reader : mapnik::util::noncopyable } // namespace detail -mapnik::geometry::geometry geometry_utils::from_twkb(const char* wkb, std::size_t size) +mapnik::geometry::geometry geometry_utils::from_twkb(char const* wkb, std::size_t size) { detail::twkb_reader reader(wkb, size); mapnik::geometry::geometry geom(reader.read()); diff --git a/src/unicode.cpp b/src/unicode.cpp index 88a9694ea..f872f8530 100644 --- a/src/unicode.cpp +++ b/src/unicode.cpp @@ -47,7 +47,7 @@ transcoder::transcoder(std::string const& encoding) } } -mapnik::value_unicode_string transcoder::transcode(const char* data, std::int32_t length) const +mapnik::value_unicode_string transcoder::transcode(char const* data, std::int32_t length) const { UErrorCode err = U_ZERO_ERROR; diff --git a/src/util/mapped_memory_file.cpp b/src/util/mapped_memory_file.cpp index 969cef537..62738e08e 100644 --- a/src/util/mapped_memory_file.cpp +++ b/src/util/mapped_memory_file.cpp @@ -20,7 +20,7 @@ mapped_memory_file::mapped_memory_file(std::string const& file_name) #endif { #if defined(MAPNIK_MEMORY_MAPPED_FILE) - const auto memory = mapnik::mapped_memory_cache::instance().find(file_name, true); + auto const memory = mapnik::mapped_memory_cache::instance().find(file_name, true); if (memory.has_value()) { diff --git a/src/value.cpp b/src/value.cpp index 5ae9ecc26..793c42f17 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -566,7 +566,7 @@ struct to_expression_string_impl : quote_(quote) {} - virtual void Append(const char* data, int32_t n) + virtual void Append(char const* data, int32_t n) { // reserve enough room to hold the appended chunk and quotes; // if another chunk follows, or any character needs escaping, @@ -634,7 +634,7 @@ struct to_expression_string_impl std::string operator()(value_null const&) const { return "null"; } - const char quote_; + char const quote_; }; } // namespace detail diff --git a/src/warp.cpp b/src/warp.cpp index 43b16f0c0..b917e0170 100644 --- a/src/warp.cpp +++ b/src/warp.cpp @@ -163,11 +163,11 @@ MAPNIK_DECL void warp_image(T& target, rasterizer.line_to_d(std::floor(polygon[4]), std::floor(polygon[5])); rasterizer.line_to_d(std::floor(polygon[6]), std::floor(polygon[7])); - const std::size_t x0 = i * mesh_size; - const std::size_t y0 = j * mesh_size; - const std::size_t x1 = std::min((i + 1) * mesh_size, source.width()); - const std::size_t y1 = std::min((j + 1) * mesh_size, source.height()); - const agg::trans_affine tr(polygon, x0, y0, x1, y1); + std::size_t const x0 = i * mesh_size; + std::size_t const y0 = j * mesh_size; + std::size_t const x1 = std::min((i + 1) * mesh_size, source.width()); + std::size_t const y1 = std::min((j + 1) * mesh_size, source.height()); + agg::trans_affine const tr(polygon, x0, y0, x1, y1); if (tr.is_valid()) { interpolator_type interpolator(tr); diff --git a/src/webp_reader.cpp b/src/webp_reader.cpp index d90f8a0d4..f8ec215e6 100644 --- a/src/webp_reader.cpp +++ b/src/webp_reader.cpp @@ -122,8 +122,8 @@ image_reader* create_webp_reader2(std::string const& filename) void register_webp_reader() { - [[maybe_unused]] const bool registered = register_image_reader("webp", create_webp_reader); - [[maybe_unused]] const bool registered2 = register_image_reader("webp", create_webp_reader2); + [[maybe_unused]] bool const registered = register_image_reader("webp", create_webp_reader); + [[maybe_unused]] bool const registered2 = register_image_reader("webp", create_webp_reader2); } // ctor diff --git a/src/well_known_srs.cpp b/src/well_known_srs.cpp index bc65ef258..d59f19d80 100644 --- a/src/well_known_srs.cpp +++ b/src/well_known_srs.cpp @@ -30,13 +30,13 @@ #include namespace mapnik { -constexpr const char MAPNIK_GEOGRAPHIC_PROJ_STR[10]{"epsg:4326"}; +constexpr char const MAPNIK_GEOGRAPHIC_PROJ_STR[10]{"epsg:4326"}; extern std::string const MAPNIK_GEOGRAPHIC_PROJ = MAPNIK_GEOGRAPHIC_PROJ_STR; // wgs84 -constexpr const char MAPNIK_WEBMERCATOR_PROJ_STR[10]{"epsg:3857"}; +constexpr char const MAPNIK_WEBMERCATOR_PROJ_STR[10]{"epsg:3857"}; extern std::string const MAPNIK_WEBMERCATOR_PROJ = MAPNIK_WEBMERCATOR_PROJ_STR; // webmercator -static const char* well_known_srs_strings[] = {MAPNIK_GEOGRAPHIC_PROJ.c_str(), MAPNIK_WEBMERCATOR_PROJ.c_str(), ""}; +static char const* well_known_srs_strings[] = {MAPNIK_GEOGRAPHIC_PROJ.c_str(), MAPNIK_WEBMERCATOR_PROJ.c_str(), ""}; std::optional is_well_known_srs(std::string const& srs) { diff --git a/src/wkb.cpp b/src/wkb.cpp index 8f9aaf985..15d29ff6a 100644 --- a/src/wkb.cpp +++ b/src/wkb.cpp @@ -35,7 +35,7 @@ namespace mapnik { struct wkb_reader : util::noncopyable { private: - const char* wkb_; + char const* wkb_; std::size_t size_; std::size_t pos_; wkbByteOrder byteOrder_; @@ -78,7 +78,7 @@ struct wkb_reader : util::noncopyable wkbGeometryCollectionZM = 3007 }; - wkb_reader(const char* wkb, std::size_t size, wkbFormat format) + wkb_reader(char const* wkb, std::size_t size, wkbFormat format) : wkb_(wkb), size_(size), pos_(0), @@ -472,7 +472,7 @@ struct wkb_reader : util::noncopyable } }; -mapnik::geometry::geometry geometry_utils::from_wkb(const char* wkb, std::size_t size, wkbFormat format) +mapnik::geometry::geometry geometry_utils::from_wkb(char const* wkb, std::size_t size, wkbFormat format) { wkb_reader reader(wkb, size, format); mapnik::geometry::geometry geom(reader.read()); diff --git a/src/wkt/geometry_to_wkt.cpp b/src/wkt/geometry_to_wkt.cpp index 59dcd837a..20f9653b0 100644 --- a/src/wkt/geometry_to_wkt.cpp +++ b/src/wkt/geometry_to_wkt.cpp @@ -32,7 +32,7 @@ namespace util { bool to_wkt(std::string& wkt, mapnik::geometry::geometry const& geom) { using sink_type = std::back_insert_iterator; - static const mapnik::wkt::wkt_generator_grammar> generator; + static mapnik::wkt::wkt_generator_grammar> const generator; sink_type sink(wkt); return boost::spirit::karma::generate(sink, generator, geom); } @@ -40,7 +40,7 @@ bool to_wkt(std::string& wkt, mapnik::geometry::geometry const& geom) bool to_wkt(std::string& wkt, mapnik::geometry::geometry const& geom) { using sink_type = std::back_insert_iterator; - static const mapnik::wkt::wkt_generator_grammar> generator; + static mapnik::wkt::wkt_generator_grammar> const generator; sink_type sink(wkt); return boost::spirit::karma::generate(sink, generator, geom); } diff --git a/src/xml_tree.cpp b/src/xml_tree.cpp index daab12090..f77637ab8 100644 --- a/src/xml_tree.cpp +++ b/src/xml_tree.cpp @@ -80,7 +80,7 @@ DEFINE_NAME_TRAIT(font_feature_settings, "font-feature-settings") template (*F_LOOKUP)()> struct name_trait> { @@ -88,7 +88,7 @@ struct name_traitsecond; @@ -124,12 +124,12 @@ xml_node& xml_tree::root() return node_; } -const xml_node& xml_tree::root() const +xml_node const& xml_tree::root() const { return node_; } -xml_attribute::xml_attribute(const char* value_) +xml_attribute::xml_attribute(char const* value_) : value(value_), processed(false) {} @@ -139,7 +139,7 @@ node_not_found::node_not_found(std::string const& node_name) msg_() {} -const char* node_not_found::what() const noexcept +char const* node_not_found::what() const noexcept { msg_ = std::string("Node " + node_name_ + "not found"); return msg_.c_str(); @@ -153,7 +153,7 @@ attribute_not_found::attribute_not_found(std::string const& node_name, std::stri msg_() {} -const char* attribute_not_found::what() const noexcept +char const* attribute_not_found::what() const noexcept { msg_ = std::string("Attribute '" + attribute_name_ + "' not found in node '" + node_name_ + "'"); return msg_.c_str(); @@ -166,7 +166,7 @@ more_than_one_child::more_than_one_child(std::string const& node_name) msg_() {} -const char* more_than_one_child::what() const noexcept +char const* more_than_one_child::what() const noexcept { msg_ = std::string("More than one child node in node '" + node_name_ + "'"); return msg_.c_str(); @@ -230,13 +230,13 @@ bool xml_node::is(std::string const& name) const return false; } -xml_node& xml_node::add_child(const char* name, unsigned line, bool is_text) +xml_node& xml_node::add_child(char const* name, unsigned line, bool is_text) { children_.emplace_back(tree_, name, line, is_text); return children_.back(); } -void xml_node::add_attribute(const char* name, const char* value_) +void xml_node::add_attribute(char const* name, char const* value_) { auto result = attributes_.emplace(name, xml_attribute(value_)); if (!result.second) @@ -364,7 +364,7 @@ T xml_node::get_attr(std::string const& name, T const& default_opt_value) const template T xml_node::get_attr(std::string const& name) const { - const auto val = get_opt_attr(name); + auto const val = get_opt_attr(name); if (val) return *val; throw attribute_not_found(name_, name); @@ -381,7 +381,7 @@ std::string const& xml_node::get_text() const } else { - const static std::string empty; + static std::string const empty; return empty; } } diff --git a/test/catch.hpp b/test/catch.hpp index 0440721c6..d003ee289 100644 --- a/test/catch.hpp +++ b/test/catch.hpp @@ -623,7 +623,7 @@ class StringRef { public: using size_type = std::size_t; - using const_iterator = const char*; + using const_iterator = char const*; private: static constexpr char const* const s_empty = ""; @@ -2177,12 +2177,12 @@ inline id performOptionalSelector(id obj, SEL sel) namespace Catch { namespace Detail { -extern const std::string unprintableString; +extern std::string const unprintableString; -std::string rawMemoryToString(const void* object, std::size_t size); +std::string rawMemoryToString(void const* object, std::size_t size); template -std::string rawMemoryToString(const T& object) +std::string rawMemoryToString(T const& object) { return rawMemoryToString(&object, sizeof(object)); } @@ -2197,7 +2197,7 @@ class IsStreamInsertable static auto test(...) -> std::false_type; public: - static const bool value = decltype(test(0))::value; + static bool const value = decltype(test(0))::value; }; template @@ -2243,7 +2243,7 @@ struct StringMaker { template static typename std::enable_if<::Catch::Detail::IsStreamInsertable::value, std::string>::type - convert(const Fake& value) + convert(Fake const& value) { ReusableStringStream rss; // NB: call using the function-like syntax to avoid ambiguity with @@ -2254,7 +2254,7 @@ struct StringMaker template static typename std::enable_if::value, std::string>::type - convert(const Fake& value) + convert(Fake const& value) { #if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) return Detail::convertUnstreamable(value); @@ -2269,7 +2269,7 @@ namespace Detail { // This function dispatches all stringification requests inside of Catch. // Should be preferably called fully qualified, like ::Catch::Detail::stringify template -std::string stringify(const T& e) +std::string stringify(T const& e) { return ::Catch::StringMaker::type>::type>::convert(e); } @@ -2295,7 +2295,7 @@ std::string stringify(T ^ e) template<> struct StringMaker { - static std::string convert(const std::string& str); + static std::string convert(std::string const& str); }; #ifdef CATCH_CONFIG_CPP17_STRING_VIEW @@ -2321,7 +2321,7 @@ struct StringMaker template<> struct StringMaker { - static std::string convert(const std::wstring& wstr); + static std::string convert(std::wstring const& wstr); }; #ifdef CATCH_CONFIG_CPP17_STRING_VIEW @@ -2552,7 +2552,7 @@ namespace Catch { template struct StringMaker> { - static std::string convert(const std::pair& pair) + static std::string convert(std::pair const& pair) { ReusableStringStream rss; rss << "{ " << ::Catch::Detail::stringify(pair.first) << ", " << ::Catch::Detail::stringify(pair.second) @@ -2569,7 +2569,7 @@ namespace Catch { template struct StringMaker> { - static std::string convert(const std::optional& optional) + static std::string convert(std::optional const& optional) { ReusableStringStream rss; if (optional.has_value()) @@ -2594,7 +2594,7 @@ namespace Detail { template::value)> struct TupleElementPrinter { - static void print(const Tuple& tuple, std::ostream& os) + static void print(Tuple const& tuple, std::ostream& os) { os << (N ? ", " : " ") << ::Catch::Detail::stringify(std::get(tuple)); TupleElementPrinter::print(tuple, os); @@ -2604,7 +2604,7 @@ struct TupleElementPrinter template struct TupleElementPrinter { - static void print(const Tuple&, std::ostream&) {} + static void print(Tuple const&, std::ostream&) {} }; } // namespace Detail @@ -2612,7 +2612,7 @@ struct TupleElementPrinter template struct StringMaker> { - static std::string convert(const std::tuple& tuple) + static std::string convert(std::tuple const& tuple) { ReusableStringStream rss; rss << '{'; @@ -2630,13 +2630,13 @@ namespace Catch { template<> struct StringMaker { - static std::string convert(const std::monostate&) { return "{ }"; } + static std::string convert(std::monostate const&) { return "{ }"; } }; template struct StringMaker> { - static std::string convert(const std::variant& variant) + static std::string convert(std::variant const& variant) { if (variant.valueless_by_exception()) { @@ -2644,7 +2644,7 @@ struct StringMaker> } else { - return std::visit([](const auto& value) { return ::Catch::Detail::stringify(value); }, variant); + return std::visit([](auto const& value) { return ::Catch::Detail::stringify(value); }, variant); } } }; @@ -2680,7 +2680,7 @@ struct is_range : detail::is_range_impl template struct is_range { - static const bool value = false; + static bool const value = false; }; #endif @@ -2847,7 +2847,7 @@ struct StringMaker> auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); char timeStamp[timeStampSize]; - const char* const fmt = "%Y-%m-%dT%H:%M:%SZ"; + char const* const fmt = "%Y-%m-%dT%H:%M:%SZ"; #ifdef _MSC_VER std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); @@ -3244,7 +3244,7 @@ struct IResultCapture // Deprecated, do not use: virtual std::string getCurrentTestName() const = 0; - virtual const AssertionResult* getLastResult() const = 0; + virtual AssertionResult const* getLastResult() const = 0; virtual void exceptionEarlyReported() = 0; }; @@ -3779,7 +3779,7 @@ struct IMutableRegistryHub virtual void registerReporter(std::string const& name, IReporterFactoryPtr const& factory) = 0; virtual void registerListener(IReporterFactoryPtr const& factory) = 0; virtual void registerTest(TestCase const& testInfo) = 0; - virtual void registerTranslator(const IExceptionTranslator* translator) = 0; + virtual void registerTranslator(IExceptionTranslator const* translator) = 0; virtual void registerTagAlias(std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo) = 0; virtual void registerStartupException() noexcept = 0; virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0; @@ -3923,14 +3923,14 @@ class Approx {} template::value>::type> - friend bool operator==(const T& lhs, Approx const& rhs) + friend bool operator==(T const& lhs, Approx const& rhs) { auto lhs_v = static_cast(lhs); return rhs.equalityComparisonImpl(lhs_v); } template::value>::type> - friend bool operator==(Approx const& lhs, const T& rhs) + friend bool operator==(Approx const& lhs, T const& rhs) { return operator==(rhs, lhs); } @@ -4346,7 +4346,7 @@ namespace Matchers { namespace Generic { namespace Detail { -std::string finalizeDescription(const std::string& desc); +std::string finalizeDescription(std::string const& desc); } template @@ -4507,7 +4507,7 @@ struct ContainsMatcher : MatcherBase> for (auto const& comparator : m_comparator) { auto present = false; - for (const auto& el : v) + for (auto const& el : v) { if (el == comparator) { @@ -4825,14 +4825,14 @@ namespace Catch { class GeneratorException : public std::exception { - const char* const m_msg = ""; + char const* const m_msg = ""; public: - GeneratorException(const char* msg) + GeneratorException(char const* msg) : m_msg(msg) {} - const char* what() const noexcept override final; + char const* what() const noexcept override final; }; namespace Generators { @@ -4955,7 +4955,7 @@ class Generators : public IGenerator { return false; } - const bool current_status = m_generators[m_current].next(); + bool const current_status = m_generators[m_current].next(); if (!current_status) { ++m_current; @@ -5072,7 +5072,7 @@ class TakeGenerator : public IGenerator return false; } - const auto success = m_generator.next(); + auto const success = m_generator.next(); // If the underlying generator does not contain enough values // then we cut short as well if (!success) @@ -5175,7 +5175,7 @@ class RepeatGenerator : public IGenerator // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache if (m_current_repeat == 0) { - const auto success = m_generator.next(); + auto const success = m_generator.next(); if (!success) { ++m_current_repeat; @@ -5220,7 +5220,7 @@ class MapGenerator : public IGenerator T const& get() const override { return m_cache; } bool next() override { - const auto success = m_generator.next(); + auto const success = m_generator.next(); if (success) { m_cache = m_function(m_generator.get()); @@ -5404,7 +5404,7 @@ class Option T& operator*() { return *nullableValue; } T const& operator*() const { return *nullableValue; } T* operator->() { return nullableValue; } - const T* operator->() const { return nullableValue; } + T const* operator->() const { return nullableValue; } T valueOr(T const& defaultValue) const { return nullableValue ? *nullableValue : defaultValue; } @@ -5535,7 +5535,7 @@ class SimplePcg32 // is chosen -- we take it as a constant for Catch2, so we only // need to deal with seeding the main state. // Picked by reading 8 bytes from `/dev/random` :-) - static const std::uint64_t s_inc = (0x13ed0cc53f939476ULL << 1ULL) | 1ULL; + static std::uint64_t const s_inc = (0x13ed0cc53f939476ULL << 1ULL) | 1ULL; }; } // end namespace Catch @@ -5890,7 +5890,7 @@ inline std::size_t registerTestMethods() std::string testCaseName = methodName.substr(15); std::string name = Detail::getAnnotation(cls, "Name", testCaseName); std::string desc = Detail::getAnnotation(cls, "Description", testCaseName); - const char* className = class_getName(cls); + char const* className = class_getName(cls); getMutableRegistryHub().registerTest(makeTestCase(new OcMethod(cls, selector), className, @@ -6155,7 +6155,7 @@ class TestSpec bool hasFilters() const; bool matches(TestCaseInfo const& testCase) const; Matches matchesByFilter(std::vector const& testCases, IConfig const& config) const; - const vectorStrings& getInvalidArgs() const; + vectorStrings const& getInvalidArgs() const; private: std::vector m_filters; @@ -7626,7 +7626,7 @@ CompleteType_t> complete_invoke(Fun&& fun, Args std::forward(args)...); } -const std::string benchmarkErrorMsg = "a benchmark failed to run successfully"; +std::string const benchmarkErrorMsg = "a benchmark failed to run successfully"; } // namespace Detail template @@ -7952,7 +7952,7 @@ using run_for_at_least_argument_t = struct optimized_away_error : std::exception { - const char* what() const noexcept override { return "could not measure benchmark, maybe it was optimized away"; } + char const* what() const noexcept override { return "could not measure benchmark, maybe it was optimized away"; } }; template @@ -7998,7 +7998,7 @@ struct ExecutionPlan } template - std::vector> run(const IConfig& cfg, Environment> env) const + std::vector> run(IConfig const& cfg, Environment> env) const { // warmup a bit Detail::run_for_at_least(std::chrono::duration_cast>(warmup_time), @@ -8227,15 +8227,15 @@ std::vector resolution(int k) return deltas; } -const auto warmup_iterations = 10000; -const auto warmup_time = std::chrono::milliseconds(100); -const auto minimum_ticks = 1000; -const auto warmup_seed = 10000; -const auto clock_resolution_estimation_time = std::chrono::milliseconds(500); -const auto clock_cost_estimation_time_limit = std::chrono::seconds(1); -const auto clock_cost_estimation_tick_limit = 100000; -const auto clock_cost_estimation_time = std::chrono::milliseconds(10); -const auto clock_cost_estimation_iterations = 10000; +auto const warmup_iterations = 10000; +auto const warmup_time = std::chrono::milliseconds(100); +auto const minimum_ticks = 1000; +auto const warmup_seed = 10000; +auto const clock_resolution_estimation_time = std::chrono::milliseconds(500); +auto const clock_cost_estimation_time_limit = std::chrono::seconds(1); +auto const clock_cost_estimation_tick_limit = 100000; +auto const clock_cost_estimation_time = std::chrono::milliseconds(10); +auto const clock_cost_estimation_iterations = 10000; template int warmup() @@ -8266,7 +8266,7 @@ EnvironmentEstimate> estimate_clock_cost(FloatDuration([k] { for (int i = 0; i < k; ++i) { - volatile auto ignored = Clock::now(); + auto volatile ignored = Clock::now(); (void)ignored; } }) @@ -8363,7 +8363,7 @@ namespace Catch { namespace Benchmark { namespace Detail { template -SampleAnalysis analyse(const IConfig& cfg, Environment, Iterator first, Iterator last) +SampleAnalysis analyse(IConfig const& cfg, Environment, Iterator first, Iterator last) { if (!cfg.benchmarkNoAnalysis()) { @@ -8445,7 +8445,7 @@ struct Benchmark {} template - ExecutionPlan> prepare(const IConfig& cfg, Environment> env) const + ExecutionPlan> prepare(IConfig const& cfg, Environment> env) const { auto min_time = env.clock_resolution.mean * Detail::minimum_ticks; auto run_time = std::max(min_time, std::chrono::duration_cast(cfg.benchmarkWarmupTime())); @@ -8548,7 +8548,7 @@ struct ObjectStorage : data() {} - ObjectStorage(const ObjectStorage& other) { new (&data) T(other.stored_object()); } + ObjectStorage(ObjectStorage const& other) { new (&data) T(other.stored_object()); } ObjectStorage(ObjectStorage&& other) { new (&data) T(std::move(other.stored_object())); } @@ -8917,7 +8917,7 @@ double erfc_inv(double x) double normal_quantile(double p) { - static const double ROOT_TWO = std::sqrt(2.0); + static double const ROOT_TWO = std::sqrt(2.0); double result = 0.0; assert(p >= 0 && p <= 1); @@ -9057,7 +9057,7 @@ std::string Approx::toString() const return rss.str(); } -bool Approx::equalityComparisonImpl(const double other) const +bool Approx::equalityComparisonImpl(double const other) const { // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value // Thanks to Richard Harris for his help refining the scaled margin value @@ -9293,7 +9293,7 @@ class RunContext : public IResultCapture, std::string getCurrentTestName() const override; - const AssertionResult* getLastResult() const override; + AssertionResult const* getLastResult() const override; void exceptionEarlyReported() override; @@ -10055,13 +10055,13 @@ struct UnaryLambdaTraits : UnaryLambdaTraits template struct UnaryLambdaTraits { - static const bool isValid = false; + static bool const isValid = false; }; template struct UnaryLambdaTraits { - static const bool isValid = true; + static bool const isValid = true; using ArgType = typename std::remove_const::type>::type; using ReturnType = ReturnT; }; @@ -10974,7 +10974,7 @@ struct Parser : ParserBase ParserBase const* parser = nullptr; size_t count = 0; }; - const size_t totalParsers = m_options.size() + m_args.size(); + size_t const totalParsers = m_options.size() + m_args.size(); assert(totalParsers < 512); // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do ParserInfo parseInfos[512]; @@ -11683,7 +11683,7 @@ class PosixColourImpl : public IColourImpl } private: - void setColour(const char* _escapeCode) { getCurrentContext().getConfig()->stream() << '\033' << _escapeCode; } + void setColour(char const* _escapeCode) { getCurrentContext().getConfig()->stream() << '\033' << _escapeCode; } }; bool useColourOnPlatform() @@ -11952,7 +11952,7 @@ bool isDebuggerActive() std::ifstream in("/proc/self/status"); for (std::string line; std::getline(in, line);) { - static const int PREFIX_LEN = 11; + static int const PREFIX_LEN = 11; if (line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0) { // We're traced if the PID is not 0 and no other PID starts @@ -12117,7 +12117,7 @@ std::unique_ptr makeEnumInfo(StringRef enumName, StringRef allValueNam enumInfo->m_name = enumName; enumInfo->m_values.reserve(values.size()); - const auto valueNames = Catch::Detail::parseEnums(allValueNames); + auto const valueNames = Catch::Detail::parseEnums(allValueNames); assert(valueNames.size() == values.size()); std::size_t i = 0; for (auto value : values) @@ -12165,7 +12165,7 @@ class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { public: ~ExceptionTranslatorRegistry(); - virtual void registerTranslator(const IExceptionTranslator* translator); + virtual void registerTranslator(IExceptionTranslator const* translator); std::string translateActiveException() const override; std::string tryTranslators() const; @@ -12183,9 +12183,9 @@ namespace Catch { ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {} -void ExceptionTranslatorRegistry::registerTranslator(const IExceptionTranslator* translator) +void ExceptionTranslatorRegistry::registerTranslator(IExceptionTranslator const* translator) { - m_translators.push_back(std::unique_ptr(translator)); + m_translators.push_back(std::unique_ptr(translator)); } #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) @@ -12231,7 +12231,7 @@ std::string ExceptionTranslatorRegistry::translateActiveException() const { return msg; } - catch (const char* msg) + catch (char const* msg) { return msg; } @@ -12314,7 +12314,7 @@ namespace Catch { struct SignalDefs { DWORD id; - const char* name; + char const* name; }; // There is no 1-1 mapping between signals and windows exceptions. @@ -12395,7 +12395,7 @@ namespace Catch { struct SignalDefs { int id; - const char* name; + char const* name; }; static SignalDefs signalDefs[] = {{SIGINT, "SIGINT - Terminal interrupt signal"}, @@ -12508,7 +12508,7 @@ namespace Catch { IGeneratorTracker::~IGeneratorTracker() {} -const char* GeneratorException::what() const noexcept +char const* GeneratorException::what() const noexcept { return m_msg; } @@ -13241,7 +13241,7 @@ WithinRelMatcher::WithinRelMatcher(double target, double epsilon) bool WithinRelMatcher::match(double const& matchee) const { - const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target)); + auto const relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target)); return marginComparison(matchee, m_target, std::isinf(relMargin) ? 0 : relMargin); } @@ -13294,7 +13294,7 @@ Floating::WithinRelMatcher WithinRel(float target) // end catch_matchers_floating.cpp // start catch_matchers_generic.cpp -std::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::string& desc) +std::string Catch::Matchers::Generic::Detail::finalizeDescription(std::string const& desc) { if (desc.empty()) { @@ -13900,7 +13900,7 @@ namespace { // Safe rotr implementation thanks to John Regehr uint32_t rotate_right(uint32_t val, uint32_t count) { - const uint32_t mask = 31; + uint32_t const mask = 31; count &= mask; return (val >> count) | (val << (-count & mask)); } @@ -13937,8 +13937,8 @@ void SimplePcg32::discard(uint64_t skip) SimplePcg32::result_type SimplePcg32::operator()() { // prepare the output value - const uint32_t xorshifted = static_cast(((m_state >> 18u) ^ m_state) >> 27u); - const auto output = rotate_right(xorshifted, m_state >> 59u); + uint32_t const xorshifted = static_cast(((m_state >> 18u) ^ m_state) >> 27u); + auto const output = rotate_right(xorshifted, m_state >> 59u); // advance state m_state = m_state * 6364136223846793005ULL + s_inc; @@ -14167,7 +14167,7 @@ class RegistryHub : public IRegistryHub, } void registerListener(IReporterFactoryPtr const& factory) override { m_reporterRegistry.registerListener(factory); } void registerTest(TestCase const& testInfo) override { m_testCaseRegistry.registerTest(testInfo); } - void registerTranslator(const IExceptionTranslator* translator) override + void registerTranslator(IExceptionTranslator const* translator) override { m_exceptionTranslatorRegistry.registerTranslator(translator); } @@ -14355,7 +14355,7 @@ struct GeneratorTracker : TestCaseTracking::TrackerBase, // `SECTION`s. // **The check for m_children.empty cannot be removed**. // doing so would break `GENERATE` _not_ followed by `SECTION`s. - const bool should_wait_for_child = [&]() { + bool const should_wait_for_child = [&]() { // No children -> nobody to wait for if (m_children.empty()) { @@ -14647,7 +14647,7 @@ std::string RunContext::getCurrentTestName() const return m_activeTestCase ? m_activeTestCase->getTestCaseInfo().name : std::string(); } -const AssertionResult* RunContext::getLastResult() const +AssertionResult const* RunContext::getLastResult() const { return &(*m_lastResult); } @@ -15046,7 +15046,7 @@ Version const& libraryVersion(); namespace Catch { namespace { -const int MaxExitCode = 255; +int const MaxExitCode = 255; IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) { @@ -15189,7 +15189,7 @@ Session::Session() // There cannot be exceptions at startup in no-exception mode. #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); + auto const& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); if (!exceptions.empty()) { config(); @@ -15199,7 +15199,7 @@ Session::Session() Colour colourGuard(Colour::Red); Catch::cerr() << "Errors occurred during startup!" << '\n'; // iterate over all exceptions and notify user - for (const auto& ex_ptr : exceptions) + for (auto const& ex_ptr : exceptions) { try { @@ -15685,7 +15685,7 @@ std::string trim(std::string const& str) StringRef trim(StringRef ref) { - const auto is_ws = [](char c) { + auto const is_ws = [](char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; }; size_t real_begin = 0; @@ -16031,12 +16031,12 @@ std::string TestCaseInfo::tagsAsString() const std::string ret; // '[' and ']' per tag std::size_t full_size = 2 * tags.size(); - for (const auto& tag : tags) + for (auto const& tag : tags) { full_size += tag.size(); } ret.reserve(full_size); - for (const auto& tag : tags) + for (auto const& tag : tags) { ret.push_back('['); ret.append(tag); @@ -16099,17 +16099,17 @@ struct TestHasher uint32_t operator()(TestCase const& t) const { // FNV-1a hash with multiplication fold. - const hash_t prime = 1099511628211u; + hash_t const prime = 1099511628211u; hash_t hash = 14695981039346656037u; - for (const char c : t.name) + for (char const c : t.name) { hash ^= c; hash *= prime; } hash ^= m_hashSuffix; hash *= prime; - const uint32_t low{static_cast(hash)}; - const uint32_t high{static_cast(hash >> 32)}; + uint32_t const low{static_cast(hash)}; + uint32_t const high{static_cast(hash >> 32)}; return low * high; } @@ -16665,7 +16665,7 @@ TestSpec::Matches TestSpec::matchesByFilter(std::vector const& testCas return matches; } -const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const +TestSpec::vectorStrings const& TestSpec::getInvalidArgs() const { return (m_invalidArgs); } @@ -16947,7 +16947,7 @@ TestSpec parseTestSpec(std::string const& arg) #include -static const uint64_t nanosecondsInSecond = 1000000000; +static uint64_t const nanosecondsInSecond = 1000000000; namespace Catch { @@ -16962,7 +16962,7 @@ namespace { auto estimateClockResolution() -> uint64_t { uint64_t sum = 0; - static const uint64_t iterations = 1000000; + static uint64_t const iterations = 1000000; auto startTime = getCurrentNanosecondsSinceEpoch(); @@ -17041,10 +17041,10 @@ namespace Catch { namespace Detail { -const std::string unprintableString = "{?}"; +std::string const unprintableString = "{?}"; namespace { -const int hexThreshold = 255; +int const hexThreshold = 255; struct Endianness { @@ -17061,7 +17061,7 @@ struct Endianness }; } // namespace -std::string rawMemoryToString(const void* object, std::size_t size) +std::string rawMemoryToString(void const* object, std::size_t size) { // Reverse order for little endian architectures int i = 0, end = static_cast(size), inc = 1; @@ -17107,7 +17107,7 @@ std::string fpToString(T value, int precision) // //// ======================================================= //// -std::string StringMaker::convert(const std::string& str) +std::string StringMaker::convert(std::string const& str) { if (!getCurrentContext().getConfig()->showInvisibles()) { @@ -17165,7 +17165,7 @@ std::string StringMaker::convert(char* str) } #ifdef CATCH_CONFIG_WCHAR -std::string StringMaker::convert(const std::wstring& wstr) +std::string StringMaker::convert(std::wstring const& wstr) { std::string s; s.reserve(wstr.size()); @@ -17936,7 +17936,7 @@ std::string getFormattedDuration(double duration) // + 1 for decimal point // + 3 for the 3 decimal places // + 1 for null terminator - const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; + std::size_t const maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; char buffer[maxDoubleSize]; // Save previous errno, to prevent sprintf from overwriting it @@ -17959,7 +17959,7 @@ bool shouldShowDuration(IConfig const& config, double duration) { return false; } - const double min = config.minDuration(); + double const min = config.minDuration(); return min >= 0 && duration >= min; } @@ -18002,20 +18002,20 @@ bool TestEventListenerBase::assertionEnded(AssertionStats const&) namespace { #ifdef CATCH_PLATFORM_MAC -const char* failedString() +char const* failedString() { return "FAILED"; } -const char* passedString() +char const* passedString() { return "PASSED"; } #else -const char* failedString() +char const* failedString() { return "failed"; } -const char* passedString() +char const* passedString() { return "passed"; } @@ -18042,7 +18042,7 @@ namespace { // - white: Passed [both/all] N test cases (no assertions). // - red: Failed N tests cases, failed M assertions. // - green: Passed [both/all] N tests cases with M assertions. -void printTotals(std::ostream& out, const Totals& totals) +void printTotals(std::ostream& out, Totals const& totals) { if (totals.testCases.total() == 0) { @@ -18051,7 +18051,7 @@ void printTotals(std::ostream& out, const Totals& totals) else if (totals.testCases.failed == totals.testCases.total()) { Colour colour(Colour::ResultError); - const std::string qualify_assertions_failed = + std::string const qualify_assertions_failed = totals.assertions.failed == totals.assertions.total() ? bothOrAll(totals.assertions.failed) : std::string(); out << "Failed " << bothOrAll(totals.testCases.failed) << pluralise(totals.testCases.failed, "test case") << ", " @@ -18231,8 +18231,8 @@ class AssertionPrinter if (itMessage == messages.end()) return; - const auto itEnd = messages.cend(); - const auto N = static_cast(std::distance(itMessage, itEnd)); + auto const itEnd = messages.cend(); + auto const N = static_cast(std::distance(itMessage, itEnd)); { Colour colourGuard(colour); @@ -18530,10 +18530,10 @@ struct RowBreak class Duration { enum class Unit { Auto, Nanoseconds, Microseconds, Milliseconds, Seconds, Minutes }; - static const uint64_t s_nanosecondsInAMicrosecond = 1000; - static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond; - static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond; - static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond; + static uint64_t const s_nanosecondsInAMicrosecond = 1000; + static uint64_t const s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond; + static uint64_t const s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond; + static uint64_t const s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond; double m_inNanoseconds; Unit m_units; @@ -18654,7 +18654,7 @@ class TablePrinter friend TablePrinter& operator<<(TablePrinter& tp, ColumnBreak) { auto colStr = tp.m_oss.str(); - const auto strSize = colStr.size(); + auto const strSize = colStr.size(); tp.m_oss.str(""); tp.open(); if (tp.m_currentColumn == static_cast(tp.m_columnInfos.size() - 1)) @@ -19099,7 +19099,7 @@ std::string getCurrentTimestamp() #endif char timeStamp[timeStampSize]; - const char* const fmt = "%Y-%m-%dT%H:%M:%SZ"; + char const* const fmt = "%Y-%m-%dT%H:%M:%SZ"; #ifdef _MSC_VER std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); @@ -19109,7 +19109,7 @@ std::string getCurrentTimestamp() return std::string(timeStamp, timeStampSize - 1); } -std::string fileNameTag(const std::vector& tags) +std::string fileNameTag(std::vector const& tags) { auto it = std::find_if(begin(tags), end(tags), [](std::string const& tag) { return tag.front() == '#'; }); if (it != tags.end()) diff --git a/test/standalone/agg_rasterizer_integer_overflow_test.cpp b/test/standalone/agg_rasterizer_integer_overflow_test.cpp index 05d3556f0..47925c5e8 100644 --- a/test/standalone/agg_rasterizer_integer_overflow_test.cpp +++ b/test/standalone/agg_rasterizer_integer_overflow_test.cpp @@ -15,7 +15,7 @@ #include // geojson box of the world -const std::string +std::string const geojson("{ \"type\": \"Feature\", \"properties\": { }, \"geometry\": { \"type\": \"Polygon\", \"coordinates\": [ [ [ " "-17963313.143242701888084, -6300857.11560364998877 ], [ -17963313.143242701888084, 13071343.332991421222687 " "], [ 7396658.353099936619401, 13071343.332991421222687 ], [ 7396658.353099936619401, " diff --git a/test/standalone/map_xml_test.cpp b/test/standalone/map_xml_test.cpp index 7f07c837a..7a5ab21b9 100644 --- a/test/standalone/map_xml_test.cpp +++ b/test/standalone/map_xml_test.cpp @@ -66,7 +66,7 @@ class tmp_dir } } } - catch (const std::exception& e) + catch (std::exception const& e) { std::cerr << "Exception caught while trying to remove " << "temporary directory " << m_path << ": " << e.what() << "\n"; @@ -149,7 +149,7 @@ void load_map(mapnik::Map& m, mapnik::fs::path const& path) } // anonymous namespace #ifndef MAPNIK_STATIC_PLUGINS -const bool registered = +bool const registered = mapnik::datasource_cache::instance().register_datasources((mapnik::fs::path("plugins") / "input").generic_string()); #endif TEST_CASE("map xml I/O") diff --git a/test/unit/datasource/csv.cpp b/test/unit/datasource/csv.cpp index 8b4e4b763..34d88f11a 100644 --- a/test/unit/datasource/csv.cpp +++ b/test/unit/datasource/csv.cpp @@ -86,7 +86,7 @@ TEST_CASE("csv") using mapnik::util::from_u8string; // check the CSV datasource is loaded - const bool have_csv_plugin = mapnik::datasource_cache::instance().plugin_registered("csv"); + bool const have_csv_plugin = mapnik::datasource_cache::instance().plugin_registered("csv"); if (have_csv_plugin) { // make the tests silent since we intentionally test error conditions that are noisy diff --git a/test/unit/datasource/gdal.cpp b/test/unit/datasource/gdal.cpp index b2ef3c88a..448ed7c59 100644 --- a/test/unit/datasource/gdal.cpp +++ b/test/unit/datasource/gdal.cpp @@ -31,7 +31,7 @@ namespace { mapnik::datasource_ptr get_gdal_ds(std::string const& file_name, std::optional band) { - const bool have_gdal_plugin = mapnik::datasource_cache::instance().plugin_registered("gdal"); + bool const have_gdal_plugin = mapnik::datasource_cache::instance().plugin_registered("gdal"); if (!have_gdal_plugin) { return mapnik::datasource_ptr(); diff --git a/test/unit/datasource/geobuf.cpp b/test/unit/datasource/geobuf.cpp index 6caa728f6..017f3b05f 100644 --- a/test/unit/datasource/geobuf.cpp +++ b/test/unit/datasource/geobuf.cpp @@ -36,7 +36,7 @@ TEST_CASE("Geobuf") { - const bool have_geobuf_plugin = mapnik::datasource_cache::instance().plugin_registered("geobuf"); + bool const have_geobuf_plugin = mapnik::datasource_cache::instance().plugin_registered("geobuf"); if (have_geobuf_plugin) { SECTION("Point") diff --git a/test/unit/datasource/geojson.cpp b/test/unit/datasource/geojson.cpp index 6d2d9dd3a..85069b26d 100644 --- a/test/unit/datasource/geojson.cpp +++ b/test/unit/datasource/geojson.cpp @@ -84,7 +84,7 @@ void iterate_over_features(mapnik::featureset_ptr features) TEST_CASE("geojson") { - const bool have_geojson_plugin = mapnik::datasource_cache::instance().plugin_registered("geojson"); + bool const have_geojson_plugin = mapnik::datasource_cache::instance().plugin_registered("geojson"); if (have_geojson_plugin) { SECTION("GeoJSON I/O errors") diff --git a/test/unit/datasource/ogr.cpp b/test/unit/datasource/ogr.cpp index 6edfe5538..0a2ef0adf 100644 --- a/test/unit/datasource/ogr.cpp +++ b/test/unit/datasource/ogr.cpp @@ -45,7 +45,7 @@ void assert_option(std::vector const& options, size_t con TEST_CASE("ogr") { - const bool have_ogr_plugin = mapnik::datasource_cache::instance().plugin_registered("ogr"); + bool const have_ogr_plugin = mapnik::datasource_cache::instance().plugin_registered("ogr"); if (have_ogr_plugin) { SECTION("ogr point feature") @@ -73,7 +73,7 @@ TEST_CASE("ogr") TEST_CASE("ogr open_options") { - const bool have_ogr_plugin = mapnik::datasource_cache::instance().plugin_registered("ogr"); + bool const have_ogr_plugin = mapnik::datasource_cache::instance().plugin_registered("ogr"); if (have_ogr_plugin) { SECTION("splitting open_options string") diff --git a/test/unit/datasource/shapeindex.cpp b/test/unit/datasource/shapeindex.cpp index 2abced5d7..376d0d03b 100644 --- a/test/unit/datasource/shapeindex.cpp +++ b/test/unit/datasource/shapeindex.cpp @@ -98,7 +98,7 @@ int create_shapefile_index(std::string const& filename, bool index_parts, bool s TEST_CASE("invalid shapeindex") { - const bool have_shape_plugin = mapnik::datasource_cache::instance().plugin_registered("shape"); + bool const have_shape_plugin = mapnik::datasource_cache::instance().plugin_registered("shape"); if (have_shape_plugin) { SECTION("Invalid index") @@ -141,7 +141,7 @@ TEST_CASE("invalid shapeindex") TEST_CASE("shapeindex") { - const bool have_shape_plugin = mapnik::datasource_cache::instance().plugin_registered("shape"); + bool const have_shape_plugin = mapnik::datasource_cache::instance().plugin_registered("shape"); if (have_shape_plugin) { SECTION("Index") diff --git a/test/unit/geometry/grid_vertex_converter.cpp b/test/unit/geometry/grid_vertex_converter.cpp index 57249b0d8..d25239e2c 100644 --- a/test/unit/geometry/grid_vertex_converter.cpp +++ b/test/unit/geometry/grid_vertex_converter.cpp @@ -7,10 +7,10 @@ TEST_CASE("spiral_iterator") SECTION("sprial 3x3") { mapnik::geometry::spiral_iterator si(3); - const mapnik::geometry::point points[] = + mapnik::geometry::point const points[] = {{0, 0}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1}}; - const std::size_t points_size = std::extent::value; + std::size_t const points_size = std::extent::value; int x, y; std::size_t index = 0; @@ -77,13 +77,13 @@ TEST_CASE("grid_vertex_converter") using converter_type = mapnik::geometry::grid_vertex_converter; converter_type gvc(path, 3.0, 3.0, 1.0); - const mapnik::geometry::point points[] = { + mapnik::geometry::point const points[] = { {0, 0}, {3, 0}, {3, 3}, {0, 3}, {-3, 3}, {-3, 0}, {-3, -3}, {0, -3}, {3, -3}, {6, -3}, {6, 0}, {6, 3}, {6, 6}, {3, 6}, {0, 6}, {-3, 6}, {-6, 6}, {-6, 3}, {-6, 0}, {-6, -3}, {-6, -6}, {-3, -6}, {0, -6}, {3, -6}, {6, -6}, {9, -6}, {9, -3}, {9, 0}, {9, 3}, {9, 6}, {9, 9}, {6, 9}, {3, 9}, {0, 9}, {-3, 9}, {-6, 9}, {-9, 9}, {-9, 6}, {-9, 3}, {-9, 0}, {-9, -3}, {-9, -6}, {-9, -9}, {-6, -9}, {-3, -9}, {0, -9}, {3, -9}, {6, -9}, {9, -9}}; - const std::size_t points_size = std::extent::value; + std::size_t const points_size = std::extent::value; double x, y; unsigned cmd = mapnik::SEG_END; diff --git a/test/unit/imaging/image.cpp b/test/unit/imaging/image.cpp index d58767ad2..9990c0354 100644 --- a/test/unit/imaging/image.cpp +++ b/test/unit/imaging/image.cpp @@ -12,7 +12,7 @@ TEST_CASE("image class") { SECTION("test gray16") { - const mapnik::image_gray16 im(4, 4); + mapnik::image_gray16 const im(4, 4); mapnik::image_gray16 im2(im); mapnik::image_gray16 im3(5, 5); @@ -147,7 +147,7 @@ TEST_CASE("image class") SECTION("image_null") { mapnik::image_null im_null; - const mapnik::image_null im_null2(2, 2); // Actually doesn't really set any size + mapnik::image_null const im_null2(2, 2); // Actually doesn't really set any size mapnik::image_null im_null3(im_null2); mapnik::image_null im_null4(std::move(im_null3)); @@ -193,7 +193,7 @@ TEST_CASE("image class") SECTION("image any") { mapnik::image_null null_im; - const mapnik::image_any im_any_null(null_im); + mapnik::image_any const im_any_null(null_im); CHECK(im_any_null.get_dtype() == mapnik::image_dtype_null); CHECK(im_any_null.bytes() == nullptr); @@ -282,7 +282,7 @@ TEST_CASE("image class") CHECK_FALSE(!buf); unsigned char* d = buf.data(); *d = 9; - const mapnik::detail::buffer buf2 = buf; + mapnik::detail::buffer const buf2 = buf; CHECK(buf2.size() == 10); unsigned char const* d2 = buf2.data(); CHECK(*d2 == 9); diff --git a/test/unit/imaging/image_view.cpp b/test/unit/imaging/image_view.cpp index 7382544c2..b450ebb73 100644 --- a/test/unit/imaging/image_view.cpp +++ b/test/unit/imaging/image_view.cpp @@ -43,7 +43,7 @@ TEST_CASE("image view") mapnik::image_view_rgba8 view_yellow(0, 2, 2, 2, im); mapnik::image_view_rgba8 view_red(2, 2, 2, 2, im); mapnik::image_view_rgba8 view_bad(99, 99, 99, 99, im); - const mapnik::image_view_rgba8 view_all_2(0, 0, 4, 4, im2); + mapnik::image_view_rgba8 const view_all_2(0, 0, 4, 4, im2); // Check that image_views all have the same underlying data CHECK(view_all == view_blue); @@ -227,7 +227,7 @@ TEST_CASE("image view") SECTION("image_view_null") { mapnik::image_view_null view_null; - const mapnik::image_view_null view_null2; + mapnik::image_view_null const view_null2; mapnik::image_view_null view_null3(view_null2); mapnik::image_view_null& view_null4 = view_null3; diff --git a/test/unit/map/background.cpp b/test/unit/map/background.cpp index 6e7dd3f90..a1ebd68a4 100644 --- a/test/unit/map/background.cpp +++ b/test/unit/map/background.cpp @@ -36,13 +36,13 @@ TEST_CASE("map") { mapnik::Map map(256, 256); mapnik::image_rgba8 image(map.width(), map.height()); - const mapnik::color c1(255, 0, 0); + mapnik::color const c1(255, 0, 0); mapnik::fill(image, c1); CHECK(image(0, 0) == c1.rgba()); // Fully transparent black should replace red color - const mapnik::color c2(0, 0, 0, 0); + mapnik::color const c2(0, 0, 0, 0); map.set_background(c2); mapnik::agg_renderer ren(map, image); ren.apply(); @@ -65,12 +65,12 @@ TEST_CASE("map") { mapnik::image_rgba8 image(map.width(), map.height()); mapnik::cairo_image_to_rgba8(image, image_surface); - const mapnik::color c1(255, 0, 0); + mapnik::color const c1(255, 0, 0); CHECK(image(0, 0) == c1.rgba()); } // Fully transparent black should replace red color - const mapnik::color c2(0, 0, 0, 0); + mapnik::color const c2(0, 0, 0, 0); map.set_background(c2); mapnik::cairo_renderer ren(map, image_context, 1.0); ren.apply(); diff --git a/test/unit/projection/proj_transform.cpp b/test/unit/projection/proj_transform.cpp index 839e36619..789ac5856 100644 --- a/test/unit/projection/proj_transform.cpp +++ b/test/unit/projection/proj_transform.cpp @@ -143,7 +143,7 @@ TEST_CASE("projection transform") // // wrong = mapnik.Box2d(-177.3145325044, -62.3337481525, // 178.0277836332, -24.5845974912) - const mapnik::box2d better(-180.0, -62.3337481525, 180.0, -24.5845974912); + mapnik::box2d const better(-180.0, -62.3337481525, 180.0, -24.5845974912); { mapnik::box2d ext(274000, 3087000, 3327000, 7173000); @@ -177,7 +177,7 @@ TEST_CASE("projection transform") // 274000 7173000 # top-most // END // - const mapnik::box2d normal(148.7639922894, -60.1222810241, 159.9548489296, -24.9771195155); + mapnik::box2d const normal(148.7639922894, -60.1222810241, 159.9548489296, -24.9771195155); { // checks for not being snapped (ie. not antimeridian) @@ -214,7 +214,7 @@ TEST_CASE("projection transform") mapnik::proj_transform prj_trans_rev(prj_geog, prj_proj); // bounds - const mapnik::box2d bounds{-180.0, 60.0, 180.0, 90.0}; + mapnik::box2d const bounds{-180.0, 60.0, 180.0, 90.0}; { // projected bounds mapnik::box2d projected_bounds{-3299207.53, -3333134.03, 3299207.53, 3333134.03}; diff --git a/test/unit/renderer/buffer_size_scale_factor.cpp b/test/unit/renderer/buffer_size_scale_factor.cpp index 425890c63..82dae6161 100644 --- a/test/unit/renderer/buffer_size_scale_factor.cpp +++ b/test/unit/renderer/buffer_size_scale_factor.cpp @@ -45,7 +45,7 @@ TEST_CASE("feature_style_processor: buffer-size with scale-factor") { SECTION("query extent with buffer-size should not be affected by scale-factor") { - const mapnik::box2d expected_query_bbox(-0.5, -0.5, 1.5, 1.5); + mapnik::box2d const expected_query_bbox(-0.5, -0.5, 1.5, 1.5); using datasource_ptr = std::shared_ptr; datasource_ptr datasource = std::make_shared(expected_query_bbox); @@ -74,7 +74,7 @@ TEST_CASE("feature_style_processor: buffer-size with scale-factor") lyr.add_style("lines"); map.add_layer(lyr); - const mapnik::box2d map_extent(0, 0, 1, 1); + mapnik::box2d const map_extent(0, 0, 1, 1); map.zoom_to_box(map_extent); { diff --git a/test/unit/renderer/feature_style_processor.cpp b/test/unit/renderer/feature_style_processor.cpp index 5040827ee..6bfb00ee8 100644 --- a/test/unit/renderer/feature_style_processor.cpp +++ b/test/unit/renderer/feature_style_processor.cpp @@ -152,7 +152,7 @@ TEST_CASE("feature_style_processor") REQUIRE(result.end_style_processing == 1); REQUIRE(result.layer_query_extents.size() == 1); - const mapnik::box2d reference_query_extent(-10, 0, 15, 20); + mapnik::box2d const reference_query_extent(-10, 0, 15, 20); REQUIRE(result.layer_query_extents.front() == reference_query_extent); REQUIRE(result.geometries.size() == 2); @@ -178,7 +178,7 @@ TEST_CASE("feature_style_processor") REQUIRE(result.end_style_processing == 1); REQUIRE(result.layer_query_extents.size() == 1); - const mapnik::box2d reference_query_extent(-10, 0, 15, 20); + mapnik::box2d const reference_query_extent(-10, 0, 15, 20); REQUIRE(result.layer_query_extents.front() == reference_query_extent); REQUIRE(result.geometries.size() == 2); @@ -214,7 +214,7 @@ TEST_CASE("feature_style_processor") REQUIRE(result.end_style_processing == 1); REQUIRE(result.layer_query_extents.size() == 1); - const mapnik::box2d reference_query_extent(-10, 0, 15, 20); + mapnik::box2d const reference_query_extent(-10, 0, 15, 20); REQUIRE(result.layer_query_extents.front() == reference_query_extent); REQUIRE(result.geometries.size() == 2); diff --git a/test/unit/serialization/wkb_formats_test.cpp b/test/unit/serialization/wkb_formats_test.cpp index f5d8ffb6f..be5549d0f 100644 --- a/test/unit/serialization/wkb_formats_test.cpp +++ b/test/unit/serialization/wkb_formats_test.cpp @@ -66,41 +66,41 @@ TEST_CASE("geometry formats") { // spatialite blob mapnik::geometry::geometry geom = - mapnik::geometry_utils::from_wkb((const char*)sp_valid_blob, + mapnik::geometry_utils::from_wkb((char const*)sp_valid_blob, sizeof(sp_valid_blob) / sizeof(sp_valid_blob[0]), mapnik::wkbSpatiaLite); // winding order is not correct per OGC so we'll fix it mapnik::geometry::correct(geom); REQUIRE(mapnik::geometry::is_valid(geom)); REQUIRE(mapnik::geometry::is_simple(geom)); - geom = mapnik::geometry_utils::from_wkb((const char*)sp_valid_blob, + geom = mapnik::geometry_utils::from_wkb((char const*)sp_valid_blob, sizeof(sp_valid_blob) / sizeof(sp_valid_blob[0]), mapnik::wkbAuto); mapnik::geometry::correct(geom); REQUIRE(mapnik::geometry::is_valid(geom)); REQUIRE(mapnik::geometry::is_simple(geom)); - geom = mapnik::geometry_utils::from_wkb((const char*)sp_invalid_blob, + geom = mapnik::geometry_utils::from_wkb((char const*)sp_invalid_blob, sizeof(sp_invalid_blob) / sizeof(sp_invalid_blob[0]), mapnik::wkbAuto); REQUIRE(geom.is()); // returns geometry_empty // sqlite generic wkb blob - geom = mapnik::geometry_utils::from_wkb((const char*)sq_valid_blob, + geom = mapnik::geometry_utils::from_wkb((char const*)sq_valid_blob, sizeof(sq_valid_blob) / sizeof(sq_valid_blob[0]), mapnik::wkbGeneric); REQUIRE(mapnik::geometry::is_valid(geom)); REQUIRE(mapnik::geometry::is_simple(geom)); - geom = mapnik::geometry_utils::from_wkb((const char*)sq_valid_blob, + geom = mapnik::geometry_utils::from_wkb((char const*)sq_valid_blob, sizeof(sq_valid_blob) / sizeof(sq_valid_blob[0]), mapnik::wkbAuto); REQUIRE(mapnik::geometry::is_valid(geom)); REQUIRE(mapnik::geometry::is_simple(geom)); - geom = mapnik::geometry_utils::from_wkb((const char*)sq_invalid_blob, + geom = mapnik::geometry_utils::from_wkb((char const*)sq_invalid_blob, sizeof(sq_invalid_blob) / sizeof(sq_invalid_blob[0]), mapnik::wkbGeneric); REQUIRE(geom.is()); // returns geometry_empty diff --git a/test/unit/serialization/xml_parser_trim.cpp b/test/unit/serialization/xml_parser_trim.cpp index 0e83cbf90..01f8ac11c 100644 --- a/test/unit/serialization/xml_parser_trim.cpp +++ b/test/unit/serialization/xml_parser_trim.cpp @@ -12,7 +12,7 @@ TEST_CASE("xml parser") // simple and non-valid mapnik XML reduced from the empty_parameter2.xml // test case. this is to check that the xml parsing routine is trimming // whitespace from text nodes as part of the parsing operation. - const std::string xml("" + std::string const xml("" " " " " " " diff --git a/test/unit/svg/util.hpp b/test/unit/svg/util.hpp index 3086d6909..74d2a1417 100644 --- a/test/unit/svg/util.hpp +++ b/test/unit/svg/util.hpp @@ -33,7 +33,7 @@ struct vertex_equal template bool operator()(T const& lhs, T const& rhs) const { - static const double eps = 1.0 / std::pow(10, N); + static double const eps = 1.0 / std::pow(10, N); return (std::fabs(std::get<0>(lhs) - std::get<0>(rhs)) < eps) && (std::fabs(std::get<1>(lhs) - std::get<1>(rhs)) < eps) && std::get<2>(lhs) == std::get<2>(rhs); } diff --git a/test/unit/util/char_array_buffer.cpp b/test/unit/util/char_array_buffer.cpp index 58540d9df..381983da2 100644 --- a/test/unit/util/char_array_buffer.cpp +++ b/test/unit/util/char_array_buffer.cpp @@ -7,7 +7,7 @@ TEST_CASE("char_array_buffer") { SECTION("std::istream seekg, tellg") { - const std::size_t buffer_size = 66; + std::size_t const buffer_size = 66; char buffer[buffer_size]; mapnik::util::char_array_buffer array_buff(buffer, buffer_size); std::istream stream(&array_buff); diff --git a/test/unit/vertex_adapter/line_offset_test.cpp b/test/unit/vertex_adapter/line_offset_test.cpp index 4871e4588..1542b6cac 100644 --- a/test/unit/vertex_adapter/line_offset_test.cpp +++ b/test/unit/vertex_adapter/line_offset_test.cpp @@ -17,7 +17,7 @@ double dist(mapnik::pixel_position const& a, mapnik::pixel_position const& b) void test_simple_segment(double const& offset) { - const double dx = 0.01; + double const dx = 0.01; fake_path path = {0, 0, 1, 0}, off_path = {0, offset, 1, offset}; mapnik::vertex_cache vc(path), off_vc(off_path); @@ -36,7 +36,7 @@ void test_simple_segment(double const& offset) void test_straight_line(double const& offset) { - const double dx = 0.01; + double const dx = 0.01; fake_path path = {0, 0, 0.1, 0, 0.9, 0, 1, 0}, off_path = {0, offset, 0.4, offset, 0.6, offset, 1, offset}; mapnik::vertex_cache vc(path), off_vc(off_path); @@ -55,11 +55,11 @@ void test_straight_line(double const& offset) void test_offset_curve(double const& offset) { - const double dx = 0.01; - const double r = (1.0 + offset); + double const dx = 0.01; + double const r = (1.0 + offset); std::vector pos, off_pos; - const size_t max_i = 1000; + size_t const max_i = 1000; for (size_t i = 0; i <= max_i; ++i) { double x = mapnik::util::pi * double(i) / max_i; @@ -94,12 +94,12 @@ void test_offset_curve(double const& offset) void test_s_shaped_curve(double const& offset) { - const double dx = 0.01; - const double r = (1.0 + offset); - const double r2 = (1.0 - offset); + double const dx = 0.01; + double const r = (1.0 + offset); + double const r2 = (1.0 - offset); std::vector pos, off_pos; - const size_t max_i = 1000; + size_t const max_i = 1000; for (size_t i = 0; i <= max_i; ++i) { double x = mapnik::util::pi * double(i) / max_i; diff --git a/test/unit/vertex_adapter/offset_converter.cpp b/test/unit/vertex_adapter/offset_converter.cpp index f855d450d..b6b80f45b 100644 --- a/test/unit/vertex_adapter/offset_converter.cpp +++ b/test/unit/vertex_adapter/offset_converter.cpp @@ -136,10 +136,10 @@ void test_straight_line(double const& offset) void test_offset_curve(double const& offset) { - const double r = (1.0 + offset); + double const r = (1.0 + offset); std::vector pos, off_pos; - const size_t max_i = 1000; + size_t const max_i = 1000; for (size_t i = 0; i <= max_i; ++i) { double x = mapnik::util::pi * double(i) / max_i; @@ -193,11 +193,11 @@ void test_offset_curve(double const& offset) void test_s_shaped_curve(double const& offset) { - const double r = (1.0 + offset); - const double r2 = (1.0 - offset); + double const r = (1.0 + offset); + double const r2 = (1.0 - offset); std::vector pos, off_pos; - const size_t max_i = 1000; + size_t const max_i = 1000; for (size_t i = 0; i <= max_i; ++i) { double x = mapnik::util::pi * double(i) / max_i; @@ -372,7 +372,7 @@ TEST_CASE("offset converter") SECTION("offsect converter does not skip SEG_MOVETO or SEG_CLOSE vertices") { - const double offset = 0.2; + double const offset = 0.2; fake_path path = {}; path.vertices_.emplace_back(-2, -2, mapnik::SEG_MOVETO); diff --git a/test/visual/renderer.hpp b/test/visual/renderer.hpp index 028fdcd21..e5e6278de 100644 --- a/test/visual/renderer.hpp +++ b/test/visual/renderer.hpp @@ -66,8 +66,8 @@ struct raster_renderer_base { using image_type = ImageType; - static constexpr const char* ext = ".png"; - static constexpr const bool support_tiles = true; + static constexpr char const* ext = ".png"; + static constexpr bool const support_tiles = true; unsigned compare(image_type const& actual, mapnik::fs::path const& reference) const { @@ -93,7 +93,7 @@ struct vector_renderer_base { using image_type = std::string; - static constexpr const bool support_tiles = false; + static constexpr bool const support_tiles = false; unsigned compare(image_type const& actual, mapnik::fs::path const& reference) const { @@ -119,7 +119,7 @@ struct vector_renderer_base struct agg_renderer : raster_renderer_base { - static constexpr const char* name = "agg"; + static constexpr char const* name = "agg"; image_type render(mapnik::Map const& map, double scale_factor) const { @@ -133,7 +133,7 @@ struct agg_renderer : raster_renderer_base #if defined(HAVE_CAIRO) struct cairo_renderer : raster_renderer_base { - static constexpr const char* name = "cairo"; + static constexpr char const* name = "cairo"; image_type render(mapnik::Map const& map, double scale_factor) const { @@ -154,7 +154,7 @@ using surface_create_type = cairo_surface_t* (&)(cairo_write_func_t, void*, doub template struct cairo_vector_renderer : vector_renderer_base { - static cairo_status_t write(void* closure, const unsigned char* data, unsigned int length) + static cairo_status_t write(void* closure, unsigned char const* data, unsigned int length) { std::ostringstream& ss = *reinterpret_cast(closure); ss.write(reinterpret_cast(data), length); @@ -184,24 +184,24 @@ inline cairo_surface_t* create_svg_1_2(cairo_write_func_t write_func, void* clos struct cairo_svg_renderer : cairo_vector_renderer { - static constexpr const char* name = "cairo-svg"; - static constexpr const char* ext = ".svg"; + static constexpr char const* name = "cairo-svg"; + static constexpr char const* ext = ".svg"; }; #endif #ifdef CAIRO_HAS_PS_SURFACE struct cairo_ps_renderer : cairo_vector_renderer { - static constexpr const char* name = "cairo-ps"; - static constexpr const char* ext = ".ps"; + static constexpr char const* name = "cairo-ps"; + static constexpr char const* ext = ".ps"; }; #endif #ifdef CAIRO_HAS_PDF_SURFACE struct cairo_pdf_renderer : cairo_vector_renderer { - static constexpr const char* name = "cairo-pdf"; - static constexpr const char* ext = ".pdf"; + static constexpr char const* name = "cairo-pdf"; + static constexpr char const* ext = ".pdf"; }; #endif #endif @@ -209,8 +209,8 @@ struct cairo_pdf_renderer : cairo_vector_renderer { - static constexpr const char* name = "grid"; + static constexpr char const* name = "grid"; void convert(mapnik::grid::data_type const& grid, image_type& image) const { @@ -392,10 +392,10 @@ class renderer return s.str(); } - const Renderer ren; - const mapnik::fs::path output_dir; - const mapnik::fs::path reference_dir; - const bool overwrite; + Renderer const ren; + mapnik::fs::path const output_dir; + mapnik::fs::path const reference_dir; + bool const overwrite; }; using renderer_type = mapnik::util::variant diff --git a/test/visual/report.cpp b/test/visual/report.cpp index aba323dee..6c648b2f3 100644 --- a/test/visual/report.cpp +++ b/test/visual/report.cpp @@ -212,7 +212,7 @@ void html_report::report(result const& r, mapnik::fs::path const& output_dir) } } -constexpr const char* html_header = R"template( +constexpr char const* html_header = R"template(