summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authordante <dante19031999@gmail.com>2021-01-14 19:50:14 +0100
committerStephan Bergmann <sbergman@redhat.com>2021-01-19 08:42:02 +0100
commite8aef914671d9712fb3fadb2d8fba60f09784288 (patch)
tree6bbf620341e966c293612f88aa36bb7635e3c104 /sax
parentae5ec5b944cf2378806498072c50d473a3ac62ed (diff)
Simplify getFirstLineBreak
Change-Id: I0fcacd3f3deb5867ed91a7037b74fa364ebc4c80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109302 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sax')
-rw-r--r--sax/source/expatwrap/saxwriter.cxx20
1 files changed, 2 insertions, 18 deletions
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(