use boost::spirit::standard instead of boost::spirit::ascii to avoid assertions failing (isascii_(ch)) in debug builds - ref #2829

This commit is contained in:
artemp 2015-05-21 11:27:21 +01:00
parent 8534d5e5c2
commit 3b663af863
7 changed files with 11 additions and 11 deletions

View file

@ -39,7 +39,7 @@ inline bool from_geojson(std::string const& json, mapnik::feature_impl & feature
using iterator_type = char const*; using iterator_type = char const*;
static const mapnik::json::feature_grammar<iterator_type,mapnik::feature_impl> g(tr); static const mapnik::json::feature_grammar<iterator_type,mapnik::feature_impl> g(tr);
using namespace boost::spirit; using namespace boost::spirit;
ascii::space_type space; standard::space_type space;
iterator_type start = json.c_str(); iterator_type start = json.c_str();
iterator_type end = start + json.length(); iterator_type end = start + json.length();
return qi::phrase_parse(start, end, (g)(boost::phoenix::ref(feature)), space); return qi::phrase_parse(start, end, (g)(boost::phoenix::ref(feature)), space);

View file

@ -37,9 +37,9 @@
namespace mapnik { namespace json { namespace mapnik { namespace json {
namespace qi = boost::spirit::qi; namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii; namespace standard = boost::spirit::standard;
namespace phoenix = boost::phoenix; namespace phoenix = boost::phoenix;
using space_type = ascii::space_type; using space_type = standard::space_type;
using json_value = mapnik::util::variant<value_null,value_bool, value_integer, value_double, std::string>; using json_value = mapnik::util::variant<value_null,value_bool, value_integer, value_double, std::string>;
using uchar = std::uint32_t; // a unicode code point using uchar = std::uint32_t; // a unicode code point

View file

@ -38,7 +38,7 @@ inline bool from_geojson(std::string const& json, mapnik::geometry::geometry<dou
{ {
using namespace boost::spirit; using namespace boost::spirit;
static const geometry_grammar<char const*> g; static const geometry_grammar<char const*> g;
ascii::space_type space; standard::space_type space;
char const* start = json.c_str(); char const* start = json.c_str();
char const* end = start + json.length(); char const* end = start + json.length();
return qi::phrase_parse(start, end, g, space, geom); return qi::phrase_parse(start, end, g, space, geom);

View file

@ -44,7 +44,7 @@ namespace mapnik { namespace topojson {
namespace qi = boost::spirit::qi; namespace qi = boost::spirit::qi;
namespace fusion = boost::fusion; namespace fusion = boost::fusion;
using space_type = boost::spirit::ascii::space_type; using space_type = mapnik::json::space_type;
template <typename Iterator, typename ErrorHandler = json::error_handler<Iterator> > template <typename Iterator, typename ErrorHandler = json::error_handler<Iterator> >
struct topojson_grammar : qi::grammar<Iterator, space_type, topology()> struct topojson_grammar : qi::grammar<Iterator, space_type, topology()>

View file

@ -192,7 +192,7 @@ template <typename Iterator>
void geojson_datasource::initialise_index(Iterator start, Iterator end) void geojson_datasource::initialise_index(Iterator start, Iterator end)
{ {
mapnik::json::boxes boxes; mapnik::json::boxes boxes;
boost::spirit::ascii::space_type space; boost::spirit::standard::space_type space;
Iterator itr = start; Iterator itr = start;
if (!boost::spirit::qi::phrase_parse(itr, end, (geojson_datasource_static_bbox_grammar)(boost::phoenix::ref(boxes)) , space)) if (!boost::spirit::qi::phrase_parse(itr, end, (geojson_datasource_static_bbox_grammar)(boost::phoenix::ref(boxes)) , space))
{ {
@ -214,7 +214,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
Iterator end = itr + geometry_index.second; Iterator end = itr + geometry_index.second;
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>(); mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1)); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
boost::spirit::ascii::space_type space; boost::spirit::standard::space_type space;
if (!boost::spirit::qi::phrase_parse(itr, end, (geojson_datasource_static_feature_grammar)(boost::phoenix::ref(*feature)), space)) if (!boost::spirit::qi::phrase_parse(itr, end, (geojson_datasource_static_feature_grammar)(boost::phoenix::ref(*feature)), space))
{ {
throw std::runtime_error("Failed to parse geojson feature"); throw std::runtime_error("Failed to parse geojson feature");
@ -236,7 +236,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
template <typename Iterator> template <typename Iterator>
void geojson_datasource::parse_geojson(Iterator start, Iterator end) void geojson_datasource::parse_geojson(Iterator start, Iterator end)
{ {
boost::spirit::ascii::space_type space; boost::spirit::standard::space_type space;
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>(); mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
std::size_t start_id = 1; std::size_t start_id = 1;
@ -355,7 +355,7 @@ boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_
chr_iterator_type end = start + json.size(); chr_iterator_type end = start + json.size();
using namespace boost::spirit; using namespace boost::spirit;
ascii::space_type space; standard::space_type space;
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1)); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
if (!qi::phrase_parse(start, end, (geojson_datasource_static_feature_grammar)(boost::phoenix::ref(*feature)), space)) if (!qi::phrase_parse(start, end, (geojson_datasource_static_feature_grammar)(boost::phoenix::ref(*feature)), space))
{ {

View file

@ -70,7 +70,7 @@ mapnik::feature_ptr large_geojson_featureset::next()
static const mapnik::transcoder tr("utf8"); static const mapnik::transcoder tr("utf8");
static const mapnik::json::feature_grammar<chr_iterator_type,mapnik::feature_impl> grammar(tr); static const mapnik::json::feature_grammar<chr_iterator_type,mapnik::feature_impl> grammar(tr);
using namespace boost::spirit; using namespace boost::spirit;
ascii::space_type space; standard::space_type space;
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,1)); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,1));
if (!qi::phrase_parse(start, end, (grammar)(boost::phoenix::ref(*feature)), space)) if (!qi::phrase_parse(start, end, (grammar)(boost::phoenix::ref(*feature)), space))
{ {

View file

@ -190,7 +190,7 @@ const mapnik::topojson::topojson_grammar<base_iterator_type> g;
template <typename T> template <typename T>
void topojson_datasource::parse_topojson(T const& buffer) void topojson_datasource::parse_topojson(T const& buffer)
{ {
boost::spirit::ascii::space_type space; boost::spirit::standard::space_type space;
bool result = boost::spirit::qi::phrase_parse(buffer.begin(), buffer.end(), g, space, topo_); bool result = boost::spirit::qi::phrase_parse(buffer.begin(), buffer.end(), g, space, topo_);
if (!result) if (!result)
{ {