diff --git a/include/mapnik/coord_array.hpp b/include/mapnik/coord_array.hpp index 91b896117..dc3c2edd6 100644 --- a/include/mapnik/coord_array.hpp +++ b/include/mapnik/coord_array.hpp @@ -27,10 +27,11 @@ #include // stl +#include #include -#include namespace mapnik { + template class coord_array { @@ -43,8 +44,9 @@ public: coord_array(coord_array const& rhs) : pt_(static_cast(rhs.size_==0?0: ::operator new (sizeof(coord_type)*rhs.size_))), - size_(rhs.size_) { - std::memcpy(pt_,rhs.pt_,sizeof(coord_type)*rhs.size_); + size_(rhs.size_) + { + std::copy(rhs.pt_, rhs.pt_ + rhs.size_ , pt_); } ~coord_array() diff --git a/include/mapnik/graphics.hpp b/include/mapnik/graphics.hpp index 483bf50b2..b15d9f46b 100644 --- a/include/mapnik/graphics.hpp +++ b/include/mapnik/graphics.hpp @@ -32,8 +32,8 @@ #include // stl +#include #include -#include // memset #include // boost @@ -81,7 +81,7 @@ public: inline void clear() { - std::memset(data_.getData(),0,sizeof(mapnik::image_data_32::pixel_type)*data_.width()*data_.height()); + std::fill(data_.getData(), data_.getData() + data_.width() * data_.height(), 0); } boost::optional const& get_background() const; diff --git a/include/mapnik/hextree.hpp b/include/mapnik/hextree.hpp index 96091b62b..166398a75 100644 --- a/include/mapnik/hextree.hpp +++ b/include/mapnik/hextree.hpp @@ -29,10 +29,9 @@ #include // stl -#include -#include -#include #include +#include +#include #include namespace mapnik { @@ -67,7 +66,7 @@ class hextree : private mapnik::noncopyable reduce_cost(0.0), children_count(0) { - std::memset(&children_[0],0,sizeof(children_)); + std::fill(children_, children_ + 16, nullptr); } ~node () diff --git a/include/mapnik/octree.hpp b/include/mapnik/octree.hpp index bf2b55638..f98eb53f8 100644 --- a/include/mapnik/octree.hpp +++ b/include/mapnik/octree.hpp @@ -29,10 +29,9 @@ #include // stl -#include -#include -#include #include +#include +#include namespace mapnik { @@ -63,7 +62,7 @@ class octree : private mapnik::noncopyable children_count(0), index(0) { - std::memset(&children_[0],0,sizeof(children_)); + std::fill(children_,children_ + 8, nullptr); } ~node() diff --git a/include/mapnik/quad_tree.hpp b/include/mapnik/quad_tree.hpp index ddd0509fa..ed716bf4d 100644 --- a/include/mapnik/quad_tree.hpp +++ b/include/mapnik/quad_tree.hpp @@ -31,8 +31,8 @@ #include // stl +#include #include -#include namespace mapnik { @@ -52,7 +52,7 @@ class quad_tree : mapnik::noncopyable explicit node(box2d const& ext) : extent_(ext) { - std::memset(children_,0,4*sizeof(node*)); + std::fill(children_, children_ + 4, nullptr); } box2d const& extent() const diff --git a/include/mapnik/util/geometry_to_wkb.hpp b/include/mapnik/util/geometry_to_wkb.hpp index bd90161b9..3ec50fc04 100644 --- a/include/mapnik/util/geometry_to_wkb.hpp +++ b/include/mapnik/util/geometry_to_wkb.hpp @@ -83,7 +83,7 @@ struct wkb_stream void write(char const* data, std::size_t size) { - std::memcpy(buffer_ + pos_, data, size); + std::copy(data, data + size, buffer_ + pos_); pos_ += size; } diff --git a/include/mapnik/vertex_vector.hpp b/include/mapnik/vertex_vector.hpp index e21769c57..198865cc5 100644 --- a/include/mapnik/vertex_vector.hpp +++ b/include/mapnik/vertex_vector.hpp @@ -32,8 +32,8 @@ #include // stl +#include #include -#include // required for memcpy with linux/g++ #include namespace mapnik @@ -131,8 +131,8 @@ private: command_size** new_commands = (command_size**)(new_vertices + max_blocks_ + grow_by); if (vertices_) { - std::memcpy(new_vertices,vertices_,max_blocks_ * sizeof(coord_type*)); - std::memcpy(new_commands,commands_,max_blocks_ * sizeof(command_size*)); + std::copy(vertices_, vertices_ + max_blocks_, new_vertices); + std::copy(commands_, commands_ + max_blocks_, new_commands); ::operator delete(vertices_); } vertices_ = new_vertices; diff --git a/include/mapnik/webp_io.hpp b/include/mapnik/webp_io.hpp index 08fa4f890..85ab3fcca 100644 --- a/include/mapnik/webp_io.hpp +++ b/include/mapnik/webp_io.hpp @@ -37,6 +37,7 @@ extern "C" #pragma clang diagnostic pop // stl +#include #include #include @@ -102,7 +103,7 @@ inline int import_image_data(T2 const& image, { typename T2::pixel_type const * row_from = image.getRow(y); image_data_32::pixel_type * row_to = im.getRow(y); - std::memcpy(row_to,row_from,stride); + std::copy(row_from, row_from + stride, row_to); } if (alpha) {