summaryrefslogtreecommitdiff
path: root/include/rtl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-07 20:33:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-08 08:43:34 +0200
commit59059d00c29334414a26bf5452572433f5735489 (patch)
treeec686065509d39261fc3d16824352b61eb2c7309 /include/rtl
parente61eed211766f26a3896c1d912dc7349abbe823d (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/rtl')
-rw-r--r--include/rtl/string.hxx4
-rw-r--r--include/rtl/ustring.hxx4
2 files changed, 4 insertions, 4 deletions
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);