summaryrefslogtreecommitdiff
path: root/include/editeng
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-12-18 17:44:41 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-12-18 18:45:51 +0100
commit1325d66a7f8657aaf9951a0664fbf14cca86905b (patch)
treeced0622b332d931f520776ac82fecc587ba3be0f /include/editeng
parentd05a74234d5ab6b029618281908552066fe04fa4 (diff)
tdf#158703: return updated position from FnAddNonBrkSpace
The paragraph text may become shorter after the function succeeds, because it may remove arbitrary number of preceding spaces; since the position may then be used to access data in the string in the caller, we need to update it, to avoid use of old position (which may point beyond the string, and produce a crash; or it may point to a wrong position in it). Change-Id: Ib1b4b63cbd7150e0f69c97032e3410db7dadd4dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160924 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/editeng')
-rw-r--r--include/editeng/svxacorr.hxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 6fe151449170..96415c20d8b6 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -411,7 +411,9 @@ public:
bool FnChgToEnEmDash( SvxAutoCorrDoc&, const OUString&,
sal_Int32 nSttPos, sal_Int32 nEndPos,
LanguageType eLang );
- bool FnAddNonBrkSpace( SvxAutoCorrDoc&, std::u16string_view,
+ // Returns an updated position, at which the insertion/removal happened. It may be
+ // a smaller value, if leading spaces were removed. If unsuccessful, returns -1.
+ sal_Int32 FnAddNonBrkSpace( SvxAutoCorrDoc&, std::u16string_view,
sal_Int32 nEndPos,
LanguageType eLang, bool& io_bNbspRunNext );
bool FnSetINetAttr( SvxAutoCorrDoc&, const OUString&,