include/rtl/string.hxx | 4 ++-- include/rtl/ustring.hxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
New commits: commit 59059d00c29334414a26bf5452572433f5735489 Author: Noel Grandin <[email protected]> AuthorDate: Thu Apr 7 20:33:28 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Fri Apr 8 08:43:34 2022 +0200 prevent using O[U]String::subView on temporaties by making the method "const &" Change-Id: I8b369ca1dd1f8d10832c85ccf3d890edb14e2c54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132688 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index e99581cd6f94..f64f2d651730 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -1540,7 +1540,7 @@ public: @param beginIndex the beginning index, inclusive. @return the specified substring. */ - SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex ) const + SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex ) const & { assert(beginIndex >= 0); assert(beginIndex <= getLength()); @@ -1559,7 +1559,7 @@ public: @param count the number of characters. @return the specified substring. */ - SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const + SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const & { assert(beginIndex >= 0); assert(count >= 0); diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index 1a6a1cae8990..c530f1702a81 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -2189,7 +2189,7 @@ public: @param beginIndex the beginning index, inclusive. @return the specified substring. */ - SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex ) const + SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex ) const & { assert(beginIndex >= 0); assert(beginIndex <= getLength()); @@ -2208,7 +2208,7 @@ public: @param count the number of characters. @return the specified substring. */ - SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const + SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const & { assert(beginIndex >= 0); assert(count >= 0);
