Remove dubious functions
authorKurt Pattyn <pattyn.kurt@gmail.com>
Sat, 18 Jan 2014 15:21:39 +0000 (16:21 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 20 Jan 2014 18:17:49 +0000 (19:17 +0100)
Change-Id: Ida5c46e3e42685f5e78f2aee657d12af62286810
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
src/websockets/qwebsocket.cpp
src/websockets/qwebsocket.h
src/websockets/qwebsocket_p.cpp
src/websockets/qwebsocket_p.h
tests/manual/websockets/tst_websockets.cpp

index cccaa8c..ada9799 100644 (file)
@@ -328,39 +328,6 @@ bool QWebSocket::flush()
 }
 
 /*!
-    Sends the given \a message over the socket as a text message and returns the number of bytes
-    actually sent.
-    \a message must be '\\0' terminated and is considered to be in UTF-8 encoded format.
-
-    \note When \a message is null or has zero length, zero is returned.
-    \note The maximum size of message, is limited by \l {QString::}{size_type}.
-
-    \sa QString::fromUtf8(), QString::size_type
- */
-qint64 QWebSocket::write(const char *message)
-{
-    Q_D(QWebSocket);
-    return d->write(message);
-}
-
-/*!
-    Sends the most \a maxSize bytes of the given \a message over the socket as a text message
-    and returns the number of bytes actually sent.
-    \a message is considered to be in UTF-8 encoded format.
-
-    \note When \a message is null, has zero length or \a maxSize < 0, zero is returned.
-    \note The maximum size of message, is limited by \l {QString::}{size_type}.
-    If the message is larger, it is truncated to the maximum value of \l {QString::}{size_type}.
-
-    \sa QString::fromUtf8(), QString::size_type
- */
-qint64 QWebSocket::write(const char *message, qint64 maxSize)
-{
-    Q_D(QWebSocket);
-    return d->write(message, maxSize);
-}
-
-/*!
     \brief Sends the given \a message over the socket as a text message and
     returns the number of bytes actually sent.
  */
index 4fba278..18f8994 100644 (file)
@@ -104,8 +104,6 @@ public:
     QWebSocketProtocol::CloseCode closeCode() const;
     QString closeReason() const;
 
-    qint64 write(const char *message) Q_REQUIRED_RESULT;
-    qint64 write(const char *message, qint64 maxSize) Q_REQUIRED_RESULT;
     qint64 write(const QString &message) Q_REQUIRED_RESULT;
     qint64 write(const QByteArray &data) Q_REQUIRED_RESULT;
 
index d94b175..bd4d1c1 100644 (file)
@@ -210,29 +210,6 @@ bool QWebSocketPrivate::flush()
 /*!
     \internal
  */
-qint64 QWebSocketPrivate::write(const char *message)
-{
-    if (!message || !*message)
-        return qint64(0);
-    uint size = qstrlen(message);
-    qint64 maxSize = qMin(qint64(size), qint64(std::numeric_limits<QString::size_type>::max()));
-    return doWriteFrames(QString::fromUtf8(message, maxSize).toUtf8(), false);
-}
-
-/*!
-    \internal
- */
-qint64 QWebSocketPrivate::write(const char *message, qint64 maxSize)
-{
-    if (!message || (maxSize <= qint64(0)) || !*message)
-        return qint64(0);
-    maxSize = qMin(maxSize, qint64(std::numeric_limits<QString::size_type>::max()));
-    return doWriteFrames(QString::fromUtf8(message, maxSize).toUtf8(), false);
-}
-
-/*!
-    \internal
- */
 qint64 QWebSocketPrivate::write(const QString &message)
 {
     return doWriteFrames(message.toUtf8(), false);
index 8f5d054..611c817 100644 (file)
@@ -140,8 +140,6 @@ public:
     QWebSocketProtocol::CloseCode closeCode() const;
     QString closeReason() const;
 
-    qint64 write(const char *message) Q_REQUIRED_RESULT;
-    qint64 write(const char *message, qint64 maxSize) Q_REQUIRED_RESULT;
     qint64 write(const QString &message) Q_REQUIRED_RESULT;
     qint64 write(const QByteArray &data) Q_REQUIRED_RESULT;    //send data as binary
 
index e0fbc09..978520d 100644 (file)
@@ -134,8 +134,7 @@ void tst_WebSocketsTest::testTextMessage()
 
     QSignalSpy spy(m_pWebSocket, SIGNAL(textMessageReceived(QString)));
 
-    QCOMPARE(m_pWebSocket->write(message), qint64(message.size()));
-
+    QCOMPARE(m_pWebSocket->write(message), qint64(message.length()));
     QTRY_VERIFY_WITH_TIMEOUT(spy.count() != 0, 1000);
     QCOMPARE(spy.count(), 1);
     QCOMPARE(spy.at(0).count(), 1);