online.git: engine/canvas engine/forms

0 views
Skip to first unread message

"Areg Nakashian (via cogerrit)"

unread,
3:59 AM (13 hours ago) 3:59 AM
to collaboraon...@googlegroups.com
engine/canvas/source/tools/spriteredrawmanager.cxx | 4 -
engine/forms/source/xforms/xpathlib/xpathlib.cxx | 51 ++++++++++++++++++---
2 files changed, 46 insertions(+), 9 deletions(-)

New commits:
commit 9728ffc5084aa8e890f44c59ddf6a052799bd6fe
Author: Areg Nakashian <areg.na...@gmail.com>
AuthorDate: Wed May 20 18:29:11 2026 -0400
Commit: Caolán McNamara <caolan....@collabora.com>
CommitDate: Mon May 25 07:58:40 2026 +0000

Replace boost lib with c++ stdlib in core

Replaced boost::adaptors::reverse with std::views::reverse since they
work similarly.

Replaced boost::lexical_cast with std::from_chars to parse duration
strings. Created a helper function for this.

Change-Id: I27e31f9d428a39e9a6a52c4bf013d7f2e4698302
Signed-off-by: Areg Nakashian <areg.na...@gmail.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3089
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>
Reviewed-by: Tor Lillqvist <t...@collabora.com>
Reviewed-by: Caolán McNamara <caolan....@collabora.com>

diff --git a/engine/canvas/source/tools/spriteredrawmanager.cxx b/engine/canvas/source/tools/spriteredrawmanager.cxx
index 2e2c07741ce7..eabd03fad6c4 100644
--- a/engine/canvas/source/tools/spriteredrawmanager.cxx
+++ b/engine/canvas/source/tools/spriteredrawmanager.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>

#include <algorithm>
+#include <ranges>

#include <basegfx/range/b2drectangle.hxx>
#include <basegfx/utils/canvastools.hxx>
@@ -27,7 +28,6 @@
#include <sal/log.hxx>

#include <spriteredrawmanager.hxx>
-#include <boost/range/adaptor/reversed.hpp>
#include <utility>

namespace canvas
@@ -437,7 +437,7 @@ namespace canvas
// this object, is the owner of the sprites. After all, a
// sprite without a canvas to render into makes not terribly
// much sense.
- for( const auto& rCurr : boost::adaptors::reverse(maSprites) )
+ for (const auto& rCurr : std::views::reverse(maSprites))
rCurr->dispose();

maSprites.clear();
diff --git a/engine/forms/source/xforms/xpathlib/xpathlib.cxx b/engine/forms/source/xforms/xpathlib/xpathlib.cxx
index c9a5ebbf339a..53c777c95197 100644
--- a/engine/forms/source/xforms/xpathlib/xpathlib.cxx
+++ b/engine/forms/source/xforms/xpathlib/xpathlib.cxx
@@ -19,6 +19,8 @@


#include <string.h>
+#include <charconv>
+#include <system_error>

#include <comphelper/servicehelper.hxx>
#include <o3tl/string_view.hxx>
@@ -37,7 +39,6 @@
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>

-#include <boost/lexical_cast.hpp>
#include <libxml/xpathInternals.h>

#include "xpathlib.hxx"
@@ -368,6 +369,15 @@ void xforms_secondsFromDateTimeFunction(xmlXPathParserContextPtr ctxt, int nargs

}

+static bool parseSalInt32(const xmlChar* pBegin, const xmlChar* pEnd, sal_Int32& value)
+{
+ const char* charBegin = reinterpret_cast<const char*>(pBegin);
+ const char* charEnd = reinterpret_cast<const char*>(pEnd);
+ auto [ptr, error] = std::from_chars(charBegin, charEnd, value);
+
+ return error == std::errc();
+}
+
static bool parseDuration(const xmlChar* aString, bool& bNegative, sal_Int32& nYears, sal_Int32& nMonth, sal_Int32& nDays,
sal_Int32& nHours, sal_Int32& nMinutes, sal_Int32& nSeconds)
{
@@ -390,26 +400,53 @@ static bool parseDuration(const xmlChar* aString, bool& bNegative, sal_Int32& nY
{
switch(pToken[0]) {
case 'Y':
- nYears = boost::lexical_cast<sal_Int32>(pString, pString-pToken);
+ if (!parseSalInt32(pString, pToken, nYears))
+ {
+ return false;
+ }
+
pString = ++pToken;
break;
case 'M':
if (!bTime)
- nMonth = boost::lexical_cast<sal_Int32>(pString, pString-pToken);
+ {
+ if (!parseSalInt32(pString, pToken, nMonth))
+ {
+ return false;
+ }
+ }
else
- nMinutes = boost::lexical_cast<sal_Int32>(pString, pString-pToken);
+ {
+ if (!parseSalInt32(pString, pToken, nMinutes))
+ {
+ return false;
+ }
+ }
+
pString = ++pToken;
break;
case 'D':
- nDays = boost::lexical_cast<sal_Int32>(pString, pString-pToken);
+ if (!parseSalInt32(pString, pToken, nDays))
+ {
+ return false;
+ }
+
pString = ++pToken;
break;
case 'H':
- nHours = boost::lexical_cast<sal_Int32>(pString, pString-pToken);
+ if (!parseSalInt32(pString, pToken, nHours))
+ {
+ return false;
+ }
+
pString = ++pToken;
break;
case 'S':
- nSeconds = boost::lexical_cast<sal_Int32>(pString, pString-pToken);
+ if (!parseSalInt32(pString, pToken, nSeconds))
+ {
+ return false;
+ }
+
pString = ++pToken;
break;
case 'T':

Reply all
Reply to author
Forward
0 new messages