summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-05-13 10:26:31 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-05-13 10:26:31 +0200
commitf9afc51f96b2b09d8be7fcd9bf080d1144643273 (patch)
tree9cfaefbd6f58d3bb47ab3be564bd74df0ff65ccb /src
parent5cbaaa1a8baf14b66efe89fe967a3e966dac659c (diff)
parent03415f5db33ee1d8af15b924f84b547a9ed8020b (diff)
Merge commit 'origin/4.5'
Diffstat (limited to 'src')
-rw-r--r--src/corelib/arch/qatomic_mips.h106
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp2
-rw-r--r--src/corelib/tools/qhash.cpp219
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/gui/image/qicon.cpp3
-rw-r--r--src/gui/image/qpixmap_win.cpp1
-rw-r--r--src/gui/kernel/qevent.cpp13
-rw-r--r--src/gui/kernel/qshortcutmap.cpp1
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp22
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.h1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp13
-rw-r--r--src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp12
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp123
16 files changed, 311 insertions, 214 deletions
diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h
index b263aab9fe..ea9954bdcc 100644
--- a/src/corelib/arch/qatomic_mips.h
+++ b/src/corelib/arch/qatomic_mips.h
@@ -103,16 +103,25 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree()
#if defined(Q_CC_GNU) && !defined(Q_OS_IRIX)
+#if _MIPS_SIM == _ABIO32
+#define SET_MIPS2 ".set mips2\n\t"
+#else
+#define SET_MIPS2
+#endif
+
inline bool QBasicAtomicInt::ref()
{
register int originalValue;
register int newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"addiu %[newValue], %[originalValue], %[one]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -125,12 +134,15 @@ inline bool QBasicAtomicInt::deref()
{
register int originalValue;
register int newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"addiu %[newValue], %[originalValue], %[minusOne]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -143,7 +155,9 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
{
register int result;
register int tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
"bnez %[result], 0f\n"
@@ -153,6 +167,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -166,7 +181,9 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
{
register int result;
register int tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
"bnez %[result], 0f\n"
@@ -177,6 +194,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
"nop\n"
"sync\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -190,7 +208,9 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
{
register int result;
register int tempValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
"ll %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
@@ -201,6 +221,7 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -219,12 +240,15 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue)
{
register int originalValue;
register int tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
"sc %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -237,13 +261,16 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue)
{
register int originalValue;
register int tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
"sc %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
"sync\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -256,13 +283,16 @@ inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue)
{
register int originalValue;
register int tempValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
"ll %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
"sc %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -280,12 +310,15 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd)
{
register int originalValue;
register int newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -298,13 +331,16 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd)
{
register int originalValue;
register int newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
"ll %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
"sync\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -317,13 +353,16 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd)
{
register int originalValue;
register int newValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
"ll %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -350,7 +389,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu
{
register T *result;
register T *tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
"bnez %[result], 0f\n"
@@ -360,6 +401,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -374,7 +416,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu
{
register T *result;
register T *tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
"bnez %[result], 0f\n"
@@ -385,6 +429,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu
"nop\n"
"sync\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -399,7 +444,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu
{
register T *result;
register T *tempValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
LLP" %[result], %[_q_value]\n"
"xor %[result], %[result], %[expectedValue]\n"
@@ -410,6 +457,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
+ ".set pop\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -430,12 +478,15 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
{
register T *originalValue;
register T *tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
SCP" %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -449,13 +500,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
{
register T *originalValue;
register T *tempValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
SCP" %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
"sync\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -469,13 +523,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
{
register T *originalValue;
register T *tempValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
LLP" %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
SCP" %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
@@ -495,12 +552,15 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo
{
register T *originalValue;
register T *newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
SCP" %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -514,13 +574,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo
{
register T *originalValue;
register T *newValue;
- asm volatile("0:\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "0:\n"
LLP" %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
SCP" %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
"sync\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
@@ -534,13 +597,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo
{
register T *originalValue;
register T *newValue;
- asm volatile("sync\n"
+ asm volatile(".set push\n"
+ SET_MIPS2
+ "sync\n"
"0:\n"
LLP" %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
SCP" %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
+ ".set pop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 8a0a3f5d38..7a6a85be4f 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -780,7 +780,7 @@ QString QFSFileEngine::fileName(FileName file) const
#endif
if (len > 0) {
QString ret;
- if (S_ISDIR(d->st.st_mode) && s[0] != '/') {
+ if (d->doStat() && S_ISDIR(d->st.st_mode) && s[0] != '/') {
QDir parent(d->filePath);
parent.cdUp();
ret = parent.path();
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 21d98b530c..b2512e19e8 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -379,6 +379,107 @@ void QHashData::checkSanity()
#endif
/*!
+ \fn uint qHash(const QPair<T1, T2> &key)
+ \relates QHash
+ \since 4.3
+
+ Returns the hash value for the \a key.
+
+ Types \c T1 and \c T2 must be supported by qHash().
+*/
+
+/*! \fn uint qHash(char key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(uchar key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(signed char key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(ushort key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(short key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(uint key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(int key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(ulong key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(long key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(quint64 key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(qint64 key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(QChar key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(const QByteArray &key)
+ \fn uint qHash(const QBitArray &key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(const QString &key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*! \fn uint qHash(const T *key)
+ \relates QHash
+
+ Returns the hash value for the \a key.
+*/
+
+/*!
\class QHash
\brief The QHash class is a template class that provides a hash-table-based dictionary.
@@ -401,7 +502,7 @@ void QHashData::checkSanity()
key. With QHash, the items are arbitrarily ordered.
\i The key type of a QMap must provide operator<(). The key
type of a QHash must provide operator==() and a global
- \l{qHash()}{qHash}(Key) function.
+ \l{qHash()} {hash} function.
\endlist
Here's an example QHash with QString keys and \c int values:
@@ -732,7 +833,6 @@ void QHashData::checkSanity()
*/
/*! \fn const T QHash::value(const Key &key, const T &defaultValue) const
-
\overload
If the hash contains no item with the given \a key, the function returns
@@ -1490,121 +1590,6 @@ void QHashData::checkSanity()
\sa operator+=(), operator-()
*/
-/*! \fn uint qHash(char key)
- \relates QHash
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(uchar key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(signed char key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(ushort key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(short key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(uint key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(int key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(ulong key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(long key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(quint64 key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(qint64 key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(QChar key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(const QByteArray &key)
- \fn uint qHash(const QBitArray &key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(const QString &key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*! \fn uint qHash(const T *key)
- \relates QHash
- \overload
-
- Returns the hash value for the \a key.
-*/
-
-/*!
- \fn uint qHash(const QPair<T1, T2> &key)
- \relates QHash
- \since 4.3
-
- Returns the hash value for the \a key.
-
- Types \c T1 and \c T2 must be supported by qHash().
-*/
-
/*! \fn QDataStream &operator<<(QDataStream &out, const QHash<Key, T>& hash)
\relates QHash
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 375d672f86..c3649e372b 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -743,7 +743,9 @@ int QString::grow(int size)
/*!
\since 4.2
- Returns a copy of the \a string string encoded in ucs4.
+ Returns a copy of the \a string, where the encoding of \a string depends on
+ the size of wchar. If wchar is 4 bytes, the \a string is interpreted as ucs-4,
+ if wchar is 2 bytes it is interpreted as ucs-2.
If \a size is -1 (default), the \a string has to be 0 terminated.
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 05145675d8..b2b8c139e9 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -856,6 +856,9 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state)
QImageWriter::supportedImageFormats() functions to retrieve a
complete list of the supported file formats.
+ Note: When you add a non-empty filename to a QIcon, the icon becomes
+ non-null, even if the file doesn't exist or points to a corrupt file.
+
\sa addPixmap()
*/
void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State state)
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index 20bed021c6..d4ebef7349 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -319,6 +319,7 @@ static QImage qt_fromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h)
} else {
qWarning("qt_fromWinHBITMAP(), failed to get bitmap bits");
}
+ qFree(data);
return image;
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index a4d5035333..0ab4423c28 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -675,12 +675,13 @@ QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease,
or QEvent::ShortcutOverride.
- If \a key is 0, the event is not a result of
- a known key; for example, it may be the result of a compose
- sequence or keyboard macro. The \a modifiers holds the keyboard
- modifiers, and the given \a text is the Unicode text that the
- key generated. If \a autorep is true, isAutoRepeat() will be
- true. \a count is the number of keys involved in the event.
+ Int \a key is the code for the Qt::Key that the event loop should listen
+ for. If \a key is 0, the event is not a result of a known key; for
+ example, it may be the result of a compose sequence or keyboard macro.
+ The \a modifiers holds the keyboard modifiers, and the given \a text
+ is the Unicode text that the key generated. If \a autorep is true,
+ isAutoRepeat() will be true. \a count is the number of keys involved
+ in the event.
*/
QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text,
bool autorep, ushort count)
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index b6703e2f69..f998bb22f3 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -751,6 +751,7 @@ bool QShortcutMap::correctGraphicsWidgetContext(Qt::ShortcutContext context, QGr
tw = tw->parentWidget();
return tw == w;
}
+ return false;
}
// Below is Qt::WindowShortcut context
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 3397c45608..175f1ab7a5 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -123,14 +123,30 @@ void QEmulationPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
real_engine->stroke(path, bgPen);
}
-
QBrush brush = pen.brush();
+ QPen copy = pen;
Qt::BrushStyle style = qbrush_style(brush);
if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
const QGradient *g = brush.gradient();
+
if (g->coordinateMode() > QGradient::LogicalMode) {
- QPaintEngineEx::stroke(path, pen);
- return;
+ if (g->coordinateMode() == QGradient::StretchToDeviceMode) {
+ QTransform mat = brush.transform();
+ mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height());
+ brush.setTransform(mat);
+ copy.setBrush(brush);
+ real_engine->stroke(path, copy);
+ return;
+ } else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
+ QTransform mat = brush.transform();
+ QRealRect r = path.controlPointRect();
+ mat.translate(r.x1, r.y1);
+ mat.scale(r.x2 - r.x1, r.y2 - r.y1);
+ brush.setTransform(mat);
+ copy.setBrush(brush);
+ real_engine->stroke(path, copy);
+ return;
+ }
}
}
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 7a236fd506..6f5ee1f7a0 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -613,7 +613,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd)
subpixelType = Subpixel_None;
lcdFilterType = 0;
#if defined(FT_LCD_FILTER_H)
- lcdFilterType = (int) FT_LCD_FILTER_DEFAULT;
+ lcdFilterType = (int)((quintptr) FT_LCD_FILTER_DEFAULT);
#endif
defaultFormat = Format_None;
canUploadGlyphsToServer = false;
diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h
index d4552e355d..d1fd0dae78 100644
--- a/src/plugins/accessible/widgets/simplewidgets.h
+++ b/src/plugins/accessible/widgets/simplewidgets.h
@@ -115,6 +115,7 @@ public:
class QAccessibleLineEdit : public QAccessibleWidgetEx, public QAccessibleTextInterface,
public QAccessibleSimpleEditableTextInterface
{
+ Q_ACCESSIBLE_OBJECT
public:
explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString());
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 91a60e7804..989a37a9d4 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -275,7 +275,6 @@ private:
int lastLockedHeight;
IDirectFB *fb;
- DFBSurfaceDescription fbDescription;
int fbWidth;
int fbHeight;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 7297a997b5..c9b676ade4 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -271,7 +271,7 @@ void QDirectFBPixmapData::fill(const QColor &color)
forceRaster = false;
setSerialNumber(++global_ser_no);
if (!dfbSurface) {
- qWarning("QDirecttFBPixmapData::fill()");
+ qWarning("QDirectFBPixmapData::fill()");
invalidate();
return;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index f571d1b385..98e32edc0d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -205,6 +205,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size,
SurfaceCreationOptions options)
{
DFBSurfaceDescription desc;
+ memset(&desc, 0, sizeof(DFBSurfaceDescription));
desc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH|DSDESC_HEIGHT);
if (!QDirectFBScreen::initSurfaceDescriptionPixelFormat(&desc, format))
return 0;
@@ -213,7 +214,6 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size,
return createDFBSurface(desc, options);
}
-
IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options)
{
DFBResult result = DFB_OK;
@@ -247,6 +247,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc,
}
desc.caps = DFBSurfaceCapabilities(desc.caps & ~DSCAPS_VIDEOONLY);
}
+
if (d_ptr->directFBFlags & SystemOnly)
desc.caps = DFBSurfaceCapabilities(desc.caps | DSCAPS_SYSTEMONLY);
@@ -293,14 +294,14 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img,
IDirectFBSurface *dfbSurface = createDFBSurface(image.size(), pixmapFormat, options);
if (!dfbSurface) {
- qWarning("QDirectFBPixmapData::fromImage() Couldn't create surface");
+ qWarning("QDirectFBScreen::copyToDFBSurface() Couldn't create surface");
return 0;
}
#ifndef QT_NO_DIRECTFB_PREALLOCATED
IDirectFBSurface *imgSurface = createDFBSurface(image, DontTrackSurface);
if (!imgSurface) {
- qWarning("QDirectFBPixmapData::fromImage()");
+ qWarning("QDirectFBScreen::copyToDFBSurface()");
QDirectFBScreen::releaseDFBSurface(dfbSurface);
return 0;
}
@@ -315,7 +316,7 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img,
dfbSurface->SetBlittingFlags(dfbSurface, flags);
DFBResult result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0);
if (result != DFB_OK)
- DirectFBError("QDirectFBPixmapData::fromImage()", result);
+ DirectFBError("QDirectFBScreen::copyToDFBSurface()", result);
dfbSurface->ReleaseSource(dfbSurface);
imgSurface->Release(imgSurface);
#else // QT_NO_DIRECTFB_PREALLOCATED
@@ -445,6 +446,7 @@ QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface)
DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const QImage &image)
{
DFBSurfaceDescription description;
+ memset(&description, 0, sizeof(DFBSurfaceDescription));
const DFBSurfacePixelFormat format = getSurfacePixelFormat(image.format());
@@ -479,6 +481,7 @@ DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer,
int length)
{
DFBSurfaceDescription description;
+ memset(&description, 0, sizeof(DFBSurfaceDescription));
description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS
| DSDESC_WIDTH
@@ -917,6 +920,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN);
DFBSurfaceDescription description;
+ memset(&description, 0, sizeof(DFBSurfaceDescription));
+
description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS);
if (::setIntOption(displayArgs, QLatin1String("width"), &description.width))
description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH);
diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
index c7249d337d..32735138d2 100644
--- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
+++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
@@ -122,16 +122,10 @@ QSize QSvgIconEngine::actualSize(const QSize &size, QIcon::Mode mode,
return size;
}
- QSvgRenderer renderer;
- d->loadDataForModeAndState(&renderer, mode, state);
- if (renderer.isValid()) {
- QSize defaultSize = renderer.defaultSize();
- if (!defaultSize.isNull())
- defaultSize.scale(size, Qt::KeepAspectRatio);
- return defaultSize;
- } else {
+ QPixmap pm = pixmap(size, mode, state);
+ if (pm.isNull())
return QSize();
- }
+ return pm.size();
}
void QSvgIconEnginePrivate::loadDataForModeAndState(QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state)
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 1f54db74ba..fbefa0c9e1 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -163,18 +163,21 @@ static inline QVariant qDateTimeFromString(QString &val)
#endif
}
-class QMYSQLResultPrivate
+class QMYSQLResultPrivate : public QObject
{
+ Q_OBJECT
public:
- QMYSQLResultPrivate(QMYSQLDriverPrivate* dp) : d(dp), result(0),
+ QMYSQLResultPrivate(const QMYSQLDriver* dp) : driver(dp), result(0),
rowsAffected(0), hasBlobs(false)
#if MYSQL_VERSION_ID >= 40108
, stmt(0), meta(0), inBinds(0), outBinds(0)
#endif
, precisionPolicy(QSql::HighPrecision)
- {}
+ {
+ connect(dp, SIGNAL(destroyed()), this, SLOT(driverDestroyed()));
+ }
- QMYSQLDriverPrivate* d;
+ const QMYSQLDriver* driver;
MYSQL_RES *result;
MYSQL_ROW row;
@@ -207,6 +210,8 @@ public:
MYSQL_BIND *outBinds;
#endif
QSql::NumericalPrecisionPolicy precisionPolicy;
+private Q_SLOTS:
+ void driverDestroyed() { driver = NULL; }
};
#ifndef QT_NO_TEXTCODEC
@@ -379,7 +384,7 @@ bool QMYSQLResultPrivate::bindInValues()
QMYSQLResult::QMYSQLResult(const QMYSQLDriver* db)
: QSqlResult(db)
{
- d = new QMYSQLResultPrivate(db->d);
+ d = new QMYSQLResultPrivate(db);
}
QMYSQLResult::~QMYSQLResult()
@@ -391,7 +396,7 @@ QMYSQLResult::~QMYSQLResult()
QVariant QMYSQLResult::handle() const
{
#if MYSQL_VERSION_ID >= 40108
- if(d->d->preparedQuerys)
+ if(d->driver && d->driver->d->preparedQuerys)
return d->meta ? qVariantFromValue(d->meta) : qVariantFromValue(d->stmt);
else
#endif
@@ -406,8 +411,8 @@ void QMYSQLResult::cleanup()
// must iterate trough leftover result sets from multi-selects or stored procedures
// if this isn't done subsequent queries will fail with "Commands out of sync"
#if MYSQL_VERSION_ID >= 40100
- while (d->d->mysql && mysql_next_result(d->d->mysql) == 0) {
- MYSQL_RES *res = mysql_store_result(d->d->mysql);
+ while (d->driver && d->driver->d->mysql && mysql_next_result(d->driver->d->mysql) == 0) {
+ MYSQL_RES *res = mysql_store_result(d->driver->d->mysql);
if (res)
mysql_free_result(res);
}
@@ -447,11 +452,14 @@ void QMYSQLResult::cleanup()
setAt(-1);
setActive(false);
- d->d->preparedQuerys = d->d->preparedQuerysEnabled;
+ if(d->driver)
+ d->driver->d->preparedQuerys = d->driver->d->preparedQuerysEnabled;
}
bool QMYSQLResult::fetch(int i)
{
+ if(!d->driver)
+ return false;
if (isForwardOnly()) { // fake a forward seek
if (at() < i) {
int x = i - at();
@@ -463,7 +471,7 @@ bool QMYSQLResult::fetch(int i)
}
if (at() == i)
return true;
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
#if MYSQL_VERSION_ID >= 40108
mysql_stmt_data_seek(d->stmt, i);
@@ -494,7 +502,9 @@ bool QMYSQLResult::fetch(int i)
bool QMYSQLResult::fetchNext()
{
- if (d->d->preparedQuerys) {
+ if(!d->driver)
+ return false;
+ if (d->driver->d->preparedQuerys) {
#if MYSQL_VERSION_ID >= 40108
if (mysql_stmt_fetch(d->stmt))
return false;
@@ -512,6 +522,8 @@ bool QMYSQLResult::fetchNext()
bool QMYSQLResult::fetchLast()
{
+ if(!d->driver)
+ return false;
if (isForwardOnly()) { // fake this since MySQL can't seek on forward only queries
bool success = fetchNext(); // did we move at all?
while (fetchNext()) {};
@@ -519,7 +531,7 @@ bool QMYSQLResult::fetchLast()
}
my_ulonglong numRows;
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
#if MYSQL_VERSION_ID >= 40108
numRows = mysql_stmt_num_rows(d->stmt);
#else
@@ -553,15 +565,18 @@ QVariant QMYSQLResult::data(int field)
return QVariant();
}
+ if (!d->driver)
+ return QVariant();
+
int fieldLength = 0;
const QMYSQLResultPrivate::QMyField &f = d->fields.at(field);
QString val;
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
if (f.nullIndicator)
return QVariant(f.type);
if (f.type != QVariant::ByteArray)
- val = toUnicode(d->d->tc, f.outField, f.bufLength);
+ val = toUnicode(d->driver->d->tc, f.outField, f.bufLength);
} else {
if (d->row[field] == NULL) {
// NULL value
@@ -569,7 +584,7 @@ QVariant QMYSQLResult::data(int field)
}
fieldLength = mysql_fetch_lengths(d->result)[field];
if (f.type != QVariant::ByteArray)
- val = toUnicode(d->d->tc, d->row[field], fieldLength);
+ val = toUnicode(d->driver->d->tc, d->row[field], fieldLength);
}
switch(f.type) {
@@ -614,7 +629,7 @@ QVariant QMYSQLResult::data(int field)
case QVariant::ByteArray: {
QByteArray ba;
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
ba = QByteArray(f.outField, f.bufLength);
} else {
ba = QByteArray(d->row[field], fieldLength);
@@ -631,7 +646,7 @@ QVariant QMYSQLResult::data(int field)
bool QMYSQLResult::isNull(int field)
{
- if (d->d->preparedQuerys)
+ if (d->driver->d->preparedQuerys)
return d->fields.at(field).nullIndicator;
else
return d->row[field] == NULL;
@@ -639,31 +654,31 @@ bool QMYSQLResult::isNull(int field)
bool QMYSQLResult::reset (const QString& query)
{
- if (!driver() || !driver()->isOpen() || driver()->isOpenError())
+ if (!driver() || !driver()->isOpen() || driver()->isOpenError() || !d->driver)
return false;
- if(d->d->preparedQuerysEnabled && prepare(query)) {
- d->d->preparedQuerys = true;
+ if(d->driver->d->preparedQuerysEnabled && prepare(query)) {
+ d->driver->d->preparedQuerys = true;
return exec();
}
- d->d->preparedQuerys = false;
+ d->driver->d->preparedQuerys = false;
- const QByteArray encQuery(fromUnicode(d->d->tc, query));
- if (mysql_real_query(d->d->mysql, encQuery.data(), encQuery.length())) {
+ const QByteArray encQuery(fromUnicode(d->driver->d->tc, query));
+ if (mysql_real_query(d->driver->d->mysql, encQuery.data(), encQuery.length())) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to execute query"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
}
- d->result = mysql_store_result(d->d->mysql);
- if (!d->result && mysql_field_count(d->d->mysql) > 0) {
+ d->result = mysql_store_result(d->driver->d->mysql);
+ if (!d->result && mysql_field_count(d->driver->d->mysql) > 0) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to store result"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
}
- int numFields = mysql_field_count(d->d->mysql);
+ int numFields = mysql_field_count(d->driver->d->mysql);
setSelect(numFields != 0);
d->fields.resize(numFields);
- d->rowsAffected = mysql_affected_rows(d->d->mysql);
+ d->rowsAffected = mysql_affected_rows(d->driver->d->mysql);
if (isSelect()) {
for(int i = 0; i < numFields; i++) {
MYSQL_FIELD* field = mysql_fetch_field_direct(d->result, i);
@@ -677,8 +692,8 @@ bool QMYSQLResult::reset (const QString& query)
int QMYSQLResult::size()
{
- if (isSelect())
- if (d->d->preparedQuerys)
+ if (d->driver && isSelect())
+ if (d->driver->d->preparedQuerys)
#if MYSQL_VERSION_ID >= 40108
return mysql_stmt_num_rows(d->stmt);
#else
@@ -697,17 +712,17 @@ int QMYSQLResult::numRowsAffected()
QVariant QMYSQLResult::lastInsertId() const
{
- if (!isActive())
+ if (!isActive() || !d->driver)
return QVariant();
- if (d->d->preparedQuerys) {
+ if (d->driver->d->preparedQuerys) {
#if MYSQL_VERSION_ID >= 40108
quint64 id = mysql_stmt_insert_id(d->stmt);
if (id)
return QVariant(id);
#endif
} else {
- quint64 id = mysql_insert_id(d->d->mysql);
+ quint64 id = mysql_insert_id(d->driver->d->mysql);
if (id)
return QVariant(id);
}
@@ -718,20 +733,20 @@ QSqlRecord QMYSQLResult::record() const
{
QSqlRecord info;
MYSQL_RES *res;
- if (!isActive() || !isSelect())
+ if (!isActive() || !isSelect() || !d->driver)
return info;
#if MYSQL_VERSION_ID >= 40108
- res = d->d->preparedQuerys ? d->meta : d->result;
+ res = d->driver->d->preparedQuerys ? d->meta : d->result;
#else
res = d->result;
#endif
- if (!mysql_errno(d->d->mysql)) {
+ if (!mysql_errno(d->driver->d->mysql)) {
mysql_field_seek(res, 0);
MYSQL_FIELD* field = mysql_fetch_field(res);
while(field) {
- info.append(qToField(field, d->d->tc));
+ info.append(qToField(field, d->driver->d->tc));
field = mysql_fetch_field(res);
}
}
@@ -741,6 +756,8 @@ QSqlRecord QMYSQLResult::record() const
bool QMYSQLResult::nextResult()
{
+ if(!d->driver)
+ return false;
#if MYSQL_VERSION_ID >= 40100
setAt(-1);
setActive(false);
@@ -754,26 +771,26 @@ bool QMYSQLResult::nextResult()
delete[] d->fields[i].outField;
d->fields.clear();
- int status = mysql_next_result(d->d->mysql);
+ int status = mysql_next_result(d->driver->d->mysql);
if (status > 0) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to execute next query"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
} else if (status == -1) {
return false; // No more result sets
}
- d->result = mysql_store_result(d->d->mysql);
- int numFields = mysql_field_count(d->d->mysql);
+ d->result = mysql_store_result(d->driver->d->mysql);
+ int numFields = mysql_field_count(d->driver->d->mysql);
if (!d->result && numFields > 0) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to store next result"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
}
setSelect(numFields > 0);
d->fields.resize(numFields);
- d->rowsAffected = mysql_affected_rows(d->d->mysql);
+ d->rowsAffected = mysql_affected_rows(d->driver->d->mysql);
if (isSelect()) {
for (int i = 0; i < numFields; i++) {
@@ -833,9 +850,11 @@ static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type)
bool QMYSQLResult::prepare(const QString& query)
{
+ if(!d->driver)
+ return false;
#if MYSQL_VERSION_ID >= 40108
cleanup();
- if (!d->d->preparedQuerys)
+ if (!d->driver->d->preparedQuerys)
return QSqlResult::prepare(query);
int r;
@@ -844,14 +863,14 @@ bool QMYSQLResult::prepare(const QString& query)
return false;
if (!d->stmt)
- d->stmt = mysql_stmt_init(d->d->mysql);
+ d->stmt = mysql_stmt_init(d->driver->d->mysql);
if (!d->stmt) {
setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to prepare statement"),
- QSqlError::StatementError, d->d));
+ QSqlError::StatementError, d->driver->d));
return false;
}
- const QByteArray encQuery(fromUnicode(d->d->tc, query));
+ const QByteArray encQuery(fromUnicode(d->driver->d->tc, query));
r = mysql_stmt_prepare(d->stmt, encQuery.constData(), encQuery.length());
if (r != 0) {
setLastError(qMakeStmtError(QCoreApplication::translate("QMYSQLResult",
@@ -873,7 +892,9 @@ bool QMYSQLResult::prepare(const QString& query)
bool QMYSQLResult::exec()
{
- if (!d->d->preparedQuerys)
+ if (!d->driver)
+ return false;
+ if (!d->driver->d->preparedQuerys)
return QSqlResult::exec();
if (!d->stmt)
return false;
@@ -963,7 +984,7 @@ bool QMYSQLResult::exec()
break;
case QVariant::String:
default: {
- QByteArray ba = fromUnicode(d->d->tc, val.toString());
+ QByteArray ba = fromUnicode(d->driver->d->tc, val.toString());
stringVector.append(ba);
currBind->buffer_type = MYSQL_TYPE_STRING;
currBind->buffer = const_cast<char *>(ba.constData());
@@ -1459,3 +1480,5 @@ bool QMYSQLDriver::isIdentifierEscapedImplementation(const QString &identifier,
}
QT_END_NAMESPACE
+
+#include "qsql_mysql.moc" \ No newline at end of file