3535#include " python_grid_utils.hpp"
3636// stl
3737#include < stdexcept>
38+ #include < cstdint>
3839
3940namespace mapnik {
4041
4142
43+
4244template <typename T>
4345void grid2utf (T const & grid_type,
4446 py::list& l,
4547 std::vector<typename T::lookup_type>& key_order)
4648{
49+ using code_point_t = std::uint32_t ;
4750 using keys_type = std::map< typename T::lookup_type, typename T::value_type>;
4851 using keys_iterator = typename keys_type::iterator;
4952
@@ -59,7 +62,7 @@ void grid2utf(T const& grid_type,
5962 for (std::size_t y = 0 ; y < data.height (); ++y)
6063 {
6164 std::uint16_t idx = 0 ;
62- const std::unique_ptr<Py_UNICODE []> line (new Py_UNICODE [array_size]);
65+ const std::unique_ptr<code_point_t []> line (new code_point_t [array_size]);
6366 typename T::value_type const * row = data.get_row (y);
6467 for (std::size_t x = 0 ; x < data.width (); ++x)
6568 {
@@ -85,12 +88,12 @@ void grid2utf(T const& grid_type,
8588 keys[val] = codepoint;
8689 key_order.push_back (val);
8790 }
88- line[idx++] = static_cast <Py_UNICODE >(codepoint);
91+ line[idx++] = static_cast <code_point_t >(codepoint);
8992 ++codepoint;
9093 }
9194 else
9295 {
93- line[idx++] = static_cast <Py_UNICODE >(key_pos->second );
96+ line[idx++] = static_cast <code_point_t >(key_pos->second );
9497 }
9598 }
9699 // else, shouldn't get here...
@@ -106,6 +109,7 @@ void grid2utf(T const& grid_type,
106109 std::vector<typename T::lookup_type>& key_order,
107110 unsigned int resolution)
108111{
112+ using code_point_t = std::uint32_t ;
109113 using keys_type = std::map< typename T::lookup_type, typename T::value_type>;
110114 using keys_iterator = typename keys_type::iterator;
111115
@@ -120,7 +124,7 @@ void grid2utf(T const& grid_type,
120124 for (unsigned y = 0 ; y < grid_type.height (); y=y+resolution)
121125 {
122126 std::uint16_t idx = 0 ;
123- const std::unique_ptr<Py_UNICODE []> line (new Py_UNICODE [array_size]);
127+ const std::unique_ptr<code_point_t []> line (new code_point_t [array_size]);
124128 mapnik::grid::value_type const * row = grid_type.get_row (y);
125129 for (unsigned x = 0 ; x < grid_type.width (); x=x+resolution)
126130 {
@@ -146,12 +150,12 @@ void grid2utf(T const& grid_type,
146150 keys[val] = codepoint;
147151 key_order.push_back (val);
148152 }
149- line[idx++] = static_cast <Py_UNICODE >(codepoint);
153+ line[idx++] = static_cast <code_point_t >(codepoint);
150154 ++codepoint;
151155 }
152156 else
153157 {
154- line[idx++] = static_cast <Py_UNICODE >(key_pos->second );
158+ line[idx++] = static_cast <code_point_t >(key_pos->second );
155159 }
156160 }
157161 // else, shouldn't get here...
@@ -320,6 +324,6 @@ void render_layer_for_grid(mapnik::Map const& map,
320324 ren.apply (layer,attributes);
321325}
322326
323- }
327+ } // namespace mapnik
324328
325329#endif
0 commit comments