From 5c1561561a859c561fb2321420f1abb7f1cedde3 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 24 Apr 2023 11:37:48 +0200 Subject: loplugin:unnecessarygetstr extend to more std::string checking suggested by mike kaganski Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/app/unohelp2.cxx | 2 +- vcl/source/control/edit.cxx | 2 +- vcl/source/control/field2.cxx | 2 +- vcl/source/gdi/mtfxmldump.cxx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/app/unohelp2.cxx b/vcl/source/app/unohelp2.cxx index 5bdb6c8388e5..575b9c74417c 100644 --- a/vcl/source/app/unohelp2.cxx +++ b/vcl/source/app/unohelp2.cxx @@ -69,7 +69,7 @@ namespace vcl::unohelper { aTree.put("mimeType", "text/plain"); std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_CLIPBOARD_CHANGED, aStream.str().c_str()); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_CLIPBOARD_CHANGED, OString(aStream.str())); } } catch( const uno::Exception& ) diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index d0eca8ab0acf..10c68412a627 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -835,7 +835,7 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool // the text that needs to be checked is only the one // before the current cursor position - const OUString aOldText( maText.getStr(), nTmpPos); + const OUString aOldText( maText.subView(0, nTmpPos) ); OUString aTmpText( aOldText ); if (officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingTypeAndReplace::get()) { diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 726af088d89c..3142106609ed 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -2318,7 +2318,7 @@ static bool ImplIsValidTimePortion( bool _bSkipInvalidCharacters, const OUString static bool ImplCutTimePortion( OUStringBuffer& _rStr, sal_Int32 _nSepPos, bool _bSkipInvalidCharacters, short* _pPortion ) { - OUString sPortion(_rStr.getStr(), _nSepPos ); + OUString sPortion(_rStr.subView(0, _nSepPos)); if (_nSepPos < _rStr.getLength()) _rStr.remove(0, _nSepPos + 1); diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index fc38ee0a5a97..1b85e23fb584 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -575,7 +575,7 @@ OString toHexString(const std::vector& a) aStrm << std::setw(2) << std::setfill('0') << std::hex << static_cast(i); } - return OString(aStrm.str().c_str()); + return OString(aStrm.str()); } void writeBitmapContentChecksum(tools::XmlWriter& rWriter, Bitmap const& rBitmap) -- cgit