From a135c28b99000b15e9f2ac94c218fcd06b17dfef Mon Sep 17 00:00:00 2001 From: rankun Date: Wed, 18 Sep 2019 13:07:37 +0800 Subject: [PATCH] fix: char to int error --- QtScrcpy/util/bufferutil.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/QtScrcpy/util/bufferutil.cpp b/QtScrcpy/util/bufferutil.cpp index 65f62d2..0c9362e 100644 --- a/QtScrcpy/util/bufferutil.cpp +++ b/QtScrcpy/util/bufferutil.cpp @@ -16,11 +16,11 @@ void BufferUtil::write16(QBuffer &buffer, quint32 value) quint16 BufferUtil::read16(QBuffer &buffer) { - char c; + uchar c; quint16 ret = 0; - buffer.getChar(&c); + buffer.getChar(reinterpret_cast(&c)); ret |= (c << 8); - buffer.getChar(&c); + buffer.getChar(reinterpret_cast(&c)); ret |= c; return ret; @@ -28,15 +28,15 @@ quint16 BufferUtil::read16(QBuffer &buffer) quint32 BufferUtil::read32(QBuffer &buffer) { - char c; + uchar c; quint32 ret = 0; - buffer.getChar(&c); + buffer.getChar(reinterpret_cast(&c)); ret |= (c << 24); - buffer.getChar(&c); + buffer.getChar(reinterpret_cast(&c)); ret |= (c << 16); - buffer.getChar(&c); + buffer.getChar(reinterpret_cast(&c)); ret |= (c << 8); - buffer.getChar(&c); + buffer.getChar(reinterpret_cast(&c)); ret |= c; return ret;