[Libreoffice-commits] core.git: sax/source
dante (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 19 07:42:48 UTC 2021
sax/source/expatwrap/saxwriter.cxx | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
New commits:
commit e8aef914671d9712fb3fadb2d8fba60f09784288
Author: dante <dante19031999 at gmail.com>
AuthorDate: Thu Jan 14 19:50:14 2021 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Jan 19 08:42:02 2021 +0100
Simplify getFirstLineBreak
Change-Id: I0fcacd3f3deb5867ed91a7037b74fa364ebc4c80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109302
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 04fd90762cd9..606db22e29c9 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -999,23 +999,6 @@ const ReplacementPair* SaxWriterHelper::findXMLReplacement(const sal_Unicode* pS
return nullptr;
}
-/** returns position of first ascii 10 within the string, -1 when no 10 in string.
- */
-sal_Int32 getFirstLineBreak(const OUString& str) throw()
-{
- const sal_Unicode* pSource = str.getStr();
- sal_Int32 nLen = str.getLength();
-
- for (int n = 0; n < nLen; n++)
- {
- if (LINEFEED == pSource[n])
- {
- return n;
- }
- }
- return -1;
-}
-
class SAXWriter : public WeakImplHelper<XWriter, XServiceInfo>
{
public:
@@ -1303,7 +1286,8 @@ void SAXWriter::characters(const OUString& aChars)
sal_Int32 nIndentPrefix(-1);
if (m_bAllowLineBreak)
{
- sal_Int32 nFirstLineBreakOccurrence = getFirstLineBreak(aChars);
+ // returns position of first ascii 10 within the string, -1 when no 10 in string.
+ sal_Int32 nFirstLineBreakOccurrence = aChars.indexOf(LINEFEED);
nLength = m_pSaxWriterHelper->calcXMLByteLength(aChars, !m_bIsCDATA, false);
nIndentPrefix = getIndentPrefixLength(
More information about the Libreoffice-commits
mailing list