[Libreoffice-commits] core.git: include/rtl
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 11 09:37:02 UTC 2019
include/rtl/string.hxx | 12 ++++++++++--
include/rtl/ustring.hxx | 16 ++++++++++++----
2 files changed, 22 insertions(+), 6 deletions(-)
New commits:
commit fbbbc7e3f9a62a80d41bcf9621cc098fd45b94c7
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Oct 11 09:00:03 2019 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Oct 11 11:36:06 2019 +0200
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 at collabora.com>
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index a7a04f9d06e4..c9ea3c6752c0 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -210,7 +210,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_string_new(&pData);
} else {
rtl_string_newFromLiteral(
@@ -344,7 +348,11 @@ public:
RTL_STRING_CONST_FUNCTION
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_string_new(&pData);
} else {
rtl_string_newFromLiteral(
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(
More information about the Libreoffice-commits
mailing list