avmedia/source/gstreamer/gstframegrabber.cxx | 4 avmedia/source/gstreamer/gstframegrabber.hxx | 8 avmedia/source/gstreamer/gstplayer.cxx | 2 avmedia/source/gstreamer/gstplayer.hxx | 6 basctl/source/basicide/baside2.hxx | 3 basctl/source/basicide/baside2b.cxx | 2 basic/source/classes/image.cxx | 3 basic/source/inc/iosys.hxx | 6 basic/source/runtime/iosys.cxx | 4 basic/source/runtime/methods.cxx | 3 basic/source/sbx/sbxvalue.cxx | 3 chart2/qa/extras/chart2dump/chart2dump.cxx | 4 chart2/qa/extras/chart2geometry.cxx | 3 chart2/qa/extras/xshape/chart2xshape.cxx | 3 chart2/source/controller/inc/ChartController.hxx | 3 chart2/source/controller/main/ChartController_Properties.cxx | 2 codemaker/source/codemaker/global.cxx | 2 codemaker/source/commoncpp/commoncpp.cxx | 4 codemaker/source/cppumaker/cpputype.cxx | 35 ++-- codemaker/source/cppumaker/dumputils.cxx | 2 codemaker/source/cppumaker/includes.cxx | 2 codemaker/source/cppumaker/includes.hxx | 3 comphelper/qa/string/test_string.cxx | 8 comphelper/source/misc/docpasswordhelper.cxx | 15 - comphelper/source/misc/storagehelper.cxx | 4 compilerplugins/clang/stringadd.cxx | 36 +++- connectivity/source/commontools/CommonTools.cxx | 2 connectivity/source/commontools/DriversConfig.cxx | 15 + connectivity/source/drivers/dbase/dindexnode.cxx | 2 connectivity/source/drivers/evoab2/NStatement.cxx | 17 +- connectivity/source/drivers/file/FStringFunctions.cxx | 2 connectivity/source/drivers/firebird/StatementCommonBase.cxx | 2 connectivity/source/drivers/firebird/StatementCommonBase.hxx | 6 connectivity/source/drivers/jdbc/Class.cxx | 2 connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx | 25 +- connectivity/source/drivers/odbc/OStatement.cxx | 2 connectivity/source/drivers/postgresql/pq_connection.cxx | 2 connectivity/source/drivers/postgresql/pq_statement.cxx | 3 connectivity/source/drivers/postgresql/pq_tools.cxx | 29 +-- connectivity/source/drivers/postgresql/pq_tools.hxx | 18 +- connectivity/source/drivers/postgresql/pq_xcolumns.cxx | 4 connectivity/source/drivers/postgresql/pq_xcolumns.hxx | 8 connectivity/source/inc/java/lang/Class.hxx | 6 connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx | 23 +- connectivity/source/inc/odbc/OStatement.hxx | 3 connectivity/source/parse/internalnode.cxx | 2 connectivity/source/parse/sqlnode.cxx | 4 cppu/source/LogBridge/LogBridge.cxx | 3 cppu/source/typelib/typelib.cxx | 2 cppu/source/uno/lbenv.cxx | 6 cpputools/source/unoexe/unoexe.cxx | 3 cui/source/dialogs/AdditionsDialog.cxx | 84 +++++----- dbaccess/qa/unit/dbtest_base.cxx | 4 dbaccess/source/core/misc/dsntypes.cxx | 24 +- dbaccess/source/filter/hsqldb/rowinputbinary.cxx | 7 dbaccess/source/filter/hsqldb/utils.cxx | 2 dbaccess/source/filter/hsqldb/utils.hxx | 6 dbaccess/source/inc/dsntypes.hxx | 25 +- dbaccess/source/ui/dlg/dbwizsetup.cxx | 2 dbaccess/source/ui/dlg/generalpage.cxx | 4 desktop/inc/dp_misc.h | 8 desktop/qa/desktop_lib/test_desktop_lib.cxx | 2 desktop/source/app/dispatchwatcher.cxx | 3 desktop/source/deployment/manager/dp_activepackages.cxx | 5 desktop/source/deployment/misc/dp_misc.cxx | 8 desktop/source/lib/init.cxx | 10 - desktop/source/pkgchk/unopkg/unopkg_app.cxx | 14 - desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx | 20 +- desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 22 +- drawinglayer/source/dumper/EnhancedShapeDumper.cxx | 2 drawinglayer/source/dumper/EnhancedShapeDumper.hxx | 6 drawinglayer/source/dumper/XShapeDumper.cxx | 49 +++-- editeng/source/misc/svxacorr.cxx | 2 extensions/source/bibliography/general.cxx | 4 extensions/source/bibliography/general.hxx | 8 extensions/source/logging/loghandler.cxx | 2 extensions/source/logging/loghandler.hxx | 6 extensions/source/propctrlr/pcrcommon.cxx | 2 extensions/source/propctrlr/pcrcommon.hxx | 6 extensions/source/scanner/sane.cxx | 2 extensions/source/scanner/sane.hxx | 6 extensions/source/update/check/download.cxx | 8 filter/source/graphicfilter/idxf/dxfreprd.cxx | 2 filter/source/graphicfilter/idxf/dxfreprd.hxx | 4 filter/source/xsltfilter/LibXSLTTransformer.cxx | 3 filter/source/xsltfilter/OleHandler.cxx | 6 filter/source/xsltfilter/OleHandler.hxx | 7 forms/source/component/DatabaseForm.cxx | 7 forms/source/component/DatabaseForm.hxx | 3 forms/source/xforms/submission/serialization_urlencoded.cxx | 3 forms/source/xforms/submission/serialization_urlencoded.hxx | 6 fpicker/source/office/OfficeControlAccess.cxx | 12 - fpicker/source/office/OfficeControlAccess.hxx | 16 + framework/inc/dispatch/interceptionhelper.hxx | 3 framework/inc/helper/persistentwindowstate.hxx | 6 framework/source/helper/persistentwindowstate.cxx | 4 framework/source/jobs/jobdata.cxx | 10 - helpcompiler/source/BasCodeTagger.cxx | 2 helpcompiler/source/HelpLinker.cxx | 4 i18nlangtag/source/isolang/isolang.cxx | 4 i18nlangtag/source/languagetag/languagetag.cxx | 2 i18nlangtag/source/languagetag/languagetagicu.cxx | 2 i18npool/source/collator/collator_unicode.cxx | 2 i18npool/source/localedata/LocaleNode.cxx | 18 +- i18npool/source/localedata/LocaleNode.hxx | 20 +- i18npool/source/localedata/filewriter.cxx | 8 idl/inc/database.hxx | 5 idl/source/prj/command.cxx | 2 idl/source/prj/database.cxx | 10 - idlc/inc/idlc.hxx | 5 idlc/source/idlc.cxx | 2 idlc/source/idlccompile.cxx | 4 idlc/source/idlcproduce.cxx | 2 include/codemaker/commoncpp.hxx | 4 include/codemaker/global.hxx | 3 include/codemaker/typemanager.hxx | 5 include/comphelper/docpasswordhelper.hxx | 9 - include/comphelper/stl_types.hxx | 2 include/comphelper/storagehelper.hxx | 3 include/connectivity/CommonTools.hxx | 2 include/connectivity/DriversConfig.hxx | 13 - include/connectivity/internalnode.hxx | 6 include/connectivity/sqlnode.hxx | 3 include/connectivity/sqlparse.hxx | 3 include/helpcompiler/compilehelp.hxx | 8 include/i18nlangtag/languagetagicu.hxx | 5 include/i18nlangtag/mslangid.hxx | 4 include/oox/dump/dumperbase.hxx | 3 include/oox/helper/attributelist.hxx | 5 include/oox/helper/binaryoutputstream.hxx | 2 include/oox/token/tokenmap.hxx | 5 include/oox/vml/vmlformatting.hxx | 5 include/rtl/stringutils.hxx | 1 include/rtl/ustring.hxx | 49 +++++ include/sax/fshelper.hxx | 5 include/sfx2/XmlIdRegistry.hxx | 6 include/sfx2/docfilt.hxx | 3 include/sfx2/doctempl.hxx | 8 include/sfx2/lokhelper.hxx | 3 include/sfx2/templatedlg.hxx | 3 include/svl/PasswordHelper.hxx | 8 include/svtools/HtmlWriter.hxx | 3 include/svtools/ctrltool.hxx | 4 include/svtools/htmlout.hxx | 6 include/svx/EnhancedCustomShapeFunctionParser.hxx | 3 include/svx/fmsrcimp.hxx | 3 include/svx/signaturelinehelper.hxx | 6 include/test/screenshot_test.hxx | 3 include/tools/XmlWriter.hxx | 5 include/tools/inetmsg.hxx | 3 include/tools/stream.hxx | 5 include/tools/wldcrd.hxx | 10 - include/unotools/localedatawrapper.hxx | 2 include/vcl/toolkit/dialog.hxx | 4 include/vcl/uitest/logger.hxx | 6 jvmfwk/inc/fwkbase.hxx | 3 jvmfwk/inc/libxmlutil.hxx | 6 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 2 jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx | 2 jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx | 6 jvmfwk/source/fwkbase.cxx | 4 jvmfwk/source/libxmlutil.cxx | 2 l10ntools/source/localize.cxx | 4 l10ntools/source/merge.cxx | 2 l10ntools/source/propmerge.cxx | 3 l10ntools/source/xmlparse.cxx | 5 lingucomponent/source/languageguessing/guesslang.cxx | 7 linguistic/source/dicimp.cxx | 2 oox/source/core/xmlfilterbase.cxx | 6 oox/source/docprop/docprophandler.cxx | 4 oox/source/docprop/docprophandler.hxx | 2 oox/source/drawingml/customshapepresetdata.cxx | 8 oox/source/dump/dumperbase.cxx | 4 oox/source/helper/attributelist.cxx | 2 oox/source/helper/binaryoutputstream.cxx | 2 oox/source/ole/vbaexport.cxx | 57 +++--- oox/source/token/tokenmap.cxx | 2 oox/source/vml/vmlformatting.cxx | 4 oox/source/vml/vmlshapecontext.cxx | 8 opencl/source/openclwrapper.cxx | 3 package/source/manifest/ManifestExport.cxx | 4 package/source/zippackage/ZipPackage.cxx | 2 postprocess/qa/services.cxx | 3 pyuno/source/module/pyuno_impl.hxx | 5 pyuno/source/module/pyuno_module.cxx | 3 pyuno/source/module/pyuno_runtime.cxx | 4 pyuno/source/module/pyuno_util.cxx | 4 registry/source/regimpl.cxx | 2 registry/source/regimpl.hxx | 5 reportdesign/source/ui/inc/metadata.hxx | 4 reportdesign/source/ui/inspection/DefaultInspection.cxx | 2 sal/cppunittester/cppunittester.cxx | 3 sal/osl/unx/uunxapi.cxx | 10 - sal/osl/unx/uunxapi.hxx | 6 sax/source/fastparser/fastparser.cxx | 5 sax/source/tools/fastserializer.cxx | 2 sax/source/tools/fastserializer.hxx | 3 sax/source/tools/fshelper.cxx | 6 sc/inc/formulalogger.hxx | 3 sc/qa/unit/helper/csv_handler.hxx | 6 sc/source/core/tool/address.cxx | 2 sc/source/core/tool/formulalogger.cxx | 2 sc/source/core/tool/interpr1.cxx | 2 sc/source/core/tool/interpr7.cxx | 5 sc/source/filter/excel/xelink.cxx | 9 - sc/source/filter/excel/xestream.cxx | 2 sc/source/filter/excel/xestring.cxx | 7 sc/source/filter/html/htmlpars.cxx | 2 sc/source/filter/inc/htmlpars.hxx | 3 sc/source/filter/inc/xestream.hxx | 6 sc/source/filter/inc/xestring.hxx | 8 sc/source/filter/oox/numberformatsbuffer.cxx | 2 sc/source/ui/miscdlgs/mtrindlg.cxx | 4 scripting/source/provider/BrowseNodeFactoryImpl.cxx | 3 sd/qa/unit/export-tests-ooxml1.cxx | 7 sd/qa/unit/export-tests.cxx | 19 +- sd/qa/unit/import-tests.cxx | 2 sd/qa/unit/sdmodeltestbase.hxx | 4 sd/source/filter/html/htmlex.cxx | 2 sd/source/filter/html/htmlex.hxx | 3 sdext/source/pdfimport/test/pdfunzip.cxx | 8 sdext/source/pdfimport/tree/style.cxx | 2 sdext/source/pdfimport/tree/style.hxx | 3 sdext/source/pdfimport/wrapper/wrapper.cxx | 3 sfx2/source/bastyp/fltfnc.cxx | 6 sfx2/source/bastyp/mieclip.cxx | 2 sfx2/source/control/emojiview.cxx | 9 - sfx2/source/doc/DocumentMetadataAccess.cxx | 4 sfx2/source/doc/docfilt.cxx | 6 sfx2/source/doc/doctempl.cxx | 16 - sfx2/source/doc/objmisc.cxx | 2 sfx2/source/doc/objserv.cxx | 4 sfx2/source/doc/objstor.cxx | 2 sfx2/source/doc/oleprops.cxx | 2 sfx2/source/doc/oleprops.hxx | 4 sfx2/source/doc/templatedlg.cxx | 2 sfx2/source/view/lokhelper.cxx | 2 shell/source/sessioninstall/SyncDbusSessionHelper.cxx | 9 - shell/source/tools/lngconvex/lngconvex.cxx | 9 - starmath/source/ooxmlexport.cxx | 4 svl/source/misc/PasswordHelper.cxx | 4 svl/source/misc/inettype.cxx | 2 svl/source/passwordcontainer/passwordcontainer.cxx | 5 svtools/qa/unit/testHtmlWriter.cxx | 2 svtools/source/control/ctrltool.cxx | 2 svtools/source/control/inettbc.cxx | 2 svtools/source/svhtml/HtmlWriter.cxx | 2 svtools/source/svhtml/htmlout.cxx | 6 svtools/source/uno/wizard/unowizard.cxx | 5 svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx | 2 svx/source/dialog/signaturelinehelper.cxx | 2 svx/source/form/fmsrcimp.cxx | 2 svx/source/xml/xmlgrhlp.cxx | 2 sw/inc/dbgoutsw.hxx | 3 sw/source/core/doc/dbgoutsw.cxx | 2 sw/source/core/inc/SwXMLTextBlocks.hxx | 10 - sw/source/core/swg/SwXMLTextBlocks.cxx | 4 sw/source/core/swg/SwXMLTextBlocks1.cxx | 2 sw/source/filter/html/htmlatr.cxx | 2 sw/source/filter/html/htmlflywriter.cxx | 6 sw/source/filter/html/wrthtml.cxx | 2 sw/source/filter/html/wrthtml.hxx | 3 sw/source/filter/ww8/docxattributeoutput.cxx | 6 sw/source/filter/ww8/docxattributeoutput.hxx | 3 sw/source/filter/ww8/docxhelper.hxx | 6 sw/source/filter/ww8/wrtww8.cxx | 4 sw/source/filter/ww8/wrtww8.hxx | 5 sw/source/ui/index/cnttab.cxx | 2 test/source/screenshot_test.cxx | 8 testtools/source/bridgetest/bridgetest.cxx | 6 testtools/source/bridgetest/multi.cxx | 3 toolkit/source/helper/property.cxx | 3 tools/source/fsys/wldcrd.cxx | 2 tools/source/inet/inetmsg.cxx | 4 tools/source/stream/stream.cxx | 2 tools/source/xml/XmlWriter.cxx | 4 ucb/source/ucp/cmis/cmis_content.cxx | 2 ucb/source/ucp/cmis/cmis_content.hxx | 6 ucb/source/ucp/webdav-neon/DAVProperties.cxx | 6 ucb/source/ucp/webdav-neon/NeonLockStore.cxx | 2 ucb/source/ucp/webdav-neon/NeonLockStore.hxx | 3 ucbhelper/source/client/proxydecider.cxx | 9 - unodevtools/source/skeletonmaker/javatypemaker.cxx | 7 unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx | 6 unotools/source/i18n/localedatawrapper.cxx | 4 unoxml/source/dom/document.cxx | 8 unoxml/source/dom/element.cxx | 4 unoxml/source/dom/elementlist.cxx | 7 unoxml/source/dom/elementlist.hxx | 6 unoxml/source/rdf/librdf_repository.cxx | 9 - vcl/headless/svpprn.cxx | 7 vcl/inc/driverblocklist.hxx | 15 + vcl/inc/ppdparser.hxx | 3 vcl/inc/unx/fontmanager.hxx | 3 vcl/inc/unx/screensaverinhibitor.hxx | 3 vcl/qa/cppunit/blocklistparsertest.cxx | 32 +-- vcl/qa/cppunit/lifecycle.cxx | 2 vcl/qt5/Qt5Frame.cxx | 2 vcl/qt5/Qt5Instance_Print.cxx | 6 vcl/skia/SkiaHelper.cxx | 6 vcl/source/app/salvtables.cxx | 2 vcl/source/filter/wmf/wmfwr.cxx | 2 vcl/source/filter/wmf/wmfwr.hxx | 2 vcl/source/font/font.cxx | 3 vcl/source/gdi/mtfxmldump.cxx | 2 vcl/source/gdi/pdfwriter_impl.cxx | 6 vcl/source/gdi/pdfwriter_impl.hxx | 4 vcl/source/gdi/pdfwriter_impl2.cxx | 2 vcl/source/helper/driverblocklist.cxx | 13 - vcl/source/opengl/OpenGLHelper.cxx | 9 - vcl/source/pdf/XmpMetadata.cxx | 2 vcl/source/uitest/logger.cxx | 4 vcl/source/window/builder.cxx | 6 vcl/source/window/dialog.cxx | 8 vcl/unx/generic/app/sm.cxx | 2 vcl/unx/generic/fontmanager/fontconfig.cxx | 4 vcl/unx/generic/fontmanager/fontmanager.cxx | 4 vcl/unx/generic/print/psputil.cxx | 2 vcl/unx/generic/print/psputil.hxx | 6 vcl/unx/generic/printer/cupsmgr.cxx | 9 - vcl/unx/generic/printer/jobdata.cxx | 2 vcl/unx/generic/printer/ppdparser.cxx | 16 + vcl/unx/generic/printer/printerinfomanager.cxx | 10 - vcl/unx/generic/window/salframe.cxx | 2 vcl/unx/generic/window/screensaverinhibitor.cxx | 2 vcl/unx/gtk3/a11y/atkwrapper.hxx | 6 vcl/unx/gtk3/a11y/gtk3atkaction.cxx | 2 vcl/unx/gtk3/a11y/gtk3atkimage.cxx | 6 vcl/unx/gtk3/a11y/gtk3atktable.cxx | 6 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 3 vcl/unx/gtk3/fpicker/SalGtkPicker.cxx | 2 vcl/unx/gtk3/fpicker/SalGtkPicker.hxx | 6 vcl/unx/gtk3/gtk3gtkframe.cxx | 2 vcl/unx/gtk3/gtk3gtkinst.cxx | 34 ++-- vcl/unx/gtk3/gtk3salprn-gtk.cxx | 3 vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx | 8 vcl/workben/svpclient.cxx | 4 writerfilter/source/dmapper/LoggedResources.cxx | 2 writerfilter/source/dmapper/LoggedResources.hxx | 6 writerfilter/source/dmapper/PropertyMap.cxx | 7 writerfilter/source/dmapper/TagLogger.cxx | 4 writerfilter/source/dmapper/TagLogger.hxx | 5 writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 2 writerperfect/qa/unit/EPUBExportTest.cxx | 2 writerperfect/source/common/WPXSvInputStream.cxx | 5 xmloff/source/chart/MultiPropertySetHandler.hxx | 3 xmloff/source/core/xmlimp.cxx | 2 xmloff/source/core/xmlmultiimagehelper.cxx | 2 xmloff/source/style/GradientStyle.cxx | 2 xmloff/source/style/TransGradientStyle.cxx | 2 xmloff/source/text/txtparai.cxx | 2 xmlsecurity/inc/biginteger.hxx | 5 xmlsecurity/inc/xmlsec/saxhelper.hxx | 16 + xmlsecurity/source/component/documentdigitalsignatures.cxx | 2 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 2 xmlsecurity/source/xmlsec/biginteger.cxx | 2 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 4 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx | 4 xmlsecurity/source/xmlsec/saxhelper.cxx | 19 +- xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx | 2 xmlsecurity/workben/pdfverify.cxx | 3 361 files changed, 1315 insertions(+), 846 deletions(-)
New commits: commit 35e471bb4d1388cf5afcdcee214cf5111edf44e3 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Dec 11 17:44:34 2020 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Dec 11 21:25:10 2020 +0100 Adapt the remaining OUString functions to std string_view ...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx index 7da1917a019b..c1341d8d6ad4 100644 --- a/avmedia/source/gstreamer/gstframegrabber.cxx +++ b/avmedia/source/gstreamer/gstframegrabber.cxx @@ -48,7 +48,7 @@ void FrameGrabber::disposePipeline() } } -FrameGrabber::FrameGrabber( const OUString &rURL ) : +FrameGrabber::FrameGrabber( std::u16string_view rURL ) : FrameGrabber_BASE() { gchar *pPipelineStr; @@ -87,7 +87,7 @@ FrameGrabber::~FrameGrabber() disposePipeline(); } -FrameGrabber* FrameGrabber::create( const OUString &rURL ) +FrameGrabber* FrameGrabber::create( std::u16string_view rURL ) { return new FrameGrabber( rURL ); } diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx index 03c4af65f1a9..b99401526506 100644 --- a/avmedia/source/gstreamer/gstframegrabber.hxx +++ b/avmedia/source/gstreamer/gstframegrabber.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include "gstplayer.hxx" #include <com/sun/star/media/XFrameGrabber.hpp> #include <cppuhelper/implbase.hxx> @@ -39,7 +43,7 @@ public: const FrameGrabber& operator=(const FrameGrabber&) =delete; // static create method instead of public Ctor - static FrameGrabber* create( const OUString &rURL ); + static FrameGrabber* create( std::u16string_view rURL ); virtual ~FrameGrabber() override; @@ -52,7 +56,7 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; private: - explicit FrameGrabber( const OUString &aURL ); + explicit FrameGrabber( std::u16string_view aURL ); }; } // avmedia::gst diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 932e1dd1c6e1..4efbc6497b09 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -527,7 +527,7 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) return GST_BUS_PASS; } -void Player::preparePlaybin( const OUString& rURL, GstElement *pSink ) +void Player::preparePlaybin( std::u16string_view rURL, GstElement *pSink ) { if (mpPlaybin != nullptr) { diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx index 4a239ca1d2a6..a82dac3f2b39 100644 --- a/avmedia/source/gstreamer/gstplayer.hxx +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <osl/conditn.hxx> #include "gstcommon.hxx" @@ -42,7 +46,7 @@ public: explicit Player(); virtual ~Player() override; - void preparePlaybin( const OUString& rURL, GstElement *pSink ); + void preparePlaybin( std::u16string_view rURL, GstElement *pSink ); bool create( const OUString& rURL ); void processMessage( GstMessage *message ); GstBusSyncReply processSyncMessage( GstMessage *message ); diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 0f304adb83b0..dfe78c588ebe 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -35,6 +35,7 @@ #include <rtl/ustrbuf.hxx> #include <set> +#include <string_view> #include <vcl/textdata.hxx> #include <basic/codecompletecache.hxx> @@ -58,7 +59,7 @@ class ModulWindowLayout; // tools Strings limited to 64K). // defined in baside2b.cxx OUString getTextEngineText (ExtTextEngine&); -void setTextEngineText (ExtTextEngine&, OUString const&); +void setTextEngineText (ExtTextEngine&, std::u16string_view); class EditorWindow final : public vcl::Window, public SfxListener { diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 0fe305fc990f..e3ac323e11ff 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -121,7 +121,7 @@ OUString getTextEngineText (ExtTextEngine& rEngine) return aText; } -void setTextEngineText (ExtTextEngine& rEngine, OUString const& aStr) +void setTextEngineText (ExtTextEngine& rEngine, std::u16string_view aStr) { rEngine.SetText(OUString()); OString aUTF8Str = OUStringToOString( aStr, RTL_TEXTENCODING_UTF8 ); diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 0fd760a1c21b..0641c1337569 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -28,6 +28,7 @@ #include <image.hxx> #include <codegen.hxx> #include <memory> +#include <string_view> SbiImage::SbiImage() : bError(false) @@ -459,7 +460,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer ) for( size_t i = 0; i < mvStringOffsets.size(); i++ ) { sal_uInt16 nOff = static_cast<sal_uInt16>(mvStringOffsets[ i ]); - OString aStr(OUStringToOString(OUString(pStrings.get() + nOff), eCharSet)); + OString aStr(OUStringToOString(std::u16string_view(pStrings.get() + nOff), eCharSet)); memcpy( pByteStrings.get() + nOff, aStr.getStr(), (aStr.getLength() + 1) * sizeof( char ) ); } r.WriteUInt32( nStringSize ); diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx index 9f60c4f29c50..7fb75a2e113c 100644 --- a/basic/source/inc/iosys.hxx +++ b/basic/source/inc/iosys.hxx @@ -20,6 +20,8 @@ #pragma once #include <memory> +#include <string_view> + #include <tools/stream.hxx> #include <o3tl/typed_flags_set.hxx> @@ -58,7 +60,7 @@ class SbiStream public: SbiStream(); ~SbiStream(); - ErrCode const & Open( const OString&, StreamMode, SbiStreamFlags, short ); + ErrCode const & Open( std::string_view, StreamMode, SbiStreamFlags, short ); ErrCode const & Close(); ErrCode Read(OString&, sal_uInt16 = 0, bool bForceReadingPerByte=false); ErrCode const & Read( char& ); @@ -96,7 +98,7 @@ public: void SetChannel( short n ) { nChan = n; } short GetChannel() const { return nChan;} void ResetChannel() { nChan = 0; } - void Open( short, const OString&, StreamMode, SbiStreamFlags, short ); + void Open( short, std::string_view, StreamMode, SbiStreamFlags, short ); void Close(); void Read(OString&); char Read(); diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index d525d1a13801..6fc681f48492 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -421,7 +421,7 @@ void UCBStream::SetSize( sal_uInt64 ) ErrCode const & SbiStream::Open -( const OString& rName, StreamMode nStrmMode, SbiStreamFlags nFlags, short nL ) +( std::string_view rName, StreamMode nStrmMode, SbiStreamFlags nFlags, short nL ) { nMode = nFlags; nLen = nL; @@ -631,7 +631,7 @@ ErrCode SbiIoSystem::GetError() return n; } -void SbiIoSystem::Open(short nCh, const OString& rName, StreamMode nMode, SbiStreamFlags nFlags, short nLen) +void SbiIoSystem::Open(short nCh, std::string_view rName, StreamMode nMode, SbiStreamFlags nFlags, short nLen) { nError = ERRCODE_NONE; if( nCh >= CHANNELS || !nCh ) diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 1fbcdd9680e2..84d51c760f1e 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -63,6 +63,7 @@ #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp> #include <memory> #include <random> +#include <string_view> #include <o3tl/char16_t2wchar_t.hxx> using namespace comphelper; @@ -2575,7 +2576,7 @@ static OUString implSetupWildcard(const OUString& rFileParam, SbiRTLData& rRTLDa return aPathStr; } -static bool implCheckWildcard(const OUString& rName, SbiRTLData const& rRTLData) +static bool implCheckWildcard(std::u16string_view rName, SbiRTLData const& rRTLData) { bool bMatch = true; diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 90edef4cb7e7..19ddc1aa2a64 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -20,6 +20,7 @@ #include <config_features.h> #include <math.h> +#include <string_view> #include <o3tl/float_int_conversion.hxx> #include <tools/debug.hxx> @@ -1499,7 +1500,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) } else { - write_uInt16_lenPrefixed_uInt8s_FromOUString(r, OUString(), RTL_TEXTENCODING_ASCII_US); + write_uInt16_lenPrefixed_uInt8s_FromOUString(r, std::u16string_view(), RTL_TEXTENCODING_ASCII_US); } break; case SbxERROR: diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index 7fd7c4a8da61..a3ad005ea0e7 100644 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -124,7 +124,7 @@ protected: { if (m_aReferenceFile.is_open()) m_aReferenceFile.close(); - OString sReferenceFile = OUStringToOString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName, RTL_TEXTENCODING_UTF8); + OString sReferenceFile = OUStringToOString(OUString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8); m_aReferenceFile.open(sReferenceFile.getStr(), std::ios_base::in); CPPUNIT_ASSERT_MESSAGE(OString("Can't open reference file: " + sReferenceFile).getStr(), m_aReferenceFile.is_open()); } @@ -132,7 +132,7 @@ protected: { if (m_aDumpFile.is_open()) m_aDumpFile.close(); - OString sDumpFile = OUStringToOString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName, RTL_TEXTENCODING_UTF8); + OString sDumpFile = OUStringToOString(OUString(m_directories.getPathFromSrc(getReferenceDirName()) + sFileName), RTL_TEXTENCODING_UTF8); m_aDumpFile.open(sDumpFile.getStr(), std::ios_base::out | std::ofstream::binary | std::ofstream::trunc); CPPUNIT_ASSERT_MESSAGE(OString("Can't open dump file: " + sDumpFile).getStr(), m_aDumpFile.is_open()); } diff --git a/chart2/qa/extras/chart2geometry.cxx b/chart2/qa/extras/chart2geometry.cxx index 6ded1a5e76ab..c15f15f66864 100644 --- a/chart2/qa/extras/chart2geometry.cxx +++ b/chart2/qa/extras/chart2geometry.cxx @@ -23,6 +23,7 @@ #include <libxml/xpathInternals.h> #include <algorithm> +#include <string_view> using uno::Reference; using beans::XPropertySet; @@ -170,7 +171,7 @@ void Chart2GeometryTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) } } -static OString OU2O(const OUString& sOUSource) +static OString OU2O(std::u16string_view sOUSource) { return rtl::OUStringToOString(sOUSource, RTL_TEXTENCODING_UTF8); } diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx index a1a0032effc3..3acb981cb78d 100644 --- a/chart2/qa/extras/xshape/chart2xshape.cxx +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -16,6 +16,7 @@ #include <test/xmltesttools.hxx> #include <fstream> +#include <string_view> class Chart2XShapeTest : public ChartTest, public XmlTestTools { @@ -49,7 +50,7 @@ private: namespace { -bool checkDumpAgainstFile(const OUString& rDump, const OUString& aFilePath) +bool checkDumpAgainstFile(const OUString& rDump, std::u16string_view aFilePath) { OString aOFile = OUStringToOString(aFilePath, RTL_TEXTENCODING_UTF8); diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index aa399f2164b3..cecef8f81f0d 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <memory> +#include <string_view> namespace com::sun::star::accessibility { class XAccessible; } namespace com::sun::star::accessibility { class XAccessibleContext; } @@ -426,7 +427,7 @@ private: //executeDispatch methods void executeDispatch_ObjectProperties(); - void executeDispatch_FormatObject( const OUString& rDispatchCommand ); + void executeDispatch_FormatObject( std::u16string_view rDispatchCommand ); void executeDlg_ObjectProperties( const OUString& rObjectCID ); bool executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bSuccessOnUnchanged ); diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 687625b89c51..666c9979830e 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -650,7 +650,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view rDispatchCommand, const un } // anonymous namespace -void ChartController::executeDispatch_FormatObject(const OUString& rDispatchCommand) +void ChartController::executeDispatch_FormatObject(std::u16string_view rDispatchCommand) { uno::Reference< XChartDocument > xChartDocument( getModel(), uno::UNO_QUERY ); OString aCommand( OUStringToOString( rDispatchCommand, RTL_TEXTENCODING_ASCII_US ) ); diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx index 8d9b5907252f..be8543cde74c 100644 --- a/codemaker/source/codemaker/global.cxx +++ b/codemaker/source/codemaker/global.cxx @@ -356,7 +356,7 @@ FileStream &operator<<(FileStream& o, const OStringBuffer& s) { return o; } -FileStream & operator <<(FileStream & out, OUString const & s) { +FileStream & operator <<(FileStream & out, std::u16string_view s) { return out << OUStringToOString(s, RTL_TEXTENCODING_UTF8); } diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx index b7eaac4ae59e..efe0dd0b48bf 100644 --- a/codemaker/source/commoncpp/commoncpp.cxx +++ b/codemaker/source/commoncpp/commoncpp.cxx @@ -63,7 +63,7 @@ OString scopedCppName(OString const & type, bool ns_alias) } OString translateUnoToCppType( - codemaker::UnoType::Sort sort, OUString const & nucleus) + codemaker::UnoType::Sort sort, std::u16string_view nucleus) { OStringBuffer buf; if (sort <= codemaker::UnoType::Sort::Any) { @@ -75,7 +75,7 @@ OString translateUnoToCppType( buf.append(cppTypes[static_cast<int>(sort)]); } else { if (sort == codemaker::UnoType::Sort::Interface - && nucleus == "com.sun.star.uno.XInterface") + && nucleus == u"com.sun.star.uno.XInterface") { buf.append("::css::uno::XInterface"); } else { diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 75906b9c5f00..c98d8d76e214 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -25,6 +25,7 @@ #include <cstdlib> #include <map> #include <set> +#include <string_view> #include <memory> #include <vector> #include <iostream> @@ -164,7 +165,7 @@ public: void dump(CppuOptions const & options); void dumpFile( - OUString const & uri, OUString const & name, bool hpp, + std::u16string_view uri, OUString const & name, bool hpp, CppuOptions const & options); void dumpDependedTypes( @@ -219,7 +220,7 @@ protected: OUString resolveOuterTypedefs(OUString const & name) const; - OUString resolveAllTypedefs(OUString const & name) const; + OUString resolveAllTypedefs(std::u16string_view name) const; codemaker::cpp::IdentifierTranslationMode isGlobal() const; @@ -412,7 +413,7 @@ void CppuType::dump(CppuOptions const & options) } void CppuType::dumpFile( - OUString const & uri, OUString const & name, bool hpp, + std::u16string_view uri, OUString const & name, bool hpp, CppuOptions const & options) { OUString fileUri( @@ -990,7 +991,7 @@ OUString CppuType::resolveOuterTypedefs(OUString const & name) const } } -OUString CppuType::resolveAllTypedefs(OUString const & name) const +OUString CppuType::resolveAllTypedefs(std::u16string_view name) const { sal_Int32 k1; OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k1))); @@ -1126,11 +1127,11 @@ private: } void dumpExceptionTypeName( - FileStream & out, OUString const & prefix, sal_uInt32 index, - OUString const & name) const; + FileStream & out, std::u16string_view prefix, sal_uInt32 index, + std::u16string_view name) const; sal_Int32 dumpExceptionTypeNames( - FileStream & out, OUString const & prefix, + FileStream & out, std::u16string_view prefix, std::vector< OUString > const & exceptions, bool runtimeException) const; rtl::Reference< unoidl::InterfaceTypeEntity > entity_; @@ -1456,9 +1457,9 @@ void InterfaceType::dumpCppuAttributes(FileStream & out, sal_uInt32 & index) << "::rtl::OUString sAttributeName" << n << "( \"" << name_ << "::" << attr.name << "\" );\n"; sal_Int32 getExcn = dumpExceptionTypeNames( - out, "get", attr.getExceptions, false); + out, u"get", attr.getExceptions, false); sal_Int32 setExcn = dumpExceptionTypeNames( - out, "set", attr.setExceptions, false); + out, u"set", attr.setExceptions, false); out << indent() << ("typelib_typedescription_newExtendedInterfaceAttribute(" " &pAttribute,\n"); @@ -1525,7 +1526,7 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) ++m; } sal_Int32 excn = dumpExceptionTypeNames( - out, "", method.exceptions, + out, u"", method.exceptions, method.name != "acquire" && method.name != "release"); out << indent() << "::rtl::OUString sReturnType" << n << "( \"" << returnType << "\" );\n" << indent() @@ -1589,15 +1590,15 @@ void InterfaceType::dumpMethodsCppuDecl( } void InterfaceType::dumpExceptionTypeName( - FileStream & out, OUString const & prefix, sal_uInt32 index, - OUString const & name) const + FileStream & out, std::u16string_view prefix, sal_uInt32 index, + std::u16string_view name) const { out << indent() << "::rtl::OUString the_" << prefix << "ExceptionName" << index << "( \"" << name << "\" );\n"; } sal_Int32 InterfaceType::dumpExceptionTypeNames( - FileStream & out, OUString const & prefix, + FileStream & out, std::u16string_view prefix, std::vector< OUString > const & exceptions, bool runtimeException) const { sal_Int32 count = 0; @@ -1608,7 +1609,7 @@ sal_Int32 InterfaceType::dumpExceptionTypeNames( } if (runtimeException) { dumpExceptionTypeName( - out, prefix, count++, "com.sun.star.uno.RuntimeException"); + out, prefix, count++, u"com.sun.star.uno.RuntimeException"); } if (count != 0) { out << indent() << "rtl_uString * the_" << prefix << "Exceptions[] = {"; @@ -1765,7 +1766,7 @@ void ConstantGroup::dumpDeclaration(FileStream & out) } } -void dumpTypeParameterName(FileStream & out, OUString const & name) +void dumpTypeParameterName(FileStream & out, std::u16string_view name) { // Prefix all type parameters with "typeparam_" to avoid problems when a // struct member has the same name as a type parameter, as in @@ -2722,7 +2723,7 @@ void PolyStructType::dumpTemplateParameters(FileStream & out) const out << " >"; } -OUString typeToIdentifier(OUString const & name) +OUString typeToIdentifier(std::u16string_view name) { sal_Int32 k; OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k))); @@ -3553,7 +3554,7 @@ private: }; void failsToSupply( - FileStream & o, OUString const & service, OString const & type) + FileStream & o, std::u16string_view service, OString const & type) { o << "::rtl::OUString(\"component context fails to supply service \") + \"" << service << "\" + \" of type \" + \"" << type << "\""; diff --git a/codemaker/source/cppumaker/dumputils.cxx b/codemaker/source/cppumaker/dumputils.cxx index 1f993b3ef7d8..15b62e04a407 100644 --- a/codemaker/source/cppumaker/dumputils.cxx +++ b/codemaker/source/cppumaker/dumputils.cxx @@ -70,7 +70,7 @@ bool dumpNamespaceClose( } void dumpTypeIdentifier(FileStream & out, OUString const & entityName) { - out << entityName.copy(entityName.lastIndexOf('.') + 1); + out << entityName.subView(entityName.lastIndexOf('.') + 1); } } diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx index a07c651bec01..db7dae46bccc 100644 --- a/codemaker/source/cppumaker/includes.cxx +++ b/codemaker/source/cppumaker/includes.cxx @@ -265,7 +265,7 @@ void Includes::dumpInclude( << (hpp ? "hpp" : "hdl") << "\"\n"; } -bool Includes::isInterfaceType(OString const & entityName) const { +bool Includes::isInterfaceType(std::string_view entityName) const { return m_manager->getSort(b2u(entityName)) == UnoType::Sort::Interface; } diff --git a/codemaker/source/cppumaker/includes.hxx b/codemaker/source/cppumaker/includes.hxx index d8070217fe3b..0362c417ac2a 100644 --- a/codemaker/source/cppumaker/includes.hxx +++ b/codemaker/source/cppumaker/includes.hxx @@ -21,6 +21,7 @@ #include <rtl/ref.hxx> #include <rtl/ustring.hxx> +#include <string_view> #include <vector> #include "dependencies.hxx" @@ -68,7 +69,7 @@ private: Includes(Includes const &) = delete; Includes& operator =(const Includes&) = delete; - bool isInterfaceType(OString const & entityName) const; + bool isInterfaceType(std::string_view entityName) const; rtl::Reference< TypeManager > m_manager; Dependencies::Map m_map; diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index faedac30260f..10b69fbf8243 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -91,7 +91,7 @@ public: const OUString& str1, sal_Int32 off1, sal_Int32 len1, const OUString& str2, sal_Int32 off2, sal_Int32 len2) override { - return str1.copy(off1, len1).compareTo(str2.copy(off2, len2)); + return str1.copy(off1, len1).compareTo(str2.subView(off2, len2)); } virtual sal_Int32 SAL_CALL compareString( const OUString& str1, @@ -238,7 +238,7 @@ void TestString::testNatural() ); // Original behavior CPPUNIT_ASSERT( - OUString("Heading 9").compareTo("Heading 10") > 0 + OUString("Heading 9").compareTo(u"Heading 10") > 0 ); CPPUNIT_ASSERT( compareNatural("Heading 10", "Heading 9", xCollator, xBI, lang::Locale()) > 0 @@ -248,7 +248,7 @@ void TestString::testNatural() compareNatural("July, the 4th", "July, the 10th", xCollator, xBI, lang::Locale()) < 0 ); CPPUNIT_ASSERT( - OUString("July, the 4th").compareTo("July, the 10th") > 0 + OUString("July, the 4th").compareTo(u"July, the 10th") > 0 ); CPPUNIT_ASSERT( compareNatural("July, the 10th", "July, the 4th", xCollator, xBI, lang::Locale()) > 0 @@ -258,7 +258,7 @@ void TestString::testNatural() compareNatural("abc08", "abc010", xCollator, xBI, lang::Locale()) < 0 ); CPPUNIT_ASSERT( - OUString("abc08").compareTo("abc010") > 0 + OUString("abc08").compareTo(u"abc010") > 0 ); CPPUNIT_ASSERT( compareNatural("abc010", "abc08", xCollator, xBI, lang::Locale()) > 0 diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 4cc0f5c74269..bd8ce5d7de7f 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -20,6 +20,7 @@ #include <config_gpgme.h> #include <algorithm> +#include <string_view> #include <comphelper/docpasswordhelper.hxx> #include <comphelper/storagehelper.hxx> @@ -56,11 +57,11 @@ using namespace ::com::sun::star; namespace comphelper { -static uno::Sequence< sal_Int8 > GeneratePBKDF2Hash( const OUString& aPassword, const uno::Sequence< sal_Int8 >& aSalt, sal_Int32 nCount, sal_Int32 nHashLength ) +static uno::Sequence< sal_Int8 > GeneratePBKDF2Hash( std::u16string_view aPassword, const uno::Sequence< sal_Int8 >& aSalt, sal_Int32 nCount, sal_Int32 nHashLength ) { uno::Sequence< sal_Int8 > aResult; - if ( !aPassword.isEmpty() && aSalt.hasElements() && nCount && nHashLength ) + if ( !aPassword.empty() && aSalt.hasElements() && nCount && nHashLength ) { OString aBytePass = OUStringToOString( aPassword, RTL_TEXTENCODING_UTF8 ); // FIXME this is subject to the SHA1-bug tdf#114939 - see also @@ -84,7 +85,7 @@ IDocPasswordVerifier::~IDocPasswordVerifier() } -uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswordInfo( const OUString& aPassword ) +uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswordInfo( std::u16string_view aPassword ) { uno::Sequence< beans::PropertyValue > aResult; @@ -109,10 +110,10 @@ uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswo } -bool DocPasswordHelper::IsModifyPasswordCorrect( const OUString& aPassword, const uno::Sequence< beans::PropertyValue >& aInfo ) +bool DocPasswordHelper::IsModifyPasswordCorrect( std::u16string_view aPassword, const uno::Sequence< beans::PropertyValue >& aInfo ) { bool bResult = false; - if ( !aPassword.isEmpty() && aInfo.hasElements() ) + if ( !aPassword.empty() && aInfo.hasElements() ) { OUString sAlgorithm; uno::Sequence< sal_Int8 > aSalt; @@ -223,7 +224,7 @@ sal_uInt32 DocPasswordHelper::GetWordHashAsUINT32( sal_uInt16 DocPasswordHelper::GetXLHashAsUINT16( - const OUString& aUString, + std::u16string_view aUString, rtl_TextEncoding nEnc ) { sal_uInt16 nResult = 0; @@ -248,7 +249,7 @@ sal_uInt16 DocPasswordHelper::GetXLHashAsUINT16( Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( - const OUString& aUString ) + std::u16string_view aUString ) { sal_uInt16 nHash = GetXLHashAsUINT16( aUString ); return {sal_Int8(nHash >> 8), sal_Int8(nHash & 0xFF)}; diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 8308e9138514..43739da24c10 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -379,11 +379,11 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream( } -uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( const OUString& aPassword ) +uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( std::u16string_view aPassword ) { // TODO/LATER: Should not the method be part of DocPasswordHelper? uno::Sequence< beans::NamedValue > aEncryptionData; - if ( !aPassword.isEmpty() ) + if ( !aPassword.empty() ) { sal_Int32 nSha1Ind = 0; // generate SHA256 start key diff --git a/compilerplugins/clang/stringadd.cxx b/compilerplugins/clang/stringadd.cxx index 3410c2a6c436..b4994ab60ec6 100644 --- a/compilerplugins/clang/stringadd.cxx +++ b/compilerplugins/clang/stringadd.cxx @@ -291,18 +291,36 @@ bool StringAdd::isSideEffectFree(Expr const* expr) { // check for calls through OUString::number/OUString::unacquired if (auto calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(callExpr->getCalleeDecl())) - if (calleeMethodDecl && calleeMethodDecl->getIdentifier()) + if (calleeMethodDecl) { - auto name = calleeMethodDecl->getName(); - if (callExpr->getNumArgs() > 0 - && (name == "number" || name == "unacquired" || name == "boolean" - || name == "copy")) + if (calleeMethodDecl->getIdentifier()) { - auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent()); - if (tc.Class("OUString") || tc.Class("OString")) + auto name = calleeMethodDecl->getName(); + if (callExpr->getNumArgs() > 0 + && (name == "number" || name == "unacquired" || name == "boolean" + || name == "copy")) { - if (isSideEffectFree(callExpr->getArg(0))) - return true; + auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent()); + if (tc.Class("OUString") || tc.Class("OString")) + { + if (isSideEffectFree(callExpr->getArg(0))) + return true; + } + } + } + else if (auto const d = dyn_cast<CXXConversionDecl>(calleeMethodDecl)) + { + if (loplugin::TypeCheck(d->getConversionType()) + .ClassOrStruct("basic_string_view") + .StdNamespace()) + { + auto const tc = loplugin::TypeCheck(calleeMethodDecl->getParent()); + if (tc.Class("OUString").Namespace("rtl").GlobalNamespace() + || tc.Class("OString").Namespace("rtl").GlobalNamespace()) + { + if (isSideEffectFree(callExpr->getCallee())) + return true; + } } } } diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx index 5c84bf6e6f18..223129a71e92 100644 --- a/connectivity/source/commontools/CommonTools.cxx +++ b/connectivity/source/commontools/CommonTools.cxx @@ -141,7 +141,7 @@ namespace connectivity return aRet; } - bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,const OUString& _sClassName ) + bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,std::u16string_view _sClassName ) { bool bRet = false; if ( _pJVM.is() ) diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index 9d2ab8a475d7..c95d30091184 100644 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -144,7 +144,7 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs ) } -OUString DriversConfig::getDriverFactoryName(const OUString& _sURL) const +OUString DriversConfig::getDriverFactoryName(std::u16string_view _sURL) const { const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); OUString sRet; @@ -162,7 +162,7 @@ OUString DriversConfig::getDriverFactoryName(const OUString& _sURL) const return sRet; } -OUString DriversConfig::getDriverTypeDisplayName(const OUString& _sURL) const +OUString DriversConfig::getDriverTypeDisplayName(std::u16string_view _sURL) const { const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); OUString sRet; @@ -180,22 +180,25 @@ OUString DriversConfig::getDriverTypeDisplayName(const OUString& _sURL) const return sRet; } -const ::comphelper::NamedValueCollection& DriversConfig::getProperties(const OUString& _sURL) const +const ::comphelper::NamedValueCollection& DriversConfig::getProperties(std::u16string_view _sURL) + const { return impl_get(_sURL,1); } -const ::comphelper::NamedValueCollection& DriversConfig::getFeatures(const OUString& _sURL) const +const ::comphelper::NamedValueCollection& DriversConfig::getFeatures(std::u16string_view _sURL) + const { return impl_get(_sURL,0); } -const ::comphelper::NamedValueCollection& DriversConfig::getMetaData(const OUString& _sURL) const +const ::comphelper::NamedValueCollection& DriversConfig::getMetaData(std::u16string_view _sURL) + const { return impl_get(_sURL,2); } -const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const OUString& _sURL,sal_Int32 _nProps) const +const ::comphelper::NamedValueCollection& DriversConfig::impl_get(std::u16string_view _sURL,sal_Int32 _nProps) const { const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB); const ::comphelper::NamedValueCollection* pRet = nullptr; diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 1ac10800f0a9..69648c480e79 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -760,7 +760,7 @@ int ONDXKey::Compare(const ONDXKey& rKey) const } else if (IsText(getDBType())) { - nRes = getValue().getString().compareTo(rKey.getValue()); + nRes = getValue().getString().compareTo(rKey.getValue().getString()); } else { diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 1616f9fb1f1f..80b02d82f0a5 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <osl/diagnose.h> #include <rtl/ustring.hxx> #include <sal/log.hxx> @@ -54,9 +58,9 @@ EBookQuery * createTrue() return e_book_query_from_string("(exists \"full_name\")"); } -EBookQuery * createTest( const OUString &aColumnName, +EBookQuery * createTest( std::u16string_view aColumnName, EBookQueryTest eTest, - const OUString &aMatch ) + std::u16string_view aMatch ) { OString sMatch = OUStringToOString( aMatch, RTL_TEXTENCODING_UTF8 ); OString sColumnName = OUStringToOString( aColumnName, RTL_TEXTENCODING_UTF8 ); @@ -364,7 +368,7 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) { // String containing only a '%' and nothing else matches everything pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, - "" ); + u"" ); } else if( aMatchString.indexOf( WILDCARD ) == -1 ) { // Simple string , eg. "to match" "contains in evo" @@ -381,9 +385,10 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) else if( aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) ) { // One occurrence of '%' matches... if ( aMatchString.startsWith(OUStringChar(WILDCARD)) ) - pResult = createTest( aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) ); + pResult = createTest( + aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.subView( 1 ) ); else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 ) - pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) ); + pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.subView( 0, aMatchString.getLength() - 1 ) ); else m_xConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD,*this); } @@ -391,7 +396,7 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) aMatchString.startsWith(OUStringChar(WILDCARD)) && aMatchString.indexOf ( WILDCARD, 1) == aMatchString.getLength() - 1 ) { // one '%' at the start and another at the end - pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.copy (1, aMatchString.getLength() - 2) ); + pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.subView (1, aMatchString.getLength() - 2) ); } else m_xConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD_MANY,*this); diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index 1df5e723c4ee..8bac436e07be 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.cxx @@ -43,7 +43,7 @@ ORowSetValue OOp_Ascii::operate(const ORowSetValue& lhs) const { if (lhs.isNull()) return lhs; - OString sStr(OUStringToOString(lhs, RTL_TEXTENCODING_ASCII_US)); + OString sStr(OUStringToOString(lhs.getString(), RTL_TEXTENCODING_ASCII_US)); sal_Int32 nAscii = sStr.toChar(); return nAscii; } diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx index c1219d74b8ed..1d7d5ef32bdf 100644 --- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx +++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx @@ -124,7 +124,7 @@ void SAL_CALL OStatementCommonBase::close() dispose(); } -void OStatementCommonBase::prepareAndDescribeStatement(const OUString& sql, +void OStatementCommonBase::prepareAndDescribeStatement(std::u16string_view sql, XSQLDA*& pOutSqlda, XSQLDA* pInSqlda) { diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.hxx b/connectivity/source/drivers/firebird/StatementCommonBase.hxx index b321a27db4f4..c92dd8634109 100644 --- a/connectivity/source/drivers/firebird/StatementCommonBase.hxx +++ b/connectivity/source/drivers/firebird/StatementCommonBase.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX +#include <sal/config.h> + +#include <string_view> + #include "Connection.hxx" #include "SubComponent.hxx" @@ -81,7 +85,7 @@ namespace connectivity::firebird virtual ~OStatementCommonBase() override; /// @throws css::sdbc::SQLException - void prepareAndDescribeStatement(const OUString& sqlIn, + void prepareAndDescribeStatement(std::u16string_view sqlIn, XSQLDA*& pOutSqlda, XSQLDA* pInSqlda=nullptr); diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx index a99dd1fb051d..862827d12c93 100644 --- a/connectivity/source/drivers/jdbc/Class.cxx +++ b/connectivity/source/drivers/jdbc/Class.cxx @@ -36,7 +36,7 @@ jclass java_lang_Class::getMyClass() const return theClass; } -java_lang_Class* java_lang_Class::forName(const OUString& _par0) +java_lang_Class* java_lang_Class::forName(std::u16string_view _par0) { jobject out(nullptr); SDBThreadAttach t; diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index 7afd4bed54f9..a47758f31a5d 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -822,7 +822,7 @@ void ODatabaseMetaDataResultSet::openTypeInfo() } void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, + std::u16string_view tableNamePattern, const Sequence< OUString >& types ) { OString aPKQ,aPKO,aPKN,aCOL; @@ -919,7 +919,8 @@ void ODatabaseMetaDataResultSet::openSchemas() } void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, const OUString& schema, - const OUString& table, const OUString& columnNamePattern ) + std::u16string_view table, + std::u16string_view columnNamePattern ) { const OUString *pSchemaPat = nullptr; @@ -953,7 +954,7 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, cons } void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, const OUString& columnNamePattern ) + std::u16string_view tableNamePattern, std::u16string_view columnNamePattern ) { const OUString *pSchemaPat = nullptr; @@ -1020,7 +1021,7 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, } void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern,const OUString& columnNamePattern ) + std::u16string_view procedureNamePattern,std::u16string_view columnNamePattern ) { const OUString *pSchemaPat = nullptr; @@ -1053,7 +1054,7 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, } void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern) + std::u16string_view procedureNamePattern) { const OUString *pSchemaPat = nullptr; @@ -1083,11 +1084,11 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const OUStri } void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope, bool nullable ) + std::u16string_view table,sal_Int32 scope, bool nullable ) { // Some ODBC drivers really don't like getting an empty string as tableName // E.g. psqlodbc up to at least version 09.01.0100 segfaults - if (table.isEmpty()) + if (table.empty()) { const char errMsg[] = "ODBC: Trying to get special columns of empty table name"; const char SQLState[] = "HY009"; @@ -1123,13 +1124,13 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& cat } void ODatabaseMetaDataResultSet::openVersionColumns(const Any& catalog, const OUString& schema, - const OUString& table) + std::u16string_view table) { openSpecialColumns(true,catalog,schema,table,SQL_SCOPE_TRANSACTION,false); } void ODatabaseMetaDataResultSet::openBestRowIdentifier( const Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope,bool nullable ) + std::u16string_view table,sal_Int32 scope,bool nullable ) { openSpecialColumns(false,catalog,schema,table,scope,nullable); } @@ -1198,7 +1199,7 @@ void ODatabaseMetaDataResultSet::openExportedKeys(const Any& catalog, const OUSt } void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const OUString& schema, - const OUString& table) + std::u16string_view table) { const OUString *pSchemaPat = nullptr; @@ -1228,7 +1229,7 @@ void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const OUStr } void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern) + std::u16string_view tableNamePattern) { const OUString *pSchemaPat = nullptr; @@ -1257,7 +1258,7 @@ void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const O } void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const OUString& schema, - const OUString& table, bool unique, bool approximate ) + std::u16string_view table, bool unique, bool approximate ) { const OUString *pSchemaPat = nullptr; diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index 6e0a37169064..dc693b964d56 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -833,7 +833,7 @@ void OStatement_Base::setMaxFieldSize(sal_Int64 _par0) setStmtOption<SQLULEN, SQL_IS_UINTEGER>(SQL_ATTR_MAX_LENGTH, _par0); } -void OStatement_Base::setCursorName(const OUString &_par0) +void OStatement_Base::setCursorName(std::u16string_view _par0) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); OString aName(OUStringToOString(_par0,getOwnConnection()->getTextEncoding())); diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index d9889dea8091..4d56d52ec9a9 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -443,7 +443,7 @@ void Connection::initialize( const Sequence< Any >& aArguments ) nColon = url.indexOf( ':' , 1+ nColon ); if( nColon != -1 ) { - o = OUStringToOString( url.copy(nColon+1), ConnectionSettings::encoding ); + o = OUStringToOString( url.subView(nColon+1), ConnectionSettings::encoding ); } } { diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx index dd7ab576b37f..ff3b05dc8190 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.cxx +++ b/connectivity/source/drivers/postgresql/pq_statement.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <string.h> +#include <string_view> using osl::MutexGuard; @@ -239,7 +240,7 @@ sal_Int32 Statement::executeUpdate( const OUString& sql ) /// @throws SQLException static void raiseSQLException( const Reference< XInterface> & owner, - const OString & sql, + std::string_view sql, const char * errorMsg, const char *errorType = nullptr ) { diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index bece8a806f29..543f042f921e 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -57,6 +57,7 @@ #include <libpq-fe.h> #include <string.h> +#include <string_view> using com::sun::star::beans::XPropertySet; @@ -91,16 +92,16 @@ OUString concatQualified( const OUString & a, const OUString &b) return a + "." + b; } -static OString iOUStringToOString( const OUString& str, ConnectionSettings const *settings) { +static OString iOUStringToOString( std::u16string_view str, ConnectionSettings const *settings) { OSL_ENSURE(settings, "pgsql-sdbc: OUStringToOString got NULL settings"); - return OUStringToOString( str, ConnectionSettings::encoding ); + return rtl::OUStringToOString( str, ConnectionSettings::encoding ); } -OString OUStringToOString( const OUString& str, ConnectionSettings const *settings) { +OString OUStringToOString( std::u16string_view str, ConnectionSettings const *settings) { return iOUStringToOString( str, settings ); } -void bufferEscapeConstant( OUStringBuffer & buf, const OUString & value, ConnectionSettings *settings ) +void bufferEscapeConstant( OUStringBuffer & buf, std::u16string_view value, ConnectionSettings *settings ) { OString y = iOUStringToOString( value, settings ); @@ -127,14 +128,14 @@ void bufferEscapeConstant( OUStringBuffer & buf, const OUString & value, Connect buf.append( OStringToOUString( strbuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) ); } -static void ibufferQuoteConstant( OUStringBuffer & buf, const OUString & value, ConnectionSettings *settings ) +static void ibufferQuoteConstant( OUStringBuffer & buf, std::u16string_view value, ConnectionSettings *settings ) { buf.append( "'" ); bufferEscapeConstant( buf, value, settings ); buf.append( "'" ); } -void bufferQuoteConstant( OUStringBuffer & buf, const OUString & value, ConnectionSettings *settings ) +void bufferQuoteConstant( OUStringBuffer & buf, std::u16string_view value, ConnectionSettings *settings ) { return ibufferQuoteConstant( buf, value, settings ); } @@ -151,7 +152,7 @@ void bufferQuoteAnyConstant( OUStringBuffer & buf, const Any &val, ConnectionSet buf.append( "NULL" ); } -static void ibufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuote, ConnectionSettings *settings ) +static void ibufferQuoteIdentifier( OUStringBuffer & buf, std::u16string_view toQuote, ConnectionSettings *settings ) { OSL_ENSURE(settings, "pgsql-sdbc: bufferQuoteIdentifier got NULL settings"); @@ -171,14 +172,14 @@ static void ibufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuot PQfreemem( cstr ); } -void bufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuote, ConnectionSettings *settings ) +void bufferQuoteIdentifier( OUStringBuffer & buf, std::u16string_view toQuote, ConnectionSettings *settings ) { return ibufferQuoteIdentifier(buf, toQuote, settings); } void bufferQuoteQualifiedIdentifier( - OUStringBuffer & buf, const OUString &schema, const OUString &table, ConnectionSettings *settings ) + OUStringBuffer & buf, std::u16string_view schema, std::u16string_view table, ConnectionSettings *settings ) { ibufferQuoteIdentifier(buf, schema, settings); buf.append( "." ); @@ -187,9 +188,9 @@ void bufferQuoteQualifiedIdentifier( void bufferQuoteQualifiedIdentifier( OUStringBuffer & buf, - const OUString &schema, - const OUString &table, - const OUString &col, + std::u16string_view schema, + std::u16string_view table, + std::u16string_view col, ConnectionSettings *settings) { ibufferQuoteIdentifier(buf, schema, settings); @@ -544,10 +545,10 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec ) } -void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUString *second) +void splitConcatenatedIdentifier( std::u16string_view source, OUString *first, OUString *second) { std::vector< OString > vec; - tokenizeSQL( OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec ); + tokenizeSQL( rtl::OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec ); switch (vec.size()) { case 1: diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx index 0647a1b38f55..90490be81eb6 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.hxx +++ b/connectivity/source/drivers/postgresql/pq_tools.hxx @@ -57,28 +57,28 @@ bool isWhitespace( sal_Unicode c ); OUString concatQualified( const OUString & a, const OUString &b); -OString OUStringToOString( const OUString& str, ConnectionSettings const *settings); +OString OUStringToOString( std::u16string_view str, ConnectionSettings const *settings); -void bufferQuoteConstant( OUStringBuffer & buf, const OUString & str, ConnectionSettings *settings ); +void bufferQuoteConstant( OUStringBuffer & buf, std::u16string_view str, ConnectionSettings *settings ); void bufferQuoteAnyConstant( OUStringBuffer & buf, const css::uno::Any &val, ConnectionSettings *settings ); -void bufferEscapeConstant( OUStringBuffer & buf, const OUString & str, ConnectionSettings *settings ); +void bufferEscapeConstant( OUStringBuffer & buf, std::u16string_view str, ConnectionSettings *settings ); OUString sqltype2string( const css::uno::Reference< css::beans::XPropertySet > & column ); void bufferQuoteQualifiedIdentifier( - OUStringBuffer & buf, const OUString &schema, const OUString &name, ConnectionSettings *settings ); + OUStringBuffer & buf, std::u16string_view schema, std::u16string_view name, ConnectionSettings *settings ); void bufferQuoteQualifiedIdentifier( OUStringBuffer & buf, - const OUString &schema, - const OUString &name, - const OUString &col, + std::u16string_view schema, + std::u16string_view name, + std::u16string_view col, ConnectionSettings *settings ); -void bufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuote, ConnectionSettings *settings ); +void bufferQuoteIdentifier( OUStringBuffer & buf, std::u16string_view toQuote, ConnectionSettings *settings ); void bufferKey2TableConstraint( OUStringBuffer &buf, const css::uno::Reference< css::beans::XPropertySet > &key, @@ -115,7 +115,7 @@ OUString array2String( const css::uno::Sequence< css::uno::Any > &seq ); css::uno::Reference< css::sdbc::XConnection > extractConnectionFromStatement( const css::uno::Reference< css::uno::XInterface > & stmt ); -void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUString *second); +void splitConcatenatedIdentifier( std::u16string_view source, OUString *first, OUString *second); void fillAttnum2attnameMap( diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx index 4edb1aabc068..ed3af3579d2a 100644 --- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx +++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx @@ -328,8 +328,8 @@ void Columns::refresh() void alterColumnByDescriptor( - const OUString & schemaName, - const OUString & tableName, + std::u16string_view schemaName, + std::u16string_view tableName, ConnectionSettings *settings, const Reference< XStatement > &stmt, const css::uno::Reference< css::beans::XPropertySet > & past, diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.hxx b/connectivity/source/drivers/postgresql/pq_xcolumns.hxx index ab8c47914516..78bb9770ebdf 100644 --- a/connectivity/source/drivers/postgresql/pq_xcolumns.hxx +++ b/connectivity/source/drivers/postgresql/pq_xcolumns.hxx @@ -37,6 +37,10 @@ #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCOLUMNS_HXX #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XCOLUMNS_HXX +#include <sal/config.h> + +#include <string_view> + #include "pq_xcontainer.hxx" #include "pq_xbase.hxx" @@ -46,8 +50,8 @@ namespace pq_sdbc_driver { void alterColumnByDescriptor( - const OUString & schemaName, - const OUString & tableName, + std::u16string_view schemaName, + std::u16string_view tableName, ConnectionSettings *settings, const css::uno::Reference< css::sdbc::XStatement > &stmt, const css::uno::Reference< css::beans::XPropertySet > & past, diff --git a/connectivity/source/inc/java/lang/Class.hxx b/connectivity/source/inc/java/lang/Class.hxx index bc68a01a536a..bdf8e2742472 100644 --- a/connectivity/source/inc/java/lang/Class.hxx +++ b/connectivity/source/inc/java/lang/Class.hxx @@ -21,6 +21,10 @@ //************ Class: java.lang.Class +#include <sal/config.h> + +#include <string_view> + #include <java/lang/Object.hxx> namespace connectivity @@ -36,7 +40,7 @@ namespace connectivity // a Constructor, that is needed for when Returning the Object is needed: java_lang_Class( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} - static java_lang_Class * forName( const OUString &_par0 ); + static java_lang_Class * forName( std::u16string_view _par0 ); // return the jre object jobject newInstanceObject(); diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx index 41f3f756cf74..8f10f3c10ad4 100644 --- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx @@ -39,6 +39,7 @@ #include <odbc/ODatabaseMetaData.hxx> #include <odbc/odbcbasedllapi.hxx> #include <memory> +#include <string_view> namespace connectivity::odbc { @@ -199,31 +200,31 @@ namespace connectivity::odbc /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openTables(const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ); + std::u16string_view tableNamePattern, const css::uno::Sequence< OUString >& types ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, - const OUString& table, const OUString& columnNamePattern ); + std::u16string_view table, std::u16string_view columnNamePattern ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openColumns( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern, const OUString& columnNamePattern ); + std::u16string_view tableNamePattern, std::u16string_view columnNamePattern ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern,const OUString& columnNamePattern ); + std::u16string_view procedureNamePattern,std::u16string_view columnNamePattern ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& procedureNamePattern); + std::u16string_view procedureNamePattern); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openVersionColumns(const css::uno::Any& catalog, const OUString& schema, - const OUString& table); + std::u16string_view table); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope, bool nullable ); + std::u16string_view table,sal_Int32 scope, bool nullable ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openForeignKeys( const css::uno::Any& catalog, const OUString* schema,const OUString* table, @@ -236,19 +237,19 @@ namespace connectivity::odbc void openImportedKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException - void openPrimaryKeys(const css::uno::Any& catalog, const OUString& schema,const OUString& table); + void openPrimaryKeys(const css::uno::Any& catalog, const OUString& schema,std::u16string_view table); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openTablePrivileges(const css::uno::Any& catalog, const OUString& schemaPattern, - const OUString& tableNamePattern); + std::u16string_view tableNamePattern); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openSpecialColumns(bool _bRowVer,const css::uno::Any& catalog, const OUString& schema, - const OUString& table,sal_Int32 scope, bool nullable ); + std::u16string_view table,sal_Int32 scope, bool nullable ); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void openIndexInfo( const css::uno::Any& catalog, const OUString& schema, - const OUString& table,bool unique,bool approximate ); + std::u16string_view table,bool unique,bool approximate ); protected: using OPropertySetHelper::getFastPropertyValue; diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx index 54b28cac825e..1b7b3a569434 100644 --- a/connectivity/source/inc/odbc/OStatement.hxx +++ b/connectivity/source/inc/odbc/OStatement.hxx @@ -35,6 +35,7 @@ #include <odbc/OFunctions.hxx> #include <odbc/OConnection.hxx> #include <odbc/odbcbasedllapi.hxx> +#include <string_view> #include <vector> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -91,7 +92,7 @@ namespace connectivity::odbc void setMaxRows(sal_Int64 _par0) ; void setFetchDirection(sal_Int32 _par0) ; void setFetchSize(sal_Int32 _par0) ; - void setCursorName(const OUString &_par0); + void setCursorName(std::u16string_view _par0); void setEscapeProcessing( const bool _bEscapeProc ); template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const; diff --git a/connectivity/source/parse/internalnode.cxx b/connectivity/source/parse/internalnode.cxx index ccee05746a17..1906ad3d4625 100644 --- a/connectivity/source/parse/internalnode.cxx +++ b/connectivity/source/parse/internalnode.cxx @@ -33,7 +33,7 @@ OSQLInternalNode::OSQLInternalNode(const char* pNewValue, } -OSQLInternalNode::OSQLInternalNode(const OString &NewValue, +OSQLInternalNode::OSQLInternalNode(std::string_view NewValue, SQLNodeType eNodeType, sal_uInt32 nNodeID) :OSQLParseNode(NewValue,eNodeType,nNodeID) diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index d31bcd2a9ada..544d14e6491a 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1599,7 +1599,7 @@ OSQLParseNode::OSQLParseNode(const char * pNewValue, OSL_ENSURE(m_eNodeType >= SQLNodeType::Rule && m_eNodeType <= SQLNodeType::Concat,"OSQLParseNode: created with invalid NodeType"); } -OSQLParseNode::OSQLParseNode(const OString &_rNewValue, +OSQLParseNode::OSQLParseNode(std::string_view _rNewValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID) :m_pParent(nullptr) @@ -2508,7 +2508,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet } -sal_Int32 OSQLParser::getFunctionReturnType(const OUString& _sFunctionName, const IParseContext* pContext) +sal_Int32 OSQLParser::getFunctionReturnType(std::u16string_view _sFunctionName, const IParseContext* pContext) { sal_Int32 nType = DataType::VARCHAR; OString sFunctionName(OUStringToOString(_sFunctionName,RTL_TEXTENCODING_UTF8)); diff --git a/cppu/source/LogBridge/LogBridge.cxx b/cppu/source/LogBridge/LogBridge.cxx index c0dc02c243ad..b93b43b64e78 100644 --- a/cppu/source/LogBridge/LogBridge.cxx +++ b/cppu/source/LogBridge/LogBridge.cxx @@ -199,7 +199,8 @@ static void LogProbe( { OString sTemp; if ( pMemberType && pMemberType->pTypeName ) - sTemp = OUStringToOString(pMemberType->pTypeName,RTL_TEXTENCODING_ASCII_US); + sTemp = OUStringToOString( + OUString::unacquired(&pMemberType->pTypeName),RTL_TEXTENCODING_ASCII_US); if ( pre ) { SAL_INFO("cppu.log", "{ LogBridge () " << sTemp ); diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 5d0d0b84f573..21f84241f578 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -279,7 +279,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() typelib_TypeDescriptionReference * pTDR = rEntry.second; if (pTDR) { - OString aTypeName( OUStringToOString( pTDR->pTypeName, RTL_TEXTENCODING_ASCII_US ) ); + OString aTypeName( OUStringToOString( OUString::unacquired(&pTDR->pTypeName), RTL_TEXTENCODING_ASCII_US ) ); SAL_INFO("cppu.typelib", "remaining type: " << aTypeName << "; ref count = " << pTDR->nRefCount); } else diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 3a86f9882b7f..93a6a1bb588f 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -41,6 +41,7 @@ #include "prim.hxx" #include "loadmodule.hxx" +#include <string_view> #include <unordered_map> #include <vector> #include <stdio.h> @@ -672,7 +673,7 @@ void writeLine( void writeLine( - void * stream, const OUString & rLine, const char * pFilter ) + void * stream, std::u16string_view rLine, const char * pFilter ) { OString aLine( OUStringToOString( rLine, RTL_TEXTENCODING_ASCII_US ) ); @@ -777,7 +778,8 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName( else { writeLine( - stream, "environment \"" + OUString::unacquired(&pEnvDcp) + "\" does not exist!", + stream, + OUString("environment \"" + OUString::unacquired(&pEnvDcp) + "\" does not exist!"), pFilter ); } } diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx index 31365aa43c7b..bc1df676a38a 100644 --- a/cpputools/source/unoexe/unoexe.cxx +++ b/cpputools/source/unoexe/unoexe.cxx @@ -18,6 +18,7 @@ */ #include <stdio.h> +#include <string_view> #include <sal/main.h> #include <sal/log.hxx> @@ -68,7 +69,7 @@ static void out( const char * pText ) fprintf( stderr, "%s", pText ); } -static void out( const OUString & rText ) +static void out( std::u16string_view rText ) { if (! s_quiet) { diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx index 2a00f1f28a0c..832a7314b440 100644 --- a/cui/source/dialogs/AdditionsDialog.cxx +++ b/cui/source/dialogs/AdditionsDialog.cxx @@ -7,6 +7,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ + +#include <sal/config.h> + +#include <string_view> + #include <config_folders.h> #include <AdditionsDialog.hxx> @@ -142,54 +147,61 @@ void parseResponse(const std::string& rResponse, std::vector<AdditionInfo>& aAdd try { AdditionInfo aNewAddition = { - OStringToOUString(OString(arrayElement.child("id").string_value().get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("name").string_value().get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("author").string_value().get()), + OStringToOUString(std::string_view(arrayElement.child("id").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("url").string_value().get()), + OStringToOUString(std::string_view(arrayElement.child("name").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("screenshotURL").string_value().get()), + OStringToOUString( + std::string_view(arrayElement.child("author").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString(std::string_view(arrayElement.child("url").string_value().get()), RTL_TEXTENCODING_UTF8), OStringToOUString( - OString(arrayElement.child("extensionIntroduction").string_value().get()), + std::string_view(arrayElement.child("screenshotURL").string_value().get()), RTL_TEXTENCODING_UTF8), OStringToOUString( - OString(arrayElement.child("extensionDescription").string_value().get()), + std::string_view( + arrayElement.child("extensionIntroduction").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("releases") - .child(0) - .child("compatibility") - .string_value() - .get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("releases") - .child(0) - .child("releaseName") - .string_value() - .get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("releases") - .child(0) - .child("license") - .string_value() - .get()), - RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("commentNumber").string_value().get()), + OStringToOUString( + std::string_view( + arrayElement.child("extensionDescription").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString(std::string_view(arrayElement.child("releases") + .child(0) + .child("compatibility") + .string_value() + .get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("commentURL").string_value().get()), + OStringToOUString(std::string_view(arrayElement.child("releases") + .child(0) + .child("releaseName") + .string_value() + .get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("rating").string_value().get()), + OStringToOUString(std::string_view(arrayElement.child("releases") + .child(0) + .child("license") + .string_value() + .get()), RTL_TEXTENCODING_UTF8), OStringToOUString( - OString(arrayElement.child("downloadNumber").string_value().get()), + std::string_view(arrayElement.child("commentNumber").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString( + std::string_view(arrayElement.child("commentURL").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString( + std::string_view(arrayElement.child("rating").string_value().get()), + RTL_TEXTENCODING_UTF8), + OStringToOUString( + std::string_view(arrayElement.child("downloadNumber").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("releases") - .child(0) - .child("downloadURL") - .string_value() - .get()), + OStringToOUString(std::string_view(arrayElement.child("releases") + .child(0) + .child("downloadURL") + .string_value() + .get()), RTL_TEXTENCODING_UTF8) }; diff --git a/dbaccess/qa/unit/dbtest_base.cxx b/dbaccess/qa/unit/dbtest_base.cxx index 72f4e9b685f1..f0b276cbb1ea 100644 --- a/dbaccess/qa/unit/dbtest_base.cxx +++ b/dbaccess/qa/unit/dbtest_base.cxx @@ -47,7 +47,9 @@ utl::TempFile DBTestBase::createTempCopy(OUString const & pathname) { tmp.EnableKillingFile(); auto const e = osl::File::copy(url, tmp.GetURL()); CPPUNIT_ASSERT_EQUAL_MESSAGE( - (OUStringToOString("<" + url + "> -> <" + tmp.GetURL() + ">", RTL_TEXTENCODING_UTF8) + (OString( + "<" + OUStringToOString(url, RTL_TEXTENCODING_UTF8) + "> -> <" + + OUStringToOString(tmp.GetURL(), RTL_TEXTENCODING_UTF8) + ">") .getStr()), osl::FileBase::E_None, e); return tmp; diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index b44b11fc16f0..494994c347da 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -72,7 +72,7 @@ ODsnTypeCollection::~ODsnTypeCollection() #endif } -OUString ODsnTypeCollection::getTypeDisplayName(const OUString& _sURL) const +OUString ODsnTypeCollection::getTypeDisplayName(std::u16string_view _sURL) const { return m_aDriverConfig.getDriverTypeDisplayName(_sURL); } @@ -130,7 +130,7 @@ bool ODsnTypeCollection::hasDriver( const char* _pAsciiPattern ) const return !sPrefix.isEmpty(); } -bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const +bool ODsnTypeCollection::isConnectionUrlRequired(std::u16string_view _sURL) const { OUString sRet; OUString sOldPattern; @@ -146,7 +146,7 @@ bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const return !sRet.isEmpty() && sRet[sRet.getLength()-1] == '*'; } -OUString ODsnTypeCollection::getMediaType(const OUString& _sURL) const +OUString ODsnTypeCollection::getMediaType(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("MediaType",OUString()); @@ -236,43 +236,43 @@ void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sD } } -OUString ODsnTypeCollection::getJavaDriverClass(const OUString& _sURL) const +OUString ODsnTypeCollection::getJavaDriverClass(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getProperties(_sURL); return aFeatures.getOrDefault("JavaDriverClass",OUString()); } -bool ODsnTypeCollection::isFileSystemBased(const OUString& _sURL) const +bool ODsnTypeCollection::isFileSystemBased(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("FileSystemBased",false); } -bool ODsnTypeCollection::supportsTableCreation(const OUString& _sURL) const +bool ODsnTypeCollection::supportsTableCreation(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("SupportsTableCreation",false); } -bool ODsnTypeCollection::supportsColumnDescription(const OUString& _sURL) const +bool ODsnTypeCollection::supportsColumnDescription(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("SupportsColumnDescription",false); } -bool ODsnTypeCollection::supportsBrowsing(const OUString& _sURL) const +bool ODsnTypeCollection::supportsBrowsing(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("SupportsBrowsing",false); } -bool ODsnTypeCollection::supportsDBCreation(const OUString& _sURL) const +bool ODsnTypeCollection::supportsDBCreation(std::u16string_view _sURL) const { const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL); return aFeatures.getOrDefault("SupportsDBCreation",false); } -Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( const OUString& _sURL ) const +Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( std::u16string_view _sURL ) const { const ::comphelper::NamedValueCollection& aProperties = m_aDriverConfig.getProperties(_sURL); return aProperties.getPropertyValues(); @@ -467,7 +467,7 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16 } } -OUString ODsnTypeCollection::getType(const OUString& _sURL) const +OUString ODsnTypeCollection::getType(std::u16string_view _sURL) const { OUString sOldPattern; for (auto const& dsnPrefix : m_aDsnPrefixes) @@ -481,7 +481,7 @@ OUString ODsnTypeCollection::getType(const OUString& _sURL) const return sOldPattern; } -sal_Int32 ODsnTypeCollection::getIndexOf(const OUString& _sURL) const +sal_Int32 ODsnTypeCollection::getIndexOf(std::u16string_view _sURL) const { sal_Int32 nRet = -1; OUString sOldPattern; diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx index 89c748fcbb82..5ded17936c38 100644 --- a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx +++ b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include "rowinputbinary.hxx" #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/io/WrongFormatException.hpp> @@ -82,7 +86,8 @@ OUString lcl_double_dabble(const std::vector<sal_uInt8>& bytes) digit += '0'; /* Resize and return the resulting string. */ - return OStringToOUString(OString(scratch.data(), scratch.size()), RTL_TEXTENCODING_UTF8); + return OStringToOUString(std::string_view(scratch.data(), scratch.size()), + RTL_TEXTENCODING_UTF8); } OUString lcl_makeStringFromBigint(const std::vector<sal_uInt8>& bytes) diff --git a/dbaccess/source/filter/hsqldb/utils.cxx b/dbaccess/source/filter/hsqldb/utils.cxx index 3dc8f2e55b16..f2b2b517b8fc 100644 --- a/dbaccess/source/filter/hsqldb/utils.cxx +++ b/dbaccess/source/filter/hsqldb/utils.cxx @@ -51,7 +51,7 @@ int getHexValue(sal_Unicode c) } // unnamed namespace //Convert ascii escaped unicode to utf-8 -OUString utils::convertToUTF8(const OString& original) +OUString utils::convertToUTF8(std::string_view original) { OUString res = OStringToOUString(original, RTL_TEXTENCODING_UTF8); for (sal_Int32 i = 0;;) diff --git a/dbaccess/source/filter/hsqldb/utils.hxx b/dbaccess/source/filter/hsqldb/utils.hxx index f0a0e35249a0..b8ed1a222c4c 100644 --- a/dbaccess/source/filter/hsqldb/utils.hxx +++ b/dbaccess/source/filter/hsqldb/utils.hxx @@ -9,11 +9,15 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <rtl/ustring.hxx> namespace dbahsql::utils { -OUString convertToUTF8(const OString& original); +OUString convertToUTF8(std::string_view original); OUString getTableNameFromStmt(const OUString& sSql); diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx index 38f8ba9213a0..629759ccfd47 100644 --- a/dbaccess/source/inc/dsntypes.hxx +++ b/dbaccess/source/inc/dsntypes.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> +#include <string_view> #include <vector> #include <dbadllapi.hxx> @@ -117,7 +118,7 @@ public: ~ODsnTypeCollection(); /// get the datasource type display name from a DSN string - OUString getTypeDisplayName(const OUString& _sURL) const; + OUString getTypeDisplayName(std::u16string_view _sURL) const; /// on a given string, cut the type prefix and return the result OUString cutPrefix(const OUString& _sURL) const; @@ -129,10 +130,10 @@ public: bool hasDriver( const char* _pAsciiPattern ) const; /// on a given string, return the Java Driver Class - OUString getJavaDriverClass(const OUString& _sURL) const; + OUString getJavaDriverClass(std::u16string_view _sURL) const; /// returns the media type of a file based database - OUString getMediaType(const OUString& _sURL) const; + OUString getMediaType(std::u16string_view _sURL) const; /// returns the dsn prefix for a given media type OUString getDatasourcePrefixFromMediaType(std::u16string_view _sMediaType, std::u16string_view _sExtension ); @@ -140,21 +141,21 @@ public: void extractHostNamePort(const OUString& _rDsn,OUString& _sDatabaseName,OUString& _rHostname,sal_Int32& _nPortNumber) const; /// check if the given data source allows creation of tables - bool supportsTableCreation(const OUString& _sURL) const; + bool supportsTableCreation(std::u16string_view _sURL) const; /// check if the given data source allows to show column description. - bool supportsColumnDescription(const OUString& _sURL) const; + bool supportsColumnDescription(std::u16string_view _sURL) const; // check if a Browse button may be shown to insert connection url - bool supportsBrowsing(const OUString& _sURL) const; + bool supportsBrowsing(std::u16string_view _sURL) const; // check if a Create New Database button may be shown to insert connection url - bool supportsDBCreation(const OUString& _sURL) const; + bool supportsDBCreation(std::u16string_view _sURL) const; /// check if the given data source type is based on the file system - i.e. the URL is a prefix plus a file URL - bool isFileSystemBased(const OUString& _sURL) const; + bool isFileSystemBased(std::u16string_view _sURL) const; - bool isConnectionUrlRequired(const OUString& _sURL) const; + bool isConnectionUrlRequired(std::u16string_view _sURL) const; /// checks if the given data source type embeds its data into the database document static bool isEmbeddedDatabase( const OUString& _sURL ); @@ -167,7 +168,7 @@ public: /** returns default settings for newly created databases of the given type. */ css::uno::Sequence< css::beans::PropertyValue> - getDefaultDBSettings( const OUString& _sURL ) const; + getDefaultDBSettings( std::u16string_view _sURL ) const; /// get access to the first element of the types collection inline TypeIterator begin() const; @@ -178,9 +179,9 @@ public: DATASOURCE_TYPE determineType(const OUString& _rDsn) const; - sal_Int32 getIndexOf(const OUString& _sURL) const; + sal_Int32 getIndexOf(std::u16string_view _sURL) const; sal_Int32 size() const; - OUString getType(const OUString& _sURL) const; + OUString getType(std::u16string_view _sURL) const; }; //- ODsnTypeCollection::TypeIterator diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 473c0d32ca34..88fd1151bfef 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -293,7 +293,7 @@ void ODbTypeWizDialogSetup::activateDatabasePath() { sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( m_pGeneralPage->GetSelectedType() ); if ( nCreateNewDBIndex == -1 ) - nCreateNewDBIndex = m_pCollection->getIndexOf( "sdbc:dbase:" ); + nCreateNewDBIndex = m_pCollection->getIndexOf( u"sdbc:dbase:" ); OSL_ENSURE( nCreateNewDBIndex != -1, "ODbTypeWizDialogSetup::activateDatabasePath: the GeneralPage should have prevented this!" ); activatePath( static_cast< PathId >( nCreateNewDBIndex + 1 ), true ); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index d61032fd4919..d02ac934fba7 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -461,7 +461,7 @@ namespace dbaui // If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() ); if ( nCreateNewDBIndex == -1 ) - nCreateNewDBIndex = m_pCollection->getIndexOf( "sdbc:dbase:" ); + nCreateNewDBIndex = m_pCollection->getIndexOf( u"sdbc:dbase:" ); bool bHideCreateNew = ( nCreateNewDBIndex == -1 ); // also, if our application policies tell us to hide the option, do it @@ -551,7 +551,7 @@ namespace dbaui // Sets the default selected database on startup. if (m_xRB_CreateDatabase->get_active() ) { - return m_pCollection->getTypeDisplayName( "sdbc:firebird:" ); + return m_pCollection->getTypeDisplayName( u"sdbc:firebird:" ); } return OGeneralPage::getDatasourceName( _rSet ); diff --git a/desktop/inc/dp_misc.h b/desktop/inc/dp_misc.h index 2953cd53cfde..0d9eadb90cb3 100644 --- a/desktop/inc/dp_misc.h +++ b/desktop/inc/dp_misc.h @@ -19,6 +19,10 @@ #pragma once +#include <sal/config.h> + +#include <string_view> + #include <osl/mutex.hxx> #include <osl/process.h> #include <com/sun/star/uno/XComponentContext.hpp> @@ -106,13 +110,13 @@ oslProcess raiseProcess( OUString const & appURL, as target encoding. */ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -void writeConsole(OUString const & sText); +void writeConsole(std::u16string_view sText); /** writes the argument to the console using the error stream. Otherwise the same as writeConsole. */ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC -void writeConsoleError(OUString const & sText); +void writeConsoleError(std::u16string_view sText); /** reads from the console. diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8a5b3f54d81a..82586de384b1 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2084,7 +2084,7 @@ void DesktopLOKTest::testGetFontSubset() rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8 ); - OString aCommand = OUStringToOString(".uno:FontSubset&name=" + aFontName, RTL_TEXTENCODING_UTF8); + OString aCommand = ".uno:FontSubset&name=" + OUStringToOString(aFontName, RTL_TEXTENCODING_UTF8); boost::property_tree::ptree aTree; char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aCommand.getStr()); std::stringstream aStream(pJSON); diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 50b92ecb7834..9ab77f399ec4 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -61,6 +61,7 @@ #include <osl/thread.hxx> #include <osl/file.hxx> #include <iostream> +#include <string_view> using namespace ::osl; using namespace ::com::sun::star::uno; @@ -89,7 +90,7 @@ struct DispatchHolder Reference< XDispatch > xDispatch; }; -std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( const OUString& rUrl, const OUString& rFactory ) +std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( std::u16string_view rUrl, const OUString& rFactory ) { // create the list of filters OUStringBuffer sQuery(256); diff --git a/desktop/source/deployment/manager/dp_activepackages.cxx b/desktop/source/deployment/manager/dp_activepackages.cxx index b301bc5ad22b..c1c5f2b28dba 100644 --- a/desktop/source/deployment/manager/dp_activepackages.cxx +++ b/desktop/source/deployment/manager/dp_activepackages.cxx @@ -21,6 +21,7 @@ #include <sal/config.h> +#include <string_view> #include <utility> #include <osl/diagnose.h> @@ -44,11 +45,11 @@ namespace { constexpr const char separator[] = "\xff"; -OString oldKey(OUString const & fileName) { +OString oldKey(std::u16string_view fileName) { return OUStringToOString(fileName, RTL_TEXTENCODING_UTF8); } -OString newKey(OUString const & id) { +OString newKey(std::u16string_view id) { return separator + OUStringToOString(id, RTL_TEXTENCODING_UTF8); } diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 21b9d4b4496b..81785e536a40 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -455,19 +455,19 @@ Reference<XInterface> resolveUnoURL( return nullptr; // warning C4715 } -static void writeConsoleWithStream(OUString const & sText, FILE * stream) +static void writeConsoleWithStream(std::u16string_view sText, FILE * stream) { OString s = OUStringToOString(sText, osl_getThreadTextEncoding()); fprintf(stream, "%s", s.getStr()); fflush(stream); } -void writeConsole(OUString const & sText) +void writeConsole(std::u16string_view sText) { writeConsoleWithStream(sText, stdout); } -void writeConsoleError(OUString const & sText) +void writeConsoleError(std::u16string_view sText) { writeConsoleWithStream(sText, stderr); } @@ -479,7 +479,7 @@ OUString readConsole() // read one char less so that the last char in buf is always zero if (fgets(buf, 1024, stdin) != nullptr) { - OUString value = OStringToOUString(OString(buf), osl_getThreadTextEncoding()); + OUString value = OStringToOUString(std::string_view(buf), osl_getThreadTextEncoding()); return value.trim(); } throw css::uno::RuntimeException("reading from stdin failed"); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e1e8ac652d3f..cc2cee9913c0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -31,6 +31,8 @@ #include <algorithm> #include <memory> #include <iostream> +#include <string_view> + #include <boost/property_tree/json_parser.hpp> #include <boost/algorithm/string.hpp> @@ -283,7 +285,7 @@ static char *convertOString(const OString &rStr) return pMemory; } -static char *convertOUString(const OUString &aStr) +static char *convertOUString(std::u16string_view aStr) { return convertOString(OUStringToOString(aStr, RTL_TEXTENCODING_UTF8)); } @@ -3492,7 +3494,7 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig return; } - SfxLokHelper::postExtTextEventAsync(pWindow, nType, OUString::fromUtf8(OString(pText, strlen(pText)))); + SfxLokHelper::postExtTextEventAsync(pWindow, nType, OUString::fromUtf8(std::string_view(pText, strlen(pText)))); } static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter) @@ -4584,7 +4586,7 @@ static char* getFonts (const char* pCommand) return pJson; } -static char* getFontSubset (const OString& aFontName) +static char* getFontSubset (std::string_view aFontName) { OUString aFoundFont(::rtl::Uri::decode(OStringToOUString(aFontName, RTL_TEXTENCODING_UTF8), rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8)); SfxObjectShell* pDocSh = SfxObjectShell::Current(); @@ -5053,7 +5055,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo } else if (aCommand.startsWith(aFontSubset)) { - return getFontSubset(OString(pCommand + aFontSubset.getLength())); + return getFontSubset(std::string_view(pCommand + aFontSubset.getLength())); } else { diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 53b2a23aec91..857902dd4f4e 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -70,8 +70,8 @@ struct ExtensionName }; -const char s_usingText [] = -"\n" +const char16_t s_usingText [] = +u"\n" "using: " APP_NAME " add <options> extension-path...\n" " " APP_NAME " validate <options> extension-identifier...\n" " " APP_NAME " remove <options> extension-identifier...\n" @@ -231,7 +231,7 @@ extern "C" int unopkg_main() return 0; } else if (isOption( info_version, &nPos )) { - dp_misc::writeConsole("\n" APP_NAME " Version 3.3\n"); + dp_misc::writeConsole(u"\n" APP_NAME " Version 3.3\n"); return 0; } //consume all bootstrap variables which may occur before the sub-command @@ -271,12 +271,12 @@ extern "C" int unopkg_main() if (cmdArg[ 0 ] == '-') { // is option: - dp_misc::writeConsoleError( + dp_misc::writeConsoleError(OUString( "\nERROR: unexpected option " + cmdArg + "!\n Use " APP_NAME " " + toString(info_help) + - " to print all options.\n"); + " to print all options.\n")); return 1; } else @@ -478,7 +478,7 @@ extern "C" int unopkg_main() vec_packages.size(), false); dp_misc::writeConsole( - "All deployed " + repository + " extensions:\n\n"); + OUString("All deployed " + repository + " extensions:\n\n")); } else { @@ -612,7 +612,7 @@ extern "C" int unopkg_main() catch (const LockFileException & e) { // No logger since it requires UNO which we don't have here - dp_misc::writeConsoleError(e.Message + "\n"); + dp_misc::writeConsoleError(OUString(e.Message + "\n")); bShowFailedMsg = false; } catch (const css::uno::Exception & e ) { diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index 98a957c014e8..1d4907b9a263 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -139,9 +139,9 @@ void CommandEnvironmentImpl::printLicense( OUString sNewLine("\n"); - dp_misc::writeConsole(sNewLine + sNewLine + s1 + sNewLine + sNewLine); - dp_misc::writeConsole(sLicense + sNewLine + sNewLine); - dp_misc::writeConsole(s2 + sNewLine); + dp_misc::writeConsole(OUString(sNewLine + sNewLine + s1 + sNewLine + sNewLine)); + dp_misc::writeConsole(OUString(sLicense + sNewLine + sNewLine)); + dp_misc::writeConsole(OUString(s2 + sNewLine)); dp_misc::writeConsole(s3); //the user may enter "yes" or "no", we compare in a case insensitive way @@ -168,7 +168,7 @@ void CommandEnvironmentImpl::printLicense( } else { - dp_misc::writeConsole(sNewLine + sNewLine + s4 + sNewLine); + dp_misc::writeConsole(OUString(sNewLine + sNewLine + s4 + sNewLine)); } } while(true); @@ -254,7 +254,7 @@ void CommandEnvironmentImpl::handle( { OUString sMsg(DpResId(RID_STR_UNSUPPORTED_PLATFORM)); sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName()); - dp_misc::writeConsole("\n" + sMsg + "\n\n"); + dp_misc::writeConsole(OUString("\n" + sMsg + "\n\n")); approve = true; } else { @@ -272,7 +272,7 @@ void CommandEnvironmentImpl::handle( if (abort && m_option_verbose) { OUString msg = ::comphelper::anyToString(request); - dp_misc::writeConsoleError("\nERROR: " + msg + "\n"); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits