Compare commits

...

6 commits

Author SHA1 Message Date
Artem Pavlenko
d70f207577 SVG parse_svg_value: restore val and is_percent to default values on parsing failure 2021-04-19 14:15:57 +01:00
Artem Pavlenko
1568fa3894 SVG parse_svg_value : re-initialise result to default value on parsing error 2021-04-19 09:26:13 +01:00
Artem Pavlenko
9901050e14 cleanup stderr 2021-04-19 09:25:24 +01:00
Artem Pavlenko
f3a5283733 update mason version 2021-04-19 09:05:13 +01:00
Artem Pavlenko
fc36c67def Update boost to 1.75.0 2021-04-19 09:03:51 +01:00
Artem Pavlenko
97b4748bc0 remove token 2021-04-19 09:03:08 +01:00
3 changed files with 4 additions and 16 deletions

View file

@ -9,8 +9,6 @@ env:
- CCACHE_TEMPDIR=/tmp/.ccache-temp - CCACHE_TEMPDIR=/tmp/.ccache-temp
- CCACHE_COMPRESS=1 - CCACHE_COMPRESS=1
- PREFIX=/tmp/mapnik - PREFIX=/tmp/mapnik
- secure: "F6ivqDNMBQQnrDGA9+7IX+GDswuIqQQd7YPJdQqa2Ked9jddAQDeJClb05ig3JlwfOlYLGZOd43ZX0pKuMtI2Gbkwz211agGP9S3YunwlRg8iWtJlO5kYFUdKCmJNhjg4icfkGELCgwXn+zuEWFSLpkPcjqAFKFlQrIJeAJJgKM="
cache: cache:
directories: directories:
- $HOME/.ccache - $HOME/.ccache

View file

@ -8,7 +8,7 @@ todo
- shrink icu data - shrink icu data
' '
MASON_VERSION="cce4ebf4" MASON_VERSION="5bc05e04"
function setup_mason() { function setup_mason() {
if [[ ! -d ./.mason ]]; then if [[ ! -d ./.mason ]]; then
@ -44,7 +44,7 @@ function install() {
} }
ICU_VERSION="57.1" ICU_VERSION="57.1"
BOOST_VERSION="1.74.0" BOOST_VERSION="1.75.0"
function install_mason_deps() { function install_mason_deps() {
install ccache 3.3.1 install ccache 3.3.1

View file

@ -275,6 +275,8 @@ double parse_svg_value(T & err_handler, const char* str, bool & is_percent)
x3::lit('%')[apply_percent]), x3::lit('%')[apply_percent]),
x3::space) || (cur != end)) x3::space) || (cur != end))
{ {
val = 0.0; // restore default value on parsing failure
is_percent = true; // viewport/viewBox logic expects default value to be `true` on failure
err_handler.on_error("SVG parse error: failed to parse <number> with value \"" + std::string(str) + "\""); err_handler.on_error("SVG parse error: failed to parse <number> with value \"" + std::string(str) + "\"");
} }
return val; return val;
@ -369,7 +371,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
auto itr = css.find(element_name); auto itr = css.find(element_name);
if (itr != css.end()) if (itr != css.end())
{ {
//std::cerr << "-> element key:" << element_name << std::endl;
for (auto const& def : std::get<1>(*itr)) for (auto const& def : std::get<1>(*itr))
{ {
style[std::get<0>(def)] = std::get<1>(def); style[std::get<0>(def)] = std::get<1>(def);
@ -394,8 +395,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
auto range = css.equal_range(solitary_class_key); auto range = css.equal_range(solitary_class_key);
for (auto itr = range.first; itr != range.second; ++itr) for (auto itr = range.first; itr != range.second; ++itr)
{ {
//std::cerr << "<" << element_name << ">";
//std::cerr << "--> solitary class key:" << solitary_class_key << std::endl;
for (auto const& def : std::get<1>(*itr)) for (auto const& def : std::get<1>(*itr))
{ {
style[std::get<0>(def)] = std::get<1>(def); style[std::get<0>(def)] = std::get<1>(def);
@ -405,8 +404,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
range = css.equal_range(class_key); range = css.equal_range(class_key);
for (auto itr = range.first; itr != range.second; ++itr) for (auto itr = range.first; itr != range.second; ++itr)
{ {
//std::cerr << "<" << element_name << ">";
//std::cerr << "---> class key:" << class_key << std::endl;
for (auto const& def : std::get<1>(*itr)) for (auto const& def : std::get<1>(*itr))
{ {
style[std::get<0>(def)] = std::get<1>(def); style[std::get<0>(def)] = std::get<1>(def);
@ -414,10 +411,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
} }
} }
} }
//else
//{
// std::cerr << "Failed to parse styles..." << std::endl;
//}
} }
} }
auto const* id_attr = node->first_attribute("id"); auto const* id_attr = node->first_attribute("id");
@ -430,8 +423,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
itr = css.find(id_key); itr = css.find(id_key);
if (itr != css.end()) if (itr != css.end())
{ {
//std::cerr << "<" << element_name << ">";
//std::cerr << "----> ID key:" << id_key << std::endl;
for (auto const& def : std::get<1>(*itr)) for (auto const& def : std::get<1>(*itr))
{ {
style[std::get<0>(def)] = std::get<1>(def); style[std::get<0>(def)] = std::get<1>(def);
@ -447,7 +438,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
{ {
auto const& r = std::get<1>(def); auto const& r = std::get<1>(def);
std::string val{r.begin(), r.end()}; std::string val{r.begin(), r.end()};
//std::cerr << "PARSE ATTR:" << std::get<0>(def) << ":" << val << std::endl;
parse_attr(parser, std::get<0>(def).c_str(), val.c_str()); parse_attr(parser, std::get<0>(def).c_str(), val.c_str());
} }
} }