diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-11 09:00:03 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-11 11:36:06 +0200 |
commit | fbbbc7e3f9a62a80d41bcf9621cc098fd45b94c7 (patch) | |
tree | 8d3288ea5a971c91499365521e77b3359730e769 /include/rtl/ustring.hxx | |
parent | 9fc8b685f9dec107ec6df721ebf3844b992fd8b1 (diff) |
Use constexpr if in const char array ctors
Change-Id: I84237b0b20d5a5aefd7268f16a6254c83c320382
Reviewed-on: https://gerrit.libreoffice.org/80637
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/rtl/ustring.hxx')
-rw-r--r-- | include/rtl/ustring.hxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index a974e3ac7a12..b63c61e677ce 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -257,7 +257,11 @@ public: assert( libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal)); pData = NULL; - if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) { + if +#if defined LIBO_INTERNAL_ONLY + constexpr +#endif + (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) { rtl_uString_new(&pData); } else { rtl_uString_newFromLiteral( @@ -280,7 +284,7 @@ public: = libreoffice_internal::Dummy()): pData(nullptr) { - if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) { + if constexpr (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) { rtl_uString_new(&pData); } else { rtl_uString_newFromStr_WithLength( @@ -499,7 +503,11 @@ public: { assert( libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal)); - if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) { + if +#if defined LIBO_INTERNAL_ONLY + constexpr +#endif + (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) { rtl_uString_new(&pData); } else { rtl_uString_newFromLiteral( @@ -517,7 +525,7 @@ public: typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16 operator =(T & literal) { - if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) { + if constexpr (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) { rtl_uString_new(&pData); } else { rtl_uString_newFromStr_WithLength( |