From eff067e5b811f5b3d680f19c82f59e7b8c45aed3 Mon Sep 17 00:00:00 2001 From: rankun Date: Sun, 19 Jan 2020 13:43:33 +0800 Subject: [PATCH] feat: change assert to Q_ASSERT --- QtScrcpy/device/controller/inputconvert/controlmsg.cpp | 2 +- QtScrcpy/device/recorder/recorder.cpp | 2 +- QtScrcpy/device/stream/stream.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/QtScrcpy/device/controller/inputconvert/controlmsg.cpp b/QtScrcpy/device/controller/inputconvert/controlmsg.cpp index 5b6dd9c..48973b9 100644 --- a/QtScrcpy/device/controller/inputconvert/controlmsg.cpp +++ b/QtScrcpy/device/controller/inputconvert/controlmsg.cpp @@ -88,7 +88,7 @@ void ControlMsg::writePosition(QBuffer &buffer, const QRect& value) quint16 ControlMsg::toFixedPoint16(float f) { - assert(f >= 0.0f && f <= 1.0f); + Q_ASSERT(f >= 0.0f && f <= 1.0f); quint32 u = f * 0x1p16f; // 2^16 if (u >= 0xffff) { u = 0xffff; diff --git a/QtScrcpy/device/recorder/recorder.cpp b/QtScrcpy/device/recorder/recorder.cpp index 5e16317..b01d1cb 100644 --- a/QtScrcpy/device/recorder/recorder.cpp +++ b/QtScrcpy/device/recorder/recorder.cpp @@ -315,7 +315,7 @@ void Recorder::stopRecorder() { bool Recorder::push(const AVPacket *packet) { QMutexLocker locker(&m_mutex); - assert(!m_stopped); + Q_ASSERT(!m_stopped); if (m_failed) { // reject any new packet (this will stop the stream) diff --git a/QtScrcpy/device/stream/stream.cpp b/QtScrcpy/device/stream/stream.cpp index 7f9cb62..3cb148f 100644 --- a/QtScrcpy/device/stream/stream.cpp +++ b/QtScrcpy/device/stream/stream.cpp @@ -233,8 +233,8 @@ bool Stream::recvPacket(AVPacket *packet) quint64 pts = bufferRead64be(header); quint32 len = bufferRead32be(&header[8]); - assert(pts == NO_PTS || (pts & 0x8000000000000000) == 0); - assert(len); + Q_ASSERT(pts == NO_PTS || (pts & 0x8000000000000000) == 0); + Q_ASSERT(len); if (av_new_packet(packet, len)) { qCritical("Could not allocate packet"); @@ -329,9 +329,9 @@ bool Stream::parse(AVPacket *packet) AV_NOPTS_VALUE, AV_NOPTS_VALUE, -1); // PARSER_FLAG_COMPLETE_FRAMES is set - assert(r == inLen); + Q_ASSERT(r == inLen); (void) r; - assert(outLen == inLen); + Q_ASSERT(outLen == inLen); if (m_parser->key_frame == 1) { packet->flags |= AV_PKT_FLAG_KEY;