sw/source/writerfilter/rtftok/rtfdispatchdestination.cxx | 18 +++++---------- 1 file changed, 7 insertions(+), 11 deletions(-)
New commits: commit fa860658fe987f6f599fe2782c69ecaa315e179d Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Jun 14 18:19:57 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sat Jun 14 19:59:20 2025 +0200 Simplify reading a string from stream No need to read char by char in a loop; ReadBytes does the job. Change-Id: I45d3b4dd14d563ea3e165be47a983c76b15bcdd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186500 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/writerfilter/rtftok/rtfdispatchdestination.cxx b/sw/source/writerfilter/rtftok/rtfdispatchdestination.cxx index 5de502772cf9..b3e4e04274f9 100644 --- a/sw/source/writerfilter/rtftok/rtfdispatchdestination.cxx +++ b/sw/source/writerfilter/rtftok/rtfdispatchdestination.cxx @@ -266,19 +266,15 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) { Id nId = NS_ooxml::LN_footnote; - // Check if this is an endnote. - OStringBuffer aBuf; - char ch; - sal_uInt64 const nCurrent = Strm().Tell(); - for (int i = 0; i < 7; ++i) { - Strm().ReadChar(ch); - aBuf.append(ch); + // Check if this is an endnote. + sal_uInt64 const nCurrent = Strm().Tell(); + char buf[7]; + std::string_view aKeyword(buf, Strm().ReadBytes(buf, std::size(buf))); + Strm().Seek(nCurrent); + if (aKeyword == "\ftnalt") + nId = NS_ooxml::LN_endnote; } - Strm().Seek(nCurrent); - OString aKeyword = aBuf.makeStringAndClear(); - if (aKeyword == "\ftnalt") - nId = NS_ooxml::LN_endnote; if (m_aStates.top().getCurrentBuffer() == &m_aSuperBuffer) m_aStates.top().setCurrentBuffer(nullptr);