diff options
author | Guoqing Zhang <guoqing.zhang@nokia.com> | 2011-03-09 13:24:25 (GMT) |
---|---|---|
committer | Guoqing Zhang <guoqing.zhang@nokia.com> | 2011-03-09 13:24:25 (GMT) |
commit | 56ad75da12ec6a4d7b65ce4e1a246ee48fda9736 (patch) | |
tree | 0968cc5085b16ce4655abf5dfdbc8e33a2240114 /src/corelib/io | |
parent | c8aad7b59ede3e1c1655059ee9db2436c627aae2 (diff) | |
parent | 5ddf54654044df30bf4febada6cbdc46fcdbde62 (diff) | |
download | Qt-56ad75da12ec6a4d7b65ce4e1a246ee48fda9736.zip Qt-56ad75da12ec6a4d7b65ce4e1a246ee48fda9736.tar.gz Qt-56ad75da12ec6a4d7b65ce4e1a246ee48fda9736.tar.bz2 |
Merge remote branch 'qt-master/master'
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/io.pri | 4 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 8 | ||||
-rw-r--r-- | src/corelib/io/qnoncontiguousbytedevice.cpp | 14 | ||||
-rw-r--r-- | src/corelib/io/qnoncontiguousbytedevice_p.h | 10 | ||||
-rw-r--r-- | src/corelib/io/qresource.cpp | 2 |
5 files changed, 28 insertions, 10 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 4d4ae21..2b61192 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -113,3 +113,7 @@ win32 { LIBS += -lplatformenv } } +integrity { + SOURCES += io/qfsfileengine_unix.cpp \ + io/qfsfileengine_iterator_unix.cpp +} diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 62e7c9f..6c03b32 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1029,7 +1029,11 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla if (openMode & QIODevice::ReadOnly) access |= PROT_READ; if (openMode & QIODevice::WriteOnly) access |= PROT_WRITE; +#if defined(Q_OS_INTEGRITY) + int pageSize = sysconf(_SC_PAGESIZE); +#else int pageSize = getpagesize(); +#endif int extra = offset % pageSize; if (quint64(size + extra) > quint64((size_t)-1)) { @@ -1079,6 +1083,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla bool QFSFileEnginePrivate::unmap(uchar *ptr) { +#if !defined(Q_OS_INTEGRITY) Q_Q(QFSFileEngine); if (!maps.contains(ptr)) { q->setError(QFile::PermissionsError, qt_error_string(EACCES)); @@ -1093,6 +1098,9 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr) } maps.remove(ptr); return true; +#else + return false; +#endif } QT_END_NAMESPACE diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp index 235f671..71cf92d 100644 --- a/src/corelib/io/qnoncontiguousbytedevice.cpp +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -153,6 +153,7 @@ void QNonContiguousByteDevice::disableReset() resetDisabled = true; } +// FIXME we should scrap this whole implementation and instead change the ByteArrayImpl to be able to cope with sub-arrays? QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(QBuffer *b) : QNonContiguousByteDevice() { buffer = b; @@ -244,7 +245,7 @@ qint64 QNonContiguousByteDeviceByteArrayImpl::size() return byteArray->size(); } -QNonContiguousByteDeviceRingBufferImpl::QNonContiguousByteDeviceRingBufferImpl(QRingBuffer *rb) +QNonContiguousByteDeviceRingBufferImpl::QNonContiguousByteDeviceRingBufferImpl(QSharedPointer<QRingBuffer> rb) : QNonContiguousByteDevice(), currentPosition(0) { ringBuffer = rb; @@ -355,6 +356,11 @@ bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount) // normal advancement currentReadBufferPosition += amount; + if (size() == -1) + emit readProgress(totalAdvancements, totalAdvancements); + else + emit readProgress(totalAdvancements, size()); + // advancing over that what has actually been read before if (currentReadBufferPosition > currentReadBufferAmount) { qint64 i = currentReadBufferPosition - currentReadBufferAmount; @@ -370,10 +376,6 @@ bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount) currentReadBufferAmount = 0; } - if (size() == -1) - emit readProgress(totalAdvancements, totalAdvancements); - else - emit readProgress(totalAdvancements, size()); return true; } @@ -505,7 +507,7 @@ QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QIODevice *dev \internal */ -QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QRingBuffer *ringBuffer) +QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QSharedPointer<QRingBuffer> ringBuffer) { return new QNonContiguousByteDeviceRingBufferImpl(ringBuffer); } diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h index ff946ed..5e0b1bb 100644 --- a/src/corelib/io/qnoncontiguousbytedevice_p.h +++ b/src/corelib/io/qnoncontiguousbytedevice_p.h @@ -57,6 +57,7 @@ #include <QtCore/qbytearray.h> #include <QtCore/qbuffer.h> #include <QtCore/qiodevice.h> +#include <QtCore/QSharedPointer> #include "private/qringbuffer_p.h" QT_BEGIN_NAMESPACE @@ -70,6 +71,7 @@ public: virtual bool atEnd() = 0; virtual bool reset() = 0; void disableReset(); + bool isResetDisabled() { return resetDisabled; } virtual qint64 size() = 0; virtual ~QNonContiguousByteDevice(); @@ -89,7 +91,7 @@ class Q_CORE_EXPORT QNonContiguousByteDeviceFactory public: static QNonContiguousByteDevice* create(QIODevice *device); static QNonContiguousByteDevice* create(QByteArray *byteArray); - static QNonContiguousByteDevice* create(QRingBuffer *ringBuffer); + static QNonContiguousByteDevice* create(QSharedPointer<QRingBuffer> ringBuffer); static QIODevice* wrap(QNonContiguousByteDevice* byteDevice); }; @@ -114,7 +116,7 @@ protected: class QNonContiguousByteDeviceRingBufferImpl : public QNonContiguousByteDevice { public: - QNonContiguousByteDeviceRingBufferImpl(QRingBuffer *rb); + QNonContiguousByteDeviceRingBufferImpl(QSharedPointer<QRingBuffer> rb); ~QNonContiguousByteDeviceRingBufferImpl(); const char* readPointer(qint64 maximumLength, qint64 &len); bool advanceReadPointer(qint64 amount); @@ -122,13 +124,14 @@ public: bool reset(); qint64 size(); protected: - QRingBuffer* ringBuffer; + QSharedPointer<QRingBuffer> ringBuffer; qint64 currentPosition; }; class QNonContiguousByteDeviceIoDeviceImpl : public QNonContiguousByteDevice { + Q_OBJECT public: QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d); ~QNonContiguousByteDeviceIoDeviceImpl(); @@ -150,6 +153,7 @@ protected: class QNonContiguousByteDeviceBufferImpl : public QNonContiguousByteDevice { + Q_OBJECT public: QNonContiguousByteDeviceBufferImpl(QBuffer *b); ~QNonContiguousByteDeviceBufferImpl(); diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 2a9d8ee..0435256 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -928,7 +928,7 @@ public: } }; -#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && ! defined (Q_OS_NACL) +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined (Q_OS_NACL) && !defined(Q_OS_INTEGRITY) #define QT_USE_MMAP #endif |