From eae4921ccdf3fce89db3d8d86f8ea7be832ac101 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Sat, 9 Jul 2022 11:56:53 +0300 Subject: [PATCH] Change regex engine to boost (gcc error) --- HtmlFile2/HtmlFile2.pro | 4 ++++ HtmlFile2/htmlfile2.cpp | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/HtmlFile2/HtmlFile2.pro b/HtmlFile2/HtmlFile2.pro index c8a6d4a934..48059c7a8c 100644 --- a/HtmlFile2/HtmlFile2.pro +++ b/HtmlFile2/HtmlFile2.pro @@ -23,6 +23,10 @@ core_windows:CONFIG += no_batch include($$CORE_ROOT_DIR/Common/3dParty/html/gumbo.pri) include($$CORE_ROOT_DIR/Common/3dParty/html/css/CssCalculator.pri) +CONFIG += core_boost_libs +CONFIG += core_boost_regex +include($$CORE_ROOT_DIR/Common/3dParty/boost/boost.pri) + ADD_DEPENDENCY(kernel, UnicodeConverter, graphics, kernel_network) SOURCES += htmlfile2.cpp diff --git a/HtmlFile2/htmlfile2.cpp b/HtmlFile2/htmlfile2.cpp index a2f3d6e87a..3ed3b4c239 100644 --- a/HtmlFile2/htmlfile2.cpp +++ b/HtmlFile2/htmlfile2.cpp @@ -26,7 +26,7 @@ #include "../DesktopEditor/graphics/pro/Graphics.h" #include "htmlfile2.h" -#include +#include #ifndef VALUE2STR #define VALUE_TO_STRING(x) #x @@ -1072,12 +1072,19 @@ private: std::wstring wsType = L"dxa"; //Если ширина указана в %, то используем тип dxa, если же в других ндтнтцах измерения, то в pct + #if 1 + // проблема с regex в старом gcc (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52719) + boost::wregex oWidthRegex(L"((width)+)[\\s]*:[\\s]*(.+%)"); + bool bIsWidthPct = boost::regex_search(sSelectors.back().m_sStyle, oWidthRegex); + #else std::wregex oWidthRegex(L"((width)+)[\\s]*:[\\s]*(.+%)"); + bool bIsWidthPct = std::regex_search(sSelectors.back().m_sStyle.data(), oWidthRegex); + #endif - if (std::regex_search(sSelectors.back().m_sStyle.data(), oWidthRegex)) - wsType = L"pct"; + if (bIsWidthPct) + wsType = L"pct"; else - nWidth *= 10; + nWidth *= 10; //------------------------- if (nWidth > 0)