]> source.dussan.org Git - tigervnc.git/commitdiff
Consistently use uint8_t for data buffers
authorPierre Ossman <ossman@cendio.se>
Thu, 2 Mar 2023 13:33:50 +0000 (14:33 +0100)
committerPierre Ossman <ossman@cendio.se>
Sat, 18 Mar 2023 12:30:34 +0000 (13:30 +0100)
These will always be byte streams at heart, so let's try to keep them
with a proper type. Should make it clearer how they will be used.

52 files changed:
common/rdr/FdInStream.cxx
common/rdr/FdInStream.h
common/rdr/FdOutStream.cxx
common/rdr/FdOutStream.h
common/rdr/InStream.h
common/rdr/MemInStream.h
common/rdr/MemOutStream.h
common/rdr/OutStream.h
common/rdr/TLSInStream.cxx
common/rdr/TLSOutStream.cxx
common/rfb/CConnection.cxx
common/rfb/CConnection.h
common/rfb/CMsgHandler.cxx
common/rfb/CMsgHandler.h
common/rfb/CMsgReader.cxx
common/rfb/CMsgWriter.cxx
common/rfb/CMsgWriter.h
common/rfb/CSecurityDH.cxx
common/rfb/CSecurityPlain.cxx
common/rfb/CSecurityRSAAES.cxx
common/rfb/CopyRectDecoder.cxx
common/rfb/CopyRectDecoder.h
common/rfb/Decoder.cxx
common/rfb/Decoder.h
common/rfb/H264Decoder.cxx
common/rfb/H264Decoder.h
common/rfb/HextileDecoder.cxx
common/rfb/HextileDecoder.h
common/rfb/HextileEncoder.cxx
common/rfb/JpegCompressor.cxx
common/rfb/JpegCompressor.h
common/rfb/RREDecoder.cxx
common/rfb/RREDecoder.h
common/rfb/RawDecoder.cxx
common/rfb/RawDecoder.h
common/rfb/SConnection.cxx
common/rfb/SConnection.h
common/rfb/SMsgHandler.h
common/rfb/SMsgReader.cxx
common/rfb/SMsgWriter.cxx
common/rfb/SMsgWriter.h
common/rfb/SSecurityPlain.cxx
common/rfb/SSecurityRSAAES.cxx
common/rfb/TightDecoder.cxx
common/rfb/TightDecoder.h
common/rfb/VNCSConnectionST.cxx
common/rfb/VNCSConnectionST.h
common/rfb/VNCServerST.cxx
common/rfb/ZRLEDecoder.cxx
common/rfb/ZRLEDecoder.h
vncviewer/CConn.cxx
vncviewer/CConn.h

index 4ddd12218fa35d84b7eff76c6b848fd30d5e93aa..8e12f3a4b1644125a1db3d17c48475d3294d229f 100644 (file)
@@ -77,7 +77,7 @@ bool FdInStream::fillBuffer()
 // returning EINTR.
 //
 
