This commit is contained in:
artemp 2014-10-21 15:52:01 +01:00
parent 30907b3dd1
commit fdd646aa5b
8 changed files with 21 additions and 20 deletions

View file

@ -27,10 +27,11 @@
#include <mapnik/coord.hpp> #include <mapnik/coord.hpp>
// stl // stl
#include <algorithm>
#include <cassert> #include <cassert>
#include <cstring>
namespace mapnik { namespace mapnik {
template <typename T> template <typename T>
class coord_array class coord_array
{ {
@ -43,8 +44,9 @@ public:
coord_array(coord_array const& rhs) coord_array(coord_array const& rhs)
: pt_(static_cast<coord_type*>(rhs.size_==0?0: ::operator new (sizeof(coord_type)*rhs.size_))), : pt_(static_cast<coord_type*>(rhs.size_==0?0: ::operator new (sizeof(coord_type)*rhs.size_))),
size_(rhs.size_) { size_(rhs.size_)
std::memcpy(pt_,rhs.pt_,sizeof(coord_type)*rhs.size_); {
std::copy(rhs.pt_, rhs.pt_ + rhs.size_ , pt_);
} }
~coord_array() ~coord_array()

View file

@ -32,8 +32,8 @@
#include <mapnik/global.hpp> #include <mapnik/global.hpp>
// stl // stl
#include <algorithm>
#include <string> #include <string>
#include <cstring> // memset
#include <memory> #include <memory>
// boost // boost
@ -81,7 +81,7 @@ public:
inline void clear() 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<color> const& get_background() const; boost::optional<color> const& get_background() const;

View file

@ -29,10 +29,9 @@
#include <mapnik/noncopyable.hpp> #include <mapnik/noncopyable.hpp>
// stl // stl
#include <vector>
#include <cstring>
#include <set>
#include <algorithm> #include <algorithm>
#include <vector>
#include <set>
#include <cmath> #include <cmath>
namespace mapnik { namespace mapnik {
@ -67,7 +66,7 @@ class hextree : private mapnik::noncopyable
reduce_cost(0.0), reduce_cost(0.0),
children_count(0) children_count(0)
{ {
std::memset(&children_[0],0,sizeof(children_)); std::fill(children_, children_ + 16, nullptr);
} }
~node () ~node ()

View file

@ -29,10 +29,9 @@
#include <mapnik/noncopyable.hpp> #include <mapnik/noncopyable.hpp>
// stl // stl
#include <vector>
#include <cstring>
#include <deque>
#include <algorithm> #include <algorithm>
#include <vector>
#include <deque>
namespace mapnik { namespace mapnik {
@ -63,7 +62,7 @@ class octree : private mapnik::noncopyable
children_count(0), children_count(0),
index(0) index(0)
{ {
std::memset(&children_[0],0,sizeof(children_)); std::fill(children_,children_ + 8, nullptr);
} }
~node() ~node()

View file

@ -31,8 +31,8 @@
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
// stl // stl
#include <algorithm>
#include <vector> #include <vector>
#include <cstring>
namespace mapnik namespace mapnik
{ {
@ -52,7 +52,7 @@ class quad_tree : mapnik::noncopyable
explicit node(box2d<double> const& ext) explicit node(box2d<double> const& ext)
: extent_(ext) : extent_(ext)
{ {
std::memset(children_,0,4*sizeof(node*)); std::fill(children_, children_ + 4, nullptr);
} }
box2d<double> const& extent() const box2d<double> const& extent() const

View file

@ -83,7 +83,7 @@ struct wkb_stream
void write(char const* data, std::size_t size) void write(char const* data, std::size_t size)
{ {
std::memcpy(buffer_ + pos_, data, size); std::copy(data, data + size, buffer_ + pos_);
pos_ += size; pos_ += size;
} }

View file

@ -32,8 +32,8 @@
#include <mapnik/noncopyable.hpp> #include <mapnik/noncopyable.hpp>
// stl // stl
#include <algorithm>
#include <tuple> #include <tuple>
#include <cstring> // required for memcpy with linux/g++
#include <cstdint> #include <cstdint>
namespace mapnik namespace mapnik
@ -131,8 +131,8 @@ private:
command_size** new_commands = (command_size**)(new_vertices + max_blocks_ + grow_by); command_size** new_commands = (command_size**)(new_vertices + max_blocks_ + grow_by);
if (vertices_) if (vertices_)
{ {
std::memcpy(new_vertices,vertices_,max_blocks_ * sizeof(coord_type*)); std::copy(vertices_, vertices_ + max_blocks_, new_vertices);
std::memcpy(new_commands,commands_,max_blocks_ * sizeof(command_size*)); std::copy(commands_, commands_ + max_blocks_, new_commands);
::operator delete(vertices_); ::operator delete(vertices_);
} }
vertices_ = new_vertices; vertices_ = new_vertices;

View file

@ -37,6 +37,7 @@ extern "C"
#pragma clang diagnostic pop #pragma clang diagnostic pop
// stl // stl
#include <algorithm>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
@ -102,7 +103,7 @@ inline int import_image_data(T2 const& image,
{ {
typename T2::pixel_type const * row_from = image.getRow(y); typename T2::pixel_type const * row_from = image.getRow(y);
image_data_32::pixel_type * row_to = im.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) if (alpha)
{ {