diff options
151 files changed, 1114 insertions, 1086 deletions
diff --git a/common/rdr/AESInStream.cxx b/common/rdr/AESInStream.cxx index e6737e64..de91a3df 100644 --- a/common/rdr/AESInStream.cxx +++ b/common/rdr/AESInStream.cxx @@ -27,7 +27,8 @@ #ifdef HAVE_NETTLE using namespace rdr; -AESInStream::AESInStream(InStream* _in, const U8* key, int _keySize) +AESInStream::AESInStream(InStream* _in, const uint8_t* key, + int _keySize) : keySize(_keySize), in(_in), counter() { if (keySize == 128) @@ -44,26 +45,26 @@ bool AESInStream::fillBuffer() { if (!in->hasData(2)) return false; - const U8* ptr = in->getptr(2); + const uint8_t* ptr = in->getptr(2); size_t length = ((int)ptr[0] << 8) | (int)ptr[1]; if (!in->hasData(2 + length + 16)) return false; ensureSpace(length); ptr = in->getptr(2 + length + 16); - const U8* ad = ptr; - const U8* data = ptr + 2; - const U8* mac = ptr + 2 + length; - U8 macComputed[16]; + const uint8_t* ad = ptr; + const uint8_t* data = ptr + 2; + const uint8_t* mac = ptr + 2 + length; + uint8_t macComputed[16]; if (keySize == 128) { EAX_SET_NONCE(&eaxCtx128, aes128_encrypt, 16, counter); EAX_UPDATE(&eaxCtx128, aes128_encrypt, 2, ad); - EAX_DECRYPT(&eaxCtx128, aes128_encrypt, length, (rdr::U8*)end, data); + EAX_DECRYPT(&eaxCtx128, aes128_encrypt, length, (uint8_t*)end, data); EAX_DIGEST(&eaxCtx128, aes128_encrypt, 16, macComputed); } else { EAX_SET_NONCE(&eaxCtx256, aes256_encrypt, 16, counter); EAX_UPDATE(&eaxCtx256, aes256_encrypt, 2, ad); - EAX_DECRYPT(&eaxCtx256, aes256_encrypt, length, (rdr::U8*)end, data); + EAX_DECRYPT(&eaxCtx256, aes256_encrypt, length, (uint8_t*)end, data); EAX_DIGEST(&eaxCtx256, aes256_encrypt, 16, macComputed); } if (memcmp(mac, macComputed, 16) != 0) @@ -82,4 +83,4 @@ bool AESInStream::fillBuffer() return true; } -#endif
\ No newline at end of file +#endif diff --git a/common/rdr/AESInStream.h b/common/rdr/AESInStream.h index 3483bd3a..6069bb71 100644 --- a/common/rdr/AESInStream.h +++ b/common/rdr/AESInStream.h @@ -29,7 +29,7 @@ namespace rdr { class AESInStream : public BufferedInStream { public: - AESInStream(InStream* in, const U8* key, int keySize); + AESInStream(InStream* in, const uint8_t* key, int keySize); virtual ~AESInStream(); private: @@ -41,7 +41,7 @@ namespace rdr { struct EAX_CTX(aes128_ctx) eaxCtx128; struct EAX_CTX(aes256_ctx) eaxCtx256; }; - U8 counter[16]; + uint8_t counter[16]; }; } diff --git a/common/rdr/AESOutStream.cxx b/common/rdr/AESOutStream.cxx index 1559b78a..fcb3e37a 100644 --- a/common/rdr/AESOutStream.cxx +++ b/common/rdr/AESOutStream.cxx @@ -29,10 +29,11 @@ using namespace rdr; const int MaxMessageSize = 8192; -AESOutStream::AESOutStream(OutStream* _out, const U8* key, int _keySize) +AESOutStream::AESOutStream(OutStream* _out, const uint8_t* key, + int _keySize) : keySize(_keySize), out(_out), counter() { - msg = new U8[MaxMessageSize + 16 + 2]; + msg = new uint8_t[MaxMessageSize + 16 + 2]; if (keySize == 128) EAX_SET_KEY(&eaxCtx128, aes128_set_encrypt_key, aes128_encrypt, key); else if (keySize == 256) @@ -71,7 +72,7 @@ bool AESOutStream::flushBuffer() } -void AESOutStream::writeMessage(const U8* data, size_t length) +void AESOutStream::writeMessage(const uint8_t* data, size_t length) { msg[0] = (length & 0xff00) >> 8; msg[1] = length & 0xff; diff --git a/common/rdr/AESOutStream.h b/common/rdr/AESOutStream.h index e5d6aa7a..f9e4f4da 100644 --- a/common/rdr/AESOutStream.h +++ b/common/rdr/AESOutStream.h @@ -28,7 +28,7 @@ namespace rdr { class AESOutStream : public BufferedOutStream { public: - AESOutStream(OutStream* out, const U8* key, int keySize); + AESOutStream(OutStream* out, const uint8_t* key, int keySize); virtual ~AESOutStream(); virtual void flush(); @@ -36,16 +36,16 @@ namespace rdr { private: virtual bool flushBuffer(); - void writeMessage(const U8* data, size_t length); + void writeMessage(const uint8_t* data, size_t length); int keySize; OutStream* out; - U8* msg; + uint8_t* msg; union { struct EAX_CTX(aes128_ctx) eaxCtx128; struct EAX_CTX(aes256_ctx) eaxCtx256; }; - U8 counter[16]; + uint8_t counter[16]; }; }; diff --git a/common/rdr/BufferedInStream.cxx b/common/rdr/BufferedInStream.cxx index 9972e13e..5978a8c9 100644 --- a/common/rdr/BufferedInStream.cxx +++ b/common/rdr/BufferedInStream.cxx @@ -34,7 +34,7 @@ static const size_t MAX_BUF_SIZE = 32 * 1024 * 1024; BufferedInStream::BufferedInStream() : bufSize(DEFAULT_BUF_SIZE), offset(0) { - ptr = end = start = new U8[bufSize]; + ptr = end = start = new uint8_t[bufSize]; gettimeofday(&lastSizeCheck, NULL); peakUsage = 0; } @@ -60,7 +60,7 @@ void BufferedInStream::ensureSpace(size_t needed) if (needed > bufSize) { size_t newSize; - U8* newBuffer; + uint8_t* newBuffer; if (needed > MAX_BUF_SIZE) throw Exception("BufferedInStream overrun: requested size of " @@ -71,7 +71,7 @@ void BufferedInStream::ensureSpace(size_t needed) while (newSize < needed) newSize *= 2; - newBuffer = new U8[newSize]; + newBuffer = new uint8_t[newSize]; memcpy(newBuffer, ptr, end - ptr); delete [] start; bufSize = newSize; @@ -101,7 +101,7 @@ void BufferedInStream::ensureSpace(size_t needed) // We know the buffer is empty, so just reset everything delete [] start; - ptr = end = start = new U8[newSize]; + ptr = end = start = new uint8_t[newSize]; bufSize = newSize; } diff --git a/common/rdr/BufferedInStream.h b/common/rdr/BufferedInStream.h index 05f7231e..89b25ffb 100644 --- a/common/rdr/BufferedInStream.h +++ b/common/rdr/BufferedInStream.h @@ -50,7 +50,7 @@ namespace rdr { private: size_t bufSize; size_t offset; - U8* start; + uint8_t* start; struct timeval lastSizeCheck; size_t peakUsage; diff --git a/common/rdr/BufferedOutStream.cxx b/common/rdr/BufferedOutStream.cxx index ff7b6b51..640f6007 100644 --- a/common/rdr/BufferedOutStream.cxx +++ b/common/rdr/BufferedOutStream.cxx @@ -34,7 +34,7 @@ static const size_t MAX_BUF_SIZE = 32 * 1024 * 1024; BufferedOutStream::BufferedOutStream(bool emulateCork) : bufSize(DEFAULT_BUF_SIZE), offset(0), emulateCork(emulateCork) { - ptr = start = sentUpTo = new U8[bufSize]; + ptr = start = sentUpTo = new uint8_t[bufSize]; end = start + bufSize; gettimeofday(&lastSizeCheck, NULL); peakUsage = 0; @@ -88,7 +88,7 @@ void BufferedOutStream::flush() // We know the buffer is empty, so just reset everything delete [] start; - ptr = start = sentUpTo = new U8[newSize]; + ptr = start = sentUpTo = new uint8_t[newSize]; end = start + newSize; bufSize = newSize; } @@ -107,7 +107,7 @@ void BufferedOutStream::overrun(size_t needed) { bool oldCorked; size_t totalNeeded, newSize; - U8* newBuffer; + uint8_t* newBuffer; // First try to get rid of the data we have // (use corked to make things a bit more efficient since we're not @@ -147,7 +147,7 @@ void BufferedOutStream::overrun(size_t needed) while (newSize < totalNeeded) newSize *= 2; - newBuffer = new U8[newSize]; + newBuffer = new uint8_t[newSize]; memcpy(newBuffer, sentUpTo, ptr - sentUpTo); delete [] start; bufSize = newSize; diff --git a/common/rdr/BufferedOutStream.h b/common/rdr/BufferedOutStream.h index 94707118..22693257 100644 --- a/common/rdr/BufferedOutStream.h +++ b/common/rdr/BufferedOutStream.h @@ -54,7 +54,7 @@ namespace rdr { private: size_t bufSize; size_t offset; - U8* start; + uint8_t* start; struct timeval lastSizeCheck; size_t peakUsage; @@ -62,7 +62,7 @@ namespace rdr { bool emulateCork; protected: - U8* sentUpTo; + uint8_t* sentUpTo; protected: BufferedOutStream(bool emulateCork=true); diff --git a/common/rdr/FdInStream.cxx b/common/rdr/FdInStream.cxx index e0174a8f..13d3a5a8 100644 --- a/common/rdr/FdInStream.cxx +++ b/common/rdr/FdInStream.cxx @@ -59,7 +59,7 @@ FdInStream::~FdInStream() bool FdInStream::fillBuffer() { - size_t n = readFd((U8*)end, availSpace()); + size_t n = readFd((uint8_t*)end, availSpace()); if (n == 0) return false; end += n; diff --git a/common/rdr/FileInStream.cxx b/common/rdr/FileInStream.cxx index 43f9ea4c..6de1a5b2 100644 --- a/common/rdr/FileInStream.cxx +++ b/common/rdr/FileInStream.cxx @@ -45,7 +45,7 @@ FileInStream::~FileInStream(void) { bool FileInStream::fillBuffer() { - size_t n = fread((U8 *)end, 1, availSpace(), file); + size_t n = fread((uint8_t*)end, 1, availSpace(), file); if (n == 0) { if (ferror(file)) throw SystemException("fread", errno); diff --git a/common/rdr/HexInStream.cxx b/common/rdr/HexInStream.cxx index 3eac9d2e..8a88d337 100644 --- a/common/rdr/HexInStream.cxx +++ b/common/rdr/HexInStream.cxx @@ -81,9 +81,9 @@ bool HexInStream::fillBuffer() { return false; size_t length = min(in_stream.avail()/2, availSpace()); - const U8* iptr = in_stream.getptr(length*2); + const uint8_t* iptr = in_stream.getptr(length*2); - U8* optr = (U8*) end; + uint8_t* optr = (uint8_t*) end; for (size_t i=0; i<length; i++) { int v = 0; readHexAndShift(iptr[i*2], &v); diff --git a/common/rdr/HexOutStream.cxx b/common/rdr/HexOutStream.cxx index 4bcd8ba4..0cbc312f 100644 --- a/common/rdr/HexOutStream.cxx +++ b/common/rdr/HexOutStream.cxx @@ -62,7 +62,7 @@ char* HexOutStream::binToHexStr(const char* data, size_t length) { bool HexOutStream::flushBuffer() { while (sentUpTo != ptr) { - U8* optr = out_stream.getptr(2); + uint8_t* optr = out_stream.getptr(2); size_t length = min(ptr-sentUpTo, out_stream.avail()/2); for (size_t i=0; i<length; i++) { diff --git a/common/rdr/InStream.h b/common/rdr/InStream.h index 26817fb8..c6c83456 100644 --- a/common/rdr/InStream.h +++ b/common/rdr/InStream.h @@ -25,10 +25,11 @@ #ifndef __RDR_INSTREAM_H__ #define __RDR_INSTREAM_H__ -#include <rdr/types.h> -#include <rdr/Exception.h> +#include <stdint.h> #include <string.h> // for memcpy +#include <rdr/Exception.h> + // Check that callers are using InStream properly, // useful when writing new protocol handling #ifdef _DEBUG @@ -122,16 +123,18 @@ namespace rdr { // readU/SN() methods read unsigned and signed N-bit integers. - inline U8 readU8() { check(1); return *ptr++; } - inline U16 readU16() { check(2); int b0 = *ptr++; int b1 = *ptr++; - return b0 << 8 | b1; } - inline U32 readU32() { check(4); int b0 = *ptr++; int b1 = *ptr++; - int b2 = *ptr++; int b3 = *ptr++; - return b0 << 24 | b1 << 16 | b2 << 8 | b3; } + inline uint8_t readU8() { check(1); return *ptr++; } + inline uint16_t readU16() { check(2); + int b0 = *ptr++; int b1 = *ptr++; + return b0 << 8 | b1; } + inline uint32_t readU32() { check(4); + int b0 = *ptr++; int b1 = *ptr++; + int b2 = *ptr++; int b3 = *ptr++; + return b0 << 24 | b1 << 16 | b2 << 8 | b3; } - inline S8 readS8() { return (S8) readU8(); } - inline S16 readS16() { return (S16)readU16(); } - inline S32 readS32() { return (S32)readU32(); } + inline int8_t readS8() { return (int8_t) readU8(); } + inline int16_t readS16() { return (int16_t)readU16(); } + inline int32_t readS32() { return (int32_t)readU32(); } // skip() ignores a number of bytes on the stream @@ -150,12 +153,17 @@ namespace rdr { // readOpaqueN() reads a quantity without byte-swapping. - inline U8 readOpaque8() { return readU8(); } - inline U16 readOpaque16() { check(2); U16 r; ((U8*)&r)[0] = *ptr++; - ((U8*)&r)[1] = *ptr++; return r; } - inline U32 readOpaque32() { check(4); U32 r; ((U8*)&r)[0] = *ptr++; - ((U8*)&r)[1] = *ptr++; ((U8*)&r)[2] = *ptr++; - ((U8*)&r)[3] = *ptr++; return r; } + inline uint8_t readOpaque8() { return readU8(); } + inline uint16_t readOpaque16() { check(2); uint16_t r; + ((uint8_t*)&r)[0] = *ptr++; + ((uint8_t*)&r)[1] = *ptr++; + return r; } + inline uint32_t readOpaque32() { check(4); uint32_t r; + ((uint8_t*)&r)[0] = *ptr++; + ((uint8_t*)&r)[1] = *ptr++; + ((uint8_t*)&r)[2] = *ptr++; + ((uint8_t*)&r)[3] = *ptr++; + return r; } // pos() returns the position in the stream. @@ -165,15 +173,15 @@ namespace rdr { // to the buffer. This is useful for a stream which is a wrapper around an // some other stream API. - inline const U8* getptr(size_t length) { check(length); - return ptr; } + inline const uint8_t* getptr(size_t length) { check(length); + return ptr; } inline void setptr(size_t length) { if (length > avail()) throw Exception("Input stream overflow"); skip(length); } private: - const U8* restorePoint; + const uint8_t* restorePoint; #ifdef RFB_INSTREAM_CHECK size_t checkedBytes; #endif @@ -201,8 +209,8 @@ namespace rdr { ,checkedBytes(0) #endif {} - const U8* ptr; - const U8* end; + const uint8_t* ptr; + const uint8_t* end; }; } diff --git a/common/rdr/MemInStream.h b/common/rdr/MemInStream.h index b54334ca..08f48392 100644 --- a/common/rdr/MemInStream.h +++ b/common/rdr/MemInStream.h @@ -19,8 +19,8 @@ // // rdr::MemInStream is an InStream which streams from a given memory buffer. // If the deleteWhenDone parameter is true then the buffer will be delete[]d in -// the destructor. Note that it is delete[]d as a U8* - strictly speaking this -// means it ought to be new[]ed as a U8* as well, but on most platforms this +// the destructor. Note that it is delete[]d as a uint8_t* - strictly speaking this +// means it ought to be new[]ed as a uint8_t* as well, but on most platforms this // doesn't matter. // @@ -37,7 +37,7 @@ namespace rdr { public: MemInStream(const void* data, size_t len, bool deleteWhenDone_=false) - : start((const U8*)data), deleteWhenDone(deleteWhenDone_) + : start((const uint8_t*)data), deleteWhenDone(deleteWhenDone_) { ptr = start; end = start + len; @@ -60,7 +60,7 @@ namespace rdr { private: bool overrun(size_t /*needed*/) { throw EndOfStream(); } - const U8* start; + const uint8_t* start; bool deleteWhenDone; }; diff --git a/common/rdr/MemOutStream.h b/common/rdr/MemOutStream.h index f8b4d93c..33920a4d 100644 --- a/common/rdr/MemOutStream.h +++ b/common/rdr/MemOutStream.h @@ -33,7 +33,7 @@ namespace rdr { public: MemOutStream(int len=1024) { - start = ptr = new U8[len]; + start = ptr = new uint8_t[len]; end = start + len; } @@ -63,7 +63,7 @@ namespace rdr { if (len < (size_t)(end - start)) throw Exception("Overflow in MemOutStream::overrun()"); - U8* newStart = new U8[len]; + uint8_t* newStart = new uint8_t[len]; memcpy(newStart, start, ptr - start); ptr = newStart + (ptr - start); delete [] start; @@ -71,7 +71,7 @@ namespace rdr { end = newStart + len; } - U8* start; + uint8_t* start; }; } diff --git a/common/rdr/OutStream.h b/common/rdr/OutStream.h index df1d8962..70216a2d 100644 --- a/common/rdr/OutStream.h +++ b/common/rdr/OutStream.h @@ -24,10 +24,11 @@ #ifndef __RDR_OUTSTREAM_H__ #define __RDR_OUTSTREAM_H__ -#include <rdr/types.h> +#include <stdint.h> +#include <string.h> // for memcpy + #include <rdr/Exception.h> #include <rdr/InStream.h> -#include <string.h> // for memcpy namespace rdr { @@ -51,14 +52,17 @@ namespace rdr { // writeU/SN() methods write unsigned and signed N-bit integers. - inline void writeU8( U8 u) { check(1); *ptr++ = u; } - inline void writeU16(U16 u) { check(2); *ptr++ = u >> 8; *ptr++ = (U8)u; } - inline void writeU32(U32 u) { check(4); *ptr++ = u >> 24; *ptr++ = u >> 16; - *ptr++ = u >> 8; *ptr++ = u; } + inline void writeU8( uint8_t u) { check(1); *ptr++ = u; } + inline void writeU16(uint16_t u) { check(2); *ptr++ = u >> 8; + *ptr++ = (uint8_t)u; } + inline void writeU32(uint32_t u) { check(4); *ptr++ = u >> 24; + *ptr++ = u >> 16; + *ptr++ = u >> 8; + *ptr++ = u; } - inline void writeS8( S8 s) { writeU8((U8)s); } - inline void writeS16(S16 s) { writeU16((U16)s); } - inline void writeS32(S32 s) { writeU32((U32)s); } + inline void writeS8( int8_t s) { writeU8((uint8_t)s); } + inline void writeS16(int16_t s) { writeU16((uint16_t)s); } + inline void writeS32(int32_t s) { writeU32((uint32_t)s); } inline void pad(size_t bytes) { while (bytes-- > 0) writeU8(0); @@ -74,7 +78,7 @@ namespace rdr { n = avail(); memcpy(ptr, data, n); ptr += n; - data = (U8*)data + n; + data = (uint8_t*)data + n; length -= n; } } @@ -95,13 +99,15 @@ namespace rdr { // writeOpaqueN() writes a quantity without byte-swapping. - inline void writeOpaque8( U8 u) { writeU8(u); } - inline void writeOpaque16(U16 u) { check(2); *ptr++ = ((U8*)&u)[0]; - *ptr++ = ((U8*)&u)[1]; } - inline void writeOpaque32(U32 u) { check(4); *ptr++ = ((U8*)&u)[0]; - *ptr++ = ((U8*)&u)[1]; - *ptr++ = ((U8*)&u)[2]; - *ptr++ = ((U8*)&u)[3]; } + inline void writeOpaque8( uint8_t u) { writeU8(u); } + inline void writeOpaque16(uint16_t u) { check(2); + *ptr++ = ((uint8_t*)&u)[0]; + *ptr++ = ((uint8_t*)&u)[1]; } + inline void writeOpaque32(uint32_t u) { check(4); + *ptr++ = ((uint8_t*)&u)[0]; + *ptr++ = ((uint8_t*)&u)[1]; + *ptr++ = ((uint8_t*)&u)[2]; + *ptr++ = ((uint8_t*)&u)[3]; } // length() returns the length of the stream. @@ -121,7 +127,7 @@ namespace rdr { // larger than the bytes actually written as doing so can result in // security issues. Use pad() in such cases instead. - inline U8* getptr(size_t length) { check(length); return ptr; } + inline uint8_t* getptr(size_t length) { check(length); return ptr; } inline void setptr(size_t length) { if (length > avail()) throw Exception("Output stream overflow"); ptr += length; } @@ -141,8 +147,8 @@ namespace rdr { protected: - U8* ptr; - U8* end; + uint8_t* ptr; + uint8_t* end; bool corked; }; diff --git a/common/rdr/RandomStream.cxx b/common/rdr/RandomStream.cxx index c9be704c..79a1a0f7 100644 --- a/common/rdr/RandomStream.cxx +++ b/common/rdr/RandomStream.cxx @@ -86,14 +86,14 @@ RandomStream::~RandomStream() { bool RandomStream::fillBuffer() { #ifdef RFB_HAVE_WINCRYPT if (provider) { - if (!CryptGenRandom(provider, availSpace(), (U8*)end)) + if (!CryptGenRandom(provider, availSpace(), (uint8_t*)end)) throw rdr::SystemException("unable to CryptGenRandom", GetLastError()); end += availSpace(); } else { #else #ifndef WIN32 if (fp) { - size_t n = fread((U8*)end, 1, availSpace(), fp); + size_t n = fread((uint8_t*)end, 1, availSpace(), fp); if (n <= 0) throw rdr::SystemException("reading /dev/urandom or /dev/random failed", errno); @@ -104,7 +104,7 @@ bool RandomStream::fillBuffer() { #endif #endif for (size_t i=availSpace(); i>0; i--) - *(U8*)end++ = (int) (256.0*rand()/(RAND_MAX+1.0)); + *(uint8_t*)end++ = (int) (256.0*rand()/(RAND_MAX+1.0)); } return true; diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx index aa552e86..f62d6d87 100644 --- a/common/rdr/TLSInStream.cxx +++ b/common/rdr/TLSInStream.cxx @@ -90,7 +90,7 @@ TLSInStream::~TLSInStream() bool TLSInStream::fillBuffer() { - size_t n = readTLS((U8*) end, availSpace()); + size_t n = readTLS((uint8_t*) end, availSpace()); if (n == 0) return false; end += n; @@ -98,7 +98,7 @@ bool TLSInStream::fillBuffer() return true; } -size_t TLSInStream::readTLS(U8* buf, size_t len) +size_t TLSInStream::readTLS(uint8_t* buf, size_t len) { int n; diff --git a/common/rdr/TLSInStream.h b/common/rdr/TLSInStream.h index 397a7b3d..5b1b716f 100644 --- a/common/rdr/TLSInStream.h +++ b/common/rdr/TLSInStream.h @@ -34,7 +34,7 @@ namespace rdr { private: virtual bool fillBuffer(); - size_t readTLS(U8* buf, size_t len); + size_t readTLS(uint8_t* buf, size_t len); static ssize_t pull(gnutls_transport_ptr_t str, void* data, size_t size); gnutls_session_t session; diff --git a/common/rdr/TLSOutStream.cxx b/common/rdr/TLSOutStream.cxx index cdfe9b12..0a88d18a 100644 --- a/common/rdr/TLSOutStream.cxx +++ b/common/rdr/TLSOutStream.cxx @@ -106,7 +106,7 @@ bool TLSOutStream::flushBuffer() return true; } -size_t TLSOutStream::writeTLS(const U8* data, size_t length) +size_t TLSOutStream::writeTLS(const uint8_t* data, size_t length) { int n; diff --git a/common/rdr/TLSOutStream.h b/common/rdr/TLSOutStream.h index 276e5c78..2d365f36 100644 --- a/common/rdr/TLSOutStream.h +++ b/common/rdr/TLSOutStream.h @@ -36,7 +36,7 @@ namespace rdr { private: virtual bool flushBuffer(); - size_t writeTLS(const U8* data, size_t length); + size_t writeTLS(const uint8_t* data, size_t length); static ssize_t push(gnutls_transport_ptr_t str, const void* data, size_t size); gnutls_session_t session; diff --git a/common/rdr/ZlibInStream.cxx b/common/rdr/ZlibInStream.cxx index 03df10cc..6441f0a1 100644 --- a/common/rdr/ZlibInStream.cxx +++ b/common/rdr/ZlibInStream.cxx @@ -94,7 +94,7 @@ bool ZlibInStream::fillBuffer() if (!underlying) throw Exception("ZlibInStream overrun: no underlying stream"); - zs->next_out = (U8*)end; + zs->next_out = (uint8_t*)end; zs->avail_out = availSpace(); if (!underlying->hasData(1)) @@ -102,7 +102,7 @@ bool ZlibInStream::fillBuffer() size_t length = underlying->avail(); if (length > bytesIn) length = bytesIn; - zs->next_in = (U8*)underlying->getptr(length); + zs->next_in = (uint8_t*)underlying->getptr(length); zs->avail_in = length; int rc = inflate(zs, Z_SYNC_FLUSH); diff --git a/common/rdr/types.h b/common/rdr/types.h index 05d27773..1a53edf7 100644 --- a/common/rdr/types.h +++ b/common/rdr/types.h @@ -19,57 +19,51 @@ #ifndef __RDR_TYPES_H__ #define __RDR_TYPES_H__ -namespace rdr { +#include <stdint.h> - typedef unsigned char U8; - typedef unsigned short U16; - typedef unsigned int U32; - typedef unsigned long long U64; - typedef signed char S8; - typedef signed short S16; - typedef signed int S32; +namespace rdr { class U8Array { public: U8Array() : buf(0) {} - U8Array(U8* a) : buf(a) {} // note: assumes ownership - U8Array(int len) : buf(new U8[len]) {} + U8Array(uint8_t* a) : buf(a) {} // note: assumes ownership + U8Array(int len) : buf(new uint8_t[len]) {} ~U8Array() { delete [] buf; } // Get the buffer pointer & clear it (i.e. caller takes ownership) - U8* takeBuf() { U8* tmp = buf; buf = 0; return tmp; } + uint8_t* takeBuf() { uint8_t* tmp = buf; buf = 0; return tmp; } - U8* buf; + uint8_t* buf; }; class U16Array { public: U16Array() : buf(0) {} - U16Array(U16* a) : buf(a) {} // note: assumes ownership - U16Array(int len) : buf(new U16[len]) {} + U16Array(uint16_t* a) : buf(a) {} // note: assumes ownership + U16Array(int len) : buf(new uint16_t[len]) {} ~U16Array() { delete [] buf; } - U16* takeBuf() { U16* tmp = buf; buf = 0; return tmp; } - U16* buf; + uint16_t* takeBuf() { uint16_t* tmp = buf; buf = 0; return tmp; } + uint16_t* buf; }; class U32Array { public: U32Array() : buf(0) {} - U32Array(U32* a) : buf(a) {} // note: assumes ownership - U32Array(int len) : buf(new U32[len]) {} + U32Array(uint32_t* a) : buf(a) {} // note: assumes ownership + U32Array(int len) : buf(new uint32_t[len]) {} ~U32Array() { delete [] buf; } - U32* takeBuf() { U32* tmp = buf; buf = 0; return tmp; } - U32* buf; + uint32_t* takeBuf() { uint32_t* tmp = buf; buf = 0; return tmp; } + uint32_t* buf; }; class S32Array { public: S32Array() : buf(0) {} - S32Array(S32* a) : buf(a) {} // note: assumes ownership - S32Array(int len) : buf(new S32[len]) {} + S32Array(int32_t* a) : buf(a) {} // note: assumes ownership + S32Array(int len) : buf(new int32_t[len]) {} ~S32Array() { delete [] buf; } - S32* takeBuf() { S32* tmp = buf; buf = 0; return tmp; } - S32* buf; + int32_t* takeBuf() { int32_t* tmp = buf; buf = 0; return tmp; } + int32_t* buf; }; } // end of namespace rdr diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 27942764..862c2c95 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -93,10 +93,10 @@ void CConnection::setFramebuffer(ModifiablePixelBuffer* fb) if ((framebuffer != NULL) && (fb != NULL)) { Rect rect; - const rdr::U8* data; + const uint8_t* data; int stride; - const rdr::U8 black[4] = { 0, 0, 0, 0 }; + const uint8_t black[4] = { 0, 0, 0, 0 }; // Copy still valid area @@ -210,7 +210,7 @@ bool CConnection::processSecurityTypesMsg() int secType = secTypeInvalid; - std::list<rdr::U8> secTypes; + std::list<uint8_t> secTypes; secTypes = security.GetEnabledSecTypes(); if (server.isVersion(3,3)) { @@ -225,7 +225,7 @@ bool CConnection::processSecurityTypesMsg() state_ = RFBSTATE_SECURITY_REASON; return true; } else if (secType == secTypeNone || secType == secTypeVncAuth) { - std::list<rdr::U8>::iterator i; + std::list<uint8_t>::iterator i; for (i = secTypes.begin(); i != secTypes.end(); i++) if (*i == secType) { secType = *i; @@ -259,10 +259,10 @@ bool CConnection::processSecurityTypesMsg() return true; } - std::list<rdr::U8>::iterator j; + std::list<uint8_t>::iterator j; for (int i = 0; i < nServerSecTypes; i++) { - rdr::U8 serverSecType = is->readU8(); + uint8_t serverSecType = is->readU8(); vlog.debug("Server offers security type %s(%d)", secTypeName(serverSecType), serverSecType); @@ -355,7 +355,7 @@ bool CConnection::processSecurityReasonMsg() is->setRestorePoint(); - rdr::U32 len = is->readU32(); + uint32_t len = is->readU32(); if (!is->hasDataOrRestore(len)) return false; is->clearRestorePoint(); @@ -553,10 +553,10 @@ void CConnection::serverCutText(const char* str) handleClipboardAnnounce(true); } -void CConnection::handleClipboardCaps(rdr::U32 flags, - const rdr::U32* lengths) +void CConnection::handleClipboardCaps(uint32_t flags, + const uint32_t* lengths) { - rdr::U32 sizes[] = { 0 }; + uint32_t sizes[] = { 0 }; CMsgHandler::handleClipboardCaps(flags, lengths); @@ -568,7 +568,7 @@ void CConnection::handleClipboardCaps(rdr::U32 flags, sizes); } -void CConnection::handleClipboardRequest(rdr::U32 flags) +void CConnection::handleClipboardRequest(uint32_t flags) { if (!(flags & rfb::clipboardUTF8)) { vlog.debug("Ignoring clipboard request for unsupported formats 0x%x", flags); @@ -587,7 +587,7 @@ void CConnection::handleClipboardPeek() writer()->writeClipboardNotify(hasLocalClipboard ? rfb::clipboardUTF8 : 0); } -void CConnection::handleClipboardNotify(rdr::U32 flags) +void CConnection::handleClipboardNotify(uint32_t flags) { strFree(serverClipboard); serverClipboard = NULL; @@ -600,9 +600,9 @@ void CConnection::handleClipboardNotify(rdr::U32 flags) } } -void CConnection::handleClipboardProvide(rdr::U32 flags, +void CConnection::handleClipboardProvide(uint32_t flags, const size_t* lengths, - const rdr::U8* const* data) + const uint8_t* const* data) { if (!(flags & rfb::clipboardUTF8)) { vlog.debug("Ignoring clipboard provide with unsupported formats 0x%x", flags); @@ -683,7 +683,7 @@ void CConnection::sendClipboardData(const char* data) if (server.clipboardFlags() & rfb::clipboardProvide) { CharArray filtered(convertCRLF(data)); size_t sizes[1] = { strlen(filtered.buf) + 1 }; - const rdr::U8* data[1] = { (const rdr::U8*)filtered.buf }; + const uint8_t* data[1] = { (const uint8_t*)filtered.buf }; if (unsolicitedClipboardAttempt) { unsolicitedClipboardAttempt = false; @@ -754,7 +754,7 @@ void CConnection::setPF(const PixelFormat& pf) formatChange = true; } -void CConnection::fence(rdr::U32 flags, unsigned len, const char data[]) +void CConnection::fence(uint32_t flags, unsigned len, const char data[]) { CMsgHandler::fence(flags, len, data); @@ -819,7 +819,7 @@ void CConnection::requestNewUpdate() void CConnection::updateEncodings() { - std::list<rdr::U32> encodings; + std::list<uint32_t> encodings; if (supportsLocalCursor) { encodings.push_back(pseudoEncodingCursorWithAlpha); diff --git a/common/rfb/CConnection.h b/common/rfb/CConnection.h index f6818628..7e5c611e 100644 --- a/common/rfb/CConnection.h +++ b/common/rfb/CConnection.h @@ -116,14 +116,14 @@ namespace rfb { virtual void serverCutText(const char* str); - virtual void handleClipboardCaps(rdr::U32 flags, - const rdr::U32* lengths); - virtual void handleClipboardRequest(rdr::U32 flags); + virtual void handleClipboardCaps(uint32_t flags, + const uint32_t* lengths); + virtual void handleClipboardRequest(uint32_t flags); virtual void handleClipboardPeek(); - virtual void handleClipboardNotify(rdr::U32 flags); - virtual void handleClipboardProvide(rdr::U32 flags, + virtual void handleClipboardNotify(uint32_t flags); + virtual void handleClipboardProvide(uint32_t flags, const size_t* lengths, - const rdr::U8* const* data); + const uint8_t* const* data); // Methods to be overridden in a derived class @@ -248,7 +248,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(rdr::U32 flags, unsigned len, const char data[]); + virtual void fence(uint32_t flags, unsigned len, const char data[]); private: bool processVersionMsg(); diff --git a/common/rfb/CMsgHandler.cxx b/common/rfb/CMsgHandler.cxx index f4f785b2..2f91d5a5 100644 --- a/common/rfb/CMsgHandler.cxx +++ b/common/rfb/CMsgHandler.cxx @@ -68,7 +68,7 @@ void CMsgHandler::setName(const char* name) server.setName(name); } -void CMsgHandler::fence(rdr::U32 /*flags*/, unsigned /*len*/, +void CMsgHandler::fence(uint32_t /*flags*/, unsigned /*len*/, const char /*data*/ []) { server.supportsFence = true; @@ -106,7 +106,7 @@ void CMsgHandler::setLEDState(unsigned int state) server.setLEDState(state); } -void CMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) +void CMsgHandler::handleClipboardCaps(uint32_t flags, const uint32_t* lengths) { int i; @@ -151,7 +151,7 @@ void CMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) server.setClipboardCaps(flags, lengths); } -void CMsgHandler::handleClipboardRequest(rdr::U32 /*flags*/) +void CMsgHandler::handleClipboardRequest(uint32_t /*flags*/) { } @@ -159,12 +159,12 @@ void CMsgHandler::handleClipboardPeek() { } -void CMsgHandler::handleClipboardNotify(rdr::U32 /*flags*/) +void CMsgHandler::handleClipboardNotify(uint32_t /*flags*/) { } -void CMsgHandler::handleClipboardProvide(rdr::U32 /*flags*/, +void CMsgHandler::handleClipboardProvide(uint32_t /*flags*/, const size_t* /*lengths*/, - const rdr::U8* const* /*data*/) + const uint8_t* const* /*data*/) { } diff --git a/common/rfb/CMsgHandler.h b/common/rfb/CMsgHandler.h index e358a4f4..eb16bc9f 100644 --- a/common/rfb/CMsgHandler.h +++ b/common/rfb/CMsgHandler.h @@ -24,7 +24,8 @@ #ifndef __RFB_CMSGHANDLER_H__ #define __RFB_CMSGHANDLER_H__ -#include <rdr/types.h> +#include <stdint.h> + #include <rfb/Pixel.h> #include <rfb/ServerParams.h> #include <rfb/Rect.h> @@ -51,11 +52,11 @@ namespace rfb { int w, int h, const ScreenSet& layout); virtual void setCursor(int width, int height, const Point& hotspot, - const rdr::U8* data) = 0; + const uint8_t* data) = 0; virtual void setCursorPos(const Point& pos) = 0; virtual void setPixelFormat(const PixelFormat& pf); virtual void setName(const char* name); - virtual void fence(rdr::U32 flags, unsigned len, const char data[]); + virtual void fence(uint32_t flags, unsigned len, const char data[]); virtual void endOfContinuousUpdates(); virtual void supportsQEMUKeyEvent(); virtual void serverInit(int width, int height, @@ -70,20 +71,20 @@ namespace rfb { virtual bool dataRect(const Rect& r, int encoding) = 0; virtual void setColourMapEntries(int firstColour, int nColours, - rdr::U16* rgbs) = 0; + uint16_t* rgbs) = 0; virtual void bell() = 0; virtual void serverCutText(const char* str) = 0; virtual void setLEDState(unsigned int state); - virtual void handleClipboardCaps(rdr::U32 flags, - const rdr::U32* lengths); - virtual void handleClipboardRequest(rdr::U32 flags); + virtual void handleClipboardCaps(uint32_t flags, + const uint32_t* lengths); + virtual void handleClipboardRequest(uint32_t flags); virtual void handleClipboardPeek(); - virtual void handleClipboardNotify(rdr::U32 flags); - virtual void handleClipboardProvide(rdr::U32 flags, + virtual void handleClipboardNotify(uint32_t flags); + virtual void handleClipboardProvide(uint32_t flags, const size_t* lengths, - const rdr::U8* const* data); + const uint8_t* const* data); ServerParams server; }; diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx index 1c175584..ad063627 100644 --- a/common/rfb/CMsgReader.cxx +++ b/common/rfb/CMsgReader.cxx @@ -26,6 +26,7 @@ #include <rdr/InStream.h> #include <rdr/ZlibInStream.h> +#include <rdr/types.h> #include <rfb/msgTypes.h> #include <rfb/clipboardTypes.h> @@ -54,7 +55,7 @@ CMsgReader::~CMsgReader() bool CMsgReader::readServerInit() { int width, height; - rdr::U32 len; + uint32_t len; if (!is->hasData(2 + 2 + 16 + 4)) return false; @@ -250,10 +251,10 @@ bool CMsgReader::readServerCutText() is->setRestorePoint(); is->skip(3); - rdr::U32 len = is->readU32(); + uint32_t len = is->readU32(); if (len & 0x80000000) { - rdr::S32 slen = len; + int32_t slen = len; slen = -slen; if (readExtendedClipboard(slen)) { is->clearRestorePoint(); @@ -281,10 +282,10 @@ bool CMsgReader::readServerCutText() return true; } -bool CMsgReader::readExtendedClipboard(rdr::S32 len) +bool CMsgReader::readExtendedClipboard(int32_t len) { - rdr::U32 flags; - rdr::U32 action; + uint32_t flags; + uint32_t action; if (!is->hasData(len)) return false; @@ -303,7 +304,7 @@ bool CMsgReader::readExtendedClipboard(rdr::S32 len) if (action & clipboardCaps) { int i; size_t num; - rdr::U32 lengths[16]; + uint32_t lengths[16]; num = 0; for (i = 0;i < 16;i++) { @@ -311,7 +312,7 @@ bool CMsgReader::readExtendedClipboard(rdr::S32 len) num++; } - if (len < (rdr::S32)(4 + 4*num)) + if (len < (int32_t)(4 + 4*num)) throw Exception("Invalid extended clipboard message"); num = 0; @@ -327,7 +328,7 @@ bool CMsgReader::readExtendedClipboard(rdr::S32 len) int i; size_t num; size_t lengths[16]; - rdr::U8* buffers[16]; + uint8_t* buffers[16]; zis.setUnderlying(is, len - 4); @@ -368,7 +369,7 @@ bool CMsgReader::readExtendedClipboard(rdr::S32 len) if (!zis.hasData(lengths[num])) throw Exception("Extended clipboard decode error"); - buffers[num] = new rdr::U8[lengths[num]]; + buffers[num] = new uint8_t[lengths[num]]; zis.readBytes(buffers[num], lengths[num]); num++; } @@ -405,8 +406,8 @@ bool CMsgReader::readExtendedClipboard(rdr::S32 len) bool CMsgReader::readFence() { - rdr::U32 flags; - rdr::U8 len; + uint32_t flags; + uint8_t len; char data[64]; if (!is->hasData(3 + 4 + 1)) @@ -479,15 +480,15 @@ bool CMsgReader::readSetXCursor(int width, int height, const Point& hotspot) rdr::U8Array rgba(width*height*4); if (width * height > 0) { - rdr::U8 pr, pg, pb; - rdr::U8 sr, sg, sb; + uint8_t pr, pg, pb; + uint8_t sr, sg, sb; int data_len = ((width+7)/8) * height; int mask_len = ((width+7)/8) * height; rdr::U8Array data(data_len); rdr::U8Array mask(mask_len); int x, y; - rdr::U8* out; + uint8_t* out; if (!is->hasData(3 + 3 + data_len + mask_len)) return false; @@ -547,8 +548,8 @@ bool CMsgReader::readSetCursor(int width, int height, const Point& hotspot) int x, y; rdr::U8Array rgba(width*height*4); - rdr::U8* in; - rdr::U8* out; + uint8_t* in; + uint8_t* out; if (!is->hasData(data_len + mask_len)) return false; @@ -592,7 +593,7 @@ bool CMsgReader::readSetCursorWithAlpha(int width, int height, const Point& hots bool ret; - rdr::U8* buf; + uint8_t* buf; int stride; // We can't use restore points as the decoder likely wants to as well, so @@ -621,7 +622,7 @@ bool CMsgReader::readSetCursorWithAlpha(int width, int height, const Point& hots assert(stride == width); for (int i = 0;i < pb.area();i++) { - rdr::U8 alpha; + uint8_t alpha; alpha = buf[3]; if (alpha == 0) @@ -647,7 +648,7 @@ bool CMsgReader::readSetVMwareCursor(int width, int height, const Point& hotspot if (width > maxCursorSize || height > maxCursorSize) throw Exception("Too big cursor"); - rdr::U8 type; + uint8_t type; if (!is->hasData(1 + 1)) return false; @@ -664,9 +665,9 @@ bool CMsgReader::readSetVMwareCursor(int width, int height, const Point& hotspot rdr::U8Array data(width*height*4); - rdr::U8* andIn; - rdr::U8* xorIn; - rdr::U8* out; + uint8_t* andIn; + uint8_t* xorIn; + uint8_t* out; int Bpp; if (!is->hasDataOrRestore(len + len)) @@ -690,7 +691,7 @@ bool CMsgReader::readSetVMwareCursor(int width, int height, const Point& hotspot xorIn += Bpp; if (andPixel == 0) { - rdr::U8 r, g, b; + uint8_t r, g, b; // Opaque pixel @@ -747,7 +748,7 @@ bool CMsgReader::readSetVMwareCursor(int width, int height, const Point& hotspot bool CMsgReader::readSetDesktopName(int x, int y, int w, int h) { - rdr::U32 len; + uint32_t len; if (!is->hasData(4)) return false; @@ -776,7 +777,7 @@ bool CMsgReader::readSetDesktopName(int x, int y, int w, int h) bool CMsgReader::readExtendedDesktopSize(int x, int y, int w, int h) { unsigned int screens, i; - rdr::U32 id, flags; + uint32_t id, flags; int sx, sy, sw, sh; ScreenSet layout; @@ -810,7 +811,7 @@ bool CMsgReader::readExtendedDesktopSize(int x, int y, int w, int h) bool CMsgReader::readLEDState() { - rdr::U8 state; + uint8_t state; if (!is->hasData(1)) return false; @@ -824,7 +825,7 @@ bool CMsgReader::readLEDState() bool CMsgReader::readVMwareLEDState() { - rdr::U32 state; + uint32_t state; if (!is->hasData(4)) return false; diff --git a/common/rfb/CMsgReader.h b/common/rfb/CMsgReader.h index ab55aed8..3b1c0ddb 100644 --- a/common/rfb/CMsgReader.h +++ b/common/rfb/CMsgReader.h @@ -24,7 +24,7 @@ #ifndef __RFB_CMSGREADER_H__ #define __RFB_CMSGREADER_H__ -#include <rdr/types.h> +#include <stdint.h> #include <rfb/Rect.h> #include <rfb/encodings.h> @@ -53,7 +53,7 @@ namespace rfb { bool readSetColourMapEntries(); bool readBell(); bool readServerCutText(); - bool readExtendedClipboard(rdr::S32 len); + bool readExtendedClipboard(int32_t len); bool readFence(); bool readEndOfContinuousUpdates(); @@ -83,7 +83,7 @@ namespace rfb { stateEnum state; - rdr::U8 currentMsgType; + uint8_t currentMsgType; int nUpdateRectsLeft; Rect dataRect; int rectEncoding; diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx index 0ac1bd73..246c5dbe 100644 --- a/common/rfb/CMsgWriter.cxx +++ b/common/rfb/CMsgWriter.cxx @@ -62,9 +62,9 @@ void CMsgWriter::writeSetPixelFormat(const PixelFormat& pf) endMsg(); } -void CMsgWriter::writeSetEncodings(const std::list<rdr::U32> encodings) +void CMsgWriter::writeSetEncodings(const std::list<uint32_t> encodings) { - std::list<rdr::U32>::const_iterator iter; + std::list<uint32_t>::const_iterator iter; startMsg(msgTypeSetEncodings); os->pad(1); os->writeU16(encodings.size()); @@ -130,7 +130,7 @@ void CMsgWriter::writeEnableContinuousUpdates(bool enable, endMsg(); } -void CMsgWriter::writeFence(rdr::U32 flags, unsigned len, const char data[]) +void CMsgWriter::writeFence(uint32_t flags, unsigned len, const char data[]) { if (!server->supportsFence) throw Exception("Server does not support fences"); @@ -150,7 +150,7 @@ void CMsgWriter::writeFence(rdr::U32 flags, unsigned len, const char data[]) endMsg(); } -void CMsgWriter::writeKeyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down) +void CMsgWriter::writeKeyEvent(uint32_t keysym, uint32_t keycode, bool down) { if (!server->supportsQEMUKeyEvent || !keycode) { /* This event isn't meaningful without a valid keysym */ @@ -204,8 +204,8 @@ void CMsgWriter::writeClientCutText(const char* str) endMsg(); } -void CMsgWriter::writeClipboardCaps(rdr::U32 caps, - const rdr::U32* lengths) +void CMsgWriter::writeClipboardCaps(uint32_t caps, + const uint32_t* lengths) { size_t i, count; @@ -233,7 +233,7 @@ void CMsgWriter::writeClipboardCaps(rdr::U32 caps, endMsg(); } -void CMsgWriter::writeClipboardRequest(rdr::U32 flags) +void CMsgWriter::writeClipboardRequest(uint32_t flags) { if (!(server->clipboardFlags() & clipboardRequest)) throw Exception("Server does not support clipboard \"request\" action"); @@ -245,7 +245,7 @@ void CMsgWriter::writeClipboardRequest(rdr::U32 flags) endMsg(); } -void CMsgWriter::writeClipboardPeek(rdr::U32 flags) +void CMsgWriter::writeClipboardPeek(uint32_t flags) { if (!(server->clipboardFlags() & clipboardPeek)) throw Exception("Server does not support clipboard \"peek\" action"); @@ -257,7 +257,7 @@ void CMsgWriter::writeClipboardPeek(rdr::U32 flags) endMsg(); } -void CMsgWriter::writeClipboardNotify(rdr::U32 flags) +void CMsgWriter::writeClipboardNotify(uint32_t flags) { if (!(server->clipboardFlags() & clipboardNotify)) throw Exception("Server does not support clipboard \"notify\" action"); @@ -269,9 +269,9 @@ void CMsgWriter::writeClipboardNotify(rdr::U32 flags) endMsg(); } -void CMsgWriter::writeClipboardProvide(rdr::U32 flags, +void CMsgWriter::writeClipboardProvide(uint32_t flags, const size_t* lengths, - const rdr::U8* const* data) + const uint8_t* const* data) { rdr::MemOutStream mos; rdr::ZlibOutStream zos; diff --git a/common/rfb/CMsgWriter.h b/common/rfb/CMsgWriter.h index 7b839393..7e7a9a17 100644 --- a/common/rfb/CMsgWriter.h +++ b/common/rfb/CMsgWriter.h @@ -25,7 +25,7 @@ #include <list> -#include <rdr/types.h> +#include <stdint.h> namespace rdr { class OutStream; } @@ -45,25 +45,25 @@ namespace rfb { void writeClientInit(bool shared); void writeSetPixelFormat(const PixelFormat& pf); - void writeSetEncodings(const std::list<rdr::U32> encodings); + void writeSetEncodings(const std::list<uint32_t> encodings); void writeSetDesktopSize(int width, int height, const ScreenSet& layout); void writeFramebufferUpdateRequest(const Rect& r,bool incremental); void writeEnableContinuousUpdates(bool enable, int x, int y, int w, int h); - void writeFence(rdr::U32 flags, unsigned len, const char data[]); + void writeFence(uint32_t flags, unsigned len, const char data[]); - void writeKeyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); + void writeKeyEvent(uint32_t keysym, uint32_t keycode, bool down); void writePointerEvent(const Point& pos, int buttonMask); void writeClientCutText(const char* str); - void writeClipboardCaps(rdr::U32 caps, const rdr::U32* lengths); - void writeClipboardRequest(rdr::U32 flags); - void writeClipboardPeek(rdr::U32 flags); - void writeClipboardNotify(rdr::U32 flags); - void writeClipboardProvide(rdr::U32 flags, const size_t* lengths, - const rdr::U8* const* data); + void writeClipboardCaps(uint32_t caps, const uint32_t* lengths); + void writeClipboardRequest(uint32_t flags); + void writeClipboardPeek(uint32_t flags); + void writeClipboardNotify(uint32_t flags); + void writeClipboardProvide(uint32_t flags, const size_t* lengths, + const uint8_t* const* data); protected: void startMsg(int type); diff --git a/common/rfb/CSecurityDH.cxx b/common/rfb/CSecurityDH.cxx index d9b09bfb..c9b2a2cf 100644 --- a/common/rfb/CSecurityDH.cxx +++ b/common/rfb/CSecurityDH.cxx @@ -39,6 +39,7 @@ #include <rdr/InStream.h> #include <rdr/OutStream.h> #include <rdr/RandomStream.h> +#include <rdr/types.h> #include <rfb/Exception.h> #include <os/os.h> @@ -83,7 +84,7 @@ bool CSecurityDH::readKey() if (!is->hasData(4)) return false; is->setRestorePoint(); - rdr::U16 gen = is->readU16(); + uint16_t gen = is->readU16(); keyLength = is->readU16(); if (keyLength < MinKeyLength) throw AuthFailureException("DH key is too short"); @@ -121,7 +122,7 @@ void CSecurityDH::writeCredentials() rdr::U8Array BBytes(keyLength); nettle_mpz_get_str_256(keyLength, sharedSecret.buf, k); nettle_mpz_get_str_256(keyLength, BBytes.buf, B); - rdr::U8 key[16]; + uint8_t key[16]; struct md5_ctx md5Ctx; md5_init(&md5Ctx); md5_update(&md5Ctx, keyLength, sharedSecret.buf); @@ -141,7 +142,7 @@ void CSecurityDH::writeCredentials() if (len >= 64) throw AuthFailureException("password is too long"); memcpy(buf + 64, password.buf, len + 1); - aes128_encrypt(&aesCtx, 128, (rdr::U8 *)buf, (rdr::U8 *)buf); + aes128_encrypt(&aesCtx, 128, (uint8_t *)buf, (uint8_t *)buf); rdr::OutStream* os = cc->getOutStream(); os->writeBytes(buf, 128); diff --git a/common/rfb/CSecurityMSLogonII.cxx b/common/rfb/CSecurityMSLogonII.cxx index a1faab85..bb7e27c7 100644 --- a/common/rfb/CSecurityMSLogonII.cxx +++ b/common/rfb/CSecurityMSLogonII.cxx @@ -39,6 +39,7 @@ #include <rdr/InStream.h> #include <rdr/OutStream.h> #include <rdr/RandomStream.h> +#include <rdr/types.h> #include <rfb/Exception.h> #include <os/os.h> @@ -79,9 +80,9 @@ bool CSecurityMSLogonII::readKey() rdr::InStream* is = cc->getInStream(); if (!is->hasData(24)) return false; - rdr::U8 gBytes[8]; - rdr::U8 pBytes[8]; - rdr::U8 ABytes[8]; + uint8_t gBytes[8]; + uint8_t pBytes[8]; + uint8_t ABytes[8]; is->readBytes(gBytes, 8); is->readBytes(pBytes, 8); is->readBytes(ABytes, 8); @@ -106,15 +107,15 @@ void CSecurityMSLogonII::writeCredentials() mpz_powm(k, A, b, p); mpz_powm(B, g, b, p); - rdr::U8 key[8]; - rdr::U8 reversedKey[8]; - rdr::U8 BBytes[8]; - rdr::U8 user[256]; - rdr::U8 pass[64]; + uint8_t key[8]; + uint8_t reversedKey[8]; + uint8_t BBytes[8]; + uint8_t user[256]; + uint8_t pass[64]; nettle_mpz_get_str_256(8, key, k); nettle_mpz_get_str_256(8, BBytes, B); for (int i = 0; i < 8; ++i) { - rdr::U8 x = 0; + uint8_t x = 0; for (int j = 0; j < 8; ++j) { x |= ((key[i] >> j) & 1) << (7 - j); } diff --git a/common/rfb/CSecurityRSAAES.cxx b/common/rfb/CSecurityRSAAES.cxx index c84422b6..b1c273a4 100644 --- a/common/rfb/CSecurityRSAAES.cxx +++ b/common/rfb/CSecurityRSAAES.cxx @@ -55,7 +55,7 @@ const int MaxKeyLength = 8192; using namespace rfb; -CSecurityRSAAES::CSecurityRSAAES(CConnection* cc, rdr::U32 _secType, +CSecurityRSAAES::CSecurityRSAAES(CConnection* cc, uint32_t _secType, int _keySize, bool _isAllEncrypted) : CSecurity(cc), state(ReadPublicKey), keySize(_keySize), isAllEncrypted(_isAllEncrypted), secType(_secType), @@ -155,8 +155,8 @@ void CSecurityRSAAES::writePublicKey() if (!rsa_generate_keypair(&clientPublicKey, &clientKey, &rs, random_func, NULL, NULL, clientKeyLength, 0)) throw AuthFailureException("failed to generate key"); - clientKeyN = new rdr::U8[rsaKeySize]; - clientKeyE = new rdr::U8[rsaKeySize]; + clientKeyN = new uint8_t[rsaKeySize]; + clientKeyE = new uint8_t[rsaKeySize]; nettle_mpz_get_str_256(rsaKeySize, clientKeyN, clientPublicKey.n); nettle_mpz_get_str_256(rsaKeySize, clientKeyE, clientPublicKey.e); os->writeU32(clientKeyLength); @@ -180,8 +180,8 @@ bool CSecurityRSAAES::readPublicKey() if (!is->hasDataOrRestore(size * 2)) return false; is->clearRestorePoint(); - serverKeyE = new rdr::U8[size]; - serverKeyN = new rdr::U8[size]; + serverKeyE = new uint8_t[size]; + serverKeyN = new uint8_t[size]; is->readBytes(serverKeyN, size); is->readBytes(serverKeyE, size); rsa_public_key_init(&serverKey); @@ -194,13 +194,13 @@ bool CSecurityRSAAES::readPublicKey() void CSecurityRSAAES::verifyServer() { - rdr::U8 lenServerKey[4] = { - (rdr::U8)((serverKeyLength & 0xff000000) >> 24), - (rdr::U8)((serverKeyLength & 0xff0000) >> 16), - (rdr::U8)((serverKeyLength & 0xff00) >> 8), - (rdr::U8)(serverKeyLength & 0xff) + uint8_t lenServerKey[4] = { + (uint8_t)((serverKeyLength & 0xff000000) >> 24), + (uint8_t)((serverKeyLength & 0xff0000) >> 16), + (uint8_t)((serverKeyLength & 0xff00) >> 8), + (uint8_t)(serverKeyLength & 0xff) }; - rdr::U8 f[8]; + uint8_t f[8]; struct sha1_ctx ctx; sha1_init(&ctx); sha1_update(&ctx, 4, lenServerKey); @@ -238,7 +238,7 @@ void CSecurityRSAAES::writeRandom() mpz_clear(x); throw AuthFailureException("failed to encrypt random"); } - rdr::U8* buffer = new rdr::U8[serverKey.size]; + uint8_t* buffer = new uint8_t[serverKey.size]; nettle_mpz_get_str_256(serverKey.size, buffer, x); mpz_clear(x); os->writeU16(serverKey.size); @@ -259,7 +259,7 @@ bool CSecurityRSAAES::readRandom() if (!is->hasDataOrRestore(size)) return false; is->clearRestorePoint(); - rdr::U8* buffer = new rdr::U8[size]; + uint8_t* buffer = new uint8_t[size]; is->readBytes(buffer, size); size_t randomSize = keySize / 8; mpz_t x; @@ -278,7 +278,7 @@ void CSecurityRSAAES::setCipher() { rawis = cc->getInStream(); rawos = cc->getOutStream(); - rdr::U8 key[32]; + uint8_t key[32]; if (keySize == 128) { struct sha1_ctx ctx; sha1_init(&ctx); @@ -310,20 +310,20 @@ void CSecurityRSAAES::setCipher() void CSecurityRSAAES::writeHash() { - rdr::U8 hash[32]; + uint8_t hash[32]; size_t len = serverKeyLength; - rdr::U8 lenServerKey[4] = { - (rdr::U8)((len & 0xff000000) >> 24), - (rdr::U8)((len & 0xff0000) >> 16), - (rdr::U8)((len & 0xff00) >> 8), - (rdr::U8)(len & 0xff) + uint8_t lenServerKey[4] = { + (uint8_t)((len & 0xff000000) >> 24), + (uint8_t)((len & 0xff0000) >> 16), + (uint8_t)((len & 0xff00) >> 8), + (uint8_t)(len & 0xff) }; len = clientKeyLength; - rdr::U8 lenClientKey[4] = { - (rdr::U8)((len & 0xff000000) >> 24), - (rdr::U8)((len & 0xff0000) >> 16), - (rdr::U8)((len & 0xff00) >> 8), - (rdr::U8)(len & 0xff) + uint8_t lenClientKey[4] = { + (uint8_t)((len & 0xff000000) >> 24), + (uint8_t)((len & 0xff0000) >> 16), + (uint8_t)((len & 0xff00) >> 8), + (uint8_t)(len & 0xff) }; int hashSize; if (keySize == 128) { @@ -355,25 +355,25 @@ void CSecurityRSAAES::writeHash() bool CSecurityRSAAES::readHash() { - rdr::U8 hash[32]; - rdr::U8 realHash[32]; + uint8_t hash[32]; + uint8_t realHash[32]; int hashSize = keySize == 128 ? 20 : 32; if (!rais->hasData(hashSize)) return false; rais->readBytes(hash, hashSize); size_t len = serverKeyLength; - rdr::U8 lenServerKey[4] = { - (rdr::U8)((len & 0xff000000) >> 24), - (rdr::U8)((len & 0xff0000) >> 16), - (rdr::U8)((len & 0xff00) >> 8), - (rdr::U8)(len & 0xff) + uint8_t lenServerKey[4] = { + (uint8_t)((len & 0xff000000) >> 24), + (uint8_t)((len & 0xff0000) >> 16), + (uint8_t)((len & 0xff00) >> 8), + (uint8_t)(len & 0xff) }; len = clientKeyLength; - rdr::U8 lenClientKey[4] = { - (rdr::U8)((len & 0xff000000) >> 24), - (rdr::U8)((len & 0xff0000) >> 16), - (rdr::U8)((len & 0xff00) >> 8), - (rdr::U8)(len & 0xff) + uint8_t lenClientKey[4] = { + (uint8_t)((len & 0xff000000) >> 24), + (uint8_t)((len & 0xff0000) >> 16), + (uint8_t)((len & 0xff00) >> 8), + (uint8_t)(len & 0xff) }; if (keySize == 128) { struct sha1_ctx ctx; @@ -458,4 +458,4 @@ void CSecurityRSAAES::writeCredentials() if (len) raos->writeBytes(password.buf, len); raos->flush(); -}
\ No newline at end of file +} diff --git a/common/rfb/CSecurityRSAAES.h b/common/rfb/CSecurityRSAAES.h index f58bb87f..543b0152 100644 --- a/common/rfb/CSecurityRSAAES.h +++ b/common/rfb/CSecurityRSAAES.h @@ -36,7 +36,7 @@ namespace rfb { class UserMsgBox; class CSecurityRSAAES : public CSecurity { public: - CSecurityRSAAES(CConnection* cc, rdr::U32 secType, + CSecurityRSAAES(CConnection* cc, uint32_t secType, int keySize, bool isAllEncrypted); virtual ~CSecurityRSAAES(); virtual bool processMsg(); @@ -62,19 +62,19 @@ namespace rfb { int state; int keySize; bool isAllEncrypted; - rdr::U32 secType; - rdr::U8 subtype; + uint32_t secType; + uint8_t subtype; struct rsa_private_key clientKey; struct rsa_public_key clientPublicKey; struct rsa_public_key serverKey; - rdr::U32 serverKeyLength; - rdr::U8* serverKeyN; - rdr::U8* serverKeyE; - rdr::U32 clientKeyLength; - rdr::U8* clientKeyN; - rdr::U8* clientKeyE; - rdr::U8 serverRandom[32]; - rdr::U8 clientRandom[32]; + uint32_t serverKeyLength; + uint8_t* serverKeyN; + uint8_t* serverKeyE; + uint32_t clientKeyLength; + uint8_t* clientKeyN; + uint8_t* clientKeyE; + uint8_t serverRandom[32]; + uint8_t clientRandom[32]; rdr::InStream* rais; rdr::OutStream* raos; diff --git a/common/rfb/CSecurityVeNCrypt.cxx b/common/rfb/CSecurityVeNCrypt.cxx index 046cd8d0..59be49a0 100644 --- a/common/rfb/CSecurityVeNCrypt.cxx +++ b/common/rfb/CSecurityVeNCrypt.cxx @@ -86,7 +86,8 @@ bool CSecurityVeNCrypt::processMsg() } /* major version in upper 8 bits and minor version in lower 8 bits */ - U16 Version = (((U16) majorVersion) << 8) | ((U16) minorVersion); + uint16_t Version = (((uint16_t) majorVersion) << 8) | + ((uint16_t) minorVersion); if (!haveSentVersion) { /* Currently we don't support former VeNCrypt 0.1 */ @@ -131,7 +132,7 @@ bool CSecurityVeNCrypt::processMsg() if (!nAvailableTypes) throw AuthFailureException("The server reported no VeNCrypt sub-types"); - availableTypes = new rdr::U32[nAvailableTypes]; + availableTypes = new uint32_t[nAvailableTypes]; haveNumberOfTypes = true; } @@ -154,9 +155,9 @@ bool CSecurityVeNCrypt::processMsg() /* make a choice and send it to the server, meanwhile set up the stack */ if (!haveChosenType) { chosenType = secTypeInvalid; - U8 i; - list<U32>::iterator j; - list<U32> secTypes; + uint8_t i; + list<uint32_t>::iterator j; + list<uint32_t> secTypes; secTypes = security->GetEnabledExtSecTypes(); diff --git a/common/rfb/CSecurityVeNCrypt.h b/common/rfb/CSecurityVeNCrypt.h index d087b2a4..476bf813 100644 --- a/common/rfb/CSecurityVeNCrypt.h +++ b/common/rfb/CSecurityVeNCrypt.h @@ -25,9 +25,10 @@ #ifndef __CSECURITYVENCRYPT_H__ #define __CSECURITYVENCRYPT_H__ +#include <stdint.h> + #include <rfb/CSecurity.h> #include <rfb/SecurityClient.h> -#include <rdr/types.h> namespace rfb { @@ -50,10 +51,10 @@ namespace rfb { bool haveListOfTypes; bool haveNumberOfTypes; bool haveChosenType; - rdr::U8 majorVersion, minorVersion; - rdr::U32 chosenType; - rdr::U8 nAvailableTypes; - rdr::U32 *availableTypes; + uint8_t majorVersion, minorVersion; + uint32_t chosenType; + uint8_t nAvailableTypes; + uint32_t *availableTypes; }; } #endif diff --git a/common/rfb/CSecurityVncAuth.cxx b/common/rfb/CSecurityVncAuth.cxx index a899b5e7..41eb5484 100644 --- a/common/rfb/CSecurityVncAuth.cxx +++ b/common/rfb/CSecurityVncAuth.cxx @@ -53,13 +53,13 @@ bool CSecurityVncAuth::processMsg() return false; // Read the challenge & obtain the user's password - rdr::U8 challenge[vncAuthChallengeSize]; + uint8_t challenge[vncAuthChallengeSize]; is->readBytes(challenge, vncAuthChallengeSize); PlainPasswd passwd; (CSecurity::upg)->getUserPasswd(cc->isSecure(), 0, &passwd.buf); // Calculate the correct response - rdr::U8 key[8]; + uint8_t key[8]; int pwdLen = strlen(passwd.buf); for (int i=0; i<8; i++) key[i] = i<pwdLen ? passwd.buf[i] : 0; diff --git a/common/rfb/ClientParams.cxx b/common/rfb/ClientParams.cxx index d933aa34..572e2d82 100644 --- a/common/rfb/ClientParams.cxx +++ b/common/rfb/ClientParams.cxx @@ -95,12 +95,12 @@ void ClientParams::setCursorPos(const Point& pos) cursorPos_ = pos; } -bool ClientParams::supportsEncoding(rdr::S32 encoding) const +bool ClientParams::supportsEncoding(int32_t encoding) const { return encodings_.count(encoding) != 0; } -void ClientParams::setEncodings(int nEncodings, const rdr::S32* encodings) +void ClientParams::setEncodings(int nEncodings, const int32_t* encodings) { compressLevel = -1; qualityLevel = -1; @@ -153,7 +153,7 @@ void ClientParams::setLEDState(unsigned int state) ledState_ = state; } -rdr::U32 ClientParams::clipboardSize(unsigned int format) const +uint32_t ClientParams::clipboardSize(unsigned int format) const { int i; @@ -165,7 +165,7 @@ rdr::U32 ClientParams::clipboardSize(unsigned int format) const throw Exception("Invalid clipboard format 0x%x", format); } -void ClientParams::setClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) +void ClientParams::setClipboardCaps(uint32_t flags, const uint32_t* lengths) { int i, num; diff --git a/common/rfb/ClientParams.h b/common/rfb/ClientParams.h index a78ad14c..0f4171cc 100644 --- a/common/rfb/ClientParams.h +++ b/common/rfb/ClientParams.h @@ -25,7 +25,8 @@ #include <set> -#include <rdr/types.h> +#include <stdint.h> + #include <rfb/Cursor.h> #include <rfb/PixelFormat.h> #include <rfb/ScreenSet.h> @@ -80,16 +81,16 @@ namespace rfb { const Point& cursorPos() const { return cursorPos_; } void setCursorPos(const Point& pos); - bool supportsEncoding(rdr::S32 encoding) const; + bool supportsEncoding(int32_t encoding) const; - void setEncodings(int nEncodings, const rdr::S32* encodings); + void setEncodings(int nEncodings, const int32_t* encodings); unsigned int ledState() { return ledState_; } void setLEDState(unsigned int state); - rdr::U32 clipboardFlags() const { return clipFlags; } - rdr::U32 clipboardSize(unsigned int format) const; - void setClipboardCaps(rdr::U32 flags, const rdr::U32* lengths); + uint32_t clipboardFlags() const { return clipFlags; } + uint32_t clipboardSize(unsigned int format) const; + void setClipboardCaps(uint32_t flags, const uint32_t* lengths); // Wrappers to check for functionality rather than specific // encodings @@ -115,10 +116,10 @@ namespace rfb { char* name_; Cursor* cursor_; Point cursorPos_; - std::set<rdr::S32> encodings_; + std::set<int32_t> encodings_; unsigned int ledState_; - rdr::U32 clipFlags; - rdr::U32 clipSizes[16]; + uint32_t clipFlags; + uint32_t clipSizes[16]; }; } #endif diff --git a/common/rfb/ComparingUpdateTracker.cxx b/common/rfb/ComparingUpdateTracker.cxx index e0964ac2..85065d7e 100644 --- a/common/rfb/ComparingUpdateTracker.cxx +++ b/common/rfb/ComparingUpdateTracker.cxx @@ -23,7 +23,7 @@ #include <stdio.h> #include <string.h> #include <vector> -#include <rdr/types.h> + #include <rfb/Exception.h> #include <rfb/LogWriter.h> #include <rfb/ComparingUpdateTracker.h> @@ -62,7 +62,7 @@ bool ComparingUpdateTracker::compare() for (int y=0; y<fb->height(); y+=BLOCK_SIZE) { Rect pos(0, y, fb->width(), __rfbmin(fb->height(), y+BLOCK_SIZE)); int srcStride; - const rdr::U8* srcData = fb->getBuffer(pos, &srcStride); + const uint8_t* srcData = fb->getBuffer(pos, &srcStride); oldFb.imageRect(pos, srcData, srcStride); } @@ -122,7 +122,7 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged) int bytesPerPixel = fb->getPF().bpp/8; int oldStride; - rdr::U8* oldData = oldFb.getBufferRW(r, &oldStride); + uint8_t* oldData = oldFb.getBufferRW(r, &oldStride); int oldStrideBytes = oldStride * bytesPerPixel; // Used to efficiently crop the left and right of the change rectangle @@ -134,16 +134,16 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged) // Get a strip of the source buffer Rect pos(r.tl.x, blockTop, r.br.x, __rfbmin(r.br.y, blockTop+BLOCK_SIZE)); int fbStride; - const rdr::U8* newBlockPtr = fb->getBuffer(pos, &fbStride); + const uint8_t* newBlockPtr = fb->getBuffer(pos, &fbStride); int newStrideBytes = fbStride * bytesPerPixel; - rdr::U8* oldBlockPtr = oldData; + uint8_t* oldBlockPtr = oldData; int blockBottom = __rfbmin(blockTop+BLOCK_SIZE, r.br.y); for (int blockLeft = r.tl.x; blockLeft < r.br.x; blockLeft += BLOCK_SIZE) { - const rdr::U8* newPtr = newBlockPtr; - rdr::U8* oldPtr = oldBlockPtr; + const uint8_t* newPtr = newBlockPtr; + uint8_t* oldPtr = oldBlockPtr; int blockRight = __rfbmin(blockLeft+BLOCK_SIZE, r.br.x); int blockWidthInBytes = (blockRight-blockLeft) * bytesPerPixel; @@ -160,8 +160,8 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged) // For every unchanged row at the bottom of the block, decrement change height { - const rdr::U8* newRowPtr = newPtr + ((changeHeight - 1) * newStrideBytes); - const rdr::U8* oldRowPtr = oldPtr + ((changeHeight - 1) * oldStrideBytes); + const uint8_t* newRowPtr = newPtr + ((changeHeight - 1) * newStrideBytes); + const uint8_t* oldRowPtr = oldPtr + ((changeHeight - 1) * oldStrideBytes); while (changeHeight > 1 && memcmp(oldRowPtr, newRowPtr, blockWidthInBytes) == 0) { newRowPtr -= newStrideBytes; @@ -173,12 +173,12 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged) // For every unchanged column at the left of the block, increment change left { - const rdr::U8* newColumnPtr = newPtr; - const rdr::U8* oldColumnPtr = oldPtr; + const uint8_t* newColumnPtr = newPtr; + const uint8_t* oldColumnPtr = oldPtr; while (changeLeft + minCompareWidthInPixels < changeRight) { - const rdr::U8* newRowPtr = newColumnPtr; - const rdr::U8* oldRowPtr = oldColumnPtr; + const uint8_t* newRowPtr = newColumnPtr; + const uint8_t* oldRowPtr = oldColumnPtr; for (int row = 0; row < changeHeight; row++) { if (memcmp(oldRowPtr, newRowPtr, minCompareWidthInBytes) != 0) @@ -198,15 +198,15 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged) // For every unchanged column at the right of the block, decrement change right { - const rdr::U8* newColumnPtr = newPtr + blockWidthInBytes; - const rdr::U8* oldColumnPtr = oldPtr + blockWidthInBytes; + const uint8_t* newColumnPtr = newPtr + blockWidthInBytes; + const uint8_t* oldColumnPtr = oldPtr + blockWidthInBytes; while (changeLeft + minCompareWidthInPixels < changeRight) { newColumnPtr -= minCompareWidthInBytes; oldColumnPtr -= minCompareWidthInBytes; - const rdr::U8* newRowPtr = newColumnPtr; - const rdr::U8* oldRowPtr = oldColumnPtr; + const uint8_t* newRowPtr = newColumnPtr; + const uint8_t* oldRowPtr = oldColumnPtr; for (int row = 0; row < changeHeight; row++) { if (memcmp(oldRowPtr, newRowPtr, minCompareWidthInBytes) != 0) diff --git a/common/rfb/Cursor.cxx b/common/rfb/Cursor.cxx index 425cc8c4..dcb28ccb 100644 --- a/common/rfb/Cursor.cxx +++ b/common/rfb/Cursor.cxx @@ -23,6 +23,7 @@ #include <assert.h> #include <string.h> +#include <rdr/types.h> #include <rfb/Cursor.h> #include <rfb/LogWriter.h> #include <rfb/Exception.h> @@ -32,10 +33,10 @@ using namespace rfb; static LogWriter vlog("Cursor"); Cursor::Cursor(int width, int height, const Point& hotspot, - const rdr::U8* data) : + const uint8_t* data) : width_(width), height_(height), hotspot_(hotspot) { - this->data = new rdr::U8[width_*height_*4]; + this->data = new uint8_t[width_*height_*4]; memcpy(this->data, data, width_*height_*4); } @@ -43,7 +44,7 @@ Cursor::Cursor(const Cursor& other) : width_(other.width_), height_(other.height_), hotspot_(other.hotspot_) { - data = new rdr::U8[width_*height_*4]; + data = new uint8_t[width_*height_*4]; memcpy(data, other.data, width_*height_*4); } @@ -81,7 +82,7 @@ static unsigned short srgb_to_lin(unsigned char srgb) } // Floyd-Steinberg dithering -static void dither(int width, int height, rdr::S32* data) +static void dither(int width, int height, int32_t* data) { for (int y = 0; y < height; y++) { for (int x_ = 0; x_ < width; x_++) { @@ -124,21 +125,21 @@ static void dither(int width, int height, rdr::S32* data) } } -rdr::U8* Cursor::getBitmap() const +uint8_t* Cursor::getBitmap() const { // First step is converting to luminance rdr::S32Array luminance(width()*height()); - rdr::S32 *lum_ptr = luminance.buf; - const rdr::U8 *data_ptr = data; + int32_t *lum_ptr = luminance.buf; + const uint8_t *data_ptr = data; for (int y = 0; y < height(); y++) { for (int x = 0; x < width(); x++) { - rdr::S32 lum; + int32_t lum; // Use BT.709 coefficients for grayscale lum = 0; - lum += (rdr::U32)srgb_to_lin(data_ptr[0]) * 6947; // 0.2126 - lum += (rdr::U32)srgb_to_lin(data_ptr[1]) * 23436; // 0.7152 - lum += (rdr::U32)srgb_to_lin(data_ptr[2]) * 2366; // 0.0722 + lum += (uint32_t)srgb_to_lin(data_ptr[0]) * 6947; // 0.2126 + lum += (uint32_t)srgb_to_lin(data_ptr[1]) * 23436; // 0.7152 + lum += (uint32_t)srgb_to_lin(data_ptr[2]) * 2366; // 0.0722 lum /= 32768; *lum_ptr++ = lum; @@ -169,15 +170,15 @@ rdr::U8* Cursor::getBitmap() const return source.takeBuf(); } -rdr::U8* Cursor::getMask() const +uint8_t* Cursor::getMask() const { // First step is converting to integer array rdr::S32Array alpha(width()*height()); - rdr::S32 *alpha_ptr = alpha.buf; - const rdr::U8 *data_ptr = data; + int32_t *alpha_ptr = alpha.buf; + const uint8_t *data_ptr = data; for (int y = 0; y < height(); y++) { for (int x = 0; x < width(); x++) { - *alpha_ptr++ = (rdr::U32)data_ptr[3] * 65535 / 255; + *alpha_ptr++ = (uint32_t)data_ptr[3] * 65535 / 255; data_ptr += 4; } } @@ -217,7 +218,7 @@ void Cursor::crop() busy = busy.intersect(Rect(hotspot_.x, hotspot_.y, hotspot_.x+1, hotspot_.y+1)); int x, y; - rdr::U8 *data_ptr = data; + uint8_t *data_ptr = data; for (y = 0; y < height(); y++) { for (x = 0; x < width(); x++) { if (data_ptr[3] > 0) { @@ -234,7 +235,7 @@ void Cursor::crop() // Copy the pixel data int newDataLen = busy.area() * 4; - rdr::U8* newData = new rdr::U8[newDataLen]; + uint8_t* newData = new uint8_t[newDataLen]; data_ptr = newData; for (y = busy.tl.y; y < busy.br.y; y++) { memcpy(data_ptr, data + y*width()*4 + busy.tl.x*4, busy.width()*4); @@ -253,7 +254,7 @@ RenderedCursor::RenderedCursor() { } -const rdr::U8* RenderedCursor::getBuffer(const Rect& _r, int* stride) const +const uint8_t* RenderedCursor::getBuffer(const Rect& _r, int* stride) const { Rect r; @@ -270,7 +271,7 @@ void RenderedCursor::update(PixelBuffer* framebuffer, Point rawOffset, diff; Rect clippedRect; - const rdr::U8* data; + const uint8_t* data; int stride; assert(framebuffer); @@ -300,8 +301,8 @@ void RenderedCursor::update(PixelBuffer* framebuffer, for (int y = 0;y < buffer.height();y++) { for (int x = 0;x < buffer.width();x++) { size_t idx; - rdr::U8 bg[4], fg[4]; - rdr::U8 rgb[3]; + uint8_t bg[4], fg[4]; + uint8_t rgb[3]; idx = (y+diff.y)*cursor->width() + (x+diff.x); memcpy(fg, cursor->getBuffer() + idx*4, 4); diff --git a/common/rfb/Cursor.h b/common/rfb/Cursor.h index 6c6db7ee..7db0e9ba 100644 --- a/common/rfb/Cursor.h +++ b/common/rfb/Cursor.h @@ -30,19 +30,19 @@ namespace rfb { class Cursor { public: - Cursor(int width, int height, const Point& hotspot, const rdr::U8* data); + Cursor(int width, int height, const Point& hotspot, const uint8_t* data); Cursor(const Cursor& other); ~Cursor(); int width() const { return width_; }; int height() const { return height_; }; const Point& hotspot() const { return hotspot_; }; - const rdr::U8* getBuffer() const { return data; }; + const uint8_t* getBuffer() const { return data; }; // getBitmap() returns a monochrome version of the cursor - rdr::U8* getBitmap() const; + uint8_t* getBitmap() const; // getMask() returns a simple mask version of the alpha channel - rdr::U8* getMask() const; + uint8_t* getMask() const; // crop() crops the cursor down to the smallest possible size, based on the // mask. @@ -51,7 +51,7 @@ namespace rfb { protected: int width_, height_; Point hotspot_; - rdr::U8* data; + uint8_t* data; }; class RenderedCursor : public PixelBuffer { @@ -60,7 +60,7 @@ namespace rfb { Rect getEffectiveRect() const { return buffer.getRect(offset); } - virtual const rdr::U8* getBuffer(const Rect& r, int* stride) const; + virtual const uint8_t* getBuffer(const Rect& r, int* stride) const; void update(PixelBuffer* framebuffer, Cursor* cursor, const Point& pos); diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 0fd070e8..a955a2c1 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -377,7 +377,7 @@ void EncodeManager::prepareEncoders(bool allowLossy) bool allowJPEG; - rdr::S32 preferred; + int32_t preferred; std::vector<int>::iterator iter; @@ -678,8 +678,8 @@ void EncodeManager::findSolidRect(const Rect& rect, Region *changed, for (dx = rect.tl.x; dx < rect.br.x; dx += SolidSearchBlock) { // We define it like this to guarantee alignment - rdr::U32 _buffer; - rdr::U8* colourValue = (rdr::U8*)&_buffer; + uint32_t _buffer; + uint8_t* colourValue = (uint8_t*)&_buffer; dw = SolidSearchBlock; if (dx + dw > rect.br.x) @@ -718,8 +718,8 @@ void EncodeManager::findSolidRect(const Rect& rect, Region *changed, encoder->writeSolidRect(erp.width(), erp.height(), pb->getPF(), colourValue); } else { - rdr::U32 _buffer2; - rdr::U8* converted = (rdr::U8*)&_buffer2; + uint32_t _buffer2; + uint8_t* converted = (uint8_t*)&_buffer2; conn->client.pf().bufferFromBuffer(converted, pb->getPF(), colourValue, 1); @@ -886,21 +886,21 @@ void EncodeManager::writeSubRect(const Rect& rect, const PixelBuffer *pb) endRect(); } -bool EncodeManager::checkSolidTile(const Rect& r, const rdr::U8* colourValue, +bool EncodeManager::checkSolidTile(const Rect& r, const uint8_t* colourValue, const PixelBuffer *pb) { switch (pb->getPF().bpp) { case 32: - return checkSolidTile(r, *(const rdr::U32*)colourValue, pb); + return checkSolidTile(r, *(const uint32_t*)colourValue, pb); case 16: - return checkSolidTile(r, *(const rdr::U16*)colourValue, pb); + return checkSolidTile(r, *(const uint16_t*)colourValue, pb); default: - return checkSolidTile(r, *(const rdr::U8*)colourValue, pb); + return checkSolidTile(r, *(const uint8_t*)colourValue, pb); } } void EncodeManager::extendSolidAreaByBlock(const Rect& r, - const rdr::U8* colourValue, + const uint8_t* colourValue, const PixelBuffer *pb, Rect* er) { int dx, dy, dw, dh; @@ -956,7 +956,7 @@ void EncodeManager::extendSolidAreaByBlock(const Rect& r, } void EncodeManager::extendSolidAreaByPixel(const Rect& r, const Rect& sr, - const rdr::U8* colourValue, + const uint8_t* colourValue, const PixelBuffer *pb, Rect* er) { int cx, cy; @@ -999,7 +999,7 @@ PixelBuffer* EncodeManager::preparePixelBuffer(const Rect& rect, const PixelBuffer *pb, bool convert) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; // Do wo need to convert the data? @@ -1029,7 +1029,7 @@ PixelBuffer* EncodeManager::preparePixelBuffer(const Rect& rect, bool EncodeManager::analyseRect(const PixelBuffer *pb, struct RectInfo *info, int maxColours) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; buffer = pb->getBuffer(pb->getRect(), &stride); @@ -1037,30 +1037,30 @@ bool EncodeManager::analyseRect(const PixelBuffer *pb, switch (pb->getPF().bpp) { case 32: return analyseRect(pb->width(), pb->height(), - (const rdr::U32*)buffer, stride, + (const uint32_t*)buffer, stride, info, maxColours); case 16: return analyseRect(pb->width(), pb->height(), - (const rdr::U16*)buffer, stride, + (const uint16_t*)buffer, stride, info, maxColours); default: return analyseRect(pb->width(), pb->height(), - (const rdr::U8*)buffer, stride, + (const uint8_t*)buffer, stride, info, maxColours); } } void EncodeManager::OffsetPixelBuffer::update(const PixelFormat& pf, int width, int height, - const rdr::U8* data_, + const uint8_t* data_, int stride_) { format = pf; // Forced cast. We never write anything though, so it should be safe. - setBuffer(width, height, (rdr::U8*)data_, stride_); + setBuffer(width, height, (uint8_t*)data_, stride_); } -rdr::U8* EncodeManager::OffsetPixelBuffer::getBufferRW(const Rect& /*r*/, int* /*stride*/) +uint8_t* EncodeManager::OffsetPixelBuffer::getBufferRW(const Rect& /*r*/, int* /*stride*/) { throw rfb::Exception("Invalid write attempt to OffsetPixelBuffer"); } diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h index fc2b97d2..f2fd4ca4 100644 --- a/common/rfb/EncodeManager.h +++ b/common/rfb/EncodeManager.h @@ -22,7 +22,8 @@ #include <vector> -#include <rdr/types.h> +#include <stdint.h> + #include <rfb/PixelBuffer.h> #include <rfb/Region.h> #include <rfb/Timer.h> @@ -82,12 +83,12 @@ namespace rfb { void writeSubRect(const Rect& rect, const PixelBuffer *pb); - bool checkSolidTile(const Rect& r, const rdr::U8* colourValue, + bool checkSolidTile(const Rect& r, const uint8_t* colourValue, const PixelBuffer *pb); - void extendSolidAreaByBlock(const Rect& r, const rdr::U8* colourValue, + void extendSolidAreaByBlock(const Rect& r, const uint8_t* colourValue, const PixelBuffer *pb, Rect* er); void extendSolidAreaByPixel(const Rect& r, const Rect& sr, - const rdr::U8* colourValue, + const uint8_t* colourValue, const PixelBuffer *pb, Rect* er); PixelBuffer* preparePixelBuffer(const Rect& rect, @@ -138,10 +139,10 @@ namespace rfb { virtual ~OffsetPixelBuffer() {} void update(const PixelFormat& pf, int width, int height, - const rdr::U8* data_, int stride); + const uint8_t* data_, int stride); private: - virtual rdr::U8* getBufferRW(const Rect& r, int* stride); + virtual uint8_t* getBufferRW(const Rect& r, int* stride); }; OffsetPixelBuffer offsetPixelBuffer; diff --git a/common/rfb/Encoder.cxx b/common/rfb/Encoder.cxx index d6d4a81d..35aa3d05 100644 --- a/common/rfb/Encoder.cxx +++ b/common/rfb/Encoder.cxx @@ -41,12 +41,12 @@ Encoder::~Encoder() } void Encoder::writeSolidRect(int width, int height, - const PixelFormat& pf, const rdr::U8* colour) + const PixelFormat& pf, const uint8_t* colour) { ManagedPixelBuffer buffer(pf, width, height); Palette palette; - rdr::U32 palcol; + uint32_t palcol; buffer.fillRect(buffer.getRect(), colour); @@ -59,27 +59,27 @@ void Encoder::writeSolidRect(int width, int height, void Encoder::writeSolidRect(const PixelBuffer* pb, const Palette& palette) { - rdr::U32 col32; - rdr::U16 col16; - rdr::U8 col8; + uint32_t col32; + uint16_t col16; + uint8_t col8; - rdr::U8* buffer; + uint8_t* buffer; assert(palette.size() == 1); // The Palette relies on implicit up and down conversion switch (pb->getPF().bpp) { case 32: - col32 = (rdr::U32)palette.getColour(0); - buffer = (rdr::U8*)&col32; + col32 = (uint32_t)palette.getColour(0); + buffer = (uint8_t*)&col32; break; case 16: - col16 = (rdr::U16)palette.getColour(0); - buffer = (rdr::U8*)&col16; + col16 = (uint16_t)palette.getColour(0); + buffer = (uint8_t*)&col16; break; default: - col8 = (rdr::U8)palette.getColour(0); - buffer = (rdr::U8*)&col8; + col8 = (uint8_t)palette.getColour(0); + buffer = (uint8_t*)&col8; break; } diff --git a/common/rfb/Encoder.h b/common/rfb/Encoder.h index 76079930..5e066323 100644 --- a/common/rfb/Encoder.h +++ b/common/rfb/Encoder.h @@ -20,7 +20,8 @@ #ifndef __RFB_ENCODER_H__ #define __RFB_ENCODER_H__ -#include <rdr/types.h> +#include <stdint.h> + #include <rfb/Rect.h> namespace rfb { @@ -83,7 +84,7 @@ namespace rfb { // efficient short cut. virtual void writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour)=0; + const uint8_t* colour)=0; protected: // Helper method for redirecting a single colour palette to the diff --git a/common/rfb/H264Decoder.cxx b/common/rfb/H264Decoder.cxx index 92231fcd..9de73422 100644 --- a/common/rfb/H264Decoder.cxx +++ b/common/rfb/H264Decoder.cxx @@ -70,7 +70,7 @@ bool H264Decoder::readRect(const Rect& /*r*/, const ServerParams& /*server*/, rdr::OutStream* os) { - rdr::U32 len; + uint32_t len; if (!is->hasData(8)) return false; @@ -79,7 +79,7 @@ bool H264Decoder::readRect(const Rect& /*r*/, len = is->readU32(); os->writeU32(len); - rdr::U32 flags = is->readU32(); + uint32_t flags = is->readU32(); os->writeU32(flags); @@ -99,8 +99,8 @@ void H264Decoder::decodeRect(const Rect& r, const void* buffer, ModifiablePixelBuffer* pb) { rdr::MemInStream is(buffer, buflen); - rdr::U32 len = is.readU32(); - rdr::U32 flags = is.readU32(); + uint32_t len = is.readU32(); + uint32_t flags = is.readU32(); H264DecoderContext* ctx = NULL; if (flags & resetAllContexts) diff --git a/common/rfb/H264DecoderContext.h b/common/rfb/H264DecoderContext.h index f261f4f2..ccb0bdb3 100644 --- a/common/rfb/H264DecoderContext.h +++ b/common/rfb/H264DecoderContext.h @@ -21,8 +21,9 @@ #ifndef __RFB_H264DECODERCONTEXT_H__ #define __RFB_H264DECODERCONTEXT_H__ +#include <stdint.h> + #include <os/Mutex.h> -#include <rdr/types.h> #include <rfb/Rect.h> #include <rfb/Decoder.h> @@ -33,8 +34,8 @@ namespace rfb { virtual ~H264DecoderContext() = 0; - virtual void decode(const rdr::U8* /*h264_buffer*/, - rdr::U32 /*len*/, + virtual void decode(const uint8_t* /*h264_buffer*/, + uint32_t /*len*/, ModifiablePixelBuffer* /*pb*/) {} void reset(); diff --git a/common/rfb/H264LibavDecoderContext.cxx b/common/rfb/H264LibavDecoderContext.cxx index 67c14991..8697a5a5 100644 --- a/common/rfb/H264LibavDecoderContext.cxx +++ b/common/rfb/H264LibavDecoderContext.cxx @@ -110,13 +110,13 @@ void H264LibavDecoderContext::freeCodec() { // We need to reallocate buffer because AVPacket uses non-const pointer. // We don't want to const_cast our buffer somewhere. So we would rather to maintain context's own buffer // Also avcodec requires a right padded buffer -rdr::U8* H264LibavDecoderContext::makeH264WorkBuffer(const rdr::U8* buffer, rdr::U32 len) +uint8_t* H264LibavDecoderContext::makeH264WorkBuffer(const uint8_t* buffer, uint32_t len) { - rdr::U32 reserve_len = len + len % AV_INPUT_BUFFER_PADDING_SIZE; + uint32_t reserve_len = len + len % AV_INPUT_BUFFER_PADDING_SIZE; if (!h264WorkBuffer || reserve_len > h264WorkBufferLength) { - h264WorkBuffer = (rdr::U8*)realloc(h264WorkBuffer, reserve_len); + h264WorkBuffer = (uint8_t*)realloc(h264WorkBuffer, reserve_len); if (h264WorkBuffer == NULL) { throw Exception("H264LibavDecoderContext: Unable to allocate memory"); } @@ -128,13 +128,13 @@ rdr::U8* H264LibavDecoderContext::makeH264WorkBuffer(const rdr::U8* buffer, rdr: return h264WorkBuffer; } -void H264LibavDecoderContext::decode(const rdr::U8* h264_in_buffer, - rdr::U32 len, +void H264LibavDecoderContext::decode(const uint8_t* h264_in_buffer, + uint32_t len, ModifiablePixelBuffer* pb) { os::AutoMutex lock(&mutex); if (!initialized) return; - rdr::U8* h264_work_buffer = makeH264WorkBuffer(h264_in_buffer, len); + uint8_t* h264_work_buffer = makeH264WorkBuffer(h264_in_buffer, len); #ifdef FFMPEG_INIT_PACKET_DEPRECATED AVPacket *packet = av_packet_alloc(); @@ -154,7 +154,7 @@ void H264LibavDecoderContext::decode(const rdr::U8* h264_in_buffer, break; } // We need to slap on tv to make it work here (don't ask me why) - if (!packet->size && len == static_cast<rdr::U32>(ret)) + if (!packet->size && len == static_cast<uint32_t>(ret)) ret = av_parser_parse2(parser, avctx, &packet->data, &packet->size, h264_work_buffer, len, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0); if (ret < 0) { diff --git a/common/rfb/H264LibavDecoderContext.h b/common/rfb/H264LibavDecoderContext.h index 1f005e4b..148ba1ad 100644 --- a/common/rfb/H264LibavDecoderContext.h +++ b/common/rfb/H264LibavDecoderContext.h @@ -34,7 +34,7 @@ namespace rfb { H264LibavDecoderContext(const Rect &r) : H264DecoderContext(r) {} ~H264LibavDecoderContext() { freeCodec(); } - virtual void decode(const rdr::U8* h264_buffer, rdr::U32 len, + virtual void decode(const uint8_t* h264_buffer, uint32_t len, ModifiablePixelBuffer* pb); protected: @@ -42,15 +42,15 @@ namespace rfb { virtual void freeCodec(); private: - rdr::U8* makeH264WorkBuffer(const rdr::U8* buffer, rdr::U32 len); + uint8_t* makeH264WorkBuffer(const uint8_t* buffer, uint32_t len); AVCodecContext *avctx; AVCodecParserContext *parser; AVFrame* frame; SwsContext* sws; uint8_t* swsBuffer; - rdr::U8* h264WorkBuffer; - rdr::U32 h264WorkBufferLength; + uint8_t* h264WorkBuffer; + uint32_t h264WorkBufferLength; }; } diff --git a/common/rfb/H264WinDecoderContext.cxx b/common/rfb/H264WinDecoderContext.cxx index a6855c0d..bb29edb6 100644 --- a/common/rfb/H264WinDecoderContext.cxx +++ b/common/rfb/H264WinDecoderContext.cxx @@ -154,8 +154,8 @@ void H264WinDecoderContext::freeCodec() { initialized = false; } -void H264WinDecoderContext::decode(const rdr::U8* h264_buffer, - rdr::U32 len, +void H264WinDecoderContext::decode(const uint8_t* h264_buffer, + uint32_t len, ModifiablePixelBuffer* pb) { os::AutoMutex lock(&mutex); if (!initialized) @@ -351,7 +351,7 @@ void H264WinDecoderContext::decode(const rdr::U8* h264_buffer, } // "7.3.2.1.1 Sequence parameter set data syntax" on page 66 of https://www.itu.int/rec/T-REC-H.264-202108-I/en -void H264WinDecoderContext::ParseSPS(const rdr::U8* buffer, int length) +void H264WinDecoderContext::ParseSPS(const uint8_t* buffer, int length) { #define EXPECT(cond) if (!(cond)) return; @@ -404,14 +404,14 @@ void H264WinDecoderContext::ParseSPS(const rdr::U8* buffer, int length) // NAL unit type EXPECT(length > 1); - rdr::U8 type = buffer[0]; + uint8_t type = buffer[0]; EXPECT((type & 0x80) == 0); // forbidden zero bit EXPECT((type & 0x1f) == 7); // SPS NAL unit type buffer++; length--; int available = 0; - rdr::U8 byte = 0; + uint8_t byte = 0; unsigned profile_idc; unsigned seq_parameter_set_id; diff --git a/common/rfb/H264WinDecoderContext.h b/common/rfb/H264WinDecoderContext.h index 96e7bf00..de51576c 100644 --- a/common/rfb/H264WinDecoderContext.h +++ b/common/rfb/H264WinDecoderContext.h @@ -33,7 +33,7 @@ namespace rfb { H264WinDecoderContext(const Rect &r) : H264DecoderContext(r) {}; ~H264WinDecoderContext() { freeCodec(); } - virtual void decode(const rdr::U8* h264_buffer, rdr::U32 len, + virtual void decode(const uint8_t* h264_buffer, uint32_t len, ModifiablePixelBuffer* pb); protected: @@ -42,12 +42,12 @@ namespace rfb { private: LONG stride; - rdr::U32 full_width = 0; - rdr::U32 full_height = 0; - rdr::U32 crop_width = 0; - rdr::U32 crop_height = 0; - rdr::U32 offset_x = 0; - rdr::U32 offset_y = 0; + uint32_t full_width = 0; + uint32_t full_height = 0; + uint32_t crop_width = 0; + uint32_t crop_height = 0; + uint32_t offset_x = 0; + uint32_t offset_y = 0; IMFTransform *decoder = NULL; IMFTransform *converter = NULL; IMFSample *input_sample = NULL; @@ -57,7 +57,7 @@ namespace rfb { IMFMediaBuffer *decoded_buffer = NULL; IMFMediaBuffer *converted_buffer = NULL; - void ParseSPS(const rdr::U8* buffer, int length); + void ParseSPS(const uint8_t* buffer, int length); }; } diff --git a/common/rfb/HextileDecoder.cxx b/common/rfb/HextileDecoder.cxx index 4275a049..f7cbc46a 100644 --- a/common/rfb/HextileDecoder.cxx +++ b/common/rfb/HextileDecoder.cxx @@ -56,7 +56,7 @@ bool HextileDecoder::readRect(const Rect& r, rdr::InStream* is, t.br.y = __rfbmin(r.br.y, t.tl.y + 16); for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 16) { - rdr::U8 tileType; + uint8_t tileType; t.br.x = __rfbmin(r.br.x, t.tl.x + 16); @@ -87,7 +87,7 @@ bool HextileDecoder::readRect(const Rect& r, rdr::InStream* is, } if (tileType & hextileAnySubrects) { - rdr::U8 nSubrects; + uint8_t nSubrects; if (!is->hasDataOrRestore(1)) return false; @@ -120,9 +120,9 @@ void HextileDecoder::decodeRect(const Rect& r, const void* buffer, rdr::MemInStream is(buffer, buflen); const PixelFormat& pf = server.pf(); switch (pf.bpp) { - case 8: hextileDecode<rdr::U8 >(r, &is, pf, pb); break; - case 16: hextileDecode<rdr::U16>(r, &is, pf, pb); break; - case 32: hextileDecode<rdr::U32>(r, &is, pf, pb); break; + case 8: hextileDecode<uint8_t >(r, &is, pf, pb); break; + case 16: hextileDecode<uint16_t>(r, &is, pf, pb); break; + case 32: hextileDecode<uint32_t>(r, &is, pf, pb); break; } } diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx index b2b0f3a4..90e59962 100644 --- a/common/rfb/HextileEncoder.cxx +++ b/common/rfb/HextileEncoder.cxx @@ -59,23 +59,23 @@ void HextileEncoder::writeRect(const PixelBuffer* pb, switch (pb->getPF().bpp) { case 8: if (improvedHextile) { - hextileEncodeBetter<rdr::U8>(os, pb); + hextileEncodeBetter<uint8_t>(os, pb); } else { - hextileEncode<rdr::U8>(os, pb); + hextileEncode<uint8_t>(os, pb); } break; case 16: if (improvedHextile) { - hextileEncodeBetter<rdr::U16>(os, pb); + hextileEncodeBetter<uint16_t>(os, pb); } else { - hextileEncode<rdr::U16>(os, pb); + hextileEncode<uint16_t>(os, pb); } break; case 32: if (improvedHextile) { - hextileEncodeBetter<rdr::U32>(os, pb); + hextileEncodeBetter<uint32_t>(os, pb); } else { - hextileEncode<rdr::U32>(os, pb); + hextileEncode<uint32_t>(os, pb); } break; } @@ -83,7 +83,7 @@ void HextileEncoder::writeRect(const PixelBuffer* pb, void HextileEncoder::writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour) + const uint8_t* colour) { rdr::OutStream* os; int tiles; @@ -120,7 +120,7 @@ void HextileEncoder::hextileEncode(rdr::OutStream* os, T oldBg = 0, oldFg = 0; bool oldBgValid = false; bool oldFgValid = false; - rdr::U8 encoded[256*sizeof(T)]; + uint8_t encoded[256*sizeof(T)]; for (t.tl.y = 0; t.tl.y < pb->height(); t.tl.y += 16) { @@ -177,10 +177,10 @@ void HextileEncoder::hextileEncode(rdr::OutStream* os, template<class T> int HextileEncoder::hextileEncodeTile(T* data, int w, int h, - int tileType, rdr::U8* encoded, + int tileType, uint8_t* encoded, T bg) { - rdr::U8* nSubrectsPtr = encoded; + uint8_t* nSubrectsPtr = encoded; *nSubrectsPtr = 0; encoded++; @@ -220,13 +220,13 @@ int HextileEncoder::hextileEncodeTile(T* data, int w, int h, if (sizeof(T) == 1) { *encoded++ = *data; } else if (sizeof(T) == 2) { - *encoded++ = ((rdr::U8*)data)[0]; - *encoded++ = ((rdr::U8*)data)[1]; + *encoded++ = ((uint8_t*)data)[0]; + *encoded++ = ((uint8_t*)data)[1]; } else if (sizeof(T) == 4) { - *encoded++ = ((rdr::U8*)data)[0]; - *encoded++ = ((rdr::U8*)data)[1]; - *encoded++ = ((rdr::U8*)data)[2]; - *encoded++ = ((rdr::U8*)data)[3]; + *encoded++ = ((uint8_t*)data)[0]; + *encoded++ = ((uint8_t*)data)[1]; + *encoded++ = ((uint8_t*)data)[2]; + *encoded++ = ((uint8_t*)data)[3]; } } @@ -334,7 +334,7 @@ class HextileTile { // big enough to store at least the number of bytes returned by the // getSize() method. // - void encode(rdr::U8* dst) const; + void encode(uint8_t* dst) const; protected: @@ -353,7 +353,7 @@ class HextileTile { T m_foreground; int m_numSubrects; - rdr::U8 m_coords[256 * 2]; + uint8_t m_coords[256 * 2]; T m_colors[256]; private: @@ -403,7 +403,7 @@ void HextileTile<T>::analyze() int y = (ptr - m_tile) / m_width; T *colorsPtr = m_colors; - rdr::U8 *coordsPtr = m_coords; + uint8_t *coordsPtr = m_coords; m_pal.clear(); m_numSubrects = 0; @@ -411,7 +411,7 @@ void HextileTile<T>::analyze() if (y > 0) { *colorsPtr++ = color; *coordsPtr++ = 0; - *coordsPtr++ = (rdr::U8)(((m_width - 1) << 4) | ((y - 1) & 0x0F)); + *coordsPtr++ = (uint8_t)(((m_width - 1) << 4) | ((y - 1) & 0x0F)); m_pal.insert(color, 1); m_numSubrects++; } @@ -445,8 +445,8 @@ void HextileTile<T>::analyze() // Save properties of this subrect *colorsPtr++ = color; - *coordsPtr++ = (rdr::U8)((x << 4) | (y & 0x0F)); - *coordsPtr++ = (rdr::U8)(((sw - 1) << 4) | ((sh - 1) & 0x0F)); + *coordsPtr++ = (uint8_t)((x << 4) | (y & 0x0F)); + *coordsPtr++ = (uint8_t)(((sw - 1) << 4) | ((sh - 1) & 0x0F)); if (!m_pal.insert(color, 1) || ((size_t)m_pal.size() > (48 + 2 * sizeof(T)*8))) { @@ -489,12 +489,12 @@ void HextileTile<T>::analyze() } template<class T> -void HextileTile<T>::encode(rdr::U8 *dst) const +void HextileTile<T>::encode(uint8_t *dst) const { assert(m_numSubrects && (m_flags & hextileAnySubrects)); // Zero subrects counter - rdr::U8 *numSubrectsPtr = dst; + uint8_t *numSubrectsPtr = dst; *dst++ = 0; for (int i = 0; i < m_numSubrects; i++) { @@ -505,13 +505,13 @@ void HextileTile<T>::encode(rdr::U8 *dst) const if (sizeof(T) == 1) { *dst++ = m_colors[i]; } else if (sizeof(T) == 2) { - *dst++ = ((rdr::U8*)&m_colors[i])[0]; - *dst++ = ((rdr::U8*)&m_colors[i])[1]; + *dst++ = ((uint8_t*)&m_colors[i])[0]; + *dst++ = ((uint8_t*)&m_colors[i])[1]; } else if (sizeof(T) == 4) { - *dst++ = ((rdr::U8*)&m_colors[i])[0]; - *dst++ = ((rdr::U8*)&m_colors[i])[1]; - *dst++ = ((rdr::U8*)&m_colors[i])[2]; - *dst++ = ((rdr::U8*)&m_colors[i])[3]; + *dst++ = ((uint8_t*)&m_colors[i])[0]; + *dst++ = ((uint8_t*)&m_colors[i])[1]; + *dst++ = ((uint8_t*)&m_colors[i])[2]; + *dst++ = ((uint8_t*)&m_colors[i])[3]; } } *dst++ = m_coords[i * 2]; @@ -536,7 +536,7 @@ void HextileEncoder::hextileEncodeBetter(rdr::OutStream* os, T oldBg = 0, oldFg = 0; bool oldBgValid = false; bool oldFgValid = false; - rdr::U8 encoded[256*sizeof(T)]; + uint8_t encoded[256*sizeof(T)]; HextileTile<T> tile; diff --git a/common/rfb/HextileEncoder.h b/common/rfb/HextileEncoder.h index 64cc0de3..20721b7c 100644 --- a/common/rfb/HextileEncoder.h +++ b/common/rfb/HextileEncoder.h @@ -31,7 +31,7 @@ namespace rfb { virtual void writeRect(const PixelBuffer* pb, const Palette& palette); virtual void writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour); + const uint8_t* colour); private: template<class T> inline void writePixel(rdr::OutStream* os, T pixel); @@ -40,7 +40,7 @@ namespace rfb { void hextileEncode(rdr::OutStream* os, const PixelBuffer* pb); template<class T> int hextileEncodeTile(T* data, int w, int h, int tileType, - rdr::U8* encoded, T bg); + uint8_t* encoded, T bg); template<class T> int testTileType(T* data, int w, int h, T* bg, T* fg); diff --git a/common/rfb/InputHandler.h b/common/rfb/InputHandler.h index 4719eca0..fbb69a56 100644 --- a/common/rfb/InputHandler.h +++ b/common/rfb/InputHandler.h @@ -23,7 +23,8 @@ #ifndef __RFB_INPUTHANDLER_H__ #define __RFB_INPUTHANDLER_H__ -#include <rdr/types.h> +#include <stdint.h> + #include <rfb/Rect.h> #include <rfb/util.h> @@ -32,7 +33,7 @@ namespace rfb { class InputHandler { public: virtual ~InputHandler() {} - virtual void keyEvent(rdr::U32 /*keysym*/, rdr::U32 /*keycode*/, + virtual void keyEvent(uint32_t /*keysym*/, uint32_t /*keycode*/, bool /*down*/) { } virtual void pointerEvent(const Point& /*pos*/, int /*buttonMask*/) { } diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx index efb26a77..51d3c357 100644 --- a/common/rfb/JpegCompressor.cxx +++ b/common/rfb/JpegCompressor.cxx @@ -155,14 +155,14 @@ JpegCompressor::~JpegCompressor(void) delete cinfo; } -void JpegCompressor::compress(const rdr::U8 *buf, volatile int stride, +void JpegCompressor::compress(const uint8_t *buf, volatile int stride, const Rect& r, const PixelFormat& pf, int quality, int subsamp) { int w = r.width(); int h = r.height(); int pixelsize; - rdr::U8 * volatile srcBuf = NULL; + uint8_t * volatile srcBuf = NULL; volatile bool srcBufIsTemp = false; JSAMPROW * volatile rowPointer = NULL; @@ -192,7 +192,7 @@ void JpegCompressor::compress(const rdr::U8 *buf, volatile int stride, cinfo->in_color_space = JCS_EXT_XBGR; if (cinfo->in_color_space != JCS_RGB) { - srcBuf = (rdr::U8 *)buf; + srcBuf = (uint8_t *)buf; pixelsize = 4; } #endif @@ -201,9 +201,9 @@ void JpegCompressor::compress(const rdr::U8 *buf, volatile int stride, stride = w; if (cinfo->in_color_space == JCS_RGB) { - srcBuf = new rdr::U8[w * h * pixelsize]; + srcBuf = new uint8_t[w * h * pixelsize]; srcBufIsTemp = true; - pf.rgbFromBuffer(srcBuf, (const rdr::U8 *)buf, w, stride, h); + pf.rgbFromBuffer(srcBuf, (const uint8_t *)buf, w, stride, h); stride = w; } diff --git a/common/rfb/JpegCompressor.h b/common/rfb/JpegCompressor.h index de201732..d4978fdf 100644 --- a/common/rfb/JpegCompressor.h +++ b/common/rfb/JpegCompressor.h @@ -43,7 +43,7 @@ namespace rfb { JpegCompressor(int bufferLen = 128*1024); virtual ~JpegCompressor(); - void compress(const rdr::U8 *, int, const Rect&, const PixelFormat&, int, int); + void compress(const uint8_t *, int, const Rect&, const PixelFormat&, int, int); void writeBytes(const void*, int); diff --git a/common/rfb/JpegDecompressor.cxx b/common/rfb/JpegDecompressor.cxx index ea148b94..5520a949 100644 --- a/common/rfb/JpegDecompressor.cxx +++ b/common/rfb/JpegDecompressor.cxx @@ -150,8 +150,8 @@ JpegDecompressor::~JpegDecompressor(void) delete dinfo; } -void JpegDecompressor::decompress(const rdr::U8 *jpegBuf, - int jpegBufLen, rdr::U8 *buf, +void JpegDecompressor::decompress(const uint8_t *jpegBuf, + int jpegBufLen, uint8_t *buf, volatile int stride, const Rect& r, const PixelFormat& pf) { @@ -159,7 +159,7 @@ void JpegDecompressor::decompress(const rdr::U8 *jpegBuf, int h = r.height(); int pixelsize; int dstBufStride; - rdr::U8 * volatile dstBuf = NULL; + uint8_t * volatile dstBuf = NULL; volatile bool dstBufIsTemp = false; JSAMPROW * volatile rowPointer = NULL; @@ -194,13 +194,13 @@ void JpegDecompressor::decompress(const rdr::U8 *jpegBuf, dinfo->out_color_space = JCS_EXT_XBGR; if (dinfo->out_color_space != JCS_RGB) { - dstBuf = (rdr::U8 *)buf; + dstBuf = (uint8_t *)buf; pixelsize = 4; } #endif if (dinfo->out_color_space == JCS_RGB) { - dstBuf = new rdr::U8[w * h * pixelsize]; + dstBuf = new uint8_t[w * h * pixelsize]; dstBufIsTemp = true; dstBufStride = w; } @@ -226,7 +226,7 @@ void JpegDecompressor::decompress(const rdr::U8 *jpegBuf, } if (dinfo->out_color_space == JCS_RGB) - pf.bufferFromRGB((rdr::U8*)buf, dstBuf, w, stride, h); + pf.bufferFromRGB((uint8_t*)buf, dstBuf, w, stride, h); jpeg_finish_decompress(dinfo); diff --git a/common/rfb/JpegDecompressor.h b/common/rfb/JpegDecompressor.h index ed367786..5d4f0c21 100644 --- a/common/rfb/JpegDecompressor.h +++ b/common/rfb/JpegDecompressor.h @@ -43,7 +43,7 @@ namespace rfb { JpegDecompressor(void); virtual ~JpegDecompressor(); - void decompress(const rdr::U8 *, int, rdr::U8 *, int, const Rect&, + void decompress(const uint8_t *, int, uint8_t *, int, const Rect&, const PixelFormat&); private: diff --git a/common/rfb/KeyRemapper.cxx b/common/rfb/KeyRemapper.cxx index 1431a21e..700ae298 100644 --- a/common/rfb/KeyRemapper.cxx +++ b/common/rfb/KeyRemapper.cxx @@ -72,10 +72,10 @@ void KeyRemapper::setMapping(const char* m) { } } -rdr::U32 KeyRemapper::remapKey(rdr::U32 key) const { +uint32_t KeyRemapper::remapKey(uint32_t key) const { os::AutoMutex a(mutex); - std::map<rdr::U32,rdr::U32>::const_iterator i = mapping.find(key); + std::map<uint32_t,uint32_t>::const_iterator i = mapping.find(key); if (i != mapping.end()) return i->second; return key; diff --git a/common/rfb/KeyRemapper.h b/common/rfb/KeyRemapper.h index 1406bad2..89853721 100644 --- a/common/rfb/KeyRemapper.h +++ b/common/rfb/KeyRemapper.h @@ -20,7 +20,8 @@ #define __RFB_KEYREMAPPER_H__ #include <map> -#include <rdr/types.h> + +#include <stdint.h> namespace os { class Mutex; } @@ -31,10 +32,10 @@ namespace rfb { KeyRemapper(const char* m=""); ~KeyRemapper(); void setMapping(const char* m); - rdr::U32 remapKey(rdr::U32 key) const; + uint32_t remapKey(uint32_t key) const; static KeyRemapper defInstance; private: - std::map<rdr::U32,rdr::U32> mapping; + std::map<uint32_t,uint32_t> mapping; os::Mutex* mutex; }; diff --git a/common/rfb/Palette.h b/common/rfb/Palette.h index a9003354..6b8cc57e 100644 --- a/common/rfb/Palette.h +++ b/common/rfb/Palette.h @@ -22,8 +22,7 @@ #include <assert.h> #include <string.h> - -#include <rdr/types.h> +#include <stdint.h> namespace rfb { class Palette { @@ -35,13 +34,13 @@ namespace rfb { void clear() { numColours = 0; memset(hash, 0, sizeof(hash)); } - inline bool insert(rdr::U32 colour, int numPixels); - inline unsigned char lookup(rdr::U32 colour) const; - inline rdr::U32 getColour(unsigned char index) const; + inline bool insert(uint32_t colour, int numPixels); + inline unsigned char lookup(uint32_t colour) const; + inline uint32_t getColour(unsigned char index) const; inline int getCount(unsigned char index) const; protected: - inline unsigned char genHash(rdr::U32 colour) const; + inline unsigned char genHash(uint32_t colour) const; protected: int numColours; @@ -49,7 +48,7 @@ namespace rfb { struct PaletteListNode { PaletteListNode *next; unsigned char idx; - rdr::U32 colour; + uint32_t colour; }; struct PaletteEntry { @@ -67,7 +66,7 @@ namespace rfb { }; } -inline bool rfb::Palette::insert(rdr::U32 colour, int numPixels) +inline bool rfb::Palette::insert(uint32_t colour, int numPixels) { PaletteListNode* pnode; PaletteListNode* prev_pnode; @@ -145,7 +144,7 @@ inline bool rfb::Palette::insert(rdr::U32 colour, int numPixels) return true; } -inline unsigned char rfb::Palette::lookup(rdr::U32 colour) const +inline unsigned char rfb::Palette::lookup(uint32_t colour) const { unsigned char hash_key; PaletteListNode* pnode; @@ -165,7 +164,7 @@ inline unsigned char rfb::Palette::lookup(rdr::U32 colour) const return 0; } -inline rdr::U32 rfb::Palette::getColour(unsigned char index) const +inline uint32_t rfb::Palette::getColour(unsigned char index) const { return entry[index].listNode->colour; } @@ -175,7 +174,7 @@ inline int rfb::Palette::getCount(unsigned char index) const return entry[index].numPixels; } -inline unsigned char rfb::Palette::genHash(rdr::U32 colour) const +inline unsigned char rfb::Palette::genHash(uint32_t colour) const { unsigned char hash_key; diff --git a/common/rfb/Password.cxx b/common/rfb/Password.cxx index a7aaeccc..b1cce2bb 100644 --- a/common/rfb/Password.cxx +++ b/common/rfb/Password.cxx @@ -25,10 +25,11 @@ #endif #include <string.h> +#include <stdint.h> extern "C" { #include <rfb/d3des.h> } -#include <rdr/types.h> + #include <rdr/Exception.h> #include <rfb/Password.h> @@ -49,7 +50,7 @@ PlainPasswd::PlainPasswd(const ObfuscatedPasswd& obfPwd) : CharArray(9) { if (obfPwd.length < 8) throw rdr::Exception("bad obfuscated password length"); deskey(d3desObfuscationKey, DE1); - des((rdr::U8*)obfPwd.buf, (rdr::U8*)buf); + des((uint8_t*)obfPwd.buf, (uint8_t*)buf); buf[8] = 0; } @@ -75,7 +76,7 @@ ObfuscatedPasswd::ObfuscatedPasswd(const PlainPasswd& plainPwd) : CharArray(8), for (i=0; i<8; i++) buf[i] = i<l ? plainPwd.buf[i] : 0; deskey(d3desObfuscationKey, EN0); - des((rdr::U8*)buf, (rdr::U8*)buf); + des((uint8_t*)buf, (uint8_t*)buf); } ObfuscatedPasswd::~ObfuscatedPasswd() { diff --git a/common/rfb/Pixel.h b/common/rfb/Pixel.h index 4e9d1644..ce1d7b15 100644 --- a/common/rfb/Pixel.h +++ b/common/rfb/Pixel.h @@ -18,9 +18,9 @@ #ifndef __RFB_PIXEL_H__ #define __RFB_PIXEL_H__ -#include <rdr/types.h> +#include <stdint.h> namespace rfb { - typedef rdr::U32 Pixel; // must be big enough to hold any pixel value + typedef uint32_t Pixel; // must be big enough to hold any pixel value } #endif diff --git a/common/rfb/PixelBuffer.cxx b/common/rfb/PixelBuffer.cxx index 1b534b7b..dedae3b2 100644 --- a/common/rfb/PixelBuffer.cxx +++ b/common/rfb/PixelBuffer.cxx @@ -63,10 +63,10 @@ void PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) const { int inStride; - const U8* data; + const uint8_t* data; int bytesPerPixel, inBytesPerRow, outBytesPerRow, bytesPerMemCpy; - U8* imageBufPos; - const U8* end; + uint8_t* imageBufPos; + const uint8_t* end; if (!r.enclosed_by(getRect())) throw rfb::Exception("Source rect %dx%d at %d,%d exceeds framebuffer %dx%d", @@ -83,7 +83,7 @@ PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) const outBytesPerRow = outStride * bytesPerPixel; bytesPerMemCpy = r.width() * bytesPerPixel; - imageBufPos = (U8*)imageBuf; + imageBufPos = (uint8_t*)imageBuf; end = data + (inBytesPerRow * r.height()); while (data < end) { @@ -96,7 +96,7 @@ PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) const void PixelBuffer::getImage(const PixelFormat& pf, void* imageBuf, const Rect& r, int stride) const { - const rdr::U8* srcBuffer; + const uint8_t* srcBuffer; int srcStride; if (format.equal(pf)) { @@ -114,8 +114,8 @@ void PixelBuffer::getImage(const PixelFormat& pf, void* imageBuf, srcBuffer = getBuffer(r, &srcStride); - pf.bufferFromBuffer((U8*)imageBuf, format, srcBuffer, r.width(), r.height(), - stride, srcStride); + pf.bufferFromBuffer((uint8_t*)imageBuf, format, srcBuffer, + r.width(), r.height(), stride, srcStride); } void PixelBuffer::setSize(int width, int height) @@ -148,7 +148,7 @@ ModifiablePixelBuffer::~ModifiablePixelBuffer() void ModifiablePixelBuffer::fillRect(const Rect& r, const void* pix) { int stride; - U8 *buf; + uint8_t *buf; int w, h, b; if (!r.enclosed_by(getRect())) @@ -166,11 +166,11 @@ void ModifiablePixelBuffer::fillRect(const Rect& r, const void* pix) if (b == 1) { while (h--) { - memset(buf, *(const U8*)pix, w); + memset(buf, *(const uint8_t*)pix, w); buf += stride * b; } } else { - U8 *start; + uint8_t *start; int w1; start = buf; @@ -195,11 +195,11 @@ void ModifiablePixelBuffer::fillRect(const Rect& r, const void* pix) void ModifiablePixelBuffer::imageRect(const Rect& r, const void* pixels, int srcStride) { - U8* dest; + uint8_t* dest; int destStride; int bytesPerPixel, bytesPerDestRow, bytesPerSrcRow, bytesPerFill; - const U8* src; - U8* end; + const uint8_t* src; + uint8_t* end; if (!r.enclosed_by(getRect())) throw rfb::Exception("Destination rect %dx%d at %d,%d exceeds framebuffer %dx%d", @@ -217,7 +217,7 @@ void ModifiablePixelBuffer::imageRect(const Rect& r, bytesPerSrcRow = bytesPerPixel * srcStride; bytesPerFill = bytesPerPixel * r.width(); - src = (const U8*)pixels; + src = (const uint8_t*)pixels; end = dest + (bytesPerDestRow * r.height()); while (dest < end) { @@ -234,8 +234,8 @@ void ModifiablePixelBuffer::copyRect(const Rect &rect, { int srcStride, dstStride; int bytesPerPixel; - const U8* srcData; - U8* dstData; + const uint8_t* srcData; + uint8_t* dstData; Rect drect, srect; @@ -290,15 +290,15 @@ void ModifiablePixelBuffer::copyRect(const Rect &rect, void ModifiablePixelBuffer::fillRect(const PixelFormat& pf, const Rect &dest, const void* pix) { - rdr::U8 buf[4]; - format.bufferFromBuffer(buf, pf, (const rdr::U8*)pix, 1); + uint8_t buf[4]; + format.bufferFromBuffer(buf, pf, (const uint8_t*)pix, 1); fillRect(dest, buf); } void ModifiablePixelBuffer::imageRect(const PixelFormat& pf, const Rect &dest, const void* pixels, int stride) { - rdr::U8* dstBuffer; + uint8_t* dstBuffer; int dstStride; if (!dest.enclosed_by(getRect())) @@ -310,7 +310,7 @@ void ModifiablePixelBuffer::imageRect(const PixelFormat& pf, const Rect &dest, stride = dest.width(); dstBuffer = getBufferRW(dest, &dstStride); - format.bufferFromBuffer(dstBuffer, pf, (const rdr::U8*)pixels, + format.bufferFromBuffer(dstBuffer, pf, (const uint8_t*)pixels, dest.width(), dest.height(), dstStride, stride); commitBufferRW(dest); @@ -319,7 +319,7 @@ void ModifiablePixelBuffer::imageRect(const PixelFormat& pf, const Rect &dest, // -=- Simple pixel buffer with a continuous block of memory FullFramePixelBuffer::FullFramePixelBuffer(const PixelFormat& pf, int w, int h, - rdr::U8* data_, int stride_) + uint8_t* data_, int stride_) : ModifiablePixelBuffer(pf, w, h), data(data_), stride(stride_) { } @@ -328,7 +328,7 @@ FullFramePixelBuffer::FullFramePixelBuffer() : data(0) {} FullFramePixelBuffer::~FullFramePixelBuffer() {} -rdr::U8* FullFramePixelBuffer::getBufferRW(const Rect& r, int* stride_) +uint8_t* FullFramePixelBuffer::getBufferRW(const Rect& r, int* stride_) { if (!r.enclosed_by(getRect())) throw rfb::Exception("Pixel buffer request %dx%d at %d,%d exceeds framebuffer %dx%d", @@ -343,7 +343,7 @@ void FullFramePixelBuffer::commitBufferRW(const Rect& /*r*/) { } -const rdr::U8* FullFramePixelBuffer::getBuffer(const Rect& r, int* stride_) const +const uint8_t* FullFramePixelBuffer::getBuffer(const Rect& r, int* stride_) const { if (!r.enclosed_by(getRect())) throw rfb::Exception("Pixel buffer request %dx%d at %d,%d exceeds framebuffer %dx%d", @@ -355,7 +355,7 @@ const rdr::U8* FullFramePixelBuffer::getBuffer(const Rect& r, int* stride_) cons } void FullFramePixelBuffer::setBuffer(int width, int height, - rdr::U8* data_, int stride_) + uint8_t* data_, int stride_) { if ((width < 0) || (width > maxPixelBufferWidth)) throw rfb::Exception("Invalid PixelBuffer width of %d pixels requested", width); @@ -415,7 +415,7 @@ void ManagedPixelBuffer::setSize(int w, int h) datasize = 0; } if (new_datasize) { - data_ = new U8[new_datasize]; + data_ = new uint8_t[new_datasize]; datasize = new_datasize; } } diff --git a/common/rfb/PixelBuffer.h b/common/rfb/PixelBuffer.h index b12a734e..05273699 100644 --- a/common/rfb/PixelBuffer.h +++ b/common/rfb/PixelBuffer.h @@ -66,7 +66,7 @@ namespace rfb { // Get a pointer into the buffer // The pointer is to the top-left pixel of the specified Rect. // The buffer stride (in pixels) is returned. - virtual const rdr::U8* getBuffer(const Rect& r, int* stride) const = 0; + virtual const uint8_t* getBuffer(const Rect& r, int* stride) const = 0; // Get pixel data for a given part of the buffer // Data is copied into the supplied buffer, with the specified @@ -112,7 +112,7 @@ namespace rfb { // Get a writeable pointer into the buffer // Like getBuffer(), the pointer is to the top-left pixel of the // specified Rect and the stride in pixels is returned. - virtual rdr::U8* getBufferRW(const Rect& r, int* stride) = 0; + virtual uint8_t* getBufferRW(const Rect& r, int* stride) = 0; // Commit the modified contents // Ensures that the changes to the specified Rect is properly // stored away and any temporary buffers are freed. The Rect given @@ -149,23 +149,23 @@ namespace rfb { class FullFramePixelBuffer : public ModifiablePixelBuffer { public: FullFramePixelBuffer(const PixelFormat& pf, int width, int height, - rdr::U8* data_, int stride); + uint8_t* data_, int stride); virtual ~FullFramePixelBuffer(); public: - virtual const rdr::U8* getBuffer(const Rect& r, int* stride) const; - virtual rdr::U8* getBufferRW(const Rect& r, int* stride); + virtual const uint8_t* getBuffer(const Rect& r, int* stride) const; + virtual uint8_t* getBufferRW(const Rect& r, int* stride); virtual void commitBufferRW(const Rect& r); protected: FullFramePixelBuffer(); - virtual void setBuffer(int width, int height, rdr::U8* data, int stride); + virtual void setBuffer(int width, int height, uint8_t* data, int stride); private: virtual void setSize(int w, int h); private: - rdr::U8* data; + uint8_t* data; int stride; }; @@ -183,7 +183,7 @@ namespace rfb { virtual void setSize(int w, int h); private: - rdr::U8* data_; // Mirrors FullFramePixelBuffer::data + uint8_t* data_; // Mirrors FullFramePixelBuffer::data unsigned long datasize; }; diff --git a/common/rfb/PixelFormat.cxx b/common/rfb/PixelFormat.cxx index 5a3f0147..938ffb5b 100644 --- a/common/rfb/PixelFormat.cxx +++ b/common/rfb/PixelFormat.cxx @@ -38,8 +38,8 @@ using namespace rfb; -rdr::U8 PixelFormat::upconvTable[256*8]; -rdr::U8 PixelFormat::downconvTable[256*8]; +uint8_t PixelFormat::upconvTable[256*8]; +uint8_t PixelFormat::downconvTable[256*8]; class PixelFormat::Init { public: @@ -59,8 +59,8 @@ PixelFormat::Init::Init() for (bits = 1;bits <= 8;bits++) { int i, maxVal; - rdr::U8 *subUpTable; - rdr::U8 *subDownTable; + uint8_t *subUpTable; + uint8_t *subDownTable; maxVal = (1 << bits) - 1; subUpTable = &upconvTable[(bits-1)*256]; @@ -234,17 +234,17 @@ bool PixelFormat::isLittleEndian(void) const } -void PixelFormat::bufferFromRGB(rdr::U8 *dst, const rdr::U8* src, int pixels) const +void PixelFormat::bufferFromRGB(uint8_t *dst, const uint8_t* src, int pixels) const { bufferFromRGB(dst, src, pixels, pixels, 1); } -void PixelFormat::bufferFromRGB(rdr::U8 *dst, const rdr::U8* src, +void PixelFormat::bufferFromRGB(uint8_t *dst, const uint8_t* src, int w, int stride, int h) const { if (is888()) { // Optimised common case - rdr::U8 *r, *g, *b, *x; + uint8_t *r, *g, *b, *x; if (bigEndian) { r = dst + (24 - redShift)/8; @@ -283,7 +283,7 @@ void PixelFormat::bufferFromRGB(rdr::U8 *dst, const rdr::U8* src, int w_ = w; while (w_--) { Pixel p; - rdr::U8 r, g, b; + uint8_t r, g, b; r = *(src++); g = *(src++); @@ -300,18 +300,18 @@ void PixelFormat::bufferFromRGB(rdr::U8 *dst, const rdr::U8* src, } -void PixelFormat::rgbFromBuffer(rdr::U8* dst, const rdr::U8* src, int pixels) const +void PixelFormat::rgbFromBuffer(uint8_t* dst, const uint8_t* src, int pixels) const { rgbFromBuffer(dst, src, pixels, pixels, 1); } -void PixelFormat::rgbFromBuffer(rdr::U8* dst, const rdr::U8* src, +void PixelFormat::rgbFromBuffer(uint8_t* dst, const uint8_t* src, int w, int stride, int h) const { if (is888()) { // Optimised common case - const rdr::U8 *r, *g, *b; + const uint8_t *r, *g, *b; if (bigEndian) { r = src + (24 - redShift)/8; @@ -345,7 +345,7 @@ void PixelFormat::rgbFromBuffer(rdr::U8* dst, const rdr::U8* src, int w_ = w; while (w_--) { Pixel p; - rdr::U8 r, g, b; + uint8_t r, g, b; p = pixelFromBuffer(src); @@ -364,22 +364,22 @@ void PixelFormat::rgbFromBuffer(rdr::U8* dst, const rdr::U8* src, Pixel PixelFormat::pixelFromPixel(const PixelFormat &srcPF, Pixel src) const { - rdr::U16 r, g, b; + uint16_t r, g, b; srcPF.rgbFromPixel(src, &r, &g, &b); return pixelFromRGB(r, g, b); } -void PixelFormat::bufferFromBuffer(rdr::U8* dst, const PixelFormat &srcPF, - const rdr::U8* src, int pixels) const +void PixelFormat::bufferFromBuffer(uint8_t* dst, const PixelFormat &srcPF, + const uint8_t* src, int pixels) const { bufferFromBuffer(dst, srcPF, src, pixels, 1, pixels, pixels); } #define IS_ALIGNED(v, a) (((intptr_t)v & (a-1)) == 0) -void PixelFormat::bufferFromBuffer(rdr::U8* dst, const PixelFormat &srcPF, - const rdr::U8* src, int w, int h, +void PixelFormat::bufferFromBuffer(uint8_t* dst, const PixelFormat &srcPF, + const uint8_t* src, int w, int h, int dstStride, int srcStride) const { if (equal(srcPF)) { @@ -391,7 +391,7 @@ void PixelFormat::bufferFromBuffer(rdr::U8* dst, const PixelFormat &srcPF, } } else if (is888() && srcPF.is888()) { // Optimised common case A: byte shuffling (e.g. endian conversion) - rdr::U8 *d[4], *s[4]; + uint8_t *d[4], *s[4]; int dstPad, srcPad; if (bigEndian) { @@ -442,15 +442,15 @@ void PixelFormat::bufferFromBuffer(rdr::U8* dst, const PixelFormat &srcPF, // Optimised common case B: 888 source switch (bpp) { case 8: - directBufferFromBufferFrom888((rdr::U8*)dst, srcPF, src, + directBufferFromBufferFrom888((uint8_t*)dst, srcPF, src, w, h, dstStride, srcStride); break; case 16: - directBufferFromBufferFrom888((rdr::U16*)dst, srcPF, src, + directBufferFromBufferFrom888((uint16_t*)dst, srcPF, src, w, h, dstStride, srcStride); break; case 32: - directBufferFromBufferFrom888((rdr::U32*)dst, srcPF, src, + directBufferFromBufferFrom888((uint32_t*)dst, srcPF, src, w, h, dstStride, srcStride); break; } @@ -458,15 +458,15 @@ void PixelFormat::bufferFromBuffer(rdr::U8* dst, const PixelFormat &srcPF, // Optimised common case C: 888 destination switch (srcPF.bpp) { case 8: - directBufferFromBufferTo888(dst, srcPF, (rdr::U8*)src, + directBufferFromBufferTo888(dst, srcPF, (uint8_t*)src, w, h, dstStride, srcStride); break; case 16: - directBufferFromBufferTo888(dst, srcPF, (rdr::U16*)src, + directBufferFromBufferTo888(dst, srcPF, (uint16_t*)src, w, h, dstStride, srcStride); break; case 32: - directBufferFromBufferTo888(dst, srcPF, (rdr::U32*)src, + directBufferFromBufferTo888(dst, srcPF, (uint32_t*)src, w, h, dstStride, srcStride); break; } @@ -478,7 +478,7 @@ void PixelFormat::bufferFromBuffer(rdr::U8* dst, const PixelFormat &srcPF, int w_ = w; while (w_--) { Pixel p; - rdr::U8 r, g, b; + uint8_t r, g, b; p = srcPF.pixelFromBuffer(src); srcPF.rgbFromPixel(p, &r, &g, &b); @@ -579,8 +579,8 @@ bool PixelFormat::parse(const char* str) depth = bits1 + bits2 + bits3; bpp = depth <= 8 ? 8 : ((depth <= 16) ? 16 : 32); trueColour = true; - rdr::U32 endianTest = 1; - bigEndian = (*(rdr::U8*)&endianTest == 0); + uint32_t endianTest = 1; + bigEndian = (*(uint8_t*)&endianTest == 0); greenShift = bits3; greenMax = (1 << bits2) - 1; @@ -607,7 +607,7 @@ bool PixelFormat::parse(const char* str) } -static int bits(rdr::U16 value) +static int bits(uint16_t value) { int bits; diff --git a/common/rfb/PixelFormat.h b/common/rfb/PixelFormat.h index ceb6c010..b59a7657 100644 --- a/common/rfb/PixelFormat.h +++ b/common/rfb/PixelFormat.h @@ -58,29 +58,29 @@ namespace rfb { bool isBigEndian(void) const; bool isLittleEndian(void) const; - inline Pixel pixelFromBuffer(const rdr::U8* buffer) const; - inline void bufferFromPixel(rdr::U8* buffer, Pixel pixel) const; + inline Pixel pixelFromBuffer(const uint8_t* buffer) const; + inline void bufferFromPixel(uint8_t* buffer, Pixel pixel) const; - inline Pixel pixelFromRGB(rdr::U16 red, rdr::U16 green, rdr::U16 blue) const; - inline Pixel pixelFromRGB(rdr::U8 red, rdr::U8 green, rdr::U8 blue) const; + inline Pixel pixelFromRGB(uint16_t red, uint16_t green, uint16_t blue) const; + inline Pixel pixelFromRGB(uint8_t red, uint8_t green, uint8_t blue) const; - void bufferFromRGB(rdr::U8 *dst, const rdr::U8* src, int pixels) const; - void bufferFromRGB(rdr::U8 *dst, const rdr::U8* src, + void bufferFromRGB(uint8_t *dst, const uint8_t* src, int pixels) const; + void bufferFromRGB(uint8_t *dst, const uint8_t* src, int w, int stride, int h) const; - inline void rgbFromPixel(Pixel pix, rdr::U16 *r, rdr::U16 *g, rdr::U16 *b) const; - inline void rgbFromPixel(Pixel pix, rdr::U8 *r, rdr::U8 *g, rdr::U8 *b) const; + inline void rgbFromPixel(Pixel pix, uint16_t *r, uint16_t *g, uint16_t *b) const; + inline void rgbFromPixel(Pixel pix, uint8_t *r, uint8_t *g, uint8_t *b) const; - void rgbFromBuffer(rdr::U8* dst, const rdr::U8* src, int pixels) const; - void rgbFromBuffer(rdr::U8* dst, const rdr::U8* src, + void rgbFromBuffer(uint8_t* dst, const uint8_t* src, int pixels) const; + void rgbFromBuffer(uint8_t* dst, const uint8_t* src, int w, int stride, int h) const; Pixel pixelFromPixel(const PixelFormat &srcPF, Pixel src) const; - void bufferFromBuffer(rdr::U8* dst, const PixelFormat &srcPF, - const rdr::U8* src, int pixels) const; - void bufferFromBuffer(rdr::U8* dst, const PixelFormat &srcPF, - const rdr::U8* src, int w, int h, + void bufferFromBuffer(uint8_t* dst, const PixelFormat &srcPF, + const uint8_t* src, int pixels) const; + void bufferFromBuffer(uint8_t* dst, const PixelFormat &srcPF, + const uint8_t* src, int w, int h, int dstStride, int srcStride) const; void print(char* str, int len) const; @@ -94,10 +94,10 @@ namespace rfb { // Templated, optimised methods template<class T> void directBufferFromBufferFrom888(T* dst, const PixelFormat &srcPF, - const rdr::U8* src, int w, int h, + const uint8_t* src, int w, int h, int dstStride, int srcStride) const; template<class T> - void directBufferFromBufferTo888(rdr::U8* dst, const PixelFormat &srcPF, + void directBufferFromBufferTo888(uint8_t* dst, const PixelFormat &srcPF, const T* src, int w, int h, int dstStride, int srcStride) const; @@ -124,18 +124,18 @@ namespace rfb { int maxBits, minBits; bool endianMismatch; - static rdr::U8 upconvTable[256*8]; - static rdr::U8 downconvTable[256*8]; + static uint8_t upconvTable[256*8]; + static uint8_t downconvTable[256*8]; class Init; friend class Init; static Init _init; /* Only for testing this class */ - friend void makePixel(const rfb::PixelFormat &, rdr::U8 *); + friend void makePixel(const rfb::PixelFormat &, uint8_t *); friend bool verifyPixel(const rfb::PixelFormat &, const rfb::PixelFormat &, - const rdr::U8 *); + const uint8_t *); }; } diff --git a/common/rfb/PixelFormat.inl b/common/rfb/PixelFormat.inl index 3a0bfe49..beec096a 100644 --- a/common/rfb/PixelFormat.inl +++ b/common/rfb/PixelFormat.inl @@ -19,7 +19,7 @@ namespace rfb { -inline Pixel PixelFormat::pixelFromBuffer(const rdr::U8* buffer) const +inline Pixel PixelFormat::pixelFromBuffer(const uint8_t* buffer) const { Pixel p; @@ -52,7 +52,7 @@ inline Pixel PixelFormat::pixelFromBuffer(const rdr::U8* buffer) const } -inline void PixelFormat::bufferFromPixel(rdr::U8* buffer, Pixel p) const +inline void PixelFormat::bufferFromPixel(uint8_t* buffer, Pixel p) const { if (bigEndian) { switch (bpp) { @@ -79,7 +79,7 @@ inline void PixelFormat::bufferFromPixel(rdr::U8* buffer, Pixel p) const } -inline Pixel PixelFormat::pixelFromRGB(rdr::U16 red, rdr::U16 green, rdr::U16 blue) const +inline Pixel PixelFormat::pixelFromRGB(uint16_t red, uint16_t green, uint16_t blue) const { Pixel p; @@ -91,7 +91,7 @@ inline Pixel PixelFormat::pixelFromRGB(rdr::U16 red, rdr::U16 green, rdr::U16 bl } -inline Pixel PixelFormat::pixelFromRGB(rdr::U8 red, rdr::U8 green, rdr::U8 blue) const +inline Pixel PixelFormat::pixelFromRGB(uint8_t red, uint8_t green, uint8_t blue) const { Pixel p; @@ -103,9 +103,9 @@ inline Pixel PixelFormat::pixelFromRGB(rdr::U8 red, rdr::U8 green, rdr::U8 blue) } -inline void PixelFormat::rgbFromPixel(Pixel p, rdr::U16 *r, rdr::U16 *g, rdr::U16 *b) const +inline void PixelFormat::rgbFromPixel(Pixel p, uint16_t *r, uint16_t *g, uint16_t *b) const { - rdr::U8 _r, _g, _b; + uint8_t _r, _g, _b; _r = p >> redShift; _g = p >> greenShift; @@ -121,9 +121,9 @@ inline void PixelFormat::rgbFromPixel(Pixel p, rdr::U16 *r, rdr::U16 *g, rdr::U1 } -inline void PixelFormat::rgbFromPixel(Pixel p, rdr::U8 *r, rdr::U8 *g, rdr::U8 *b) const +inline void PixelFormat::rgbFromPixel(Pixel p, uint8_t *r, uint8_t *g, uint8_t *b) const { - rdr::U8 _r, _g, _b; + uint8_t _r, _g, _b; _r = p >> redShift; _g = p >> greenShift; diff --git a/common/rfb/RREDecoder.cxx b/common/rfb/RREDecoder.cxx index 1384a2be..c85c015c 100644 --- a/common/rfb/RREDecoder.cxx +++ b/common/rfb/RREDecoder.cxx @@ -43,7 +43,7 @@ RREDecoder::~RREDecoder() bool RREDecoder::readRect(const Rect& /*r*/, rdr::InStream* is, const ServerParams& server, rdr::OutStream* os) { - rdr::U32 numRects; + uint32_t numRects; size_t len; if (!is->hasData(4)) @@ -73,9 +73,9 @@ void RREDecoder::decodeRect(const Rect& r, const void* buffer, rdr::MemInStream is(buffer, buflen); const PixelFormat& pf = server.pf(); switch (pf.bpp) { - case 8: rreDecode<rdr::U8 >(r, &is, pf, pb); break; - case 16: rreDecode<rdr::U16>(r, &is, pf, pb); break; - case 32: rreDecode<rdr::U32>(r, &is, pf, pb); break; + case 8: rreDecode<uint8_t >(r, &is, pf, pb); break; + case 16: rreDecode<uint16_t>(r, &is, pf, pb); break; + case 32: rreDecode<uint32_t>(r, &is, pf, pb); break; } } diff --git a/common/rfb/RREEncoder.cxx b/common/rfb/RREEncoder.cxx index bbad7c7e..e73a23bf 100644 --- a/common/rfb/RREEncoder.cxx +++ b/common/rfb/RREEncoder.cxx @@ -47,9 +47,9 @@ bool RREEncoder::isSupported() void RREEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) { - rdr::U8* imageBuf; + uint8_t* imageBuf; int stride; - rdr::U32 bg; + uint32_t bg; int w = pb->width(); int h = pb->height(); @@ -79,13 +79,13 @@ void RREEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) int nSubrects = -1; switch (pb->getPF().bpp) { case 8: - nSubrects = rreEncode<rdr::U8>((rdr::U8*)imageBuf, w, h, &mos, bg); + nSubrects = rreEncode<uint8_t>((uint8_t*)imageBuf, w, h, &mos, bg); break; case 16: - nSubrects = rreEncode<rdr::U16>((rdr::U16*)imageBuf, w, h, &mos, bg); + nSubrects = rreEncode<uint16_t>((uint16_t*)imageBuf, w, h, &mos, bg); break; case 32: - nSubrects = rreEncode<rdr::U32>((rdr::U32*)imageBuf, w, h, &mos, bg); + nSubrects = rreEncode<uint32_t>((uint32_t*)imageBuf, w, h, &mos, bg); break; } @@ -99,7 +99,7 @@ void RREEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) void RREEncoder::writeSolidRect(int /*width*/, int /*height*/, const PixelFormat& pf, - const rdr::U8* colour) + const uint8_t* colour) { rdr::OutStream* os; diff --git a/common/rfb/RREEncoder.h b/common/rfb/RREEncoder.h index 767e7348..b13135b4 100644 --- a/common/rfb/RREEncoder.h +++ b/common/rfb/RREEncoder.h @@ -33,7 +33,7 @@ namespace rfb { virtual void writeRect(const PixelBuffer* pb, const Palette& palette); virtual void writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour); + const uint8_t* colour); private: template<class T> inline void writePixel(rdr::OutStream* os, T pixel); diff --git a/common/rfb/RawEncoder.cxx b/common/rfb/RawEncoder.cxx index 28115588..2fa1af36 100644 --- a/common/rfb/RawEncoder.cxx +++ b/common/rfb/RawEncoder.cxx @@ -47,7 +47,7 @@ bool RawEncoder::isSupported() void RawEncoder::writeRect(const PixelBuffer* pb, const Palette& /*palette*/) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; rdr::OutStream* os; @@ -68,7 +68,7 @@ void RawEncoder::writeRect(const PixelBuffer* pb, void RawEncoder::writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour) + const uint8_t* colour) { rdr::OutStream* os; int pixels, pixel_size; diff --git a/common/rfb/RawEncoder.h b/common/rfb/RawEncoder.h index ee98d4ad..76da4c5b 100644 --- a/common/rfb/RawEncoder.h +++ b/common/rfb/RawEncoder.h @@ -31,7 +31,7 @@ namespace rfb { virtual void writeRect(const PixelBuffer* pb, const Palette& palette); virtual void writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour); + const uint8_t* colour); }; } #endif diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index 8e0bff8c..a30e9187 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -161,8 +161,8 @@ bool SConnection::processVersionMsg() versionReceived(); - std::list<rdr::U8> secTypes; - std::list<rdr::U8>::iterator i; + std::list<uint8_t> secTypes; + std::list<uint8_t>::iterator i; secTypes = security.GetEnabledSecTypes(); if (client.isVersion(3,3)) { @@ -216,8 +216,8 @@ bool SConnection::processSecurityTypeMsg() void SConnection::processSecurityType(int secType) { // Verify that the requested security type should be offered - std::list<rdr::U8> secTypes; - std::list<rdr::U8>::iterator i; + std::list<uint8_t> secTypes; + std::list<uint8_t>::iterator i; secTypes = security.GetEnabledSecTypes(); for (i=secTypes.begin(); i!=secTypes.end(); i++) @@ -352,7 +352,7 @@ bool SConnection::accessCheck(AccessRights ar) const return (accessRights & ar) == ar; } -void SConnection::setEncodings(int nEncodings, const rdr::S32* encodings) +void SConnection::setEncodings(int nEncodings, const int32_t* encodings) { int i; @@ -367,7 +367,7 @@ void SConnection::setEncodings(int nEncodings, const rdr::S32* encodings) SMsgHandler::setEncodings(nEncodings, encodings); if (client.supportsEncoding(pseudoEncodingExtendedClipboard)) { - rdr::U32 sizes[] = { 0 }; + uint32_t sizes[] = { 0 }; writer()->writeClipboardCaps(rfb::clipboardUTF8 | rfb::clipboardRequest | rfb::clipboardPeek | @@ -389,7 +389,7 @@ void SConnection::clientCutText(const char* str) handleClipboardAnnounce(true); } -void SConnection::handleClipboardRequest(rdr::U32 flags) +void SConnection::handleClipboardRequest(uint32_t flags) { if (!(flags & rfb::clipboardUTF8)) { vlog.debug("Ignoring clipboard request for unsupported formats 0x%x", flags); @@ -408,7 +408,7 @@ void SConnection::handleClipboardPeek() writer()->writeClipboardNotify(hasLocalClipboard ? rfb::clipboardUTF8 : 0); } -void SConnection::handleClipboardNotify(rdr::U32 flags) +void SConnection::handleClipboardNotify(uint32_t flags) { strFree(clientClipboard); clientClipboard = NULL; @@ -421,9 +421,9 @@ void SConnection::handleClipboardNotify(rdr::U32 flags) } } -void SConnection::handleClipboardProvide(rdr::U32 flags, +void SConnection::handleClipboardProvide(uint32_t flags, const size_t* lengths, - const rdr::U8* const* data) + const uint8_t* const* data) { if (!(flags & rfb::clipboardUTF8)) { vlog.debug("Ignoring clipboard provide with unsupported formats 0x%x", flags); @@ -523,7 +523,7 @@ void SConnection::framebufferUpdateRequest(const Rect& /*r*/, } } -void SConnection::fence(rdr::U32 flags, unsigned len, const char data[]) +void SConnection::fence(uint32_t flags, unsigned len, const char data[]) { if (!(flags & fenceFlagRequest)) return; @@ -596,7 +596,7 @@ void SConnection::sendClipboardData(const char* data) (client.clipboardFlags() & rfb::clipboardProvide)) { CharArray filtered(convertCRLF(data)); size_t sizes[1] = { strlen(filtered.buf) + 1 }; - const rdr::U8* data[1] = { (const rdr::U8*)filtered.buf }; + const uint8_t* data[1] = { (const uint8_t*)filtered.buf }; if (unsolicitedClipboardAttempt) { unsolicitedClipboardAttempt = false; @@ -631,7 +631,7 @@ void SConnection::cleanup() void SConnection::writeFakeColourMap(void) { int i; - rdr::U16 red[256], green[256], blue[256]; + uint16_t red[256], green[256], blue[256]; for (i = 0;i < 256;i++) client.pf().rgbFromPixel(i, &red[i], &green[i], &blue[i]); diff --git a/common/rfb/SConnection.h b/common/rfb/SConnection.h index b7e30c6a..113811b9 100644 --- a/common/rfb/SConnection.h +++ b/common/rfb/SConnection.h @@ -80,16 +80,16 @@ namespace rfb { // Overridden from SMsgHandler - virtual void setEncodings(int nEncodings, const rdr::S32* encodings); + virtual void setEncodings(int nEncodings, const int32_t* encodings); virtual void clientCutText(const char* str); - virtual void handleClipboardRequest(rdr::U32 flags); + virtual void handleClipboardRequest(uint32_t flags); virtual void handleClipboardPeek(); - virtual void handleClipboardNotify(rdr::U32 flags); - virtual void handleClipboardProvide(rdr::U32 flags, + virtual void handleClipboardNotify(uint32_t flags); + virtual void handleClipboardProvide(uint32_t flags, const size_t* lengths, - const rdr::U8* const* data); + const uint8_t* const* data); virtual void supportsQEMUKeyEvent(); @@ -130,7 +130,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(rdr::U32 flags, unsigned len, const char data[]); + virtual void fence(uint32_t flags, unsigned len, const char data[]); // enableContinuousUpdates() is called when the client wants to enable // or disable continuous updates, or change the active area. @@ -177,7 +177,7 @@ namespace rfb { // of a SConnection to the server. How the access rights are treated // is up to the derived class. - typedef rdr::U16 AccessRights; + typedef uint16_t AccessRights; static const AccessRights AccessView; // View display contents static const AccessRights AccessKeyEvents; // Send key events static const AccessRights AccessPtrEvents; // Send pointer events @@ -216,7 +216,7 @@ namespace rfb { stateEnum state() { return state_; } - rdr::S32 getPreferredEncoding() { return preferredEncoding; } + int32_t getPreferredEncoding() { return preferredEncoding; } protected: // throwConnFailedException() prints a message to the log, sends a conn @@ -260,7 +260,7 @@ namespace rfb { CharArray authFailureMsg; stateEnum state_; - rdr::S32 preferredEncoding; + int32_t preferredEncoding; AccessRights accessRights; char* clientClipboard; diff --git a/common/rfb/SDesktop.h b/common/rfb/SDesktop.h index 6d2a5dd8..0a6203a2 100644 --- a/common/rfb/SDesktop.h +++ b/common/rfb/SDesktop.h @@ -125,13 +125,13 @@ namespace rfb { public: SStaticDesktop(const Point& size) : server(0), buffer(0) { PixelFormat pf; - const rdr::U8 black[4] = { 0, 0, 0, 0 }; + const uint8_t black[4] = { 0, 0, 0, 0 }; buffer = new ManagedPixelBuffer(pf, size.x, size.y); if (buffer) buffer->fillRect(buffer->getRect(), black); } SStaticDesktop(const Point& size, const PixelFormat& pf) : buffer(0) { - const rdr::U8 black[4] = { 0, 0, 0, 0 }; + const uint8_t black[4] = { 0, 0, 0, 0 }; buffer = new ManagedPixelBuffer(pf, size.x, size.y); if (buffer) buffer->fillRect(buffer->getRect(), black); diff --git a/common/rfb/SMsgHandler.cxx b/common/rfb/SMsgHandler.cxx index 4f008039..3eccd92d 100644 --- a/common/rfb/SMsgHandler.cxx +++ b/common/rfb/SMsgHandler.cxx @@ -49,7 +49,7 @@ void SMsgHandler::setPixelFormat(const PixelFormat& pf) client.setPF(pf); } -void SMsgHandler::setEncodings(int nEncodings, const rdr::S32* encodings) +void SMsgHandler::setEncodings(int nEncodings, const int32_t* encodings) { bool firstFence, firstContinuousUpdates, firstLEDState, firstQEMUKeyEvent; @@ -73,7 +73,7 @@ void SMsgHandler::setEncodings(int nEncodings, const rdr::S32* encodings) supportsQEMUKeyEvent(); } -void SMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) +void SMsgHandler::handleClipboardCaps(uint32_t flags, const uint32_t* lengths) { int i; @@ -118,7 +118,7 @@ void SMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) client.setClipboardCaps(flags, lengths); } -void SMsgHandler::handleClipboardRequest(rdr::U32 /*flags*/) +void SMsgHandler::handleClipboardRequest(uint32_t /*flags*/) { } @@ -126,13 +126,13 @@ void SMsgHandler::handleClipboardPeek() { } -void SMsgHandler::handleClipboardNotify(rdr::U32 /*flags*/) +void SMsgHandler::handleClipboardNotify(uint32_t /*flags*/) { } -void SMsgHandler::handleClipboardProvide(rdr::U32 /*flags*/, +void SMsgHandler::handleClipboardProvide(uint32_t /*flags*/, const size_t* /*lengths*/, - const rdr::U8* const* /*data*/) + const uint8_t* const* /*data*/) { } diff --git a/common/rfb/SMsgHandler.h b/common/rfb/SMsgHandler.h index 274a1c3c..ec8040d2 100644 --- a/common/rfb/SMsgHandler.h +++ b/common/rfb/SMsgHandler.h @@ -23,7 +23,8 @@ #ifndef __RFB_SMSGHANDLER_H__ #define __RFB_SMSGHANDLER_H__ -#include <rdr/types.h> +#include <stdint.h> + #include <rfb/PixelFormat.h> #include <rfb/ClientParams.h> #include <rfb/InputHandler.h> @@ -46,22 +47,22 @@ namespace rfb { virtual void clientInit(bool shared); virtual void setPixelFormat(const PixelFormat& pf); - virtual void setEncodings(int nEncodings, const rdr::S32* encodings); + virtual void setEncodings(int nEncodings, const int32_t* encodings); 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(rdr::U32 flags, unsigned len, const char data[]) = 0; + virtual void fence(uint32_t flags, unsigned len, const char data[]) = 0; virtual void enableContinuousUpdates(bool enable, int x, int y, int w, int h) = 0; - virtual void handleClipboardCaps(rdr::U32 flags, - const rdr::U32* lengths); - virtual void handleClipboardRequest(rdr::U32 flags); + virtual void handleClipboardCaps(uint32_t flags, + const uint32_t* lengths); + virtual void handleClipboardRequest(uint32_t flags); virtual void handleClipboardPeek(); - virtual void handleClipboardNotify(rdr::U32 flags); - virtual void handleClipboardProvide(rdr::U32 flags, + virtual void handleClipboardNotify(uint32_t flags); + virtual void handleClipboardProvide(uint32_t flags, const size_t* lengths, - const rdr::U8* const* data); + const uint8_t* const* data); // InputHandler interface // The InputHandler methods will be called for the corresponding messages. diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx index e7c78c4e..ba2eb175 100644 --- a/common/rfb/SMsgReader.cxx +++ b/common/rfb/SMsgReader.cxx @@ -25,6 +25,7 @@ #include <rdr/InStream.h> #include <rdr/ZlibInStream.h> +#include <rdr/types.h> #include <rfb/msgTypes.h> #include <rfb/qemuTypes.h> @@ -153,7 +154,7 @@ bool SMsgReader::readSetDesktopSize() { int width, height; int screens, i; - rdr::U32 id, flags; + uint32_t id, flags; int sx, sy, sw, sh; ScreenSet layout; @@ -225,8 +226,8 @@ bool SMsgReader::readEnableContinuousUpdates() bool SMsgReader::readFence() { - rdr::U32 flags; - rdr::U8 len; + uint32_t flags; + uint8_t len; char data[64]; if (!is->hasData(3 + 4 + 1)) @@ -263,7 +264,7 @@ bool SMsgReader::readKeyEvent() return false; bool down = is->readU8(); is->skip(2); - rdr::U32 key = is->readU32(); + uint32_t key = is->readU32(); handler->keyEvent(key, 0, down); return true; } @@ -288,10 +289,10 @@ bool SMsgReader::readClientCutText() is->setRestorePoint(); is->skip(3); - rdr::U32 len = is->readU32(); + uint32_t len = is->readU32(); if (len & 0x80000000) { - rdr::S32 slen = len; + int32_t slen = len; slen = -slen; if (readExtendedClipboard(slen)) { is->clearRestorePoint(); @@ -320,10 +321,10 @@ bool SMsgReader::readClientCutText() return true; } -bool SMsgReader::readExtendedClipboard(rdr::S32 len) +bool SMsgReader::readExtendedClipboard(int32_t len) { - rdr::U32 flags; - rdr::U32 action; + uint32_t flags; + uint32_t action; if (!is->hasData(len)) return false; @@ -342,7 +343,7 @@ bool SMsgReader::readExtendedClipboard(rdr::S32 len) if (action & clipboardCaps) { int i; size_t num; - rdr::U32 lengths[16]; + uint32_t lengths[16]; num = 0; for (i = 0;i < 16;i++) { @@ -350,7 +351,7 @@ bool SMsgReader::readExtendedClipboard(rdr::S32 len) num++; } - if (len < (rdr::S32)(4 + 4*num)) + if (len < (int32_t)(4 + 4*num)) throw Exception("Invalid extended clipboard message"); num = 0; @@ -366,7 +367,7 @@ bool SMsgReader::readExtendedClipboard(rdr::S32 len) int i; size_t num; size_t lengths[16]; - rdr::U8* buffers[16]; + uint8_t* buffers[16]; zis.setUnderlying(is, len - 4); @@ -407,7 +408,7 @@ bool SMsgReader::readExtendedClipboard(rdr::S32 len) if (!zis.hasData(lengths[num])) throw Exception("Extended clipboard decode error"); - buffers[num] = new rdr::U8[lengths[num]]; + buffers[num] = new uint8_t[lengths[num]]; zis.readBytes(buffers[num], lengths[num]); num++; } @@ -476,8 +477,8 @@ bool SMsgReader::readQEMUKeyEvent() if (!is->hasData(2 + 4 + 4)) return false; bool down = is->readU16(); - rdr::U32 keysym = is->readU32(); - rdr::U32 keycode = is->readU32(); + uint32_t keysym = is->readU32(); + uint32_t keycode = is->readU32(); if (!keycode) { vlog.error("Key event without keycode - ignoring"); return true; diff --git a/common/rfb/SMsgReader.h b/common/rfb/SMsgReader.h index acc872ed..f99b6627 100644 --- a/common/rfb/SMsgReader.h +++ b/common/rfb/SMsgReader.h @@ -54,7 +54,7 @@ namespace rfb { bool readKeyEvent(); bool readPointerEvent(); bool readClientCutText(); - bool readExtendedClipboard(rdr::S32 len); + bool readExtendedClipboard(int32_t len); bool readQEMUMessage(); bool readQEMUKeyEvent(); @@ -70,7 +70,7 @@ namespace rfb { stateEnum state; - rdr::U8 currentMsgType; + uint8_t currentMsgType; }; } #endif diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx index c8b50b67..29bd5897 100644 --- a/common/rfb/SMsgWriter.cxx +++ b/common/rfb/SMsgWriter.cxx @@ -27,6 +27,7 @@ #include <rdr/OutStream.h> #include <rdr/MemOutStream.h> #include <rdr/ZlibOutStream.h> +#include <rdr/types.h> #include <rfb/msgTypes.h> #include <rfb/fenceTypes.h> @@ -56,7 +57,7 @@ SMsgWriter::~SMsgWriter() { } -void SMsgWriter::writeServerInit(rdr::U16 width, rdr::U16 height, +void SMsgWriter::writeServerInit(uint16_t width, uint16_t height, const PixelFormat& pf, const char* name) { os->writeU16(width); @@ -68,9 +69,9 @@ void SMsgWriter::writeServerInit(rdr::U16 width, rdr::U16 height, } void SMsgWriter::writeSetColourMapEntries(int firstColour, int nColours, - const rdr::U16 red[], - const rdr::U16 green[], - const rdr::U16 blue[]) + const uint16_t red[], + const uint16_t green[], + const uint16_t blue[]) { startMsg(msgTypeSetColourMapEntries); os->pad(1); @@ -105,8 +106,8 @@ void SMsgWriter::writeServerCutText(const char* str) endMsg(); } -void SMsgWriter::writeClipboardCaps(rdr::U32 caps, - const rdr::U32* lengths) +void SMsgWriter::writeClipboardCaps(uint32_t caps, + const uint32_t* lengths) { size_t i, count; @@ -134,7 +135,7 @@ void SMsgWriter::writeClipboardCaps(rdr::U32 caps, endMsg(); } -void SMsgWriter::writeClipboardRequest(rdr::U32 flags) +void SMsgWriter::writeClipboardRequest(uint32_t flags) { if (!client->supportsEncoding(pseudoEncodingExtendedClipboard)) throw Exception("Client does not support extended clipboard"); @@ -148,7 +149,7 @@ void SMsgWriter::writeClipboardRequest(rdr::U32 flags) endMsg(); } -void SMsgWriter::writeClipboardPeek(rdr::U32 flags) +void SMsgWriter::writeClipboardPeek(uint32_t flags) { if (!client->supportsEncoding(pseudoEncodingExtendedClipboard)) throw Exception("Client does not support extended clipboard"); @@ -162,7 +163,7 @@ void SMsgWriter::writeClipboardPeek(rdr::U32 flags) endMsg(); } -void SMsgWriter::writeClipboardNotify(rdr::U32 flags) +void SMsgWriter::writeClipboardNotify(uint32_t flags) { if (!client->supportsEncoding(pseudoEncodingExtendedClipboard)) throw Exception("Client does not support extended clipboard"); @@ -176,9 +177,9 @@ void SMsgWriter::writeClipboardNotify(rdr::U32 flags) endMsg(); } -void SMsgWriter::writeClipboardProvide(rdr::U32 flags, +void SMsgWriter::writeClipboardProvide(uint32_t flags, const size_t* lengths, - const rdr::U8* const* data) + const uint8_t* const* data) { rdr::MemOutStream mos; rdr::ZlibOutStream zos; @@ -211,7 +212,7 @@ void SMsgWriter::writeClipboardProvide(rdr::U32 flags, endMsg(); } -void SMsgWriter::writeFence(rdr::U32 flags, unsigned len, const char data[]) +void SMsgWriter::writeFence(uint32_t flags, unsigned len, const char data[]) { if (!client->supportsEncoding(pseudoEncodingFence)) throw Exception("Client does not support fences"); @@ -242,7 +243,7 @@ void SMsgWriter::writeEndOfContinuousUpdates() endMsg(); } -void SMsgWriter::writeDesktopSize(rdr::U16 reason, rdr::U16 result) +void SMsgWriter::writeDesktopSize(uint16_t reason, uint16_t result) { ExtendedDesktopSizeMsg msg; @@ -445,8 +446,8 @@ void SMsgWriter::writePseudoRects() rdr::U8Array data(cursor.width()*cursor.height() * (client->pf().bpp/8)); rdr::U8Array mask(cursor.getMask()); - const rdr::U8* in; - rdr::U8* out; + const uint8_t* in; + uint8_t* out; in = cursor.getBuffer(); out = data.buf; @@ -538,8 +539,8 @@ void SMsgWriter::writeSetDesktopSizeRect(int width, int height) os->writeU32(pseudoEncodingDesktopSize); } -void SMsgWriter::writeExtendedDesktopSizeRect(rdr::U16 reason, - rdr::U16 result, +void SMsgWriter::writeExtendedDesktopSizeRect(uint16_t reason, + uint16_t result, int fb_width, int fb_height, const ScreenSet& layout) @@ -632,7 +633,7 @@ void SMsgWriter::writeSetXCursorRect(int width, int height, void SMsgWriter::writeSetCursorWithAlphaRect(int width, int height, int hotspotX, int hotspotY, - const rdr::U8* data) + const uint8_t* data) { if (!client->supportsEncoding(pseudoEncodingCursorWithAlpha)) throw Exception("Client does not support local cursors"); @@ -660,7 +661,7 @@ void SMsgWriter::writeSetCursorWithAlphaRect(int width, int height, void SMsgWriter::writeSetVMwareCursorRect(int width, int height, int hotspotX, int hotspotY, - const rdr::U8* data) + const uint8_t* data) { if (!client->supportsEncoding(pseudoEncodingVMwareCursor)) throw Exception("Client does not support local cursors"); @@ -694,7 +695,7 @@ void SMsgWriter::writeSetVMwareCursorPositionRect(int hotspotX, int hotspotY) os->writeU32(pseudoEncodingVMwareCursorPosition); } -void SMsgWriter::writeLEDStateRect(rdr::U8 state) +void SMsgWriter::writeLEDStateRect(uint8_t state) { if (!client->supportsEncoding(pseudoEncodingLEDState) && !client->supportsEncoding(pseudoEncodingVMwareLEDState)) diff --git a/common/rfb/SMsgWriter.h b/common/rfb/SMsgWriter.h index 49381bad..07f7cf23 100644 --- a/common/rfb/SMsgWriter.h +++ b/common/rfb/SMsgWriter.h @@ -23,7 +23,8 @@ #ifndef __RFB_SMSGWRITER_H__ #define __RFB_SMSGWRITER_H__ -#include <rdr/types.h> +#include <stdint.h> + #include <rfb/encodings.h> #include <rfb/ScreenSet.h> @@ -42,7 +43,7 @@ namespace rfb { // writeServerInit() must only be called at the appropriate time in the // protocol initialisation. - void writeServerInit(rdr::U16 width, rdr::U16 height, + void writeServerInit(uint16_t width, uint16_t height, const PixelFormat& pf, const char* name); // Methods to write normal protocol messages @@ -50,24 +51,24 @@ namespace rfb { // writeSetColourMapEntries() writes a setColourMapEntries message, using // the given colour entries. void writeSetColourMapEntries(int firstColour, int nColours, - const rdr::U16 red[], - const rdr::U16 green[], - const rdr::U16 blue[]); + const uint16_t red[], + const uint16_t green[], + const uint16_t blue[]); // writeBell() does the obvious thing. void writeBell(); void writeServerCutText(const char* str); - void writeClipboardCaps(rdr::U32 caps, const rdr::U32* lengths); - void writeClipboardRequest(rdr::U32 flags); - void writeClipboardPeek(rdr::U32 flags); - void writeClipboardNotify(rdr::U32 flags); - void writeClipboardProvide(rdr::U32 flags, const size_t* lengths, - const rdr::U8* const* data); + void writeClipboardCaps(uint32_t caps, const uint32_t* lengths); + void writeClipboardRequest(uint32_t flags); + void writeClipboardPeek(uint32_t flags); + void writeClipboardNotify(uint32_t flags); + void writeClipboardProvide(uint32_t flags, const size_t* lengths, + const uint8_t* const* data); // writeFence() sends a new fence request or response to the client. - void writeFence(rdr::U32 flags, unsigned len, const char data[]); + void writeFence(uint32_t flags, unsigned len, const char data[]); // writeEndOfContinuousUpdates() indicates that we have left continuous // updates mode. @@ -75,7 +76,7 @@ namespace rfb { // writeDesktopSize() won't actually write immediately, but will // write the relevant pseudo-rectangle as part of the next update. - void writeDesktopSize(rdr::U16 reason, rdr::U16 result=0); + void writeDesktopSize(uint16_t reason, uint16_t result=0); void writeSetDesktopName(); @@ -128,7 +129,7 @@ namespace rfb { void writeNoDataRects(); void writeSetDesktopSizeRect(int width, int height); - void writeExtendedDesktopSizeRect(rdr::U16 reason, rdr::U16 result, + void writeExtendedDesktopSizeRect(uint16_t reason, uint16_t result, int fb_width, int fb_height, const ScreenSet& layout); void writeSetDesktopNameRect(const char *name); @@ -140,12 +141,12 @@ namespace rfb { const void* data, const void* mask); void writeSetCursorWithAlphaRect(int width, int height, int hotspotX, int hotspotY, - const rdr::U8* data); + const uint8_t* data); void writeSetVMwareCursorRect(int width, int height, int hotspotX, int hotspotY, - const rdr::U8* data); + const uint8_t* data); void writeSetVMwareCursorPositionRect(int hotspotX, int hotspotY); - void writeLEDStateRect(rdr::U8 state); + void writeLEDStateRect(uint8_t state); void writeQEMUKeyEventRect(); ClientParams* client; @@ -161,7 +162,7 @@ namespace rfb { bool needQEMUKeyEvent; typedef struct { - rdr::U16 reason, result; + uint16_t reason, result; } ExtendedDesktopSizeMsg; std::list<ExtendedDesktopSizeMsg> extendedDesktopSizeMsgs; diff --git a/common/rfb/SSecurity.h b/common/rfb/SSecurity.h index cef2027f..fa3c63cb 100644 --- a/common/rfb/SSecurity.h +++ b/common/rfb/SSecurity.h @@ -43,7 +43,6 @@ #ifndef __RFB_SSECURITY_H__ #define __RFB_SSECURITY_H__ -#include <rdr/types.h> #include <rfb/SConnection.h> #include <rfb/util.h> #include <list> diff --git a/common/rfb/SSecurityRSAAES.cxx b/common/rfb/SSecurityRSAAES.cxx index 3211f12f..1b13397d 100644 --- a/common/rfb/SSecurityRSAAES.cxx +++ b/common/rfb/SSecurityRSAAES.cxx @@ -39,6 +39,7 @@ #include <rfb/Exception.h> #include <rdr/AESInStream.h> #include <rdr/AESOutStream.h> +#include <rdr/types.h> #if !defined(WIN32) && !defined(__APPLE__) #include <rfb/UnixPasswordValidator.h> #endif @@ -68,7 +69,7 @@ BoolParameter SSecurityRSAAES::requireUsername ("RequireUsername", "Require username for the RSA-AES security types", false, ConfServer); -SSecurityRSAAES::SSecurityRSAAES(SConnection* sc, rdr::U32 _secType, +SSecurityRSAAES::SSecurityRSAAES(SConnection* sc, uint32_t _secType, int _keySize, bool _isAllEncrypted) : SSecurity(sc), state(SendPublicKey), keySize(_keySize), isAllEncrypted(_isAllEncrypted), secType(_secType), @@ -107,7 +108,7 @@ void SSecurityRSAAES::cleanup() delete raos; } -static inline ssize_t findSubstr(rdr::U8* data, size_t size, const char *pattern) +static inline ssize_t findSubstr(uint8_t* data, size_t size, const char *pattern) { size_t patternLength = strlen(pattern); for (size_t i = 0; i + patternLength < size; ++i) { @@ -121,8 +122,8 @@ next: return -1; } -static bool loadPEM(rdr::U8* data, size_t size, const char *begin, - const char *end, rdr::U8** der, size_t *derSize) +static bool loadPEM(uint8_t* data, size_t size, const char *begin, + const char *end, uint8_t** der, size_t *derSize) { ssize_t pos1 = findSubstr(data, size, begin); if (pos1 == -1) @@ -134,7 +135,7 @@ static bool loadPEM(rdr::U8* data, size_t size, const char *begin, char *derBase64 = (char *)data + pos1; if (!base64Size) return false; - *der = new rdr::U8[BASE64_DECODE_LENGTH(base64Size)]; + *der = new uint8_t[BASE64_DECODE_LENGTH(base64Size)]; struct base64_decode_ctx ctx; base64_decode_init(&ctx); if (!base64_decode_update(&ctx, derSize, *der, base64Size, derBase64)) @@ -180,7 +181,7 @@ void SSecurityRSAAES::loadPrivateKey() throw ConnFailedException("failed to import key"); } -void SSecurityRSAAES::loadPKCS1Key(const rdr::U8* data, size_t size) +void SSecurityRSAAES::loadPKCS1Key(const uint8_t* data, size_t size) { struct rsa_public_key pub; rsa_private_key_init(&serverKey); @@ -191,14 +192,14 @@ void SSecurityRSAAES::loadPKCS1Key(const rdr::U8* data, size_t size) throw ConnFailedException("failed to import key"); } serverKeyLength = serverKey.size * 8; - serverKeyN = new rdr::U8[serverKey.size]; - serverKeyE = new rdr::U8[serverKey.size]; + serverKeyN = new uint8_t[serverKey.size]; + serverKeyE = new uint8_t[serverKey.size]; nettle_mpz_get_str_256(serverKey.size, serverKeyN, pub.n); nettle_mpz_get_str_256(serverKey.size, serverKeyE, pub.e); rsa_public_key_clear(&pub); } -void SSecurityRSAAES::loadPKCS8Key(const rdr::U8* data, size_t size) +void SSecurityRSAAES::loadPKCS8Key(const uint8_t* data, size_t size) { struct asn1_der_iterator i, j; uint32_t version; @@ -296,8 +297,8 @@ bool SSecurityRSAAES::readPublicKey() if (!is->hasDataOrRestore(size * 2)) return false; is->clearRestorePoint(); - clientKeyE = new rdr::U8[size]; - clientKeyN = new rdr::U8[size]; + clientKeyE = new uint8_t[size]; + clientKeyN = new uint8_t[size]; is->readBytes(clientKeyN, size); is->readBytes(clientKeyE, size); rsa_public_key_init(&clientKey); @@ -336,7 +337,7 @@ void SSecurityRSAAES::writeRandom() mpz_clear(x); throw ConnFailedException("failed to encrypt random"); } - rdr::U8* buffer = new rdr::U8[clientKey.size]; + uint8_t* buffer = new uint8_t[clientKey.size]; nettle_mpz_get_str_256(clientKey.size, buffer, x); mpz_clear(x); os->writeU16(clientKey.size); @@ -357,7 +358,7 @@ bool SSecurityRSAAES::readRandom() if (!is->hasDataOrRestore(size)) return false; is->clearRestorePoint(); - rdr::U8* buffer = new rdr::U8[size]; + uint8_t* buffer = new uint8_t[size]; is->readBytes(buffer, size); size_t randomSize = keySize / 8; mpz_t x; @@ -376,7 +377,7 @@ void SSecurityRSAAES::setCipher() { rawis = sc->getInStream(); rawos = sc->getOutStream(); - rdr::U8 key[32]; + uint8_t key[32]; if (keySize == 128) { struct sha1_ctx ctx; sha1_init(&ctx); @@ -408,20 +409,20 @@ void SSecurityRSAAES::setCipher() void SSecurityRSAAES::writeHash() { - rdr::U8 hash[32]; + uint8_t hash[32]; size_t len = serverKeyLength; - rdr::U8 lenServerKey[4] = { - (rdr::U8)((len & 0xff000000) >> 24), - (rdr::U8)((len & 0xff0000) >> 16), - (rdr::U8)((len & 0xff00) >> 8), - (rdr::U8)(len & 0xff) + uint8_t lenServerKey[4] = { + (uint8_t)((len & 0xff000000) >> 24), + (uint8_t)((len & 0xff0000) >> 16), + (uint8_t)((len & 0xff00) >> 8), + (uint8_t)(len & 0xff) }; len = clientKeyLength; - rdr::U8 lenClientKey[4] = { - (rdr::U8)((len & 0xff000000) >> 24), - (rdr::U8)((len & 0xff0000) >> 16), - (rdr::U8)((len & 0xff00) >> 8), - (rdr::U8)(len & 0xff) + uint8_t lenClientKey[4] = { + (uint8_t)((len & 0xff000000) >> 24), + (uint8_t)((len & 0xff0000) >> 16), + (uint8_t)((len & 0xff00) >> 8), + (uint8_t)(len & 0xff) }; int hashSize; if (keySize == 128) { @@ -453,25 +454,25 @@ void SSecurityRSAAES::writeHash() bool SSecurityRSAAES::readHash() { - rdr::U8 hash[32]; - rdr::U8 realHash[32]; + uint8_t hash[32]; + uint8_t realHash[32]; int hashSize = keySize == 128 ? 20 : 32; if (!rais->hasData(hashSize)) return false; rais->readBytes(hash, hashSize); size_t len = serverKeyLength; - rdr::U8 lenServerKey[4] = { - (rdr::U8)((len & 0xff000000) >> 24), - (rdr::U8)((len & 0xff0000) >> 16), - (rdr::U8)((len & 0xff00) >> 8), - (rdr::U8)(len & 0xff) + uint8_t lenServerKey[4] = { + (uint8_t)((len & 0xff000000) >> 24), + (uint8_t)((len & 0xff0000) >> 16), + (uint8_t)((len & 0xff00) >> 8), + (uint8_t)(len & 0xff) }; len = clientKeyLength; - rdr::U8 lenClientKey[4] = { - (rdr::U8)((len & 0xff000000) >> 24), - (rdr::U8)((len & 0xff0000) >> 16), - (rdr::U8)((len & 0xff00) >> 8), - (rdr::U8)(len & 0xff) + uint8_t lenClientKey[4] = { + (uint8_t)((len & 0xff000000) >> 24), + (uint8_t)((len & 0xff0000) >> 16), + (uint8_t)((len & 0xff00) >> 8), + (uint8_t)(len & 0xff) }; if (keySize == 128) { struct sha1_ctx ctx; @@ -531,7 +532,7 @@ bool SSecurityRSAAES::readCredentials() rais->setRestorePoint(); if (!rais->hasData(1)) return false; - rdr::U8 lenUsername = rais->readU8(); + uint8_t lenUsername = rais->readU8(); if (!rais->hasDataOrRestore(lenUsername + 1)) return false; if (!username.buf) { @@ -541,7 +542,7 @@ bool SSecurityRSAAES::readCredentials() } else { rais->skip(lenUsername); } - rdr::U8 lenPassword = rais->readU8(); + uint8_t lenPassword = rais->readU8(); if (!rais->hasDataOrRestore(lenPassword)) return false; password.replaceBuf(new char[lenPassword + 1]); diff --git a/common/rfb/SSecurityRSAAES.h b/common/rfb/SSecurityRSAAES.h index 17e0d407..9ff76296 100644 --- a/common/rfb/SSecurityRSAAES.h +++ b/common/rfb/SSecurityRSAAES.h @@ -33,7 +33,7 @@ namespace rfb { class SSecurityRSAAES : public SSecurity { public: - SSecurityRSAAES(SConnection* sc, rdr::U32 secType, + SSecurityRSAAES(SConnection* sc, uint32_t secType, int keySize, bool isAllEncrypted); virtual ~SSecurityRSAAES(); virtual bool processMsg(); @@ -50,8 +50,8 @@ namespace rfb { private: void cleanup(); void loadPrivateKey(); - void loadPKCS1Key(const rdr::U8* data, size_t size); - void loadPKCS8Key(const rdr::U8* data, size_t size); + void loadPKCS1Key(const uint8_t* data, size_t size); + void loadPKCS8Key(const uint8_t* data, size_t size); void writePublicKey(); bool readPublicKey(); void writeRandom(); @@ -68,17 +68,17 @@ namespace rfb { int state; int keySize; bool isAllEncrypted; - rdr::U32 secType; + uint32_t secType; struct rsa_private_key serverKey; struct rsa_public_key clientKey; - rdr::U32 serverKeyLength; - rdr::U8* serverKeyN; - rdr::U8* serverKeyE; - rdr::U32 clientKeyLength; - rdr::U8* clientKeyN; - rdr::U8* clientKeyE; - rdr::U8 serverRandom[32]; - rdr::U8 clientRandom[32]; + uint32_t serverKeyLength; + uint8_t* serverKeyN; + uint8_t* serverKeyE; + uint32_t clientKeyLength; + uint8_t* clientKeyN; + uint8_t* clientKeyE; + uint8_t serverRandom[32]; + uint8_t clientRandom[32]; CharArray username; CharArray password; diff --git a/common/rfb/SSecurityVeNCrypt.cxx b/common/rfb/SSecurityVeNCrypt.cxx index 70d50d20..c126d82f 100644 --- a/common/rfb/SSecurityVeNCrypt.cxx +++ b/common/rfb/SSecurityVeNCrypt.cxx @@ -64,7 +64,7 @@ bool SSecurityVeNCrypt::processMsg() { rdr::InStream* is = sc->getInStream(); rdr::OutStream* os = sc->getOutStream(); - rdr::U8 i; + uint8_t i; /* VeNCrypt initialization */ @@ -93,7 +93,7 @@ bool SSecurityVeNCrypt::processMsg() haveRecvdMinorVersion = true; /* WORD value with major version in upper 8 bits and minor version in lower 8 bits */ - U16 Version = (((U16)majorVersion) << 8) | ((U16)minorVersion); + uint16_t Version = (((uint16_t)majorVersion) << 8) | ((uint16_t)minorVersion); switch (Version) { case 0x0000: /* 0.0 - The client cannot support us! */ @@ -115,16 +115,16 @@ bool SSecurityVeNCrypt::processMsg() } /* - * send number of supported VeNCrypt authentication types (U8) followed - * by authentication types (U32s) + * send number of supported VeNCrypt authentication types (uint8_t) + * followed by authentication types (uint32_t:s) */ if (!haveSentTypes) { - list<U32> listSubTypes; + list<uint32_t> listSubTypes; listSubTypes = security->GetEnabledExtSecTypes(); numTypes = listSubTypes.size(); - subTypes = new U32[numTypes]; + subTypes = new uint32_t[numTypes]; for (i = 0; i < numTypes; i++) { subTypes[i] = listSubTypes.front(); diff --git a/common/rfb/SSecurityVeNCrypt.h b/common/rfb/SSecurityVeNCrypt.h index afbf7247..86cf420a 100644 --- a/common/rfb/SSecurityVeNCrypt.h +++ b/common/rfb/SSecurityVeNCrypt.h @@ -44,8 +44,8 @@ namespace rfb { SecurityServer *security; bool haveSentVersion, haveRecvdMajorVersion, haveRecvdMinorVersion; bool haveSentTypes, haveChosenType; - rdr::U8 majorVersion, minorVersion, numTypes; - rdr::U32 *subTypes, chosenType; + uint8_t majorVersion, minorVersion, numTypes; + uint32_t *subTypes, chosenType; }; } #endif diff --git a/common/rfb/SSecurityVncAuth.cxx b/common/rfb/SSecurityVncAuth.cxx index a19404d3..380b4f4c 100644 --- a/common/rfb/SSecurityVncAuth.cxx +++ b/common/rfb/SSecurityVncAuth.cxx @@ -60,10 +60,10 @@ SSecurityVncAuth::SSecurityVncAuth(SConnection* sc) bool SSecurityVncAuth::verifyResponse(const PlainPasswd &password) { - rdr::U8 expectedResponse[vncAuthChallengeSize]; + uint8_t expectedResponse[vncAuthChallengeSize]; // Calculate the expected response - rdr::U8 key[8]; + uint8_t key[8]; int pwdLen = strlen(password.buf); for (int i=0; i<8; i++) key[i] = i<pwdLen ? password.buf[i] : 0; diff --git a/common/rfb/SSecurityVncAuth.h b/common/rfb/SSecurityVncAuth.h index 94d5aaf2..c6c329c4 100644 --- a/common/rfb/SSecurityVncAuth.h +++ b/common/rfb/SSecurityVncAuth.h @@ -24,11 +24,12 @@ #ifndef __RFB_SSECURITYVNCAUTH_H__ #define __RFB_SSECURITYVNCAUTH_H__ +#include <stdint.h> + #include <rfb/Configuration.h> #include <rfb/Password.h> #include <rfb/SSecurity.h> #include <rfb/Security.h> -#include <rdr/types.h> namespace rfb { @@ -61,8 +62,8 @@ namespace rfb { private: bool verifyResponse(const PlainPasswd &password); enum {vncAuthChallengeSize = 16}; - rdr::U8 challenge[vncAuthChallengeSize]; - rdr::U8 response[vncAuthChallengeSize]; + uint8_t challenge[vncAuthChallengeSize]; + uint8_t response[vncAuthChallengeSize]; bool sentChallenge; VncAuthPasswdGetter* pg; SConnection::AccessRights accessRights; diff --git a/common/rfb/ScreenSet.h b/common/rfb/ScreenSet.h index 9680b6e7..e43055f2 100644 --- a/common/rfb/ScreenSet.h +++ b/common/rfb/ScreenSet.h @@ -23,8 +23,8 @@ #include <stdio.h> #include <string.h> +#include <stdint.h> -#include <rdr/types.h> #include <rfb/Rect.h> #include <list> #include <set> @@ -38,7 +38,7 @@ namespace rfb { struct Screen { Screen(void) : id(0), flags(0) {}; - Screen(rdr::U32 id_, int x_, int y_, int w_, int h_, rdr::U32 flags_) : + Screen(uint32_t id_, int x_, int y_, int w_, int h_, uint32_t flags_) : id(id_), dimensions(x_, y_, x_+w_, y_+h_), flags(flags_) {}; inline bool operator==(const Screen& r) const { @@ -51,9 +51,9 @@ namespace rfb { return true; } - rdr::U32 id; + uint32_t id; Rect dimensions; - rdr::U32 flags; + uint32_t flags; }; // rfb::ScreenSet @@ -75,7 +75,7 @@ namespace rfb { inline int num_screens(void) const { return screens.size(); }; inline void add_screen(const Screen screen) { screens.push_back(screen); }; - inline void remove_screen(rdr::U32 id) { + inline void remove_screen(uint32_t id) { std::list<Screen>::iterator iter, nextiter; for (iter = screens.begin();iter != screens.end();iter = nextiter) { nextiter = iter; nextiter++; @@ -86,7 +86,7 @@ namespace rfb { inline bool validate(int fb_width, int fb_height) const { std::list<Screen>::const_iterator iter; - std::set<rdr::U32> seen_ids; + std::set<uint32_t> seen_ids; Rect fb_rect; if (screens.empty()) diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx index efed0cd0..e1c35139 100644 --- a/common/rfb/Security.cxx +++ b/common/rfb/Security.cxx @@ -69,10 +69,10 @@ Security::Security(StringParameter &secTypes) delete [] secTypesStr; } -const std::list<rdr::U8> Security::GetEnabledSecTypes(void) +const std::list<uint8_t> Security::GetEnabledSecTypes(void) { - list<rdr::U8> result; - list<U32>::iterator i; + list<uint8_t> result; + list<uint32_t>::iterator i; /* Partial workaround for Vino's stupid behaviour. It doesn't allow * the basic authentication types as part of the VeNCrypt handshake, @@ -93,10 +93,10 @@ const std::list<rdr::U8> Security::GetEnabledSecTypes(void) return result; } -const std::list<rdr::U32> Security::GetEnabledExtSecTypes(void) +const std::list<uint32_t> Security::GetEnabledExtSecTypes(void) { - list<rdr::U32> result; - list<U32>::iterator i; + list<uint32_t> result; + list<uint32_t>::iterator i; for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) if (*i != secTypeVeNCrypt) /* Do not include VeNCrypt type to avoid loops */ @@ -105,9 +105,9 @@ const std::list<rdr::U32> Security::GetEnabledExtSecTypes(void) return result; } -void Security::EnableSecType(U32 secType) +void Security::EnableSecType(uint32_t secType) { - list<U32>::iterator i; + list<uint32_t>::iterator i; for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) if (*i == secType) @@ -116,9 +116,9 @@ void Security::EnableSecType(U32 secType) enabledSecTypes.push_back(secType); } -bool Security::IsSupported(U32 secType) +bool Security::IsSupported(uint32_t secType) { - list<U32>::iterator i; + list<uint32_t>::iterator i; for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) if (*i == secType) @@ -131,7 +131,7 @@ bool Security::IsSupported(U32 secType) char *Security::ToString(void) { - list<U32>::iterator i; + list<uint32_t>::iterator i; static char out[128]; /* Should be enough */ bool firstpass = true; const char *name; @@ -153,7 +153,7 @@ char *Security::ToString(void) return out; } -rdr::U32 rfb::secTypeNum(const char* name) +uint32_t rfb::secTypeNum(const char* name) { if (strcasecmp(name, "None") == 0) return secTypeNone; if (strcasecmp(name, "VncAuth") == 0) return secTypeVncAuth; @@ -180,7 +180,7 @@ rdr::U32 rfb::secTypeNum(const char* name) return secTypeInvalid; } -const char* rfb::secTypeName(rdr::U32 num) +const char* rfb::secTypeName(uint32_t num) { switch (num) { case secTypeNone: return "None"; @@ -208,13 +208,13 @@ const char* rfb::secTypeName(rdr::U32 num) } } -std::list<rdr::U32> rfb::parseSecTypes(const char* types_) +std::list<uint32_t> rfb::parseSecTypes(const char* types_) { - std::list<rdr::U32> result; + std::list<uint32_t> result; CharArray types(strDup(types_)), type; while (types.buf) { strSplit(types.buf, ',', &type.buf, &types.buf); - rdr::U32 typeNum = secTypeNum(type.buf); + uint32_t typeNum = secTypeNum(type.buf); if (typeNum != secTypeInvalid) result.push_back(typeNum); } diff --git a/common/rfb/Security.h b/common/rfb/Security.h index 57800ffd..430a1d89 100644 --- a/common/rfb/Security.h +++ b/common/rfb/Security.h @@ -22,33 +22,34 @@ #ifndef __RFB_SECTYPES_H__ #define __RFB_SECTYPES_H__ -#include <rdr/types.h> +#include <stdint.h> + #include <rfb/Configuration.h> #include <list> namespace rfb { - const rdr::U8 secTypeInvalid = 0; - const rdr::U8 secTypeNone = 1; - const rdr::U8 secTypeVncAuth = 2; + const uint8_t secTypeInvalid = 0; + const uint8_t secTypeNone = 1; + const uint8_t secTypeVncAuth = 2; - const rdr::U8 secTypeRA2 = 5; - const rdr::U8 secTypeRA2ne = 6; + const uint8_t secTypeRA2 = 5; + const uint8_t secTypeRA2ne = 6; - const rdr::U8 secTypeSSPI = 7; - const rdr::U8 secTypeSSPIne = 8; + const uint8_t secTypeSSPI = 7; + const uint8_t secTypeSSPIne = 8; - const rdr::U8 secTypeTight = 16; - const rdr::U8 secTypeUltra = 17; - const rdr::U8 secTypeTLS = 18; - const rdr::U8 secTypeVeNCrypt = 19; + const uint8_t secTypeTight = 16; + const uint8_t secTypeUltra = 17; + const uint8_t secTypeTLS = 18; + const uint8_t secTypeVeNCrypt = 19; - const rdr::U8 secTypeDH = 30; + const uint8_t secTypeDH = 30; - const rdr::U8 secTypeMSLogonII = 113; + const uint8_t secTypeMSLogonII = 113; - const rdr::U8 secTypeRA256 = 129; - const rdr::U8 secTypeRAne256 = 130; + const uint8_t secTypeRA256 = 129; + const uint8_t secTypeRAne256 = 130; /* VeNCrypt subtypes */ const int secTypePlain = 256; @@ -65,9 +66,9 @@ namespace rfb { // result types - const rdr::U32 secResultOK = 0; - const rdr::U32 secResultFailed = 1; - const rdr::U32 secResultTooMany = 2; // deprecated + const uint32_t secResultOK = 0; + const uint32_t secResultFailed = 1; + const uint32_t secResultTooMany = 2; // deprecated class Security { public: @@ -87,18 +88,18 @@ namespace rfb { */ /* Enable/Disable certain security type */ - void EnableSecType(rdr::U32 secType); - void DisableSecType(rdr::U32 secType) { enabledSecTypes.remove(secType); } + void EnableSecType(uint32_t secType); + void DisableSecType(uint32_t secType) { enabledSecTypes.remove(secType); } - void SetSecTypes(std::list<rdr::U32> &secTypes) { enabledSecTypes = secTypes; } + void SetSecTypes(std::list<uint32_t> &secTypes) { enabledSecTypes = secTypes; } /* Check if certain type is supported */ - bool IsSupported(rdr::U32 secType); + bool IsSupported(uint32_t secType); /* Get list of enabled security types without VeNCrypt subtypes */ - const std::list<rdr::U8> GetEnabledSecTypes(void); + const std::list<uint8_t> GetEnabledSecTypes(void); /* Get list of enabled VeNCrypt subtypes */ - const std::list<rdr::U32> GetEnabledExtSecTypes(void); + const std::list<uint32_t> GetEnabledExtSecTypes(void); /* Output char* is stored in static array */ char *ToString(void); @@ -108,12 +109,12 @@ namespace rfb { #endif private: - std::list<rdr::U32> enabledSecTypes; + std::list<uint32_t> enabledSecTypes; }; - const char* secTypeName(rdr::U32 num); - rdr::U32 secTypeNum(const char* name); - std::list<rdr::U32> parseSecTypes(const char* types); + const char* secTypeName(uint32_t num); + uint32_t secTypeNum(const char* name); + std::list<uint32_t> parseSecTypes(const char* types); } #endif diff --git a/common/rfb/SecurityClient.cxx b/common/rfb/SecurityClient.cxx index 80165f57..1350640d 100644 --- a/common/rfb/SecurityClient.cxx +++ b/common/rfb/SecurityClient.cxx @@ -65,7 +65,7 @@ StringParameter SecurityClient::secTypes "VncAuth,None", ConfViewer); -CSecurity* SecurityClient::GetCSecurity(CConnection* cc, U32 secType) +CSecurity* SecurityClient::GetCSecurity(CConnection* cc, uint32_t secType) { assert (CSecurity::upg != NULL); /* (upg == NULL) means bug in the viewer */ #if defined(HAVE_GNUTLS) || defined(HAVE_NETTLE) diff --git a/common/rfb/SecurityClient.h b/common/rfb/SecurityClient.h index b13afa42..b86fcb35 100644 --- a/common/rfb/SecurityClient.h +++ b/common/rfb/SecurityClient.h @@ -33,7 +33,7 @@ namespace rfb { SecurityClient(void) : Security(secTypes) {} /* Create client side CSecurity class instance */ - CSecurity* GetCSecurity(CConnection* cc, rdr::U32 secType); + CSecurity* GetCSecurity(CConnection* cc, uint32_t secType); static StringParameter secTypes; }; diff --git a/common/rfb/SecurityServer.cxx b/common/rfb/SecurityServer.cxx index 1d1150ad..3e23a89d 100644 --- a/common/rfb/SecurityServer.cxx +++ b/common/rfb/SecurityServer.cxx @@ -54,7 +54,7 @@ StringParameter SecurityServer::secTypes "VncAuth", ConfServer); -SSecurity* SecurityServer::GetSSecurity(SConnection* sc, U32 secType) +SSecurity* SecurityServer::GetSSecurity(SConnection* sc, uint32_t secType) { if (!IsSupported(secType)) goto bail; diff --git a/common/rfb/SecurityServer.h b/common/rfb/SecurityServer.h index 354f6420..a51ee23c 100644 --- a/common/rfb/SecurityServer.h +++ b/common/rfb/SecurityServer.h @@ -33,7 +33,7 @@ namespace rfb { SecurityServer(void) : Security(secTypes) {} /* Create server side SSecurity class instance */ - SSecurity* GetSSecurity(SConnection* sc, rdr::U32 secType); + SSecurity* GetSSecurity(SConnection* sc, uint32_t secType); static StringParameter secTypes; }; diff --git a/common/rfb/ServerParams.cxx b/common/rfb/ServerParams.cxx index 729b3cfb..62fbde91 100644 --- a/common/rfb/ServerParams.cxx +++ b/common/rfb/ServerParams.cxx @@ -92,7 +92,7 @@ void ServerParams::setLEDState(unsigned int state) ledState_ = state; } -rdr::U32 ServerParams::clipboardSize(unsigned int format) const +uint32_t ServerParams::clipboardSize(unsigned int format) const { int i; @@ -104,7 +104,7 @@ rdr::U32 ServerParams::clipboardSize(unsigned int format) const throw Exception("Invalid clipboard format 0x%x", format); } -void ServerParams::setClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) +void ServerParams::setClipboardCaps(uint32_t flags, const uint32_t* lengths) { int i, num; diff --git a/common/rfb/ServerParams.h b/common/rfb/ServerParams.h index dba8b9a1..4feacf18 100644 --- a/common/rfb/ServerParams.h +++ b/common/rfb/ServerParams.h @@ -69,9 +69,9 @@ namespace rfb { unsigned int ledState() { return ledState_; } void setLEDState(unsigned int state); - rdr::U32 clipboardFlags() const { return clipFlags; } - rdr::U32 clipboardSize(unsigned int format) const; - void setClipboardCaps(rdr::U32 flags, const rdr::U32* lengths); + uint32_t clipboardFlags() const { return clipFlags; } + uint32_t clipboardSize(unsigned int format) const; + void setClipboardCaps(uint32_t flags, const uint32_t* lengths); bool supportsQEMUKeyEvent; bool supportsSetDesktopSize; @@ -88,8 +88,8 @@ namespace rfb { char* name_; Cursor* cursor_; unsigned int ledState_; - rdr::U32 clipFlags; - rdr::U32 clipSizes[16]; + uint32_t clipFlags; + uint32_t clipSizes[16]; }; } #endif diff --git a/common/rfb/TightDecoder.cxx b/common/rfb/TightDecoder.cxx index f56a4284..65c7191a 100644 --- a/common/rfb/TightDecoder.cxx +++ b/common/rfb/TightDecoder.cxx @@ -28,6 +28,7 @@ #include <rdr/InStream.h> #include <rdr/MemInStream.h> #include <rdr/OutStream.h> +#include <rdr/types.h> #include <rfb/ServerParams.h> #include <rfb/Exception.h> @@ -51,7 +52,7 @@ TightDecoder::~TightDecoder() bool TightDecoder::readRect(const Rect& r, rdr::InStream* is, const ServerParams& server, rdr::OutStream* os) { - rdr::U8 comp_ctl; + uint8_t comp_ctl; if (!is->hasData(1)) return false; @@ -80,7 +81,7 @@ bool TightDecoder::readRect(const Rect& r, rdr::InStream* is, // "JPEG" compression type. if (comp_ctl == tightJpeg) { - rdr::U32 len; + uint32_t len; // FIXME: Might be less than 3 bytes if (!is->hasDataOrRestore(3)) @@ -112,7 +113,7 @@ bool TightDecoder::readRect(const Rect& r, rdr::InStream* is, // Possible palette if ((comp_ctl & tightExplicitFilter) != 0) { - rdr::U8 filterId; + uint8_t filterId; if (!is->hasDataOrRestore(1)) return false; @@ -169,7 +170,7 @@ bool TightDecoder::readRect(const Rect& r, rdr::InStream* is, return false; os->copyBytes(is, dataSize); } else { - rdr::U32 len; + uint32_t len; // FIXME: Might be less than 3 bytes if (!is->hasDataOrRestore(3)) @@ -197,13 +198,13 @@ bool TightDecoder::doRectsConflict(const Rect& /*rectA*/, size_t buflenB, const ServerParams& /*server*/) { - rdr::U8 comp_ctl_a, comp_ctl_b; + uint8_t comp_ctl_a, comp_ctl_b; assert(buflenA >= 1); assert(buflenB >= 1); - comp_ctl_a = *(const rdr::U8*)bufferA; - comp_ctl_b = *(const rdr::U8*)bufferB; + comp_ctl_a = *(const uint8_t*)bufferA; + comp_ctl_b = *(const uint8_t*)bufferB; // Resets or use of zlib pose the same problem, so merge them if ((comp_ctl_a & 0x80) == 0x00) @@ -221,12 +222,12 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, size_t buflen, const ServerParams& server, ModifiablePixelBuffer* pb) { - const rdr::U8* bufptr; + const uint8_t* bufptr; const PixelFormat& pf = server.pf(); - rdr::U8 comp_ctl; + uint8_t comp_ctl; - bufptr = (const rdr::U8*)buffer; + bufptr = (const uint8_t*)buffer; assert(buflen >= 1); @@ -245,7 +246,7 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, // "Fill" compression type. if (comp_ctl == tightFill) { if (pf.is888()) { - rdr::U8 pix[4]; + uint8_t pix[4]; assert(buflen >= 3); @@ -260,10 +261,10 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, // "JPEG" compression type. if (comp_ctl == tightJpeg) { - rdr::U32 len; + uint32_t len; int stride; - rdr::U8 *buf; + uint8_t *buf; JpegDecompressor jd; @@ -286,11 +287,11 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, // "Basic" compression type. int palSize = 0; - rdr::U8 palette[256 * 4]; + uint8_t palette[256 * 4]; bool useGradient = false; if ((comp_ctl & tightExplicitFilter) != 0) { - rdr::U8 filterId; + uint8_t filterId; assert(buflen >= 1); @@ -341,7 +342,7 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, // Determine if the data should be decompressed or just copied. size_t rowSize, dataSize; - rdr::U8* netbuf; + uint8_t* netbuf; netbuf = NULL; @@ -361,7 +362,7 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, if (dataSize < TIGHT_MIN_TO_COMPRESS) assert(buflen >= dataSize); else { - rdr::U32 len; + uint32_t len; int streamId; rdr::MemInStream* ms; @@ -378,7 +379,7 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, zis[streamId].setUnderlying(ms, len); // Allocate buffer and decompress the data - netbuf = new rdr::U8[dataSize]; + netbuf = new uint8_t[dataSize]; if (!zis[streamId].hasData(dataSize)) throw Exception("Tight decode error"); @@ -395,7 +396,7 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, // Time to decode the actual data bool directDecode; - rdr::U8* outbuf; + uint8_t* outbuf; int stride; if (pb->getPF().equal(pf)) { @@ -409,7 +410,7 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, if (directDecode) outbuf = pb->getBufferRW(r, &stride); else { - outbuf = new rdr::U8[r.area() * (pf.bpp/8)]; + outbuf = new uint8_t[r.area() * (pf.bpp/8)]; stride = r.width(); } @@ -417,24 +418,24 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, // Truecolor data if (useGradient) { if (pf.is888()) - FilterGradient24(bufptr, pf, (rdr::U32*)outbuf, stride, r); + FilterGradient24(bufptr, pf, (uint32_t*)outbuf, stride, r); else { switch (pf.bpp) { case 8: assert(false); break; case 16: - FilterGradient(bufptr, pf, (rdr::U16*)outbuf, stride, r); + FilterGradient(bufptr, pf, (uint16_t*)outbuf, stride, r); break; case 32: - FilterGradient(bufptr, pf, (rdr::U32*)outbuf, stride, r); + FilterGradient(bufptr, pf, (uint32_t*)outbuf, stride, r); break; } } } else { // Copy - rdr::U8* ptr = outbuf; - const rdr::U8* srcPtr = bufptr; + uint8_t* ptr = outbuf; + const uint8_t* srcPtr = bufptr; int w = r.width(); int h = r.height(); if (pf.is888()) { @@ -457,16 +458,16 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, // Indexed color switch (pf.bpp) { case 8: - FilterPalette((const rdr::U8*)palette, palSize, - bufptr, (rdr::U8*)outbuf, stride, r); + FilterPalette((const uint8_t*)palette, palSize, + bufptr, (uint8_t*)outbuf, stride, r); break; case 16: - FilterPalette((const rdr::U16*)palette, palSize, - bufptr, (rdr::U16*)outbuf, stride, r); + FilterPalette((const uint16_t*)palette, palSize, + bufptr, (uint16_t*)outbuf, stride, r); break; case 32: - FilterPalette((const rdr::U32*)palette, palSize, - bufptr, (rdr::U32*)outbuf, stride, r); + FilterPalette((const uint32_t*)palette, palSize, + bufptr, (uint32_t*)outbuf, stride, r); break; } } @@ -481,10 +482,10 @@ void TightDecoder::decodeRect(const Rect& r, const void* buffer, delete [] netbuf; } -rdr::U32 TightDecoder::readCompact(rdr::InStream* is) +uint32_t TightDecoder::readCompact(rdr::InStream* is) { - rdr::U8 b; - rdr::U32 result; + uint8_t b; + uint32_t result; b = is->readU8(); result = (int)b & 0x7F; @@ -501,14 +502,14 @@ rdr::U32 TightDecoder::readCompact(rdr::InStream* is) } void -TightDecoder::FilterGradient24(const rdr::U8 *inbuf, - const PixelFormat& pf, rdr::U32* outbuf, +TightDecoder::FilterGradient24(const uint8_t *inbuf, + const PixelFormat& pf, uint32_t* outbuf, int stride, const Rect& r) { int x, y, c; - rdr::U8 prevRow[TIGHT_MAX_WIDTH*3]; - rdr::U8 thisRow[TIGHT_MAX_WIDTH*3]; - rdr::U8 pix[3]; + uint8_t prevRow[TIGHT_MAX_WIDTH*3]; + uint8_t thisRow[TIGHT_MAX_WIDTH*3]; + uint8_t pix[3]; int est[3]; memset(prevRow, 0, sizeof(prevRow)); @@ -525,7 +526,7 @@ TightDecoder::FilterGradient24(const rdr::U8 *inbuf, pix[c] = inbuf[y*rectWidth*3+c] + prevRow[c]; thisRow[c] = pix[c]; } - pf.bufferFromRGB((rdr::U8*)&outbuf[y*stride], pix, 1); + pf.bufferFromRGB((uint8_t*)&outbuf[y*stride], pix, 1); continue; } @@ -539,7 +540,7 @@ TightDecoder::FilterGradient24(const rdr::U8 *inbuf, pix[c] = inbuf[(y*rectWidth+x)*3+c] + est[c]; thisRow[x*3+c] = pix[c]; } - pf.bufferFromRGB((rdr::U8*)&outbuf[y*stride+x], pix, 1); + pf.bufferFromRGB((uint8_t*)&outbuf[y*stride+x], pix, 1); } memcpy(prevRow, thisRow, sizeof(prevRow)); @@ -547,14 +548,14 @@ TightDecoder::FilterGradient24(const rdr::U8 *inbuf, } template<class T> -void TightDecoder::FilterGradient(const rdr::U8* inbuf, +void TightDecoder::FilterGradient(const uint8_t* inbuf, const PixelFormat& pf, T* outbuf, int stride, const Rect& r) { int x, y, c; - static rdr::U8 prevRow[TIGHT_MAX_WIDTH*3]; - static rdr::U8 thisRow[TIGHT_MAX_WIDTH*3]; - rdr::U8 pix[3]; + static uint8_t prevRow[TIGHT_MAX_WIDTH*3]; + static uint8_t thisRow[TIGHT_MAX_WIDTH*3]; + uint8_t pix[3]; int est[3]; memset(prevRow, 0, sizeof(prevRow)); @@ -573,7 +574,7 @@ void TightDecoder::FilterGradient(const rdr::U8* inbuf, memcpy(thisRow, pix, sizeof(pix)); - pf.bufferFromRGB((rdr::U8*)&outbuf[y*stride], pix, 1); + pf.bufferFromRGB((uint8_t*)&outbuf[y*stride], pix, 1); continue; } @@ -593,7 +594,7 @@ void TightDecoder::FilterGradient(const rdr::U8* inbuf, memcpy(&thisRow[x*3], pix, sizeof(pix)); - pf.bufferFromRGB((rdr::U8*)&outbuf[y*stride+x], pix, 1); + pf.bufferFromRGB((uint8_t*)&outbuf[y*stride+x], pix, 1); } memcpy(prevRow, thisRow, sizeof(prevRow)); @@ -602,14 +603,14 @@ void TightDecoder::FilterGradient(const rdr::U8* inbuf, template<class T> void TightDecoder::FilterPalette(const T* palette, int palSize, - const rdr::U8* inbuf, T* outbuf, + const uint8_t* inbuf, T* outbuf, int stride, const Rect& r) { // Indexed color int x, h = r.height(), w = r.width(), b, pad = stride - w; T* ptr = outbuf; - rdr::U8 bits; - const rdr::U8* srcPtr = inbuf; + uint8_t bits; + const uint8_t* srcPtr = inbuf; if (palSize <= 2) { // 2-color palette while (h > 0) { diff --git a/common/rfb/TightDecoder.h b/common/rfb/TightDecoder.h index 47d65d6f..03b61daf 100644 --- a/common/rfb/TightDecoder.h +++ b/common/rfb/TightDecoder.h @@ -45,18 +45,18 @@ namespace rfb { ModifiablePixelBuffer* pb); private: - rdr::U32 readCompact(rdr::InStream* is); + uint32_t readCompact(rdr::InStream* is); - void FilterGradient24(const rdr::U8* inbuf, const PixelFormat& pf, - rdr::U32* outbuf, int stride, const Rect& r); + void FilterGradient24(const uint8_t* inbuf, const PixelFormat& pf, + uint32_t* outbuf, int stride, const Rect& r); template<class T> - void FilterGradient(const rdr::U8* inbuf, const PixelFormat& pf, + void FilterGradient(const uint8_t* inbuf, const PixelFormat& pf, T* outbuf, int stride, const Rect& r); template<class T> void FilterPalette(const T* palette, int palSize, - const rdr::U8* inbuf, T* outbuf, + const uint8_t* inbuf, T* outbuf, int stride, const Rect& r); private: diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx index fe987e15..1a169a3d 100644 --- a/common/rfb/TightEncoder.cxx +++ b/common/rfb/TightEncoder.cxx @@ -104,7 +104,7 @@ void TightEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) void TightEncoder::writeSolidRect(int /*width*/, int /*height*/, const PixelFormat& pf, - const rdr::U8* colour) + const uint8_t* colour) { rdr::OutStream* os; @@ -116,40 +116,40 @@ void TightEncoder::writeSolidRect(int /*width*/, int /*height*/, void TightEncoder::writeMonoRect(const PixelBuffer* pb, const Palette& palette) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; buffer = pb->getBuffer(pb->getRect(), &stride); switch (pb->getPF().bpp) { case 32: - writeMonoRect(pb->width(), pb->height(), (rdr::U32*)buffer, stride, + writeMonoRect(pb->width(), pb->height(), (uint32_t*)buffer, stride, pb->getPF(), palette); break; case 16: - writeMonoRect(pb->width(), pb->height(), (rdr::U16*)buffer, stride, + writeMonoRect(pb->width(), pb->height(), (uint16_t*)buffer, stride, pb->getPF(), palette); break; default: - writeMonoRect(pb->width(), pb->height(), (rdr::U8*)buffer, stride, + writeMonoRect(pb->width(), pb->height(), (uint8_t*)buffer, stride, pb->getPF(), palette); } } void TightEncoder::writeIndexedRect(const PixelBuffer* pb, const Palette& palette) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; buffer = pb->getBuffer(pb->getRect(), &stride); switch (pb->getPF().bpp) { case 32: - writeIndexedRect(pb->width(), pb->height(), (rdr::U32*)buffer, stride, + writeIndexedRect(pb->width(), pb->height(), (uint32_t*)buffer, stride, pb->getPF(), palette); break; case 16: - writeIndexedRect(pb->width(), pb->height(), (rdr::U16*)buffer, stride, + writeIndexedRect(pb->width(), pb->height(), (uint16_t*)buffer, stride, pb->getPF(), palette); break; default: @@ -166,7 +166,7 @@ void TightEncoder::writeFullColourRect(const PixelBuffer* pb) rdr::OutStream* zos; int length; - const rdr::U8* buffer; + const uint8_t* buffer; int stride, h; os = conn->getOutStream(); @@ -194,10 +194,10 @@ void TightEncoder::writeFullColourRect(const PixelBuffer* pb) flushZlibOutStream(zos); } -void TightEncoder::writePixels(const rdr::U8* buffer, const PixelFormat& pf, +void TightEncoder::writePixels(const uint8_t* buffer, const PixelFormat& pf, unsigned int count, rdr::OutStream* os) { - rdr::U8 rgb[2048]; + uint8_t rgb[2048]; if ((pf.bpp != 32) || !pf.is888()) { os->writeBytes(buffer, count * pf.bpp/8); @@ -219,9 +219,9 @@ void TightEncoder::writePixels(const rdr::U8* buffer, const PixelFormat& pf, } } -void TightEncoder::writeCompact(rdr::OutStream* os, rdr::U32 value) +void TightEncoder::writeCompact(rdr::OutStream* os, uint32_t value) { - rdr::U8 b; + uint8_t b; b = value & 0x7F; if (value <= 0x7F) { os->writeU8(b); @@ -300,7 +300,7 @@ void TightEncoder::writeMonoRect(int width, int height, pal[1] = (T)palette.getColour(1); os->writeU8(1); - writePixels((rdr::U8*)pal, pf, 2, os); + writePixels((uint8_t*)pal, pf, 2, os); // Set up compression length = (width + 7)/8 * height; @@ -387,7 +387,7 @@ void TightEncoder::writeIndexedRect(int width, int height, pal[i] = (T)palette.getColour(i); os->writeU8(palette.size() - 1); - writePixels((rdr::U8*)pal, pf, palette.size(), os); + writePixels((uint8_t*)pal, pf, palette.size(), os); // Set up compression zos = getZlibOutStream(streamId, idxZlibLevel, width * height); diff --git a/common/rfb/TightEncoder.h b/common/rfb/TightEncoder.h index 2be2f6d4..0608eb09 100644 --- a/common/rfb/TightEncoder.h +++ b/common/rfb/TightEncoder.h @@ -38,17 +38,17 @@ namespace rfb { virtual void writeRect(const PixelBuffer* pb, const Palette& palette); virtual void writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour); + const uint8_t* colour); protected: void writeMonoRect(const PixelBuffer* pb, const Palette& palette); void writeIndexedRect(const PixelBuffer* pb, const Palette& palette); void writeFullColourRect(const PixelBuffer* pb); - void writePixels(const rdr::U8* buffer, const PixelFormat& pf, + void writePixels(const uint8_t* buffer, const PixelFormat& pf, unsigned int count, rdr::OutStream* os); - void writeCompact(rdr::OutStream* os, rdr::U32 value); + void writeCompact(rdr::OutStream* os, uint32_t value); rdr::OutStream* getZlibOutStream(int streamId, int level, size_t length); void flushZlibOutStream(rdr::OutStream* os); diff --git a/common/rfb/TightJPEGEncoder.cxx b/common/rfb/TightJPEGEncoder.cxx index 976601f7..5c8706ee 100644 --- a/common/rfb/TightJPEGEncoder.cxx +++ b/common/rfb/TightJPEGEncoder.cxx @@ -115,7 +115,7 @@ int TightJPEGEncoder::getQualityLevel() void TightJPEGEncoder::writeRect(const PixelBuffer* pb, const Palette& /*palette*/) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; int quality, subsampling; @@ -152,17 +152,17 @@ void TightJPEGEncoder::writeRect(const PixelBuffer* pb, void TightJPEGEncoder::writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour) + const uint8_t* colour) { // FIXME: Add a shortcut in the JPEG compressor to handle this case // without having to use the default fallback which is very slow. Encoder::writeSolidRect(width, height, pf, colour); } -void TightJPEGEncoder::writeCompact(rdr::U32 value, rdr::OutStream* os) +void TightJPEGEncoder::writeCompact(uint32_t value, rdr::OutStream* os) { // Copied from TightEncoder as it's overkill to inherit just for this - rdr::U8 b; + uint8_t b; b = value & 0x7F; if (value <= 0x7F) { diff --git a/common/rfb/TightJPEGEncoder.h b/common/rfb/TightJPEGEncoder.h index 3d8fa8c1..002deabb 100644 --- a/common/rfb/TightJPEGEncoder.h +++ b/common/rfb/TightJPEGEncoder.h @@ -40,10 +40,10 @@ namespace rfb { virtual void writeRect(const PixelBuffer* pb, const Palette& palette); virtual void writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour); + const uint8_t* colour); protected: - void writeCompact(rdr::U32 value, rdr::OutStream* os); + void writeCompact(uint32_t value, rdr::OutStream* os); protected: JpegCompressor jc; diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 9f58e786..564dd319 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -80,7 +80,7 @@ VNCSConnectionST::~VNCSConnectionST() // Release any keys the client still had pressed while (!pressedKeys.empty()) { - rdr::U32 keysym, keycode; + uint32_t keysym, keycode; keysym = pressedKeys.begin()->second; keycode = pressedKeys.begin()->first; @@ -261,7 +261,7 @@ void VNCSConnectionST::writeFramebufferUpdateOrClose() } } -void VNCSConnectionST::screenLayoutChangeOrClose(rdr::U16 reason) +void VNCSConnectionST::screenLayoutChangeOrClose(uint16_t reason) { try { screenLayoutChange(reason); @@ -502,8 +502,8 @@ public: // keyEvent() - record in the pressedKeys which keys were pressed. Allow // multiple down events (for autorepeat), but only allow a single up event. -void VNCSConnectionST::keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down) { - rdr::U32 lookup; +void VNCSConnectionST::keyEvent(uint32_t keysym, uint32_t keycode, bool down) { + uint32_t lookup; if (rfb::Server::idleTimeout) idleTimer.start(secsToMillis(rfb::Server::idleTimeout)); @@ -669,9 +669,9 @@ void VNCSConnectionST::setDesktopSize(int fb_width, int fb_height, writer()->writeDesktopSize(reasonClient, result); } -void VNCSConnectionST::fence(rdr::U32 flags, unsigned len, const char data[]) +void VNCSConnectionST::fence(uint32_t flags, unsigned len, const char data[]) { - rdr::U8 type; + uint8_t type; if (flags & fenceFlagRequest) { if (flags & fenceFlagSyncNext) { @@ -808,7 +808,7 @@ bool VNCSConnectionST::handleTimeout(Timer* t) bool VNCSConnectionST::isShiftPressed() { - std::map<rdr::U32, rdr::U32>::const_iterator iter; + std::map<uint32_t, uint32_t>::const_iterator iter; for (iter = pressedKeys.begin(); iter != pressedKeys.end(); ++iter) { if (iter->second == XK_Shift_L) @@ -1108,7 +1108,7 @@ void VNCSConnectionST::writeLosslessRefresh() } -void VNCSConnectionST::screenLayoutChange(rdr::U16 reason) +void VNCSConnectionST::screenLayoutChange(uint16_t reason) { if (!authenticated()) return; diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h index 72b0c529..23215d24 100644 --- a/common/rfb/VNCSConnectionST.h +++ b/common/rfb/VNCSConnectionST.h @@ -71,7 +71,7 @@ namespace rfb { // Wrappers to make these methods "safe" for VNCServerST. void writeFramebufferUpdateOrClose(); - void screenLayoutChangeOrClose(rdr::U16 reason); + void screenLayoutChangeOrClose(uint16_t reason); void setCursorOrClose(); void bellOrClose(); void setDesktopNameOrClose(const char *name); @@ -124,11 +124,11 @@ namespace rfb { virtual void clientInit(bool shared); virtual void setPixelFormat(const PixelFormat& pf); virtual void pointerEvent(const Point& pos, int buttonMask); - virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); + virtual void keyEvent(uint32_t keysym, uint32_t keycode, bool down); virtual void framebufferUpdateRequest(const Rect& r, bool incremental); virtual void setDesktopSize(int fb_width, int fb_height, const ScreenSet& layout); - virtual void fence(rdr::U32 flags, unsigned len, const char data[]); + virtual void fence(uint32_t flags, unsigned len, const char data[]); virtual void enableContinuousUpdates(bool enable, int x, int y, int w, int h); virtual void handleClipboardRequest(); @@ -158,7 +158,7 @@ namespace rfb { void writeDataUpdate(); void writeLosslessRefresh(); - void screenLayoutChange(rdr::U16 reason); + void screenLayoutChange(uint16_t reason); void setCursor(); void setCursorPos(); void setDesktopName(const char *name); @@ -172,7 +172,7 @@ namespace rfb { bool inProcessMessages; bool pendingSyncFence, syncFence; - rdr::U32 fenceFlags; + uint32_t fenceFlags; unsigned fenceDataLen; char *fenceData; @@ -189,7 +189,7 @@ namespace rfb { Region cuRegion; EncodeManager encodeManager; - std::map<rdr::U32, rdr::U32> pressedKeys; + std::map<uint32_t, uint32_t> pressedKeys; Timer idleTimer; diff --git a/common/rfb/VNCServer.h b/common/rfb/VNCServer.h index 4535b562..3f97634b 100644 --- a/common/rfb/VNCServer.h +++ b/common/rfb/VNCServer.h @@ -95,7 +95,7 @@ namespace rfb { // cursorData argument contains width*height rgba quadruplets with // non-premultiplied alpha. virtual void setCursor(int width, int height, const Point& hotspot, - const rdr::U8* cursorData) = 0; + const uint8_t* cursorData) = 0; // setCursorPos() tells the server the current position of the cursor, and // whether the server initiated that change (e.g. through another X11 diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 411cfd5e..a02366e1 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -65,7 +65,6 @@ #include <rfb/util.h> #include <rfb/ledStates.h> -#include <rdr/types.h> using namespace rfb; @@ -416,7 +415,7 @@ void VNCServerST::add_copied(const Region& dest, const Point& delta) } void VNCServerST::setCursor(int width, int height, const Point& newHotspot, - const rdr::U8* data) + const uint8_t* data) { delete cursor; cursor = new Cursor(width, height, newHotspot, data); @@ -463,14 +462,14 @@ void VNCServerST::setLEDState(unsigned int state) // Event handlers -void VNCServerST::keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down) +void VNCServerST::keyEvent(uint32_t keysym, uint32_t keycode, bool down) { if (rfb::Server::maxIdleTime) idleTimer.start(secsToMillis(rfb::Server::maxIdleTime)); // Remap the key if required if (keyRemapper) { - rdr::U32 newkey; + uint32_t newkey; newkey = keyRemapper->remapKey(keysym); if (newkey != keysym) { slog.debug("Key remapped to 0x%x", newkey); diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h index 159e3a4b..26059574 100644 --- a/common/rfb/VNCServerST.h +++ b/common/rfb/VNCServerST.h @@ -98,7 +98,7 @@ namespace rfb { virtual void add_changed(const Region ®ion); virtual void add_copied(const Region &dest, const Point &delta); virtual void setCursor(int width, int height, const Point& hotspot, - const rdr::U8* data); + const uint8_t* data); virtual void setCursorPos(const Point& p, bool warped); virtual void setName(const char* name_); virtual void setLEDState(unsigned state); @@ -116,7 +116,7 @@ namespace rfb { unsigned getLEDState() const { return ledState; } // Event handlers - void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); + void keyEvent(uint32_t keysym, uint32_t keycode, bool down); void pointerEvent(VNCSConnectionST* client, const Point& pos, int buttonMask); void handleClipboardRequest(VNCSConnectionST* client); diff --git a/common/rfb/ZRLEDecoder.cxx b/common/rfb/ZRLEDecoder.cxx index c61b66bf..6dad55f4 100644 --- a/common/rfb/ZRLEDecoder.cxx +++ b/common/rfb/ZRLEDecoder.cxx @@ -32,21 +32,21 @@ using namespace rfb; -static inline rdr::U32 readOpaque24A(rdr::InStream* is) +static inline uint32_t readOpaque24A(rdr::InStream* is) { - rdr::U32 r=0; - ((rdr::U8*)&r)[0] = is->readU8(); - ((rdr::U8*)&r)[1] = is->readU8(); - ((rdr::U8*)&r)[2] = is->readU8(); + uint32_t r=0; + ((uint8_t*)&r)[0] = is->readU8(); + ((uint8_t*)&r)[1] = is->readU8(); + ((uint8_t*)&r)[2] = is->readU8(); return r; } -static inline rdr::U32 readOpaque24B(rdr::InStream* is) +static inline uint32_t readOpaque24B(rdr::InStream* is) { - rdr::U32 r=0; - ((rdr::U8*)&r)[1] = is->readU8(); - ((rdr::U8*)&r)[2] = is->readU8(); - ((rdr::U8*)&r)[3] = is->readU8(); + uint32_t r=0; + ((uint8_t*)&r)[1] = is->readU8(); + ((uint8_t*)&r)[2] = is->readU8(); + ((uint8_t*)&r)[3] = is->readU8(); return r; } @@ -79,7 +79,7 @@ bool ZRLEDecoder::readRect(const Rect& /*r*/, rdr::InStream* is, const ServerParams& /*server*/, rdr::OutStream* os) { - rdr::U32 len; + uint32_t len; if (!is->hasData(4)) return false; @@ -106,9 +106,9 @@ void ZRLEDecoder::decodeRect(const Rect& r, const void* buffer, rdr::MemInStream is(buffer, buflen); const rfb::PixelFormat& pf = server.pf(); switch (pf.bpp) { - case 8: zrleDecode<rdr::U8>(r, &is, &zis, pf, pb); break; - case 16: zrleDecode<rdr::U16>(r, &is, &zis, pf, pb); break; - case 32: zrleDecode<rdr::U32>(r, &is, &zis, pf, pb); break; + case 8: zrleDecode<uint8_t>(r, &is, &zis, pf, pb); break; + case 16: zrleDecode<uint16_t>(r, &is, &zis, pf, pb); break; + case 32: zrleDecode<uint32_t>(r, &is, &zis, pf, pb); break; } } @@ -123,7 +123,7 @@ void ZRLEDecoder::zrleDecode(const Rect& r, rdr::InStream* is, Rect t; T buf[64 * 64]; - Pixel maxPixel = pf.pixelFromRGB((rdr::U16)-1, (rdr::U16)-1, (rdr::U16)-1); + Pixel maxPixel = pf.pixelFromRGB((uint16_t)-1, (uint16_t)-1, (uint16_t)-1); bool fitsInLS3Bytes = maxPixel < (1<<24); bool fitsInMS3Bytes = (maxPixel & 0xff) == 0; bool isLowCPixel = (sizeof(T) == 4) && @@ -198,8 +198,8 @@ void ZRLEDecoder::zrleDecode(const Rect& r, rdr::InStream* is, for (int i = 0; i < t.height(); i++) { T* eol = ptr + t.width(); - rdr::U8 byte = 0; - rdr::U8 nbits = 0; + uint8_t byte = 0; + uint8_t nbits = 0; while (ptr < eol) { if (nbits == 0) { @@ -208,7 +208,7 @@ void ZRLEDecoder::zrleDecode(const Rect& r, rdr::InStream* is, nbits = 8; } nbits -= bppp; - rdr::U8 index = (byte >> nbits) & ((1 << bppp) - 1) & 127; + uint8_t index = (byte >> nbits) & ((1 << bppp) - 1) & 127; *ptr++ = palette[index]; } } diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx index d257d05c..4e25d49f 100644 --- a/common/rfb/ZRLEEncoder.cxx +++ b/common/rfb/ZRLEEncoder.cxx @@ -96,7 +96,7 @@ void ZRLEEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) void ZRLEEncoder::writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour) + const uint8_t* colour) { int tiles; @@ -122,7 +122,7 @@ void ZRLEEncoder::writeSolidRect(int width, int height, void ZRLEEncoder::writePaletteTile(const Rect& tile, const PixelBuffer* pb, const Palette& palette) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; buffer = pb->getBuffer(tile, &stride); @@ -130,17 +130,17 @@ void ZRLEEncoder::writePaletteTile(const Rect& tile, const PixelBuffer* pb, switch (pb->getPF().bpp) { case 32: writePaletteTile(tile.width(), tile.height(), - (rdr::U32*)buffer, stride, + (uint32_t*)buffer, stride, pb->getPF(), palette); break; case 16: writePaletteTile(tile.width(), tile.height(), - (rdr::U16*)buffer, stride, + (uint16_t*)buffer, stride, pb->getPF(), palette); break; default: writePaletteTile(tile.width(), tile.height(), - (rdr::U8*)buffer, stride, + (uint8_t*)buffer, stride, pb->getPF(), palette); } } @@ -148,7 +148,7 @@ void ZRLEEncoder::writePaletteTile(const Rect& tile, const PixelBuffer* pb, void ZRLEEncoder::writePaletteRLETile(const Rect& tile, const PixelBuffer* pb, const Palette& palette) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; buffer = pb->getBuffer(tile, &stride); @@ -156,24 +156,24 @@ void ZRLEEncoder::writePaletteRLETile(const Rect& tile, const PixelBuffer* pb, switch (pb->getPF().bpp) { case 32: writePaletteRLETile(tile.width(), tile.height(), - (rdr::U32*)buffer, stride, + (uint32_t*)buffer, stride, pb->getPF(), palette); break; case 16: writePaletteRLETile(tile.width(), tile.height(), - (rdr::U16*)buffer, stride, + (uint16_t*)buffer, stride, pb->getPF(), palette); break; default: writePaletteRLETile(tile.width(), tile.height(), - (rdr::U8*)buffer, stride, + (uint8_t*)buffer, stride, pb->getPF(), palette); } } void ZRLEEncoder::writeRawTile(const Rect& tile, const PixelBuffer* pb) { - const rdr::U8* buffer; + const uint8_t* buffer; int stride; int w, h, stride_bytes; @@ -193,22 +193,22 @@ void ZRLEEncoder::writeRawTile(const Rect& tile, const PixelBuffer* pb) void ZRLEEncoder::writePalette(const PixelFormat& pf, const Palette& palette) { - rdr::U8 buffer[256*4]; + uint8_t buffer[256*4]; int i; if (pf.bpp == 32) { - rdr::U32* buf; - buf = (rdr::U32*)buffer; + uint32_t* buf; + buf = (uint32_t*)buffer; for (i = 0;i < palette.size();i++) *buf++ = palette.getColour(i); } else if (pf.bpp == 16) { - rdr::U16* buf; - buf = (rdr::U16*)buffer; + uint16_t* buf; + buf = (uint16_t*)buffer; for (i = 0;i < palette.size();i++) *buf++ = palette.getColour(i); } else { - rdr::U8* buf; - buf = (rdr::U8*)buffer; + uint8_t* buf; + buf = (uint8_t*)buffer; for (i = 0;i < palette.size();i++) *buf++ = palette.getColour(i); } @@ -216,13 +216,13 @@ void ZRLEEncoder::writePalette(const PixelFormat& pf, const Palette& palette) writePixels(buffer, pf, palette.size()); } -void ZRLEEncoder::writePixels(const rdr::U8* buffer, const PixelFormat& pf, +void ZRLEEncoder::writePixels(const uint8_t* buffer, const PixelFormat& pf, unsigned int count) { Pixel maxPixel; - rdr::U8 pixBuf[4]; + uint8_t pixBuf[4]; - maxPixel = pf.pixelFromRGB((rdr::U16)-1, (rdr::U16)-1, (rdr::U16)-1); + maxPixel = pf.pixelFromRGB((uint16_t)-1, (uint16_t)-1, (uint16_t)-1); pf.bufferFromPixel(pixBuf, maxPixel); if ((pf.bpp != 32) || ((pixBuf[0] != 0) && (pixBuf[3] != 0))) { @@ -264,13 +264,13 @@ void ZRLEEncoder::writePaletteTile(int width, int height, for (int i = 0; i < height; i++) { int w; - rdr::U8 nbits = 0; - rdr::U8 byte = 0; + uint8_t nbits = 0; + uint8_t byte = 0; w = width; while (w--) { T pix = *buffer++; - rdr::U8 index = palette.lookup(pix); + uint8_t index = palette.lookup(pix); byte = (byte << bppp) | index; nbits += bppp; if (nbits >= 8) { diff --git a/common/rfb/ZRLEEncoder.h b/common/rfb/ZRLEEncoder.h index a1f35533..4cfff75d 100644 --- a/common/rfb/ZRLEEncoder.h +++ b/common/rfb/ZRLEEncoder.h @@ -35,7 +35,7 @@ namespace rfb { virtual void writeRect(const PixelBuffer* pb, const Palette& palette); virtual void writeSolidRect(int width, int height, const PixelFormat& pf, - const rdr::U8* colour); + const uint8_t* colour); protected: void writePaletteTile(const Rect& tile, const PixelBuffer* pb, @@ -46,7 +46,7 @@ namespace rfb { void writePalette(const PixelFormat& pf, const Palette& palette); - void writePixels(const rdr::U8* buffer, const PixelFormat& pf, + void writePixels(const uint8_t* buffer, const PixelFormat& pf, unsigned int count); protected: diff --git a/common/rfb/fenceTypes.h b/common/rfb/fenceTypes.h index 41778602..fa507472 100644 --- a/common/rfb/fenceTypes.h +++ b/common/rfb/fenceTypes.h @@ -18,16 +18,16 @@ #ifndef __RFB_FENCETYPES_H__ #define __RFB_FENCETYPES_H__ -#include <rdr/types.h> +#include <stdint.h> namespace rfb { - const rdr::U32 fenceFlagBlockBefore = 1<<0; - const rdr::U32 fenceFlagBlockAfter = 1<<1; - const rdr::U32 fenceFlagSyncNext = 1<<2; + const uint32_t fenceFlagBlockBefore = 1<<0; + const uint32_t fenceFlagBlockAfter = 1<<1; + const uint32_t fenceFlagSyncNext = 1<<2; - const rdr::U32 fenceFlagRequest = 1<<31; + const uint32_t fenceFlagRequest = 1<<31; - const rdr::U32 fenceFlagsSupported = (fenceFlagBlockBefore | + const uint32_t fenceFlagsSupported = (fenceFlagBlockBefore | fenceFlagBlockAfter | fenceFlagSyncNext | fenceFlagRequest); diff --git a/tests/perf/convperf.cxx b/tests/perf/convperf.cxx index 7a01bae8..c1126e7d 100644 --- a/tests/perf/convperf.cxx +++ b/tests/perf/convperf.cxx @@ -32,9 +32,9 @@ static const int tile = 64; static const int fbsize = 4096; -static rdr::U8 *fb1, *fb2; +static uint8_t *fb1, *fb2; -typedef void (*testfn) (rfb::PixelFormat&, rfb::PixelFormat&, rdr::U8*, rdr::U8*); +typedef void (*testfn) (rfb::PixelFormat&, rfb::PixelFormat&, uint8_t*, uint8_t*); struct TestEntry { const char *label; @@ -43,7 +43,7 @@ struct TestEntry { static void testMemcpy(rfb::PixelFormat &dstpf, rfb::PixelFormat& /*srcpf*/, - rdr::U8 *dst, rdr::U8 *src) + uint8_t *dst, uint8_t *src) { int h; h = tile; @@ -56,21 +56,21 @@ static void testMemcpy(rfb::PixelFormat &dstpf, static void testBuffer(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, - rdr::U8 *dst, rdr::U8 *src) + uint8_t *dst, uint8_t *src) { dstpf.bufferFromBuffer(dst, srcpf, src, tile, tile, fbsize, fbsize); } static void testToRGB(rfb::PixelFormat& /*dstpf*/, rfb::PixelFormat &srcpf, - rdr::U8 *dst, rdr::U8 *src) + uint8_t *dst, uint8_t *src) { srcpf.rgbFromBuffer(dst, src, tile, fbsize, tile); } static void testFromRGB(rfb::PixelFormat &dstpf, rfb::PixelFormat& /*srcpf*/, - rdr::U8 *dst, rdr::U8 *src) + uint8_t *dst, uint8_t *src) { dstpf.bufferFromRGB(dst, src, tile, fbsize, tile); } @@ -81,7 +81,7 @@ static void doTest(testfn fn, rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf) for (int i = 0;i < 10000;i++) { int x, y; - rdr::U8 *dst, *src; + uint8_t *dst, *src; x = rand() % (fbsize - tile); y = rand() % (fbsize - tile); dst = fb1 + (x + y * fbsize) * dstpf.bpp/8; @@ -135,8 +135,8 @@ int main(int /*argc*/, char** /*argv*/) bufsize = fbsize * fbsize * 4; - fb1 = new rdr::U8[bufsize]; - fb2 = new rdr::U8[bufsize]; + fb1 = new uint8_t[bufsize]; + fb2 = new uint8_t[bufsize]; for (i = 0;i < bufsize;i++) { fb1[i] = rand(); diff --git a/tests/perf/decperf.cxx b/tests/perf/decperf.cxx index 0509c15d..c72ec1d7 100644 --- a/tests/perf/decperf.cxx +++ b/tests/perf/decperf.cxx @@ -59,7 +59,7 @@ private: virtual void overrun(size_t needed); int offset; - rdr::U8 buf[131072]; + uint8_t buf[131072]; }; class CConn : public rfb::CConnection { @@ -69,11 +69,11 @@ public: virtual void initDone(); virtual void setPixelFormat(const rfb::PixelFormat& pf); - virtual void setCursor(int, int, const rfb::Point&, const rdr::U8*); + virtual void setCursor(int, int, const rfb::Point&, const uint8_t*); virtual void setCursorPos(const rfb::Point&); virtual void framebufferUpdateStart(); virtual void framebufferUpdateEnd(); - virtual void setColourMapEntries(int, int, rdr::U16*); + virtual void setColourMapEntries(int, int, uint16_t*); virtual void bell(); virtual void serverCutText(const char*); @@ -145,7 +145,7 @@ void CConn::setPixelFormat(const rfb::PixelFormat& /*pf*/) CConnection::setPixelFormat(filePF); } -void CConn::setCursor(int, int, const rfb::Point&, const rdr::U8*) +void CConn::setCursor(int, int, const rfb::Point&, const uint8_t*) { } @@ -169,7 +169,7 @@ void CConn::framebufferUpdateEnd() cpuTime += getCpuCounter(); } -void CConn::setColourMapEntries(int, int, rdr::U16*) +void CConn::setColourMapEntries(int, int, uint16_t*) { } diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx index 476b613a..40e3abfc 100644 --- a/tests/perf/encperf.cxx +++ b/tests/perf/encperf.cxx @@ -68,7 +68,7 @@ static rfb::BoolParameter translate("translate", static const rfb::PixelFormat fbPF(32, 24, false, true, 255, 255, 255, 0, 8, 16); // Encodings to use -static const rdr::S32 encodings[] = { +static const int32_t encodings[] = { rfb::encodingTight, rfb::encodingCopyRect, rfb::encodingRRE, rfb::encodingHextile, rfb::encodingZRLE, rfb::pseudoEncodingLastRect, rfb::pseudoEncodingQualityLevel0 + 8, @@ -85,7 +85,7 @@ private: virtual void overrun(size_t needed); int offset; - rdr::U8 buf[131072]; + uint8_t buf[131072]; }; class CConn : public rfb::CConnection { @@ -98,12 +98,12 @@ public: virtual void initDone() {}; virtual void resizeFramebuffer(); - virtual void setCursor(int, int, const rfb::Point&, const rdr::U8*); + virtual void setCursor(int, int, const rfb::Point&, const uint8_t*); virtual void setCursorPos(const rfb::Point&); virtual void framebufferUpdateStart(); virtual void framebufferUpdateEnd(); virtual bool dataRect(const rfb::Rect&, int); - virtual void setColourMapEntries(int, int, rdr::U16*); + virtual void setColourMapEntries(int, int, uint16_t*); virtual void bell(); virtual void serverCutText(const char*); @@ -217,7 +217,7 @@ void CConn::resizeFramebuffer() setFramebuffer(pb); } -void CConn::setCursor(int, int, const rfb::Point&, const rdr::U8*) +void CConn::setCursor(int, int, const rfb::Point&, const uint8_t*) { } @@ -265,7 +265,7 @@ bool CConn::dataRect(const rfb::Rect &r, int encoding) return true; } -void CConn::setColourMapEntries(int, int, rdr::U16*) +void CConn::setColourMapEntries(int, int, uint16_t*) { } diff --git a/tests/perf/fbperf.cxx b/tests/perf/fbperf.cxx index d512ef80..5d626602 100644 --- a/tests/perf/fbperf.cxx +++ b/tests/perf/fbperf.cxx @@ -93,7 +93,7 @@ TestWindow::~TestWindow() void TestWindow::start(int width, int height) { - rdr::U32 pixel; + uint32_t pixel; stop(); @@ -176,7 +176,7 @@ void TestWindow::update() void TestWindow::changefb() { - rdr::U32 pixel; + uint32_t pixel; pixel = rand(); fb->fillRect(fb->getRect(), &pixel); @@ -195,7 +195,7 @@ void TestWindow::timer(void* data) void PartialTestWindow::changefb() { rfb::Rect r; - rdr::U32 pixel; + uint32_t pixel; r = fb->getRect(); r.tl.x += w() / 4; diff --git a/tests/unit/conv.cxx b/tests/unit/conv.cxx index 5696c149..2f15cb55 100644 --- a/tests/unit/conv.cxx +++ b/tests/unit/conv.cxx @@ -26,9 +26,9 @@ #include <rfb/PixelFormat.h> -static const rdr::U8 pixelRed = 0xf1; -static const rdr::U8 pixelGreen = 0xc3; -static const rdr::U8 pixelBlue = 0x97; +static const uint8_t pixelRed = 0xf1; +static const uint8_t pixelGreen = 0xc3; +static const uint8_t pixelBlue = 0x97; static const int fbWidth = 40; static const int fbHeight = 30; @@ -48,7 +48,7 @@ struct TestEntry { namespace rfb { void makePixel(const rfb::PixelFormat &pf, - rdr::U8 *buffer) + uint8_t *buffer) { rfb::Pixel p; @@ -63,7 +63,7 @@ void makePixel(const rfb::PixelFormat &pf, bool verifyPixel(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf, - const rdr::U8 *buffer) + const uint8_t *buffer) { rfb::Pixel p; int r, g, b; @@ -108,7 +108,7 @@ static bool testPixel(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf) { rfb::Pixel p; - rdr::U8 buffer[4]; + uint8_t buffer[4]; makePixel(srcpf, buffer); @@ -127,7 +127,7 @@ static bool testBuffer(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf) { int i, x, y, unaligned; - rdr::U8 bufIn[fbMalloc], bufOut[fbMalloc]; + uint8_t bufIn[fbMalloc], bufOut[fbMalloc]; // Once aligned, and once unaligned for (unaligned = 0;unaligned < 2;unaligned++) { @@ -160,7 +160,7 @@ static bool testBuffer(const rfb::PixelFormat &dstpf, bufOut + unaligned + (x + y*fbWidth)*dstpf.bpp/8)) return false; } else { - const rdr::U8 zero[4] = { 0, 0, 0, 0 }; + const uint8_t zero[4] = { 0, 0, 0, 0 }; if (memcmp(bufOut + unaligned + (x + y*fbWidth)*dstpf.bpp/8, zero, dstpf.bpp/8) != 0) return false; @@ -176,7 +176,7 @@ static bool testRGB(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf) { int i, x, y, unaligned; - rdr::U8 bufIn[fbMalloc], bufRGB[fbMalloc], bufOut[fbMalloc]; + uint8_t bufIn[fbMalloc], bufRGB[fbMalloc], bufOut[fbMalloc]; // Once aligned, and once unaligned for (unaligned = 0;unaligned < 2;unaligned++) { @@ -215,7 +215,7 @@ static bool testRGB(const rfb::PixelFormat &dstpf, bufOut + unaligned + (x + y*fbWidth)*dstpf.bpp/8)) return false; } else { - const rdr::U8 zero[4] = { 0, 0, 0, 0 }; + const uint8_t zero[4] = { 0, 0, 0, 0 }; if (memcmp(bufOut + unaligned + (x + y*fbWidth)*dstpf.bpp/8, zero, dstpf.bpp/8) != 0) return false; @@ -231,9 +231,9 @@ static bool testPixelRGB(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf) { rfb::Pixel p; - rdr::U16 r16, g16, b16; - rdr::U8 r8, g8, b8; - rdr::U8 buffer[4]; + uint16_t r16, g16, b16; + uint8_t r8, g8, b8; + uint8_t buffer[4]; makePixel(srcpf, buffer); diff --git a/unix/common/randr.cxx b/unix/common/randr.cxx index 72b9a125..12c4841f 100644 --- a/unix/common/randr.cxx +++ b/unix/common/randr.cxx @@ -137,7 +137,7 @@ rfb::ScreenSet computeScreenLayout(OutputIdMap *outputIdMap) if (outputIdMap->count(outputId) == 1) newIdMap[outputId] = (*outputIdMap)[outputId]; else { - rdr::U32 id; + uint32_t id; OutputIdMap::const_iterator iter; while (true) { diff --git a/unix/common/unixcommon.h b/unix/common/unixcommon.h index dd02d403..d04c3ae9 100644 --- a/unix/common/unixcommon.h +++ b/unix/common/unixcommon.h @@ -24,7 +24,7 @@ #include <rfb/ScreenSet.h> -typedef std::map<unsigned int, rdr::U32> OutputIdMap; +typedef std::map<unsigned int, uint32_t> OutputIdMap; rfb::ScreenSet computeScreenLayout(OutputIdMap *outputIdMap); diff --git a/unix/tx/TXWindow.cxx b/unix/tx/TXWindow.cxx index af8395dc..c771a623 100644 --- a/unix/tx/TXWindow.cxx +++ b/unix/tx/TXWindow.cxx @@ -467,7 +467,7 @@ void TXWindow::handleXEvent(XEvent* ev) XChangeProperty(dpy, se.requestor, se.property, XA_ATOM, 32, PropModeReplace, (unsigned char*)targets, 2); } else if (se.target == xaTIMESTAMP) { - rdr::U32 t = selectionOwnTime[se.selection]; + Time t = selectionOwnTime[se.selection]; XChangeProperty(dpy, se.requestor, se.property, XA_INTEGER, 32, PropModeReplace, (unsigned char*)&t, 1); } else if (se.target == XA_STRING) { diff --git a/unix/tx/TXWindow.h b/unix/tx/TXWindow.h index 746791d6..223c07a8 100644 --- a/unix/tx/TXWindow.h +++ b/unix/tx/TXWindow.h @@ -28,7 +28,6 @@ #ifndef __TXWINDOW_H__ #define __TXWINDOW_H__ -#include <rdr/types.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index 5f5366b7..0b6d7ef1 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -510,7 +510,7 @@ KeyCode XDesktop::keysymToKeycode(Display* dpy, KeySym keysym) { } -void XDesktop::keyEvent(rdr::U32 keysym, rdr::U32 xtcode, bool down) { +void XDesktop::keyEvent(uint32_t keysym, uint32_t xtcode, bool down) { #ifdef HAVE_XTEST int keycode = 0; @@ -944,20 +944,20 @@ bool XDesktop::setCursor() // Copied from XserverDesktop::setCursor() in // unix/xserver/hw/vnc/XserverDesktop.cc and adapted to - // handle long -> U32 conversion for 64-bit Xlib - rdr::U8* cursorData; - rdr::U8 *out; + // handle long -> uint32_t conversion for 64-bit Xlib + uint8_t* cursorData; + uint8_t *out; const unsigned long *pixels; - cursorData = new rdr::U8[cim->width * cim->height * 4]; + cursorData = new uint8_t[cim->width * cim->height * 4]; // Un-premultiply alpha pixels = cim->pixels; out = cursorData; for (int y = 0; y < cim->height; y++) { for (int x = 0; x < cim->width; x++) { - rdr::U8 alpha; - rdr::U32 pixel = *pixels++; + uint8_t alpha; + uint32_t pixel = *pixels++; alpha = (pixel >> 24) & 0xff; if (alpha == 0) diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h index 6ebcd9f8..02217496 100644 --- a/unix/x0vncserver/XDesktop.h +++ b/unix/x0vncserver/XDesktop.h @@ -58,7 +58,7 @@ public: KeyCode addKeysym(Display* dpy, KeySym keysym); void deleteAddedKeysyms(Display* dpy); KeyCode keysymToKeycode(Display* dpy, KeySym keysym); - virtual void keyEvent(rdr::U32 keysym, rdr::U32 xtcode, bool down); + virtual void keyEvent(uint32_t keysym, uint32_t xtcode, bool down); virtual void clientCutText(const char* str); virtual unsigned int setScreenLayout(int fb_width, int fb_height, const rfb::ScreenSet& layout); diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx index 7107bfcb..b7506513 100644 --- a/unix/x0vncserver/XPixelBuffer.cxx +++ b/unix/x0vncserver/XPixelBuffer.cxx @@ -54,7 +54,7 @@ XPixelBuffer::XPixelBuffer(Display *dpy, ImageFactory &factory, ffs(m_image->xim->blue_mask) - 1); // Set up the remaining data of the parent class. - setBuffer(rect.width(), rect.height(), (rdr::U8 *)m_image->xim->data, + setBuffer(rect.width(), rect.height(), (uint8_t *)m_image->xim->data, m_image->xim->bytes_per_line * 8 / m_image->xim->bits_per_pixel); // Get initial screen image from the X display. diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index 603e1e5e..3b4eee6a 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -126,12 +126,12 @@ void XserverDesktop::setFramebuffer(int w, int h, void* fbptr, int stride_) } if (!fbptr) { - shadowFramebuffer = new rdr::U8[w * h * (format.bpp/8)]; + shadowFramebuffer = new uint8_t[w * h * (format.bpp/8)]; fbptr = shadowFramebuffer; stride_ = w; } - setBuffer(w, h, (rdr::U8*)fbptr, stride_); + setBuffer(w, h, (uint8_t*)fbptr, stride_); vncSetGlueContext(screenIndex); layout = ::computeScreenLayout(&outputIdMap); @@ -231,19 +231,19 @@ void XserverDesktop::setDesktopName(const char* name) void XserverDesktop::setCursor(int width, int height, int hotX, int hotY, const unsigned char *rgbaData) { - rdr::U8* cursorData; + uint8_t* cursorData; - rdr::U8 *out; + uint8_t *out; const unsigned char *in; - cursorData = new rdr::U8[width * height * 4]; + cursorData = new uint8_t[width * height * 4]; // Un-premultiply alpha in = rgbaData; out = cursorData; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - rdr::U8 alpha; + uint8_t alpha; alpha = in[3]; if (alpha == 0) @@ -500,7 +500,7 @@ void XserverDesktop::grabRegion(const rfb::Region& region) std::vector<rfb::Rect>::iterator i; region.get_rects(&rects); for (i = rects.begin(); i != rects.end(); i++) { - rdr::U8 *buffer; + uint8_t *buffer; int bufStride; buffer = getBufferRW(*i, &bufStride); @@ -510,7 +510,7 @@ void XserverDesktop::grabRegion(const rfb::Region& region) } } -void XserverDesktop::keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down) +void XserverDesktop::keyEvent(uint32_t keysym, uint32_t keycode, bool down) { if (!rawKeyboard) keycode = 0; diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h index 57ee8083..94f6f076 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.h +++ b/unix/xserver/hw/vnc/XserverDesktop.h @@ -94,7 +94,7 @@ public: virtual void queryConnection(network::Socket* sock, const char* userName); virtual void pointerEvent(const rfb::Point& pos, int buttonMask); - virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); + virtual void keyEvent(uint32_t keysym, uint32_t keycode, bool down); virtual unsigned int setScreenLayout(int fb_width, int fb_height, const rfb::ScreenSet& layout); virtual void handleClipboardRequest(); @@ -119,7 +119,7 @@ private: int screenIndex; rfb::VNCServer* server; std::list<network::SocketListener*> listeners; - rdr::U8* shadowFramebuffer; + uint8_t* shadowFramebuffer; uint32_t queryConnectId; network::Socket* queryConnectSocket; diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index da27b848..9ab5a696 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -400,7 +400,7 @@ void CConn::framebufferUpdateEnd() // The rest of the callbacks are fairly self-explanatory... void CConn::setColourMapEntries(int /*firstColour*/, int /*nColours*/, - rdr::U16* /*rgbs*/) + uint16_t* /*rgbs*/) { vlog.error(_("Invalid SetColourMapEntries from server!")); } @@ -426,7 +426,7 @@ bool CConn::dataRect(const Rect& r, int encoding) } void CConn::setCursor(int width, int height, const Point& hotspot, - const rdr::U8* data) + const uint8_t* data) { desktop->setCursor(width, height, hotspot, data); } @@ -436,7 +436,7 @@ void CConn::setCursorPos(const Point& pos) desktop->setCursorPos(pos); } -void CConn::fence(rdr::U32 flags, unsigned len, const char data[]) +void CConn::fence(uint32_t flags, unsigned len, const char data[]) { CMsgHandler::fence(flags, len, data); diff --git a/vncviewer/CConn.h b/vncviewer/CConn.h index e662ec87..4f0e86fe 100644 --- a/vncviewer/CConn.h +++ b/vncviewer/CConn.h @@ -53,7 +53,7 @@ public: void setName(const char* name); - void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs); + void setColourMapEntries(int firstColour, int nColours, uint16_t* rgbs); void bell(); @@ -62,10 +62,10 @@ public: bool dataRect(const rfb::Rect& r, int encoding); void setCursor(int width, int height, const rfb::Point& hotspot, - const rdr::U8* data); + const uint8_t* data); void setCursorPos(const rfb::Point& pos); - void fence(rdr::U32 flags, unsigned len, const char data[]); + void fence(uint32_t flags, unsigned len, const char data[]); void setLEDState(unsigned int state); diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index 70573a28..4eccbf52 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -376,7 +376,7 @@ void DesktopWindow::resizeFramebuffer(int new_w, int new_h) void DesktopWindow::setCursor(int width, int height, const rfb::Point& hotspot, - const rdr::U8* data) + const uint8_t* data) { viewport->setCursor(width, height, hotspot, data); } @@ -1321,7 +1321,7 @@ void DesktopWindow::remoteResize(int width, int height) layout.begin()->dimensions.br.y = height; } else { int i; - rdr::U32 id; + uint32_t id; int sx, sy, sw, sh; rfb::Rect viewport_rect, screen_rect; diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h index f7721f2e..a36d2bdc 100644 --- a/vncviewer/DesktopWindow.h +++ b/vncviewer/DesktopWindow.h @@ -58,7 +58,7 @@ public: // New image for the locally rendered cursor void setCursor(int width, int height, const rfb::Point& hotspot, - const rdr::U8* data); + const uint8_t* data); // Server-provided cursor position void setCursorPos(const rfb::Point& pos); diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx index d0481708..027f5706 100644 --- a/vncviewer/OptionsDialog.cxx +++ b/vncviewer/OptionsDialog.cxx @@ -24,7 +24,6 @@ #include <stdlib.h> #include <list> -#include <rdr/types.h> #include <rfb/encodings.h> #if defined(HAVE_GNUTLS) || defined(HAVE_NETTLE) @@ -219,11 +218,11 @@ void OptionsDialog::loadOptions(void) /* Security */ Security security(SecurityClient::secTypes); - list<U8> secTypes; - list<U8>::iterator iter; + list<uint8_t> secTypes; + list<uint8_t>::iterator iter; - list<U32> secTypesExt; - list<U32>::iterator iterExt; + list<uint32_t> secTypesExt; + list<uint32_t>::iterator iterExt; encNoneCheckbox->value(false); #ifdef HAVE_GNUTLS diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx index b37e47a5..2c91c704 100644 --- a/vncviewer/PlatformPixelBuffer.cxx +++ b/vncviewer/PlatformPixelBuffer.cxx @@ -61,13 +61,13 @@ PlatformPixelBuffer::PlatformPixelBuffer(int width, int height) : vlog.debug("Using standard XImage"); } - setBuffer(width, height, (rdr::U8*)xim->data, + setBuffer(width, height, (uint8_t*)xim->data, xim->bytes_per_line / (getPF().bpp/8)); // On X11, the Pixmap backing this Surface is uninitialized. clear(0, 0, 0); #else - setBuffer(width, height, (rdr::U8*)Surface::data, width); + setBuffer(width, height, (uint8_t*)Surface::data, width); #endif } diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 89d1a097..c12394ab 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -246,7 +246,7 @@ static const char * dotcursor_xpm[] = { " "}; void Viewport::setCursor(int width, int height, const Point& hotspot, - const rdr::U8* data) + const uint8_t* data) { int i; @@ -267,12 +267,12 @@ void Viewport::setCursor(int width, int height, const Point& hotspot, cursorHotspot.x = cursorHotspot.y = 2; } else { if ((width == 0) || (height == 0)) { - U8 *buffer = new U8[4]; + uint8_t *buffer = new uint8_t[4]; memset(buffer, 0, 4); cursor = new Fl_RGB_Image(buffer, 1, 1, 4); cursorHotspot.x = cursorHotspot.y = 0; } else { - U8 *buffer = new U8[width * height * 4]; + uint8_t *buffer = new uint8_t[width * height * 4]; memcpy(buffer, data, width * height * 4); cursor = new Fl_RGB_Image(buffer, width, height, 4); cursorHotspot = hotspot; @@ -830,7 +830,7 @@ void Viewport::resetKeyboard() } -void Viewport::handleKeyPress(int keyCode, rdr::U32 keySym) +void Viewport::handleKeyPress(int keyCode, uint32_t keySym) { static bool menuRecursion = false; @@ -968,7 +968,7 @@ int Viewport::handleSystemEvent(void *event, void *data) UINT vKey; bool isExtended; int keyCode; - rdr::U32 keySym; + uint32_t keySym; vKey = msg->wParam; isExtended = (msg->lParam & (1 << 24)) != 0; @@ -1148,7 +1148,7 @@ int Viewport::handleSystemEvent(void *event, void *data) keyCode = code_map_osx_to_qnum[keyCode]; if (cocoa_is_key_press(event)) { - rdr::U32 keySym; + uint32_t keySym; keySym = cocoa_event_keysym(event); if (keySym == NoSymbol) { diff --git a/vncviewer/Viewport.h b/vncviewer/Viewport.h index a42b06c6..c70cca6e 100644 --- a/vncviewer/Viewport.h +++ b/vncviewer/Viewport.h @@ -49,7 +49,7 @@ public: // New image for the locally rendered cursor void setCursor(int width, int height, const rfb::Point& hotspot, - const rdr::U8* data); + const uint8_t* data); // Change client LED state void setLEDState(unsigned int state); @@ -86,7 +86,7 @@ private: void resetKeyboard(); - void handleKeyPress(int keyCode, rdr::U32 keySym); + void handleKeyPress(int keyCode, uint32_t keySym); void handleKeyRelease(int keyCode); static int handleSystemEvent(void *event, void *data); @@ -113,7 +113,7 @@ private: rfb::Point lastPointerPos; int lastButtonMask; - typedef std::map<int, rdr::U32> DownMap; + typedef std::map<int, uint32_t> DownMap; DownMap downKeySym; #ifdef WIN32 @@ -128,7 +128,7 @@ private: int clipboardSource; - rdr::U32 menuKeySym; + uint32_t menuKeySym; int menuKeyCode, menuKeyFLTK; Fl_Menu_Button *contextMenu; diff --git a/vncviewer/menukey.cxx b/vncviewer/menukey.cxx index e216f7b2..c12d8c93 100644 --- a/vncviewer/menukey.cxx +++ b/vncviewer/menukey.cxx @@ -66,7 +66,7 @@ const MenuKeySymbol* getMenuKeySymbols() return menuSymbols; } -void getMenuKey(int *fltkcode, int *keycode, rdr::U32 *keysym) +void getMenuKey(int *fltkcode, int *keycode, uint32_t *keysym) { const char *menuKeyStr; diff --git a/vncviewer/menukey.h b/vncviewer/menukey.h index 79354288..50106955 100644 --- a/vncviewer/menukey.h +++ b/vncviewer/menukey.h @@ -18,16 +18,16 @@ #ifndef __KEYSYM_H__ #define __KEYSYM_H__ -#include <rdr/types.h> +#include <stdint.h> typedef struct { const char* name; int fltkcode; int keycode; - rdr::U32 keysym; + uint32_t keysym; } MenuKeySymbol; -void getMenuKey(int *fltkcode, int *keycode, rdr::U32 *keysym); +void getMenuKey(int *fltkcode, int *keycode, uint32_t *keysym); int getMenuKeySymbolCount(); const MenuKeySymbol* getMenuKeySymbols(); diff --git a/win/rfb_win32/BitmapInfo.h b/win/rfb_win32/BitmapInfo.h index 6a6f0d24..6cbea15c 100644 --- a/win/rfb_win32/BitmapInfo.h +++ b/win/rfb_win32/BitmapInfo.h @@ -20,7 +20,6 @@ #define __RFB_WIN32_BITMAP_INFO_H__ #include <windows.h> -#include <rdr/types.h> namespace rfb { namespace win32 { @@ -39,7 +38,7 @@ namespace rfb { inline void initMaxAndShift(DWORD mask, int* max, int* shift) { for ((*shift) = 0; (mask & 1) == 0; (*shift)++) mask >>= 1; - (*max) = (rdr::U16)mask; + (*max) = (uint16_t)mask; } }; diff --git a/win/rfb_win32/DIBSectionBuffer.cxx b/win/rfb_win32/DIBSectionBuffer.cxx index ad24663b..632c0a4c 100644 --- a/win/rfb_win32/DIBSectionBuffer.cxx +++ b/win/rfb_win32/DIBSectionBuffer.cxx @@ -48,12 +48,12 @@ DIBSectionBuffer::~DIBSectionBuffer() { inline void initMaxAndShift(DWORD mask, int* max, int* shift) { for ((*shift) = 0; (mask & 1) == 0; (*shift)++) mask >>= 1; - (*max) = (rdr::U16)mask; + (*max) = (uint16_t)mask; } void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) { HBITMAP new_bitmap = 0; - rdr::U8* new_data = 0; + uint8_t* new_data = 0; if (!pf.trueColour) throw rfb::Exception("palette format not supported"); @@ -71,9 +71,9 @@ void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) { bi.bmiHeader.biWidth = w; bi.bmiHeader.biHeight = -h; bi.bmiHeader.biCompression = (format.bpp > 8) ? BI_BITFIELDS : BI_RGB; - bi.mask.red = format.pixelFromRGB((rdr::U16)~0, 0, 0); - bi.mask.green = format.pixelFromRGB(0, (rdr::U16)~0, 0); - bi.mask.blue = format.pixelFromRGB(0, 0, (rdr::U16)~0); + bi.mask.red = format.pixelFromRGB((uint16_t)~0, 0, 0); + bi.mask.green = format.pixelFromRGB(0, (uint16_t)~0, 0); + bi.mask.blue = format.pixelFromRGB(0, 0, (uint16_t)~0); // Create a DIBSection to draw into if (device) diff --git a/win/rfb_win32/DeviceFrameBuffer.cxx b/win/rfb_win32/DeviceFrameBuffer.cxx index cf93f14c..f7740d1f 100644 --- a/win/rfb_win32/DeviceFrameBuffer.cxx +++ b/win/rfb_win32/DeviceFrameBuffer.cxx @@ -27,6 +27,7 @@ #endif #include <vector> +#include <rdr/types.h> #include <rfb_win32/DeviceFrameBuffer.h> #include <rfb_win32/DeviceContext.h> #include <rfb_win32/IconInfo.h> @@ -149,7 +150,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) if (!iconInfo.hbmColor) height /= 2; - buffer.buf = new rdr::U8[width * height * 4]; + buffer.buf = new uint8_t[width * height * 4]; Point hotspot = Point(iconInfo.xHotspot, iconInfo.yHotspot); @@ -190,10 +191,10 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) (bi.bV5BlueMask != ((unsigned)0xff << bidx*8))) throw rdr::Exception("unsupported cursor colour format"); - rdr::U8* rwbuffer = buffer.buf; + uint8_t* rwbuffer = buffer.buf; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - rdr::U8 r, g, b, a; + uint8_t r, g, b, a; r = rwbuffer[ridx]; g = rwbuffer[gidx]; @@ -212,15 +213,15 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) // B/W cursor rdr::U8Array mask(maskInfo.bmWidthBytes * maskInfo.bmHeight); - rdr::U8* andMask = mask.buf; - rdr::U8* xorMask = mask.buf + height * maskInfo.bmWidthBytes; + uint8_t* andMask = mask.buf; + uint8_t* xorMask = mask.buf + height * maskInfo.bmWidthBytes; if (!GetBitmapBits(iconInfo.hbmMask, maskInfo.bmWidthBytes * maskInfo.bmHeight, mask.buf)) throw rdr::SystemException("GetBitmapBits", GetLastError()); bool doOutline = false; - rdr::U8* rwbuffer = buffer.buf; + uint8_t* rwbuffer = buffer.buf; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int byte = y * maskInfo.bmWidthBytes + x / 8; @@ -264,8 +265,8 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) memset(outline.buf, 0, (width + 2)*(height + 2)*4); // Pass 1, outline everything - rdr::U8* in = buffer.buf; - rdr::U8* out = outline.buf + width*4 + 4; + uint8_t* in = buffer.buf; + uint8_t* out = outline.buf + width*4 + 4; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { // Visible pixel? diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx index 67aa34f9..c381c412 100644 --- a/win/rfb_win32/SDisplay.cxx +++ b/win/rfb_win32/SDisplay.cxx @@ -323,7 +323,7 @@ void SDisplay::pointerEvent(const Point& pos, int buttonmask) { } } -void SDisplay::keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down) { +void SDisplay::keyEvent(uint32_t keysym, uint32_t keycode, bool down) { // - Check that the SDesktop doesn't need restarting if (isRestartRequired()) restartCore(); diff --git a/win/rfb_win32/SDisplay.h b/win/rfb_win32/SDisplay.h index 8e38edb3..febc720e 100644 --- a/win/rfb_win32/SDisplay.h +++ b/win/rfb_win32/SDisplay.h @@ -80,7 +80,7 @@ namespace rfb { virtual void handleClipboardAnnounce(bool available); virtual void handleClipboardData(const char* data); virtual void pointerEvent(const Point& pos, int buttonmask); - virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); + virtual void keyEvent(uint32_t keysym, uint32_t keycode, bool down); // -=- Clipboard events diff --git a/win/rfb_win32/SInput.cxx b/win/rfb_win32/SInput.cxx index 8ead409d..efc17fdb 100644 --- a/win/rfb_win32/SInput.cxx +++ b/win/rfb_win32/SInput.cxx @@ -145,8 +145,8 @@ BoolParameter rfb::win32::SKeyboard::rawKeyboard("RawKeyboard", // The keysymToAscii table transforms a couple of awkward keysyms into their // ASCII equivalents. struct keysymToAscii_t { - rdr::U32 keysym; - rdr::U8 ascii; + uint32_t keysym; + uint8_t ascii; }; keysymToAscii_t keysymToAscii[] = { @@ -154,15 +154,15 @@ keysymToAscii_t keysymToAscii[] = { { XK_KP_Equal, '=' }, }; -rdr::U8 latin1DeadChars[] = { +uint8_t latin1DeadChars[] = { XK_grave, XK_acute, XK_asciicircum, XK_diaeresis, XK_degree, XK_cedilla, XK_asciitilde }; struct latin1ToDeadChars_t { - rdr::U8 latin1Char; - rdr::U8 deadChar; - rdr::U8 baseChar; + uint8_t latin1Char; + uint8_t deadChar; + uint8_t baseChar; }; latin1ToDeadChars_t latin1ToDeadChars[] = { @@ -350,7 +350,7 @@ win32::SKeyboard::SKeyboard() keystate[VK_SHIFT] = (modifierState & 1) ? 0x80 : 0; keystate[VK_CONTROL] = (modifierState & 2) ? 0x80 : 0; keystate[VK_MENU] = (modifierState & 4) ? 0x80 : 0; - rdr::U8 chars[2]; + uint8_t chars[2]; int nchars = ToAscii(vkCode, 0, keystate, (WORD*)&chars, 0); if (nchars < 0) { vlog.debug("Found dead key 0x%x '%c'", @@ -363,7 +363,7 @@ win32::SKeyboard::SKeyboard() } -void win32::SKeyboard::keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down) +void win32::SKeyboard::keyEvent(uint32_t keysym, uint32_t keycode, bool down) { // If scan code is available use that directly as windows uses // compatible scancodes diff --git a/win/rfb_win32/SInput.h b/win/rfb_win32/SInput.h index c927c65f..9013a37e 100644 --- a/win/rfb_win32/SInput.h +++ b/win/rfb_win32/SInput.h @@ -26,10 +26,12 @@ #include <rfb/Rect.h> #include <rfb/Configuration.h> -#include <rdr/types.h> + #include <map> #include <vector> +#include <stdint.h> + namespace rfb { namespace win32 { @@ -45,7 +47,7 @@ namespace rfb { void pointerEvent(const Point& pos, int buttonmask); protected: Point last_position; - rdr::U8 last_buttonmask; + uint8_t last_buttonmask; }; // -=- Keyboard event handling @@ -53,13 +55,13 @@ namespace rfb { class SKeyboard { public: SKeyboard(); - void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down); + void keyEvent(uint32_t keysym, uint32_t keycode, bool down); static BoolParameter deadKeyAware; static BoolParameter rawKeyboard; private: - std::map<rdr::U32,rdr::U8> vkMap; - std::map<rdr::U32,bool> extendedMap; - std::vector<rdr::U8> deadChars; + std::map<uint32_t,uint8_t> vkMap; + std::map<uint32_t,bool> extendedMap; + std::vector<uint8_t> deadChars; }; }; // win32 diff --git a/win/rfb_win32/Security.cxx b/win/rfb_win32/Security.cxx index 17dbd4dc..fc038859 100644 --- a/win/rfb_win32/Security.cxx +++ b/win/rfb_win32/Security.cxx @@ -97,7 +97,7 @@ void AccessEntries::addEntry(const PSID sid, PSID Sid::copySID(const PSID sid) { if (!IsValidSid(sid)) throw rdr::Exception("invalid SID in copyPSID"); - PSID buf = (PSID)new rdr::U8[GetLengthSid(sid)]; + PSID buf = (PSID)new uint8_t[GetLengthSid(sid)]; if (!CopySid(GetLengthSid(sid), buf, sid)) throw rdr::SystemException("CopySid failed", GetLastError()); return buf; @@ -105,7 +105,7 @@ PSID Sid::copySID(const PSID sid) { void Sid::setSID(const PSID sid) { delete [] buf; - buf = (rdr::U8*)copySID(sid); + buf = (uint8_t*)copySID(sid); } void Sid::getUserNameAndDomain(TCHAR** name, TCHAR** domain) { diff --git a/win/rfb_win32/SecurityPage.cxx b/win/rfb_win32/SecurityPage.cxx index 59d0a832..600a8a34 100644 --- a/win/rfb_win32/SecurityPage.cxx +++ b/win/rfb_win32/SecurityPage.cxx @@ -47,8 +47,8 @@ SecurityPage::SecurityPage(Security *security_) void SecurityPage::initDialog() { - list<U8> secTypes; - list<U8>::iterator i; + list<uint8_t> secTypes; + list<uint8_t>::iterator i; if (isItemChecked(IDC_ENC_X509)) enableX509Dialogs(); @@ -69,8 +69,8 @@ SecurityPage::initDialog() } } - list<U32> secTypesExt; - list<U32>::iterator iext; + list<uint32_t> secTypesExt; + list<uint32_t>::iterator iext; secTypesExt = security->GetEnabledExtSecTypes(); @@ -124,7 +124,7 @@ SecurityPage::onOk() { bool x509_loaded = false; #endif bool vnc_loaded = false; - list<U32> secTypes; + list<uint32_t> secTypes; /* Keep same priorities as in common/rfb/SecurityClient::secTypes */ secTypes.push_back(secTypeVeNCrypt); diff --git a/win/rfb_win32/SecurityPage.h b/win/rfb_win32/SecurityPage.h index b43c2a36..258b58e0 100644 --- a/win/rfb_win32/SecurityPage.h +++ b/win/rfb_win32/SecurityPage.h @@ -20,7 +20,6 @@ #ifndef __RFB_WIN32_SECURITYPAGE_H__ #define __RFB_WIN32_SECURITYPAGE_H__ -#include <rdr/types.h> #include <rfb/Security.h> #include <rfb_win32/Dialog.h> diff --git a/win/rfb_win32/keymap.h b/win/rfb_win32/keymap.h index b9b6c310..8e06bbea 100644 --- a/win/rfb_win32/keymap.h +++ b/win/rfb_win32/keymap.h @@ -27,8 +27,8 @@ // not on the main keyboard). struct keymap_t { - rdr::U32 keysym; - rdr::U8 vk; + uint32_t keysym; + uint8_t vk; bool extended; }; |