Commit b5d964e6 authored by Thiago Macieira's avatar Thiago Macieira Committed by Orgad Shaneh
Browse files

Sqlite: Stop using QtCore private macros in Qt Creator



Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER is entirely private and may
change at any time.

More importantly, this macro is not necessary at all. QByteArrayLiteral
solves the problem neatly.

Change-Id: Ib306f8f647014b399b87ffff13f2c0f38c459ab1
Reviewed-by: default avatarAdam Majer <adamm@zombino.com>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent e8633933
......@@ -115,27 +115,7 @@ SQLITE_EXPORT QDataStream &operator>>(QDataStream &datastream, Utf8String &text)
SQLITE_EXPORT QDebug operator<<(QDebug debug, const Utf8String &text);
SQLITE_EXPORT void PrintTo(const Utf8String &text, ::std::ostream* os);
#if defined(Q_COMPILER_LAMBDA)
# define Utf8StringLiteral(str) \
([]() -> Utf8String { \
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() }; \
const QByteArray byteArray(holder); \
return Utf8String::fromByteArray(byteArray); \
}()) \
/**/
#endif
#ifndef Utf8StringLiteral
// no lambdas, not GCC, just return a temporary QByteArray
# define Utf8StringLiteral(str) Utf8String(str, sizeof(str) - 1)
#endif
#define Utf8StringLiteral(str) Utf8String::fromByteArray(QByteArrayLiteral(str))
Q_DECLARE_METATYPE(Utf8String)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment