filter/source/msfilter/escherex.cxx | 6 +++--- filter/source/msfilter/msvbahelper.cxx | 26 +++++++++++++------------- filter/source/msfilter/rtfutil.cxx | 4 ++-- filter/source/msfilter/svdfppt.cxx | 4 ++-- include/filter/msfilter/escherex.hxx | 2 +- include/filter/msfilter/msvbahelper.hxx | 4 ++-- include/filter/msfilter/svdfppt.hxx | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-)
New commits: commit f725629a6241ec064770c28957f11d306c18f130 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Sep 27 13:45:51 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Sep 27 15:04:00 2022 +0200 use more string_view in filter Change-Id: I75c98f1da8898840bb882c17c7f1e59ec11ae8af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140648 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 9c754b236988..8169a0fb0601 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -209,12 +209,12 @@ void EscherPropertyContainer::AddOpt( void EscherPropertyContainer::AddOpt( sal_uInt16 nPropID, - const OUString& rString) + std::u16string_view rString) { std::vector<sal_uInt8> aBuf; - aBuf.reserve(rString.getLength() * 2 + 2); + aBuf.reserve(rString.size() * 2 + 2); - for(sal_Int32 i(0); i < rString.getLength(); i++) + for(size_t i(0); i < rString.size(); i++) { const sal_Unicode nUnicode(rString[i]); aBuf.push_back(static_cast<sal_uInt8>(nUnicode)); diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index d55a636fcc14..f43b121ecb67 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -56,12 +56,12 @@ OUString makeMacroURL( std::u16string_view sMacroName ) return sUrlPart0 + sMacroName + sUrlPart1; } -OUString extractMacroName( const OUString& rMacroUrl ) +OUString extractMacroName( std::u16string_view rMacroUrl ) { - if( rMacroUrl.startsWith( sUrlPart0 ) && rMacroUrl.endsWith( sUrlPart1 ) ) + if( o3tl::starts_with(rMacroUrl, sUrlPart0 ) && o3tl::ends_with(rMacroUrl, sUrlPart1 ) ) { - return rMacroUrl.copy( sUrlPart0.getLength(), - rMacroUrl.getLength() - sUrlPart0.getLength() - sUrlPart1.getLength() ); + return OUString(rMacroUrl.substr( sUrlPart0.getLength(), + rMacroUrl.size() - sUrlPart0.getLength() - sUrlPart1.getLength() )); } return OUString(); } @@ -668,7 +668,7 @@ KeyCodeEntry const aMSKeyCodesData[] = { { "F15", KEY_F15 }, }; -awt::KeyEvent parseKeyEvent( const OUString& Key ) +awt::KeyEvent parseKeyEvent( std::u16string_view Key ) { static std::map< OUString, sal_uInt16 > s_KeyCodes = []() { @@ -679,37 +679,37 @@ awt::KeyEvent parseKeyEvent( const OUString& Key ) } return tmp; }(); - OUString sKeyCode; + std::u16string_view sKeyCode; sal_uInt16 nVclKey = 0; // parse the modifier if any - for ( int i=0; i<Key.getLength(); ++i ) + for ( size_t i=0; i<Key.size(); ++i ) { if ( ! getModifier( Key[ i ], nVclKey ) ) { - sKeyCode = Key.copy( i ); + sKeyCode = Key.substr( i ); break; } } // check if keycode is surrounded by '{}', if so scoop out the contents // else it should be just one char of ( 'a-z,A-Z,0-9' ) - if ( sKeyCode.getLength() == 1 ) // ( a single char ) + if ( sKeyCode.size() == 1 ) // ( a single char ) { nVclKey |= parseChar( sKeyCode[ 0 ] ); } else // key should be enclosed in '{}' { - if ( sKeyCode.getLength() < 3 || sKeyCode[0] != '{' || sKeyCode[sKeyCode.getLength() - 1 ] != '}' ) + if ( sKeyCode.size() < 3 || sKeyCode[0] != '{' || sKeyCode[sKeyCode.size() - 1 ] != '}' ) throw uno::RuntimeException(); - sKeyCode = sKeyCode.copy(1, sKeyCode.getLength() - 2 ); + sKeyCode = sKeyCode.substr(1, sKeyCode.size() - 2 ); - if ( sKeyCode.getLength() == 1 ) + if ( sKeyCode.size() == 1 ) nVclKey |= parseChar( sKeyCode[ 0 ] ); else { - auto it = s_KeyCodes.find( sKeyCode ); + auto it = s_KeyCodes.find( OUString(sKeyCode) ); if ( it == s_KeyCodes.end() ) // unknown or unsupported throw uno::RuntimeException(); nVclKey |= it->second; diff --git a/filter/source/msfilter/rtfutil.cxx b/filter/source/msfilter/rtfutil.cxx index e20a146c42d6..75f453c347c9 100644 --- a/filter/source/msfilter/rtfutil.cxx +++ b/filter/source/msfilter/rtfutil.cxx @@ -231,10 +231,10 @@ OString OutString(const OUString& rStr, rtl_TextEncoding eDestEnc, bool bUnicode } /// Checks if lossless conversion of the string to eDestEnc is possible or not. -static bool TryOutString(const OUString& rStr, rtl_TextEncoding eDestEnc) +static bool TryOutString(std::u16string_view rStr, rtl_TextEncoding eDestEnc) { int nUCMode = 1; - for (sal_Int32 n = 0; n < rStr.getLength(); ++n) + for (size_t n = 0; n < rStr.size(); ++n) { bool bRet; OutChar(rStr[n], &nUCMode, eDestEnc, &bRet); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 7ccf84d1941b..6d8a55ee9177 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -5117,14 +5117,14 @@ void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, const DffRecordHeader } } -void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const OUString& aString, +void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, std::u16string_view aString, sal_uInt32& nCharCount, sal_uInt32 nCharReadCnt, bool& bTextPropAtom, sal_uInt32 nExtParaPos, const std::vector< StyleTextProp9 >& aStyleTextProp9, sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip, sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme ) { - sal_uInt16 nStringLen = aString.getLength(); + sal_uInt16 nStringLen = aString.size(); sal_uInt16 nDummy16; rIn.ReadUInt16( nDummy16 ); diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx index f6906173ee1a..462cee4f75af 100644 --- a/include/filter/msfilter/escherex.hxx +++ b/include/filter/msfilter/escherex.hxx @@ -704,7 +704,7 @@ public: void AddOpt( sal_uInt16 nPropertyID, - const OUString& rString); + std::u16string_view rString); void AddOpt( sal_uInt16 nPropertyID, diff --git a/include/filter/msfilter/msvbahelper.hxx b/include/filter/msfilter/msvbahelper.hxx index d5cb1e96f533..1568970eb697 100644 --- a/include/filter/msfilter/msvbahelper.hxx +++ b/include/filter/msfilter/msvbahelper.hxx @@ -56,13 +56,13 @@ struct MSFILTER_DLLPUBLIC MacroResolvedInfo }; MSFILTER_DLLPUBLIC OUString makeMacroURL( std::u16string_view sMacroName ); -MSFILTER_DLLPUBLIC OUString extractMacroName( const OUString& rMacroUrl ); +MSFILTER_DLLPUBLIC OUString extractMacroName( std::u16string_view rMacroUrl ); MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell const * pShell ); MSFILTER_DLLPUBLIC OUString resolveVBAMacro( SfxObjectShell const * pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName ); MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false ); MSFILTER_DLLPUBLIC bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, css::uno::Sequence< css::uno::Any >& aArgs, css::uno::Any& aRet, const css::uno::Any& aCaller ); /// @throws css::uno::RuntimeException -MSFILTER_DLLPUBLIC css::awt::KeyEvent parseKeyEvent( const OUString& sKey ); +MSFILTER_DLLPUBLIC css::awt::KeyEvent parseKeyEvent( std::u16string_view sKey ); /// @throws css::uno::RuntimeException MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const css::uno::Reference< css::frame::XModel >& rxDoc, const css::awt::KeyEvent& rKeyEvent, const OUString& sMacro ); diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index 6ac77727a2d7..40ace3c33425 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -1090,7 +1090,7 @@ struct PPTStyleTextPropReader static void ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, - const OUString& aString, + std::u16string_view aString, sal_uInt32& nCharCount, sal_uInt32 nCharReadCnt, bool& bTextPropAtom,