summaryrefslogtreecommitdiff
path: root/include/rtl/strbuf.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-06-25 10:15:34 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-06-25 12:38:32 +0200
commit8007417c318140d74b87ec5abcf835f4a2ba9682 (patch)
tree0ea40500853d78008c0d1aa1083a0e415e457e9a /include/rtl/strbuf.hxx
parent707ef3171a096787b2f7a4c221e60962f05e7d01 (diff)
Revert "Revert "Generalize OUStringLiteral1""
This reverts commit 5cba714b4d03ed54debf71534ad8c8edc383a01e, now including a workaround for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53658> "internal compiler error -- segmentation fault." Change-Id: I31f6d9ddcb0b884134703df2b9dc1800ba0a84be
Diffstat (limited to 'include/rtl/strbuf.hxx')
-rw-r--r--include/rtl/strbuf.hxx28
1 files changed, 20 insertions, 8 deletions
diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index 81773b48a28a..307110367a1e 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -170,10 +170,14 @@ public:
template< typename T >
OStringBuffer( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
: pData(NULL)
- , nCapacity( libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 + 16 )
- {
- assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
- rtl_string_newFromLiteral( &pData, literal, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1, 16 );
+ , nCapacity( libreoffice_internal::ConstCharArrayDetector<T>::length + 16 )
+ {
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ rtl_string_newFromLiteral(
+ &pData,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length, 16);
#ifdef RTL_STRING_UNITTEST
rtl_string_unittest_const_literal = true;
#endif
@@ -453,8 +457,12 @@ public:
typename libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer& >::Type append( T& literal )
{
RTL_STRING_CONST_FUNCTION
- assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
- rtl_stringbuffer_insert( &pData, &nCapacity, getLength(), literal, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 );
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ rtl_stringbuffer_insert(
+ &pData, &nCapacity, getLength(),
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
return *this;
}
@@ -708,8 +716,12 @@ public:
typename libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, T& literal )
{
RTL_STRING_CONST_FUNCTION
- assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
- rtl_stringbuffer_insert( &pData, &nCapacity, offset, literal, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 );
+ assert(
+ libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+ rtl_stringbuffer_insert(
+ &pData, &nCapacity, offset,
+ libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
+ libreoffice_internal::ConstCharArrayDetector<T>::length);
return *this;
}