summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qbytearray_p.h
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2020-03-31 12:30:18 +0200
committerLiang Qi <liang.qi@qt.io>2020-03-31 16:24:30 +0200
commit7ed097b31f7e15812144c360021872cf8f11821e (patch)
tree0bc0ac535734fb4513728042b090d15eb86aaa33 /src/corelib/text/qbytearray_p.h
parent82a39f12fa50424fe792b4ff7e7764d98ebabe3e (diff)
parent947e1f45c762cf6d26bc8f241833689c6e636627 (diff)
Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"v5.15.0-beta3
Diffstat (limited to 'src/corelib/text/qbytearray_p.h')
-rw-r--r--src/corelib/text/qbytearray_p.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/text/qbytearray_p.h b/src/corelib/text/qbytearray_p.h
index 3c6257f786..ffec6dca22 100644
--- a/src/corelib/text/qbytearray_p.h
+++ b/src/corelib/text/qbytearray_p.h
@@ -56,10 +56,9 @@
QT_BEGIN_NAMESPACE
-enum {
- // Define as enum to force inlining. Don't expose MaxAllocSize in a public header.
- MaxByteArraySize = MaxAllocSize - sizeof(std::remove_pointer<QByteArray::DataPtr>::type)
-};
+// -1 because of the terminating NUL
+constexpr qsizetype MaxByteArraySize = MaxAllocSize - sizeof(std::remove_pointer<QByteArray::DataPtr>::type) - 1;
+constexpr qsizetype MaxStringSize = (MaxAllocSize - sizeof(std::remove_pointer<QByteArray::DataPtr>::type)) / 2 - 1;
QT_END_NAMESPACE