[Libreoffice-commits] libcdr.git: src/lib

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 22 12:21:29 UTC 2021


 src/lib/CDRParser.cpp |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 0d36bda438c8c1e33ef9aada24a65d8bb8107c6c
Author:     Fridrich Štrba <fridrich.strba at bluewin.ch>
AuthorDate: Mon Mar 22 13:19:35 2021 +0100
Commit:     Fridrich Štrba <fridrich.strba at bluewin.ch>
CommitDate: Mon Mar 22 13:20:04 2021 +0100

    use the iso8859_1 to parse colours
    
    The standard parser chokes on some characters due to conversion of
    codes >127 into negative numbers
    
    Change-Id: I3e5ac008376997c0b9b657016c293d5702bf75ec

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 36b6aff..62bdf0d 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -105,6 +105,7 @@ static void processNameForEncoding(librevenge::RVNGString &name, unsigned short
 static int parseColourString(const char *colourString, libcdr::CDRColor &colour, double &opacity)
 {
   using namespace boost::spirit::qi;
+
   bool bRes = false;
 
   boost::optional<unsigned> colourModel, colourPalette;
@@ -146,14 +147,14 @@ static int parseColourString(const char *colourString, libcdr::CDRColor &colour,
     bRes = phrase_parse(it, end,
                         //  Begin grammar
                         (
-                          (cmodel | omit[+alnum]) >> lit(',')
-                          >> (cpalette | omit[+alnum]) >> lit(',')
+                          (cmodel | omit[+iso8859_1::alnum]) >> lit(',')
+                          >> (cpalette | omit[+iso8859_1::alnum]) >> lit(',')
                           >> *(uint_ >> lit(','))
-                          >> omit[(repeat(8)[xdigit] >> '-' >> repeat(3)[repeat(4)[xdigit] >> '-'] >> repeat(12)[xdigit])]
-                          >> -(lit(',') >> *char_)
+                          >> omit[(repeat(8)[iso8859_1::xdigit] >> '-' >> repeat(3)[repeat(4)[iso8859_1::xdigit] >> '-'] >> repeat(12)[iso8859_1::xdigit])]
+                          >> -(lit(',') >> *iso8859_1::char_)
                         ),
                         //  End grammar
-                        space,
+                        iso8859_1::space,
                         colourModel, colourPalette, val, rest)
            && it == end;
   }


More information about the Libreoffice-commits mailing list