aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@qt.io>2021-12-22 09:34:35 +0100
committerFawzi Mohamed <fawzi.mohamed@qt.io>2021-12-23 23:31:11 +0100
commitc1c6ecb677546b9ab8c8014c21204ff2ade3041d (patch)
tree6f1586e1959c4f928b38ad6a01801cbd53864260 /tests
parent547bb50eb345bd230d56aeba04239556742a453b (diff)
qmlls qiopipe: avoid non needed casts
QByteArray uses qsizetype, so some of the limitations for qiopipe are not relevant anymore. Still keep a max size of std::numeric_limits<int>::max(), because if we exceed it something has gone seriously wrong, and this is just or testing. Change-Id: If3f15714fdbad94a521cea72167cb4a3054cfb11 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 6e516d89864703849cdd3deba4e8af6b8753a8cf)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmlls/qlanguageserver/qiopipe.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/qmlls/qlanguageserver/qiopipe.cpp b/tests/auto/qmlls/qlanguageserver/qiopipe.cpp
index de6d37a02f..a4f9b1bb5d 100644
--- a/tests/auto/qmlls/qlanguageserver/qiopipe.cpp
+++ b/tests/auto/qmlls/qlanguageserver/qiopipe.cpp
@@ -138,9 +138,8 @@ qint64 QPipeEndPoint::readData(char *data, qint64 maxlen)
return 0;
Q_ASSERT(maxlen > 0);
- Q_ASSERT(maxlen <= std::numeric_limits<int>::max());
memcpy(data, m_buffer.data(), static_cast<size_t>(maxlen));
- m_buffer = m_buffer.mid(static_cast<int>(maxlen));
+ m_buffer = m_buffer.mid(maxlen);
return maxlen;
}
@@ -164,7 +163,7 @@ qint64 QPipeEndPoint::writeData(const char *data, qint64 len)
Q_ASSERT(prevLen + len > 0);
Q_ASSERT(prevLen + len <= std::numeric_limits<int>::max());
- buffer.resize(static_cast<int>(prevLen + len));
+ buffer.resize(prevLen + len);
memcpy(buffer.data() + prevLen, data, static_cast<size_t>(len));
emit bytesWritten(len);
emit m_remoteEndPoint->readyRead();