-size_t FdInStream::readFd(void* buf, size_t len)
+size_t FdInStream::readFd(uint8_t* buf, size_t len)
 {
   int n;
   do {
index 71370a59c80f6e1fd1b5964bfc8a6f5dbfeacfbf..0f8373fe7323883c5f0268c1df77bd7cdf9bc715 100644 (file)
@@ -39,7 +39,7 @@ namespace rdr {
   private:
     virtual bool fillBuffer();
 
-    size_t readFd(void* buf, size_t len);
+    size_t readFd(uint8_t* buf, size_t len);
 
     int fd;
     bool closeWhenDone;
index e630a4d770b65216ec0e31251b3469a1c073e614..3a8cb076fe027391f5a8c3a46f9511616c6f5a55 100644 (file)
@@ -78,7 +78,7 @@ void FdOutStream::cork(bool enable)
 
 bool FdOutStream::flushBuffer()
 {
-  size_t n = writeFd((const void*) sentUpTo, ptr - sentUpTo);
+  size_t n = writeFd(sentUpTo, ptr - sentUpTo);
   if (n == 0)
     return false;
 
@@ -96,7 +96,7 @@ bool FdOutStream::flushBuffer()
 // returning EINTR.
 //
 
-size_t FdOutStream::writeFd(const void* data, size_t length)
+size_t FdOutStream::writeFd(const uint8_t* data, size_t length)
 {
   int n;
 
index 80804da4518ced89d63c5c895744de500b64e0e8..05fc1fed741708bd92759b5f07ddea827a6d6e8f 100644 (file)
@@ -45,7 +45,7 @@ namespace rdr {
 
   private:
     virtual bool flushBuffer();
-    size_t writeFd(const void* data, size_t length);
+    size_t writeFd(const uint8_t* data, size_t length);
     int fd;
     struct timeval lastWrite;
   };
index c6c83456b0897c9949fffea7970e48af431e4695..019ca5a725be617ce4523c5f3b0490bfcf650be0 100644 (file)
@@ -145,7 +145,7 @@ namespace rdr {
 
     // readBytes() reads an exact number of bytes.
 
-    void readBytes(void* data, size_t length) {
+    void readBytes(uint8_t* data, size_t length) {
       check(length);
       memcpy(data, ptr, length);
       ptr += length;
index 08f483929c9ad59e944a38ac91909c98acbcd837..61d0848224ac9a3834a444392e2655bccb27bc5d 100644 (file)
@@ -36,8 +36,8 @@ namespace rdr {
 
   public:
 
-    MemInStream(const void* data, size_t len, bool deleteWhenDone_=false)
-      : start((const uint8_t*)data), deleteWhenDone(deleteWhenDone_)
+    MemInStream(const uint8_t* data, size_t len, bool deleteWhenDone_=false)
+      : start(data), deleteWhenDone(deleteWhenDone_)
     {
       ptr = start;
       end = start + len;
index 33920a4d01d9f40642ffbb5f0726d0a768fc4386..5ed1ccf784b1c85d90a223328bcb1be78ec6d5b4 100644 (file)
@@ -48,7 +48,7 @@ namespace rdr {
 
     // data() returns a pointer to the buffer.
 
-    const void* data() { return (const void*)start; }
+    const uint8_t* data() { return start; }
 
   protected:
 
index 70216a2df58bb94706fc86b245e428fdf9f4ad7b..8450efd09171a8f2db6e5ab9a9f835e1f7e796c5 100644 (file)
@@ -70,7 +70,7 @@ namespace rdr {
 
     // writeBytes() writes an exact number of bytes.
 
-    void writeBytes(const void* data, size_t length) {
+    void writeBytes(const uint8_t* data, size_t length) {
       while (length > 0) {
         check(1);
         size_t n = length;
index f62d6d8726246f9ac1ea3f2f98fbca0a3d7be2bf..7ba98155fdd4b20c484288d373f00341be83768b 100644 (file)
@@ -53,7 +53,7 @@ ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size)
     if (in->avail() < size)
       size = in->avail();
   
-    in->readBytes(data, size);
+    in->readBytes((uint8_t*)data, size);
   } catch (EndOfStream&) {
     return 0;
   } catch (SystemException &e) {
index 0a88d18ab24554f9525c90c52f983e0f6fb00264..a06dd285fc29b5f828619fcedaef144215919c10 100644 (file)
@@ -44,7 +44,7 @@ ssize_t TLSOutStream::push(gnutls_transport_ptr_t str, const void* data,
   self->saved_exception = NULL;
 
   try {
-    out->writeBytes(data, size);
+    out->writeBytes((const uint8_t*)data, size);
     out->flush();
   } catch (SystemException &e) {
     vlog.error("Failure sending TLS data: %s", e.str());
index 521649ac3f7c873a0e8863b8ed9474b0a8ebce4a..c07df2165b7189be4a63f241f8410cf2b3d63ac5 100644 (file)
@@ -163,7 +163,7 @@ bool CConnection::processVersionMsg()
   if (!is->hasData(12))
     return false;
 
-  is->readBytes(verStr, 12);
+  is->readBytes((uint8_t*)verStr, 12);
   verStr[12] = '\0';
 
   if (sscanf(verStr, "RFB %03d.%03d\n",
@@ -192,7 +192,7 @@ bool CConnection::processVersionMsg()
 
   sprintf(verStr, "RFB %03d.%03d\n",
           server.majorVersion, server.minorVersion);
-  os->writeBytes(verStr, 12);
+  os->writeBytes((const uint8_t*)verStr, 12);
   os->flush();
 
   state_ = RFBSTATE_SECURITY_TYPES;
@@ -361,7 +361,7 @@ bool CConnection::processSecurityReasonMsg()
   is->clearRestorePoint();
 
   std::vector<char> reason(len + 1);
-  is->readBytes(reason.data(), len);
+  is->readBytes((uint8_t*)reason.data(), len);
   reason[len] = '\0';
 
   state_ = RFBSTATE_INVALID;
@@ -747,7 +747,7 @@ void CConnection::setPF(const PixelFormat& pf)
   formatChange = true;
 }
 
-void CConnection::fence(uint32_t flags, unsigned len, const char data[])
+void CConnection::fence(uint32_t flags, unsigned len, const uint8_t data[])
 {
   CMsgHandler::fence(flags, len, data);
 
index 71da175eed41e37a6733f0bc3491f4aa3bba8b8f..df0fbb14ade3c05308d2017f7c34c29e42684290 100644 (file)
@@ -249,7 +249,7 @@ namespace rfb {
     // responds to requests, stating no support for synchronisation.
     // When overriding, call CMsgHandler::fence() directly in order to
     // state correct support for fence flags.
-    virtual void fence(uint32_t flags, unsigned len, const char data[]);
+    virtual void fence(uint32_t flags, unsigned len, const uint8_t data[]);
 
   private:
     bool processVersionMsg();
index e37811f99f55af14c515ffd2403037821af01d50..c3594af9edb8daf3103386b0657645b77ce6b3a4 100644 (file)
@@ -70,7 +70,7 @@ void CMsgHandler::setName(const char* name)
 }
 
 void CMsgHandler::fence(uint32_t /*flags*/, unsigned /*len*/,
-                        const char /*data*/ [])
+                        const uint8_t /*data*/ [])
 {
   server.supportsFence = true;
 }
index c427749ff6593e4116a65e6020f7d4a3c91d44e0..16a53c6a600ebad7dd697da17ce3b9fa5043f838 100644 (file)
@@ -55,7 +55,7 @@ namespace rfb {
     virtual void setCursorPos(const Point& pos) = 0;
     virtual void setPixelFormat(const PixelFormat& pf);
     virtual void setName(const char* name);
-    virtual void fence(uint32_t flags, unsigned len, const char data[]);
+    virtual void fence(uint32_t flags, unsigned len, const uint8_t data[]);
     virtual void endOfContinuousUpdates();
     virtual void supportsQEMUKeyEvent();
     virtual void serverInit(int width, int height,
index be5133cfd6cadbefacc5619dda6a704c618cd0c2..c0a96690364964a1e16757919bfd7dca83d02f05 100644 (file)
@@ -74,7 +74,7 @@ bool CMsgReader::readServerInit()
     return false;
   is->clearRestorePoint();
   std::vector<char> name(len + 1);
-  is->readBytes(name.data(), len);
+  is->readBytes((uint8_t*)name.data(), len);
   name[len] = '\0';
   handler->serverInit(width, height, pf, name.data());
 
@@ -276,7 +276,7 @@ bool CMsgReader::readServerCutText()
     return true;
   }
   std::vector<char> ca(len);
-  is->readBytes(ca.data(), len);
+  is->readBytes((uint8_t*)ca.data(), len);
   std::string filtered(convertLF(ca.data(), len));
   handler->serverCutText(filtered.c_str());
 
@@ -409,7 +409,7 @@ bool CMsgReader::readFence()
 {
   uint32_t flags;
   uint8_t len;
-  char data[64];
+  uint8_t data[64];
 
   if (!is->hasData(3 + 4 + 1))
     return false;
@@ -763,7 +763,7 @@ bool CMsgReader::readSetDesktopName(int x, int y, int w, int h)
   is->clearRestorePoint();
 
   std::vector<char> name(len + 1);
-  is->readBytes(name.data(), len);
+  is->readBytes((uint8_t*)name.data(), len);
   name[len] = '\0';
 
   if (x || y || w || h) {
index 246c5dbe57f296385f3a498d4f969c4c0812156f..0ff8192614349d3a10606ad56f0d9de96c658dc2 100644 (file)
@@ -130,7 +130,7 @@ void CMsgWriter::writeEnableContinuousUpdates(bool enable,
   endMsg();
 }
 
-void CMsgWriter::writeFence(uint32_t flags, unsigned len, const char data[])
+void CMsgWriter::writeFence(uint32_t flags, unsigned len, const uint8_t data[])
 {
   if (!server->supportsFence)
     throw Exception("Server does not support fences");
@@ -200,7 +200,7 @@ void CMsgWriter::writeClientCutText(const char* str)
   startMsg(msgTypeClientCutText);
   os->pad(3);
   os->writeU32(len);
-  os->writeBytes(str, len);
+  os->writeBytes((const uint8_t*)str, len);
   endMsg();
 }
 
index 7e7a9a1726afc7bb9a8b56df9d5987629051bc22..1b70a1d011de6a696d7de71a4edb56d32846e136 100644 (file)
@@ -51,7 +51,7 @@ namespace rfb {
     void writeFramebufferUpdateRequest(const Rect& r,bool incremental);
     void writeEnableContinuousUpdates(bool enable, int x, int y, int w, int h);
 
-    void writeFence(uint32_t flags, unsigned len, const char data[]);
+    void writeFence(uint32_t flags, unsigned len, const uint8_t data[]);
 
     void writeKeyEvent(uint32_t keysym, uint32_t keycode, bool down);
     void writePointerEvent(const Point& pos, int buttonMask);
index 9e67885c248a6de01d073f899589af60d38a99e9..f6e5ded437d89e8f3c8980d9e3abb324397bf5bd 100644 (file)
@@ -130,7 +130,7 @@ void CSecurityDH::writeCredentials()
   struct aes128_ctx aesCtx;
   aes128_set_encrypt_key(&aesCtx, key);
 
-  char buf[128];
+  uint8_t buf[128];
   if (!rs.hasData(128))
     throw ConnFailedException("failed to generate random padding");
   rs.readBytes(buf, 128);
@@ -140,7 +140,7 @@ void CSecurityDH::writeCredentials()
   if (password.size() >= 64)
     throw AuthFailureException("password is too long");
   memcpy(buf + 64, password.c_str(), password.size() + 1);
-  aes128_encrypt(&aesCtx, 128, (uint8_t *)buf, (uint8_t *)buf);
+  aes128_encrypt(&aesCtx, 128, buf, buf);
 
   rdr::OutStream* os = cc->getOutStream();
   os->writeBytes(buf, 128);
index 7b75ef86f5c353c35ff3675c34924127cf573346..d9599f9ca20c41785441db09749c722a2673d20f 100644 (file)
@@ -41,8 +41,8 @@ bool CSecurityPlain::processMsg()
   // Return the response to the server
   os->writeU32(username.size());
   os->writeU32(password.size());
-  os->writeBytes(username.data(), username.size());
-  os->writeBytes(password.data(), password.size());
+  os->writeBytes((const uint8_t*)username.data(), username.size());
+  os->writeBytes((const uint8_t*)password.data(), password.size());
   os->flush();
   return true;
 }
index 6194caab1d4d10fc2fff1354027627e209a926ec..5a4bc9c9b1419368816e5c9ffd0cf390482657a6 100644 (file)
@@ -445,7 +445,7 @@ void CSecurityRSAAES::writeCredentials()
     if (username.size() > 255)
       throw AuthFailureException("username is too long");
     raos->writeU8(username.size());
-    raos->writeBytes(username.data(), username.size());
+    raos->writeBytes((const uint8_t*)username.data(), username.size());
   } else {
     raos->writeU8(0);
   }
@@ -453,6 +453,6 @@ void CSecurityRSAAES::writeCredentials()
   if (password.size() > 255)
     throw AuthFailureException("password is too long");
   raos->writeU8(password.size());
-  raos->writeBytes(password.data(), password.size());
+  raos->writeBytes((const uint8_t*)password.data(), password.size());
   raos->flush();
 }
index fb05dcbd1621341cbcb846106933ccafdb5e1c78..a73838811f2c406db1c5a09cacd8edb06f5c00c1 100644 (file)
@@ -49,7 +49,7 @@ bool CopyRectDecoder::readRect(const Rect& /*r*/,
 
 
 void CopyRectDecoder::getAffectedRegion(const Rect& rect,
-                                        const void* buffer,
+                                        const uint8_t* buffer,
                                         size_t buflen,
                                         const ServerParams& server,
                                         Region* region)
@@ -64,7 +64,7 @@ void CopyRectDecoder::getAffectedRegion(const Rect& rect,
                                                    srcY-rect.tl.y))));
 }
 
-void CopyRectDecoder::decodeRect(const Rect& r, const void* buffer,
+void CopyRectDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
                                  size_t buflen,
                                  const ServerParams& /*server*/,
                                  ModifiablePixelBuffer* pb)
index 5100eb2f9964affa97524fec39d9e2fa3a81ecf8..c9f9c8907f3d7080100e5f7844b2ba58ca612e2f 100644 (file)
@@ -28,10 +28,10 @@ namespace rfb {
     virtual ~CopyRectDecoder();
     virtual bool readRect(const Rect& r, rdr::InStream* is,
                           const ServerParams& server, rdr::OutStream* os);
-    virtual void getAffectedRegion(const Rect& rect, const void* buffer,
+    virtual void getAffectedRegion(const Rect& rect, const uint8_t* buffer,
                                    size_t buflen, const ServerParams& server,
                                    Region* region);
-    virtual void decodeRect(const Rect& r, const void* buffer,
+    virtual void decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb);
   };
index 832d8cf056ccf503b15385eeafc38d7c92dc322f..78c54ec3cf954ea091c8bf318c17d11241572730 100644 (file)
@@ -46,7 +46,7 @@ Decoder::~Decoder()
 }
 
 void Decoder::getAffectedRegion(const Rect& rect,
-                                const void* /*buffer*/,
+                                const uint8_t* /*buffer*/,
                                 size_t /*buflen*/,
                                 const ServerParams& /*server*/,
                                 Region* region)
@@ -55,10 +55,10 @@ void Decoder::getAffectedRegion(const Rect& rect,
 }
 
 bool Decoder::doRectsConflict(const Rect& /*rectA*/,
-                              const void* /*bufferA*/,
+                              const uint8_t* /*bufferA*/,
                               size_t /*buflenA*/,
                               const Rect& /*rectB*/,
-                              const void* /*bufferB*/,
+                              const uint8_t* /*bufferB*/,
                               size_t /*buflenB*/,
                               const ServerParams& /*server*/)
 {
index cb206a0d6e03d52ebdb650e6b6bfd90bf2b72bfc..7798773737bbe4db4283300cabb05e8964c2a2b5 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef __RFB_DECODER_H__
 #define __RFB_DECODER_H__
 
+#include <stdint.h>
+
 namespace rdr {
   class InStream;
   class OutStream;
@@ -62,7 +64,7 @@ namespace rfb {
     // getAffectedRegion() returns the parts of the frame buffer will
     // be either read from or written do when decoding this rect. The
     // default implementation simply returns the given rectangle.
-    virtual void getAffectedRegion(const Rect& rect, const void* buffer,
+    virtual void getAffectedRegion(const Rect& rect, const uint8_t* buffer,
                                    size_t buflen, const ServerParams& server,
                                    Region* region);
 
@@ -70,10 +72,10 @@ namespace rfb {
     // in the order they were received. This will only be called if the
     // DecoderPartiallyOrdered flag has been set.
     virtual bool doRectsConflict(const Rect& rectA,
-                                 const void* bufferA,
+                                 const uint8_t* bufferA,
                                  size_t buflenA,
                                  const Rect& rectB,
-                                 const void* bufferB,
+                                 const uint8_t* bufferB,
                                  size_t buflenB,
                                  const ServerParams& server);
 
@@ -81,7 +83,7 @@ namespace rfb {
     // given buffer, onto the ModifiablePixelBuffer. The PixelFormat of
     // the PixelBuffer might not match the ConnParams and it is up to
     // the decoder to do any necessary conversion.
-    virtual void decodeRect(const Rect& r, const void* buffer,
+    virtual void decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb)=0;
 
index 9de73422b38764e3c7d3f6182576fd90d6fc7002..f18554ef3e5661e657f6470da4be1c89c6bc56e1 100644 (file)
@@ -93,7 +93,7 @@ bool H264Decoder::readRect(const Rect& /*r*/,
   return true;
 }
 
-void H264Decoder::decodeRect(const Rect& r, const void* buffer,
+void H264Decoder::decodeRect(const Rect& r, const uint8_t* buffer,
                              size_t buflen,
                              const ServerParams& /*server*/,
                              ModifiablePixelBuffer* pb)
index cfb8e05cd45c0bb6bb5ea6af325bb1a312798058..b4f5553e0d30b42f8fcb4bf942cfd79443889545 100644 (file)
@@ -35,7 +35,7 @@ namespace rfb {
     virtual ~H264Decoder();
     virtual bool readRect(const Rect& r, rdr::InStream* is,
                           const ServerParams& server, rdr::OutStream* os);
-    virtual void decodeRect(const Rect& r, const void* buffer,
+    virtual void decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb);
 
index f7cbc46a96dcee389f6f091cebac9f2efc1a64a7..2243d67fdb22dc919cd7ebe0fde7aa557d4317a3 100644 (file)
@@ -113,7 +113,7 @@ bool HextileDecoder::readRect(const Rect& r, rdr::InStream* is,
   return true;
 }
 
-void HextileDecoder::decodeRect(const Rect& r, const void* buffer,
+void HextileDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
                                 size_t buflen, const ServerParams& server,
                                 ModifiablePixelBuffer* pb)
 {
@@ -158,7 +158,7 @@ void HextileDecoder::hextileDecode(const Rect& r, rdr::InStream* is,
       int tileType = is->readU8();
 
       if (tileType & hextileRaw) {
-        is->readBytes(buf, t.area() * sizeof(T));
+        is->readBytes((uint8_t*)buf, t.area() * sizeof(T));
         pb->imageRect(pf, t, buf);
         continue;
       }
index e8961d731c409664198fc2b53ca298ca54aaf91a..9163b5bb87af4c9074d78ab83f4d758c1d54867c 100644 (file)
@@ -31,7 +31,7 @@ namespace rfb {
     virtual ~HextileDecoder();
     virtual bool readRect(const Rect& r, rdr::InStream* is,
                           const ServerParams& server, rdr::OutStream* os);
-    virtual void decodeRect(const Rect& r, const void* buffer,
+    virtual void decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb);
   private:
index 90e599624dabbc8ee263de2ccdb23a8e995b5aa9..a63cf1fb1ff2cd448d997243358e07c5de529f58 100644 (file)
@@ -161,7 +161,8 @@ void HextileEncoder::hextileEncode(rdr::OutStream* os,
         if (encodedLen < 0) {
           pb->getImage(buf, t);
           os->writeU8(hextileRaw);
-          os->writeBytes(buf, t.width() * t.height() * sizeof(T));
+          os->writeBytes((const uint8_t*)buf,
+                         t.width() * t.height() * sizeof(T));
           oldBgValid = oldFgValid = false;
           continue;
         }
@@ -557,7 +558,8 @@ void HextileEncoder::hextileEncodeBetter(rdr::OutStream* os,
       if ( (tileType & hextileRaw) != 0 ||
            encodedLen >= t.width() * t.height() * sizeof(T)) {
         os->writeU8(hextileRaw);
-        os->writeBytes(buf, t.width() * t.height() * sizeof(T));
+        os->writeBytes((const uint8_t*)buf,
+                       t.width() * t.height() * sizeof(T));
         oldBgValid = oldFgValid = false;
         continue;
       }
index d5c5fd0d970fb421cddf1fbe935729a62c961ed3..a4dd5f3937c907f80aa3e00015e1798ba81e8a5b 100644 (file)
@@ -254,7 +254,7 @@ void JpegCompressor::compress(const uint8_t *buf, volatile int stride,
   delete[] rowPointer;
 }
 
-void JpegCompressor::writeBytes(const void* /*data*/, int /*length*/)
+void JpegCompressor::writeBytes(const uint8_t* /*data*/, int /*length*/)
 {
   throw rdr::Exception("writeBytes() is not valid with a JpegCompressor instance.  Use compress() instead.");
 }
index d4978fdf6ec417903fd854b49a85162478e62c5d..26194204f6c2e1929077eee904ca69c6fed7836d 100644 (file)
@@ -45,7 +45,7 @@ namespace rfb {
 
     void compress(const uint8_t *, int, const Rect&, const PixelFormat&, int, int);
 
-    void writeBytes(const void*, int);
+    void writeBytes(const uint8_t*, int);
 
   private:
 
index c85c015cb6bf31ddf0e31dc158f4f83000dbdd10..41bf501a241e1cf8ca05c9f9496e0642ab6c4244 100644 (file)
@@ -66,7 +66,7 @@ bool RREDecoder::readRect(const Rect& /*r*/, rdr::InStream* is,
   return true;
 }
 
-void RREDecoder::decodeRect(const Rect& r, const void* buffer,
+void RREDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb)
 {
index 05acbc242dded4e399bfed82d1076afdbd3bdd85..a1d7f9b8a889e22e84bd611562a7362aa82c1bfa 100644 (file)
@@ -31,7 +31,7 @@ namespace rfb {
     virtual ~RREDecoder();
     virtual bool readRect(const Rect& r, rdr::InStream* is,
                           const ServerParams& server, rdr::OutStream* os);
-    virtual void decodeRect(const Rect& r, const void* buffer,
+    virtual void decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb);
   private:
index a86696e95e5469d2f2200f9aef5deb281a7e56a2..f2ea586b4bb77d9ab359b8213a8fec3920e75e8c 100644 (file)
@@ -46,7 +46,7 @@ bool RawDecoder::readRect(const Rect& r, rdr::InStream* is,
   return true;
 }
 
-void RawDecoder::decodeRect(const Rect& r, const void* buffer,
+void RawDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb)
 {
index 2661ea57d4965cd922fce753b13e6b8d60f52ba1..33948ced4302cfadafa843e7ce1ea5ff46835bf2 100644 (file)
@@ -27,7 +27,7 @@ namespace rfb {
     virtual ~RawDecoder();
     virtual bool readRect(const Rect& r, rdr::InStream* is,
                           const ServerParams& server, rdr::OutStream* os);
-    virtual void decodeRect(const Rect& r, const void* buffer,
+    virtual void decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb);
   };
index e5d40e9db083a089c0d7dc9ef4ea76eab0c8059c..2b18d8c130b5e9ee06a2db7daa2a8df855d5225d 100644 (file)
@@ -88,7 +88,7 @@ void SConnection::initialiseProtocol()
   char str[13];
 
   sprintf(str, "RFB %03d.%03d\n", defaultMajorVersion, defaultMinorVersion);
-  os->writeBytes(str, 12);
+  os->writeBytes((const uint8_t*)str, 12);
   os->flush();
 
   state_ = RFBSTATE_PROTOCOL_VERSION;
@@ -126,7 +126,7 @@ bool SConnection::processVersionMsg()
   if (!is->hasData(12))
     return false;
 
-  is->readBytes(verStr, 12);
+  is->readBytes((uint8_t*)verStr, 12);
   verStr[12] = '\0';
 
   if (sscanf(verStr, "RFB %03d.%03d\n",
@@ -298,7 +298,8 @@ bool SConnection::handleAuthFailureTimeout(Timer* /*t*/)
     os->writeU32(secResultFailed);
     if (!client.beforeVersion(3,8)) { // 3.8 onwards have failure message
       os->writeU32(authFailureMsg.size());
-      os->writeBytes(authFailureMsg.data(), authFailureMsg.size());
+      os->writeBytes((const uint8_t*)authFailureMsg.data(),
+                     authFailureMsg.size());
     }
     os->flush();
   } catch (rdr::Exception& e) {
@@ -326,12 +327,12 @@ void SConnection::throwConnFailedException(const char* format, ...)
     if (client.majorVersion == 3 && client.minorVersion == 3) {
       os->writeU32(0);
       os->writeU32(strlen(str));
-      os->writeBytes(str, strlen(str));
+      os->writeBytes((const uint8_t*)str, strlen(str));
       os->flush();
     } else {
       os->writeU8(0);
       os->writeU32(strlen(str));
-      os->writeBytes(str, strlen(str));
+      os->writeBytes((const uint8_t*)str, strlen(str));
       os->flush();
     }
   }
@@ -467,7 +468,7 @@ void SConnection::approveConnection(bool accept, const char* reason)
         if (!reason)
           reason = "Authentication failure";
         os->writeU32(strlen(reason));
-        os->writeBytes(reason, strlen(reason));
+        os->writeBytes((const uint8_t*)reason, strlen(reason));
       }
     }
     os->flush();
@@ -519,7 +520,8 @@ void SConnection::framebufferUpdateRequest(const Rect& /*r*/,
   }
 }
 
-void SConnection::fence(uint32_t flags, unsigned len, const char data[])
+void SConnection::fence(uint32_t flags, unsigned len,
+                        const uint8_t data[])
 {
   if (!(flags & fenceFlagRequest))
     return;
index 08574069c3487a689a5b9289ce920bc6ac8ed699..b163d6273edb3cb6abf49f438874e02d303153e6 100644 (file)
@@ -132,7 +132,7 @@ namespace rfb {
     // it responds directly to requests (stating it doesn't support any
     // synchronisation) and drops responses. Override to implement more proper
     // support.
-    virtual void fence(uint32_t flags, unsigned len, const char data[]);
+    virtual void fence(uint32_t flags, unsigned len, const uint8_t data[]);
 
     // enableContinuousUpdates() is called when the client wants to enable
     // or disable continuous updates, or change the active area.
index ec8040d2d8280a2cf3b75694922d8ab917dbb447..20dc066f28cdea4763b32cc4393b369ccab57861 100644 (file)
@@ -51,7 +51,7 @@ namespace rfb {
     virtual void framebufferUpdateRequest(const Rect& r, bool incremental) = 0;
     virtual void setDesktopSize(int fb_width, int fb_height,
                                 const ScreenSet& layout) = 0;
-    virtual void fence(uint32_t flags, unsigned len, const char data[]) = 0;
+    virtual void fence(uint32_t flags, unsigned len, const uint8_t data[]) = 0;
     virtual void enableContinuousUpdates(bool enable,
                                          int x, int y, int w, int h) = 0;
 
index 8cd8d147431f97b4c2595fa9786cca6c0578eed1..68c9365b16fecbe57725074d383192eb48fb1591 100644 (file)
@@ -229,7 +229,7 @@ bool SMsgReader::readFence()
 {
   uint32_t flags;
   uint8_t len;
-  char data[64];
+  uint8_t data[64];
 
   if (!is->hasData(3 + 4 + 1))
     return false;
@@ -315,7 +315,7 @@ bool SMsgReader::readClientCutText()
   }
 
   std::vector<char> ca(len);
-  is->readBytes(ca.data(), len);
+  is->readBytes((uint8_t*)ca.data(), len);
   std::string filtered(convertLF(ca.data(), len));
   handler->clientCutText(filtered.c_str());
 
index 1172ac4d4830f81286c9c2b857eaafedd4cca063..95f85352bbde2647d6a13080986e90a7051b9b3d 100644 (file)
@@ -63,7 +63,7 @@ void SMsgWriter::writeServerInit(uint16_t width, uint16_t height,
   os->writeU16(height);
   pf.write(os);
   os->writeU32(strlen(name));
-  os->writeBytes(name, strlen(name));
+  os->writeBytes((const uint8_t*)name, strlen(name));
   endMsg();
 }
 
@@ -101,7 +101,7 @@ void SMsgWriter::writeServerCutText(const char* str)
   startMsg(msgTypeServerCutText);
   os->pad(3);
   os->writeU32(len);
-  os->writeBytes(str, len);
+  os->writeBytes((const uint8_t*)str, len);
   endMsg();
 }
 
@@ -211,7 +211,8 @@ void SMsgWriter::writeClipboardProvide(uint32_t flags,
   endMsg();
 }
 
-void SMsgWriter::writeFence(uint32_t flags, unsigned len, const char data[])
+void SMsgWriter::writeFence(uint32_t flags, unsigned len,
+                            const uint8_t data[])
 {
   if (!client->supportsEncoding(pseudoEncodingFence))
     throw Exception("Client does not support fences");
@@ -585,12 +586,13 @@ void SMsgWriter::writeSetDesktopNameRect(const char *name)
   os->writeU16(0);
   os->writeU32(pseudoEncodingDesktopName);
   os->writeU32(strlen(name));
-  os->writeBytes(name, strlen(name));
+  os->writeBytes((const uint8_t*)name, strlen(name));
 }
 
 void SMsgWriter::writeSetCursorRect(int width, int height,
                                     int hotspotX, int hotspotY,
-                                    const void* data, const void* mask)
+                                    const uint8_t* data,
+                                    const uint8_t* mask)
 {
   if (!client->supportsEncoding(pseudoEncodingCursor))
     throw Exception("Client does not support local cursors");
@@ -608,7 +610,8 @@ void SMsgWriter::writeSetCursorRect(int width, int height,
 
 void SMsgWriter::writeSetXCursorRect(int width, int height,
                                      int hotspotX, int hotspotY,
-                                     const void* data, const void* mask)
+                                     const uint8_t* data,
+                                     const uint8_t* mask)
 {
   if (!client->supportsEncoding(pseudoEncodingXCursor))
     throw Exception("Client does not support local cursors");
index 07f7cf236f06b02661a977b65b972f56f4900d27..c46551e9a819af93cb306d4ce99c8c74637fb728 100644 (file)
@@ -68,7 +68,7 @@ namespace rfb {
                                const uint8_t* const* data);
 
     // writeFence() sends a new fence request or response to the client.
-    void writeFence(uint32_t flags, unsigned len, const char data[]);
+    void writeFence(uint32_t flags, unsigned len, const uint8_t data[]);
 
     // writeEndOfContinuousUpdates() indicates that we have left continuous
     // updates mode.
@@ -135,10 +135,10 @@ namespace rfb {
     void writeSetDesktopNameRect(const char *name);
     void writeSetCursorRect(int width, int height,
                             int hotspotX, int hotspotY,
-                            const void* data, const void* mask);
+                            const uint8_t* data, const uint8_t* mask);
     void writeSetXCursorRect(int width, int height,
                              int hotspotX, int hotspotY,
-                             const void* data, const void* mask);
+                             const uint8_t* data, const uint8_t* mask);
     void writeSetCursorWithAlphaRect(int width, int height,
                                      int hotspotX, int hotspotY,
                                      const uint8_t* data);
index e65b6d3be9a4bc2d9c915f9457a00df3d25bf330..42f5009b2dd100561df0a25edcc7df5b2e9353ce 100644 (file)
@@ -99,8 +99,8 @@ bool SSecurityPlain::processMsg()
     if (!is->hasData(ulen + plen))
       return false;
     state = 2;
-    is->readBytes(username, ulen);
-    is->readBytes(password, plen);
+    is->readBytes((uint8_t*)username, ulen);
+    is->readBytes((uint8_t*)password, plen);
     password[plen] = 0;
     username[ulen] = 0;
     plen = 0;
index 042e4838ddf7b56df8c3d6d5401abf3997341f34..2a8dfa3eb7b406dc62b2d22f7227448ead551831 100644 (file)
@@ -539,12 +539,12 @@ bool SSecurityRSAAES::readCredentials()
   uint8_t lenUsername = rais->readU8();
   if (!rais->hasDataOrRestore(lenUsername + 1))
     return false;
-  rais->readBytes(username, lenUsername);
+  rais->readBytes((uint8_t*)username, lenUsername);
   username[lenUsername] = 0;
   uint8_t lenPassword = rais->readU8();
   if (!rais->hasDataOrRestore(lenPassword))
     return false;
-  rais->readBytes(password, lenPassword);
+  rais->readBytes((uint8_t*)password, lenPassword);
   password[lenPassword] = 0;
   rais->clearRestorePoint();
   return true;
index acc9d5a5dfbe99f1179fabbd0b14a90ddee51b15..54b620ea88017f8aba665eb90e82cba61af4e251 100644 (file)
@@ -192,10 +192,10 @@ bool TightDecoder::readRect(const Rect& r, rdr::InStream* is,
 }
 
 bool TightDecoder::doRectsConflict(const Rect& /*rectA*/,
-                                   const void* bufferA,
+                                   const uint8_t* bufferA,
                                    size_t buflenA,
                                    const Rect& /*rectB*/,
-                                   const void* bufferB,
+                                   const uint8_t* bufferB,
                                    size_t buflenB,
                                    const ServerParams& /*server*/)
 {
@@ -219,7 +219,7 @@ bool TightDecoder::doRectsConflict(const Rect& /*rectA*/,
   return false;
 }
 
-void TightDecoder::decodeRect(const Rect& r, const void* buffer,
+void TightDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
                               size_t buflen, const ServerParams& server,
                               ModifiablePixelBuffer* pb)
 {
index 03b61dafe84b31733ac1c4833cae8da25e9be0b2..764f138e18e6002f87147e14fa4b5f1e90a60874 100644 (file)
@@ -34,13 +34,13 @@ namespace rfb {
     virtual bool readRect(const Rect& r, rdr::InStream* is,
                           const ServerParams& server, rdr::OutStream* os);
     virtual bool doRectsConflict(const Rect& rectA,
-                                 const void* bufferA,
+                                 const uint8_t* bufferA,
                                  size_t buflenA,
                                  const Rect& rectB,
-                                 const void* bufferB,
+                                 const uint8_t* bufferB,
                                  size_t buflenB,
                                  const ServerParams& server);
-    virtual void decodeRect(const Rect& r, const void* buffer,
+    virtual void decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb);
 
index 5d047e6a1da692e4bdf66537c0ff7868006bef85..90311770da5bc2663f32649126668c11d9cf114e 100644 (file)
@@ -672,7 +672,7 @@ void VNCSConnectionST::setDesktopSize(int fb_width, int fb_height,
   writer()->writeDesktopSize(reasonClient, result);
 }
 
-void VNCSConnectionST::fence(uint32_t flags, unsigned len, const char data[])
+void VNCSConnectionST::fence(uint32_t flags, unsigned len, const uint8_t data[])
 {
   uint8_t type;
 
@@ -685,7 +685,7 @@ void VNCSConnectionST::fence(uint32_t flags, unsigned len, const char data[])
       delete [] fenceData;
       fenceData = NULL;
       if (len > 0) {
-        fenceData = new char[len];
+        fenceData = new uint8_t[len];
         memcpy(fenceData, data, len);
       }
 
@@ -771,7 +771,7 @@ void VNCSConnectionST::supportsLocalCursor()
 
 void VNCSConnectionST::supportsFence()
 {
-  char type = 0;
+  uint8_t type = 0;
   writer()->writeFence(fenceFlagRequest, sizeof(type), &type);
 }
 
@@ -825,7 +825,7 @@ bool VNCSConnectionST::isShiftPressed()
 
 void VNCSConnectionST::writeRTTPing()
 {
-  char type;
+  uint8_t type;
 
   if (!client.supportsFence())
     return;
index 79f0b4fea748f35399c13c9632e67678854f68d0..edc0391edcde5e2b93cff77278ba34dac03bd20c 100644 (file)
@@ -128,7 +128,7 @@ namespace rfb {
     virtual void framebufferUpdateRequest(const Rect& r, bool incremental);
     virtual void setDesktopSize(int fb_width, int fb_height,
                                 const ScreenSet& layout);
-    virtual void fence(uint32_t flags, unsigned len, const char data[]);
+    virtual void fence(uint32_t flags, unsigned len, const uint8_t data[]);
     virtual void enableContinuousUpdates(bool enable,
                                          int x, int y, int w, int h);
     virtual void handleClipboardRequest();
@@ -174,7 +174,7 @@ namespace rfb {
     bool pendingSyncFence, syncFence;
     uint32_t fenceFlags;
     unsigned fenceDataLen;
-    char *fenceData;
+    uint8_t *fenceData;
 
     Congestion congestion;
     Timer congestionTimer;
index 5f5ee34a53eaf41e229b56863340ac99cdbd215a..7bed8831c68bcc3c0701893c432fa7517d7fff0d 100644 (file)
@@ -139,11 +139,11 @@ void VNCServerST::addSocket(network::Socket* sock, bool outgoing)
       rdr::OutStream& os = sock->outStream();
 
       // Shortest possible way to tell a client it is not welcome
-      os.writeBytes("RFB 003.003\n", 12);
+      os.writeBytes((const uint8_t*)"RFB 003.003\n", 12);
       os.writeU32(0);
       const char* reason = "Too many security failures";
       os.writeU32(strlen(reason));
-      os.writeBytes(reason, strlen(reason));
+      os.writeBytes((const uint8_t*)reason, strlen(reason));
       os.flush();
     } catch (rdr::Exception&) {
     }
index 6dad55f495e783fa77af729734f06f58cea5e272..4b768afcb301ce995c8a20ba045f1d047af3bc9c 100644 (file)
@@ -99,7 +99,7 @@ bool ZRLEDecoder::readRect(const Rect& /*r*/, rdr::InStream* is,
   return true;
 }
 
-void ZRLEDecoder::decodeRect(const Rect& r, const void* buffer,
+void ZRLEDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
                              size_t buflen, const ServerParams& server,
                              ModifiablePixelBuffer* pb)
 {
@@ -185,7 +185,7 @@ void ZRLEDecoder::zrleDecode(const Rect& r, rdr::InStream* is,
                 *ptr = readOpaque24B(zis);
             }
           } else {
-            zis->readBytes(buf, t.area() * sizeof(T));
+            zis->readBytes((uint8_t*)buf, t.area() * sizeof(T));
           }
 
         } else {
index 3885124a96e5755503ee0d5361c4f2234a81cc9a..e72bf1b67ab7f1b1920a84e23522d3fa68544752 100644 (file)
@@ -32,7 +32,7 @@ namespace rfb {
     virtual ~ZRLEDecoder();
     virtual bool readRect(const Rect& r, rdr::InStream* is,
                           const ServerParams& server, rdr::OutStream* os);
-    virtual void decodeRect(const Rect& r, const void* buffer,
+    virtual void decodeRect(const Rect& r, const uint8_t* buffer,
                             size_t buflen, const ServerParams& server,
                             ModifiablePixelBuffer* pb);
 
index 780214f2ca2bb9a3451e1e7342bce4ee225fb494..a69eb014a0628c4e56bd3f14d526d90e1138163b 100644 (file)
@@ -434,7 +434,7 @@ void CConn::setCursorPos(const Point& pos)
   desktop->setCursorPos(pos);
 }
 
-void CConn::fence(uint32_t flags, unsigned len, const char data[])
+void CConn::fence(uint32_t flags, unsigned len, const uint8_t data[])
 {
   CMsgHandler::fence(flags, len, data);
 
index 0d8d77896db1268eba2e92625b6755279cdc0c5c..835699e5c4dbadfb1f3758bda011286db5ca7713 100644 (file)
@@ -65,7 +65,7 @@ public:
                  const uint8_t* data);
   void setCursorPos(const rfb::Point& pos);
 
-  void fence(uint32_t flags, unsigned len, const char data[]);
+  void fence(uint32_t flags, unsigned len, const uint8_t data[]);
 
   void setLEDState(unsigned int state);