From ee2378a6d2c33c9ff285199bec632fd4a3388dbb Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 18 Sep 2013 19:50:04 -0700 Subject: [PATCH] port minor fixes around type handling from c++11 branch --- include/mapnik/image_filter_types.hpp | 3 +-- include/mapnik/vertex_vector.hpp | 16 ++++++++-------- src/expression_grammar.cpp | 4 +--- src/font_engine_freetype.cpp | 8 ++++---- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/include/mapnik/image_filter_types.hpp b/include/mapnik/image_filter_types.hpp index 8457880c7..9ce9150d1 100644 --- a/include/mapnik/image_filter_types.hpp +++ b/include/mapnik/image_filter_types.hpp @@ -29,8 +29,7 @@ #include // boost -#include - +#include // stl #include #include diff --git a/include/mapnik/vertex_vector.hpp b/include/mapnik/vertex_vector.hpp index 44fbd7884..836628cd6 100644 --- a/include/mapnik/vertex_vector.hpp +++ b/include/mapnik/vertex_vector.hpp @@ -55,12 +55,12 @@ public: // required for iterators support typedef boost::tuple value_type; typedef std::size_t size_type; - + typedef unsigned char command_size; private: unsigned num_blocks_; unsigned max_blocks_; coord_type** vertices_; - unsigned char** commands_; + command_size** commands_; size_type pos_; public: @@ -90,7 +90,7 @@ public: return pos_; } - void push_back (coord_type x,coord_type y,unsigned command) + void push_back (coord_type x,coord_type y,command_size command) { unsigned block = pos_ >> block_shift; if (block >= num_blocks_) @@ -98,9 +98,9 @@ public: allocate_block(block); } coord_type* vertex = vertices_[block] + ((pos_ & block_mask) << 1); - unsigned char* cmd= commands_[block] + (pos_ & block_mask); + command_size* cmd= commands_[block] + (pos_ & block_mask); - *cmd = static_cast(command); + *cmd = static_cast(command); *vertex++ = x; *vertex = y; ++pos_; @@ -130,11 +130,11 @@ private: { coord_type** new_vertices = static_cast(::operator new (sizeof(coord_type*)*((max_blocks_ + grow_by) * 2))); - unsigned char** new_commands = (unsigned char**)(new_vertices + max_blocks_ + grow_by); + 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(unsigned char*)); + std::memcpy(new_commands,commands_,max_blocks_ * sizeof(command_size*)); ::operator delete(vertices_); } vertices_ = new_vertices; @@ -144,7 +144,7 @@ private: vertices_[block] = static_cast (::operator new(sizeof(coord_type)*(block_size * 2 + block_size / (sizeof(coord_type))))); - commands_[block] = (unsigned char*)(vertices_[block] + block_size*2); + commands_[block] = (command_size*)(vertices_[block] + block_size*2); ++num_blocks_; } }; diff --git a/src/expression_grammar.cpp b/src/expression_grammar.cpp index 294996361..875bd6f5a 100644 --- a/src/expression_grammar.cpp +++ b/src/expression_grammar.cpp @@ -22,12 +22,10 @@ // mapnik #include - // stl #include -namespace mapnik -{ +namespace mapnik { template struct mapnik::expression_grammar; diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index 646c60d25..9de827074 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -233,8 +233,8 @@ face_ptr freetype_engine::create_face(std::string const& family_name) if (mem_font_itr != memory_fonts_.end()) // memory font { FT_Error error = FT_New_Memory_Face(library_, - (FT_Byte const*) mem_font_itr->second.c_str(), //buffer - mem_font_itr->second.size(), // size + reinterpret_cast(mem_font_itr->second.c_str()), + static_cast(mem_font_itr->second.size()), // size itr->second.first, // face index &face); @@ -253,8 +253,8 @@ face_ptr freetype_engine::create_face(std::string const& family_name) = memory_fonts_.insert(std::make_pair(itr->second.second, buffer)); FT_Error error = FT_New_Memory_Face (library_, - (FT_Byte const*) result.first->second.c_str(), - buffer.size(), + reinterpret_cast(result.first->second.c_str()), + static_cast(buffer.size()), itr->second.first, &face); if (!error) return boost::make_shared(face);