diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-05-03 15:43:10 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-03 16:11:58 +0200 |
commit | 6dac3f18941bd2d66218ec43f08e4fb9be869c63 (patch) | |
tree | f2664c9f31d5046f38a1403f46eb0fc162d5242c /src/corelib/tools/qbytearray.h | |
parent | b4dabb9e50ce26469b0b7d71e168463abf727334 (diff) | |
parent | 1e49914fee099c4c0d634743326b50ad02e6c8f1 (diff) |
Merge "Merge remote-tracking branch 'origin/api_changes'" into refs/staging/master
Diffstat (limited to 'src/corelib/tools/qbytearray.h')
-rw-r--r-- | src/corelib/tools/qbytearray.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 45be63aa9b..0f5ebcfb18 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -169,13 +169,14 @@ struct QByteArrayDataPtr #if defined(Q_COMPILER_LAMBDA) # define QByteArrayLiteral(str) \ - ([]() -> QByteArrayDataPtr { \ + ([]() -> QByteArray { \ enum { Size = sizeof(str) - 1 }; \ static const QStaticByteArrayData<Size> qbytearray_literal = { \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(Size), \ str }; \ QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; \ - return holder; \ + const QByteArray ba(holder); \ + return ba; \ }()) \ /**/ @@ -185,22 +186,22 @@ struct QByteArrayDataPtr // To do that, we need the __extension__ {( )} trick which only GCC supports # define QByteArrayLiteral(str) \ - __extension__ ({ \ + QByteArray(__extension__ ({ \ enum { Size = sizeof(str) - 1 }; \ static const QStaticByteArrayData<Size> qbytearray_literal = { \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(Size), \ str }; \ QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; \ holder; \ - }) \ + })) \ /**/ #endif #ifndef QByteArrayLiteral -// no lambdas, not GCC, use const char * instead +// no lambdas, not GCC, just return a temporary QByteArray -# define QByteArrayLiteral(str) (str) +# define QByteArrayLiteral(str) QByteArray(str, sizeof(str) - 1) #endif class Q_CORE_EXPORT QByteArray |