summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-21 09:16:58 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-21 09:16:58 (GMT)
commitb000d828d20793b2aad0e9d1449adaf1331c0b01 (patch)
tree3df4cd34721a7db0e5f8b0c45c17b52f41e5d6fc /src/corelib
parent2fdac06f820f2362d3ca83ab6d73ed874d903098 (diff)
parent76f64bfa979e291a8350fd87ceda4307d5a48d71 (diff)
downloadQt-b000d828d20793b2aad0e9d1449adaf1331c0b01.zip
Qt-b000d828d20793b2aad0e9d1449adaf1331c0b01.tar.gz
Qt-b000d828d20793b2aad0e9d1449adaf1331c0b01.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Allow GNU Free Documentation license header. Add missing license header. Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to ab9a897b688e991a8405cf938dea9d6a2f1ac072 Fix example compile and runtime warnings, webkit examples not built. qgl_cl_p.h is no longer existent Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to 5699175f55acbdfa4ac95ab6c727ebd4a201f3a2 Doc: Fixed documentation errors. doc: Added more DITA output to the XML generator doc: Fixed type of Package::name Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to 508b02a252b524d34f3ed970eef3bdb6350a2b77 Fix for emitting changed signal in QClipboard Fixed tst_QNetworkDiskCache creating badly named directories. Specialize peek() for QBuffer Documentation changes to QTextLayout. Doc: Updated example license to three clause BSD license.
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qnamespace.qdoc4
-rw-r--r--src/corelib/io/qbuffer.cpp18
-rw-r--r--src/corelib/io/qiodevice.cpp49
-rw-r--r--src/corelib/io/qiodevice_p.h4
-rw-r--r--src/corelib/tools/qdatetime.cpp4
5 files changed, 56 insertions, 23 deletions
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index abbc03e..4faedc9 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1743,7 +1743,7 @@
\value Key_MediaLast
\value Key_unknown
- \value Key_Call A key to answer or initiate a call (\see Key_ToggleCallHangup for a key to toggle current call state)
+ \value Key_Call A key to answer or initiate a call (see \l Key_ToggleCallHangup for a key to toggle current call state)
\value Key_Camera A key to activate the camera shutter
\value Key_CameraFocus A key to focus the camera
\value Key_Context1
@@ -1751,7 +1751,7 @@
\value Key_Context3
\value Key_Context4
\value Key_Flip
- \value Key_Hangup A key to end an ongoing call (\see Key_ToggleCallHangup for a key to toggle current call state)
+ \value Key_Hangup A key to end an ongoing call (see \l Key_ToggleCallHangup for a key to toggle current call state)
\value Key_No
\value Key_Select
\value Key_Yes
diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp
index c1ff353..73c71ea 100644
--- a/src/corelib/io/qbuffer.cpp
+++ b/src/corelib/io/qbuffer.cpp
@@ -62,6 +62,9 @@ public:
QByteArray defaultBuf;
int ioIndex;
+ virtual qint64 peek(char *data, qint64 maxSize);
+ virtual QByteArray peek(qint64 maxSize);
+
#ifndef QT_NO_QOBJECT
// private slots
void _q_emitSignals();
@@ -83,6 +86,21 @@ void QBufferPrivate::_q_emitSignals()
}
#endif
+qint64 QBufferPrivate::peek(char *data, qint64 maxSize)
+{
+ qint64 readBytes = qMin(maxSize, static_cast<qint64>(buf->size()) - pos);
+ memcpy(data, buf->constData() + pos, readBytes);
+ return readBytes;
+}
+
+QByteArray QBufferPrivate::peek(qint64 maxSize)
+{
+ qint64 readBytes = qMin(maxSize, static_cast<qint64>(buf->size()) - pos);
+ if (pos == 0 && maxSize >= buf->size())
+ return *buf;
+ return QByteArray(buf->constData() + pos, readBytes);
+}
+
/*!
\class QBuffer
\reentrant
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index d2e4f75..ea60792 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1442,6 +1442,35 @@ bool QIODevicePrivate::putCharHelper(char c)
return q_func()->write(&c, 1) == 1;
}
+/*!
+ \internal
+*/
+qint64 QIODevicePrivate::peek(char *data, qint64 maxSize)
+{
+ qint64 readBytes = q_func()->read(data, maxSize);
+ if (readBytes <= 0)
+ return readBytes;
+
+ buffer.ungetBlock(data, readBytes);
+ pos -= readBytes;
+ return readBytes;
+}
+
+/*!
+ \internal
+*/
+QByteArray QIODevicePrivate::peek(qint64 maxSize)
+{
+ QByteArray result = q_func()->read(maxSize);
+
+ if (result.isEmpty())
+ return result;
+
+ buffer.ungetBlock(result.constData(), result.size());
+ pos -= result.size();
+ return result;
+}
+
/*! \fn bool QIODevice::getChar(char *c)
Reads one character from the device and stores it in \a c. If \a c
@@ -1476,14 +1505,7 @@ bool QIODevice::getChar(char *c)
*/
qint64 QIODevice::peek(char *data, qint64 maxSize)
{
- Q_D(QIODevice);
- qint64 readBytes = read(data, maxSize);
- if (readBytes <= 0)
- return readBytes;
-
- d->buffer.ungetBlock(data, readBytes);
- d->pos -= readBytes;
- return readBytes;
+ return d_func()->peek(data, maxSize);
}
/*!
@@ -1505,16 +1527,7 @@ qint64 QIODevice::peek(char *data, qint64 maxSize)
*/
QByteArray QIODevice::peek(qint64 maxSize)
{
- Q_D(QIODevice);
- QByteArray result = read(maxSize);
-
- if (result.isEmpty())
- return result;
-
- d->buffer.ungetBlock(result.constData(), result.size());
- d->pos -= result.size();
-
- return result;
+ return d_func()->peek(maxSize);
}
/*!
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index 225a0b9..4a25562 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -231,7 +231,9 @@ public:
accessMode = q_func()->isSequential() ? Sequential : RandomAccess;
return accessMode == Sequential;
}
-
+
+ virtual qint64 peek(char *data, qint64 maxSize);
+ virtual QByteArray peek(qint64 maxSize);
#ifdef QT_NO_QOBJECT
QIODevice *q_ptr;
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 14b4a26..ae8aad6 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2385,7 +2385,7 @@ uint QDateTime::toTime_t() const
/*!
\since 4.7
- Sets the date and time given the number of \a mulliseconds that have
+ Sets the date and time given the number of milliseconds,\a msecs, that have
passed since 1970-01-01T00:00:00.000, Coordinated Universal Time
(Qt::UTC). On systems that do not support time zones this function
will behave as if local time were Qt::UTC.
@@ -3188,7 +3188,7 @@ QDateTime QDateTime::fromTime_t(uint seconds)
/*!
\since 4.7
- Returns a datetime whose date and time are the number of milliseconds \a msec
+ Returns a datetime whose date and time are the number of milliseconds, \a msecs,
that have passed since 1970-01-01T00:00:00.000, Coordinated Universal
Time (Qt::UTC). On systems that do not support time zones, the time
will be set as if local time were Qt::UTC.