X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FExternalTransforms.cpp;h=e7c8cf66c317967c74d7ef39dfa3284c59482cb4;hb=421853d1bf021b7180a61d8c2908ede2dce48061;hp=270a7c83b0f9deb387387ec84d074b9c66bca1ef;hpb=dcc50a24548b3ff46f9060897793ca346befa7e2;p=lyx.git diff --git a/src/insets/ExternalTransforms.cpp b/src/insets/ExternalTransforms.cpp index 270a7c83b0..e7c8cf66c3 100644 --- a/src/insets/ExternalTransforms.cpp +++ b/src/insets/ExternalTransforms.cpp @@ -18,7 +18,7 @@ #include "support/lyxlib.h" // float_equal #include "support/Translator.h" -#include +#include "support/regex.h" #include // abs #include @@ -218,7 +218,10 @@ string const ClipLatexOption::option_impl() const ostringstream os; if (!data.bbox.empty()) - os << "bb=" << data.bbox << ','; + os << "bb=" << data.bbox.xl.asLatexString() << ' ' + << data.bbox.yb.asLatexString() << ' ' + << data.bbox.xr.asLatexString() << ' ' + << data.bbox.yt.asLatexString() << ','; if (data.clip) os << "clip,"; return os.str(); @@ -279,10 +282,10 @@ string const sanitizeLatexOption(string const & input) // Strip any leading commas // "[,,,,foo..." -> "foo..." ("foo..." may be empty) string output; - boost::smatch what; - static boost::regex const front("^( *[[],*)(.*)$"); + lyx::smatch what; + static lyx::regex const front("^( *\\[,*)(.*)$"); - regex_match(it, end, what, front, boost::match_partial); + regex_match(it, end, what, front); if (!what[0].matched) { lyxerr << "Unable to sanitize LaTeX \"Option\": " << input << '\n'; @@ -293,9 +296,9 @@ string const sanitizeLatexOption(string const & input) // Replace any consecutive commas with a single one // "foo,,,,bar" -> "foo,bar" // with iterator now pointing to 'b' - static boost::regex const commas("([^,]*)(,,*)(.*)$"); + static lyx::regex const commas("([^,]*)(,,*)(.*)$"); for (; it != end;) { - regex_match(it, end, what, commas, boost::match_partial); + regex_match(it, end, what, commas); if (!what[0].matched) { output += string(it, end); break; @@ -306,7 +309,9 @@ string const sanitizeLatexOption(string const & input) // Strip any trailing commas // "...foo,,,]" -> "...foo" ("...foo,,," may be empty) - static boost::regex const back("^(.*[^,])?,*[]] *$"); + static lyx::regex const back("^(.*[^,])?,*\\] *$"); + // false positive from coverity + // coverity[CHECKED_RETURN] regex_match(output, what, back); if (!what[0].matched) { lyxerr << "Unable to sanitize LaTeX \"Option\": " @@ -333,7 +338,7 @@ void extractIt(boost::any const & any_factory, return; Factory factory = boost::any_cast(any_factory); - if (!factory.empty()) + if (factory) transformer = factory(data); }