From: Pierre Ossman Date: Sun, 21 Apr 2024 00:18:22 +0000 (+0200) Subject: Avoid shadowing variables X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=12b3f4021641537b90727b23d42de5dff59006cd;p=tigervnc.git Avoid shadowing variables It's a source of confusion and possibly bugs to reuse the same variable name for multiple things. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f798cca..526c7f13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) include(CheckIncludeFiles) include(CheckFunctionExists) include(CheckLibraryExists) +include(CheckVariableExists) include(CheckTypeSize) include(CheckCSourceCompiles) include(CheckCXXSourceCompiles) @@ -185,6 +186,13 @@ if(ENABLE_H264) add_definitions("-DHAVE_H264") set(H264_LIBS "WIN") # may be LIBAV in the future set(H264_LIBRARIES ole32 mfplat mfuuid wmcodecdspuuid) + + set(CMAKE_REQUIRED_LIBRARIES ${H264_LIBRARIES}) + check_variable_exists(CLSID_VideoProcessorMFT HAVE_VIDEO_PROCESSOR_MFT) + set(CMAKE_REQUIRED_LIBRARIES) + if(HAVE_VIDEO_PROCESSOR_MFT) + add_definitions("-DHAVE_VIDEO_PROCESSOR_MFT") + endif() else() find_package(Ffmpeg) if (AVCODEC_FOUND AND AVUTIL_FOUND AND SWSCALE_FOUND) diff --git a/common/network/Socket.cxx b/common/network/Socket.cxx index 971a7170..8da44366 100644 --- a/common/network/Socket.cxx +++ b/common/network/Socket.cxx @@ -128,8 +128,8 @@ void Socket::setFd(int fd) isShutdown_ = false; } -SocketListener::SocketListener(int fd) - : fd(fd), filter(nullptr) +SocketListener::SocketListener(int fd_) + : fd(fd_), filter(nullptr) { initSockets(); } diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index d9b376c9..3f2f0f1f 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -338,8 +338,8 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr, listen(sock); } -Socket* TcpListener::createSocket(int fd) { - return new TcpSocket(fd); +Socket* TcpListener::createSocket(int fd_) { + return new TcpSocket(fd_); } std::list TcpListener::getMyAddresses() { diff --git a/common/network/UnixSocket.cxx b/common/network/UnixSocket.cxx index e7793849..3a422b6c 100644 --- a/common/network/UnixSocket.cxx +++ b/common/network/UnixSocket.cxx @@ -157,8 +157,8 @@ UnixListener::~UnixListener() unlink(addr.sun_path); } -Socket* UnixListener::createSocket(int fd) { - return new UnixSocket(fd); +Socket* UnixListener::createSocket(int fd_) { + return new UnixSocket(fd_); } int UnixListener::getMyPort() { diff --git a/common/os/Mutex.cxx b/common/os/Mutex.cxx index 5e245a6d..2a768b4c 100644 --- a/common/os/Mutex.cxx +++ b/common/os/Mutex.cxx @@ -84,9 +84,9 @@ void Mutex::unlock() #endif } -Condition::Condition(Mutex* mutex) +Condition::Condition(Mutex* mutex_) { - this->mutex = mutex; + this->mutex = mutex_; #ifdef WIN32 systemCondition = new CONDITION_VARIABLE; diff --git a/common/rdr/AESInStream.cxx b/common/rdr/AESInStream.cxx index de91a3df..d6d944a3 100644 --- a/common/rdr/AESInStream.cxx +++ b/common/rdr/AESInStream.cxx @@ -45,15 +45,15 @@ bool AESInStream::fillBuffer() { if (!in->hasData(2)) return false; - const uint8_t* ptr = in->getptr(2); - size_t length = ((int)ptr[0] << 8) | (int)ptr[1]; + const uint8_t* buf = in->getptr(2); + size_t length = ((int)buf[0] << 8) | (int)buf[1]; if (!in->hasData(2 + length + 16)) return false; ensureSpace(length); - ptr = in->getptr(2 + length + 16); - const uint8_t* ad = ptr; - const uint8_t* data = ptr + 2; - const uint8_t* mac = ptr + 2 + length; + buf = in->getptr(2 + length + 16); + const uint8_t* ad = buf; + const uint8_t* data = buf + 2; + const uint8_t* mac = buf + 2 + length; uint8_t macComputed[16]; if (keySize == 128) { diff --git a/common/rdr/BufferedOutStream.cxx b/common/rdr/BufferedOutStream.cxx index 0ee3d644..0d6a1eb6 100644 --- a/common/rdr/BufferedOutStream.cxx +++ b/common/rdr/BufferedOutStream.cxx @@ -31,8 +31,8 @@ using namespace rdr; static const size_t DEFAULT_BUF_SIZE = 16384; static const size_t MAX_BUF_SIZE = 32 * 1024 * 1024; -BufferedOutStream::BufferedOutStream(bool emulateCork) - : bufSize(DEFAULT_BUF_SIZE), offset(0), emulateCork(emulateCork) +BufferedOutStream::BufferedOutStream(bool emulateCork_) + : bufSize(DEFAULT_BUF_SIZE), offset(0), emulateCork(emulateCork_) { ptr = start = sentUpTo = new uint8_t[bufSize]; end = start + bufSize; diff --git a/common/rdr/Exception.cxx b/common/rdr/Exception.cxx index f5ad1819..d5546274 100644 --- a/common/rdr/Exception.cxx +++ b/common/rdr/Exception.cxx @@ -51,8 +51,8 @@ Exception::Exception(const char *format, ...) { va_end(ap); } -GAIException::GAIException(const char* s, int err) - : Exception("%s", s) +GAIException::GAIException(const char* s, int err_) + : Exception("%s", s), err(err_) { strncat(str_, ": ", len-1-strlen(str_)); #ifdef _WIN32 diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 212671aa..0db5f4c8 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -675,7 +675,7 @@ void CConnection::sendClipboardData(const char* data) // FIXME: This conversion magic should be in CMsgWriter std::string filtered(convertCRLF(data)); size_t sizes[1] = { filtered.size() + 1 }; - const uint8_t* data[1] = { (const uint8_t*)filtered.c_str() }; + const uint8_t* datas[1] = { (const uint8_t*)filtered.c_str() }; if (unsolicitedClipboardAttempt) { unsolicitedClipboardAttempt = false; @@ -687,7 +687,7 @@ void CConnection::sendClipboardData(const char* data) } } - writer()->writeClipboardProvide(rfb::clipboardUTF8, sizes, data); + writer()->writeClipboardProvide(rfb::clipboardUTF8, sizes, datas); } else { writer()->writeClientCutText(data); } diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx index c10b7033..8bcdbfd0 100644 --- a/common/rfb/CMsgReader.cxx +++ b/common/rfb/CMsgReader.cxx @@ -827,31 +827,31 @@ bool CMsgReader::readExtendedDesktopSize(int x, int y, int w, int h) bool CMsgReader::readLEDState() { - uint8_t state; + uint8_t ledState; if (!is->hasData(1)) return false; - state = is->readU8(); + ledState = is->readU8(); - handler->setLEDState(state); + handler->setLEDState(ledState); return true; } bool CMsgReader::readVMwareLEDState() { - uint32_t state; + uint32_t ledState; if (!is->hasData(4)) return false; - state = is->readU32(); + ledState = is->readU32(); // As luck has it, this extension uses the same bit definitions, // so no conversion required - handler->setLEDState(state); + handler->setLEDState(ledState); return true; } diff --git a/common/rfb/CSecurityDH.cxx b/common/rfb/CSecurityDH.cxx index f6e5ded4..6d9650bd 100644 --- a/common/rfb/CSecurityDH.cxx +++ b/common/rfb/CSecurityDH.cxx @@ -47,8 +47,8 @@ using namespace rfb; const int MinKeyLength = 128; const int MaxKeyLength = 1024; -CSecurityDH::CSecurityDH(CConnection* cc) - : CSecurity(cc), keyLength(0) +CSecurityDH::CSecurityDH(CConnection* cc_) + : CSecurity(cc_), keyLength(0) { mpz_init(g); mpz_init(p); diff --git a/common/rfb/CSecurityMSLogonII.cxx b/common/rfb/CSecurityMSLogonII.cxx index d7e23715..e721cdfc 100644 --- a/common/rfb/CSecurityMSLogonII.cxx +++ b/common/rfb/CSecurityMSLogonII.cxx @@ -44,8 +44,8 @@ using namespace rfb; -CSecurityMSLogonII::CSecurityMSLogonII(CConnection* cc) - : CSecurity(cc) +CSecurityMSLogonII::CSecurityMSLogonII(CConnection* cc_) + : CSecurity(cc_) { mpz_init(g); mpz_init(p); diff --git a/common/rfb/CSecurityNone.h b/common/rfb/CSecurityNone.h index 98379c73..df685d0d 100644 --- a/common/rfb/CSecurityNone.h +++ b/common/rfb/CSecurityNone.h @@ -29,7 +29,7 @@ namespace rfb { class CSecurityNone : public CSecurity { public: - CSecurityNone(CConnection* cc) : CSecurity(cc) {} + CSecurityNone(CConnection* cc_) : CSecurity(cc_) {} bool processMsg() override { return true; } int getType() const override {return secTypeNone;} }; diff --git a/common/rfb/CSecurityPlain.h b/common/rfb/CSecurityPlain.h index 0cc9e8ed..0dbf4064 100644 --- a/common/rfb/CSecurityPlain.h +++ b/common/rfb/CSecurityPlain.h @@ -26,7 +26,7 @@ namespace rfb { class CSecurityPlain : public CSecurity { public: - CSecurityPlain(CConnection* cc) : CSecurity(cc) {} + CSecurityPlain(CConnection* cc_) : CSecurity(cc_) {} bool processMsg() override; int getType() const override { return secTypePlain; } }; diff --git a/common/rfb/CSecurityRSAAES.cxx b/common/rfb/CSecurityRSAAES.cxx index 832574a0..96d96b01 100644 --- a/common/rfb/CSecurityRSAAES.cxx +++ b/common/rfb/CSecurityRSAAES.cxx @@ -56,9 +56,9 @@ const int MaxKeyLength = 8192; using namespace rfb; -CSecurityRSAAES::CSecurityRSAAES(CConnection* cc, uint32_t _secType, +CSecurityRSAAES::CSecurityRSAAES(CConnection* cc_, uint32_t _secType, int _keySize, bool _isAllEncrypted) - : CSecurity(cc), state(ReadPublicKey), + : CSecurity(cc_), state(ReadPublicKey), keySize(_keySize), isAllEncrypted(_isAllEncrypted), secType(_secType), clientKey(), clientPublicKey(), serverKey(), serverKeyN(nullptr), serverKeyE(nullptr), diff --git a/common/rfb/CSecurityStack.cxx b/common/rfb/CSecurityStack.cxx index 6b8da8dd..838d68ac 100644 --- a/common/rfb/CSecurityStack.cxx +++ b/common/rfb/CSecurityStack.cxx @@ -25,9 +25,9 @@ using namespace rfb; -CSecurityStack::CSecurityStack(CConnection* cc, int Type, +CSecurityStack::CSecurityStack(CConnection* cc_, int Type, CSecurity* s0, CSecurity* s1) - : CSecurity(cc), type(Type) + : CSecurity(cc_), type(Type) { state = 0; state0 = s0; diff --git a/common/rfb/CSecurityTLS.cxx b/common/rfb/CSecurityTLS.cxx index 0633dbce..8d8b58fd 100644 --- a/common/rfb/CSecurityTLS.cxx +++ b/common/rfb/CSecurityTLS.cxx @@ -82,8 +82,8 @@ static const char* configdirfn(const char* fn) return full_path; } -CSecurityTLS::CSecurityTLS(CConnection* cc, bool _anon) - : CSecurity(cc), session(nullptr), +CSecurityTLS::CSecurityTLS(CConnection* cc_, bool _anon) + : CSecurity(cc_), session(nullptr), anon_cred(nullptr), cert_cred(nullptr), anon(_anon), tlsis(nullptr), tlsos(nullptr), rawis(nullptr), rawos(nullptr) diff --git a/common/rfb/CSecurityVeNCrypt.cxx b/common/rfb/CSecurityVeNCrypt.cxx index 2b74fe29..19dcabc3 100644 --- a/common/rfb/CSecurityVeNCrypt.cxx +++ b/common/rfb/CSecurityVeNCrypt.cxx @@ -42,8 +42,9 @@ using namespace std; static LogWriter vlog("CVeNCrypt"); -CSecurityVeNCrypt::CSecurityVeNCrypt(CConnection* cc, SecurityClient* sec) - : CSecurity(cc), csecurity(nullptr), security(sec) +CSecurityVeNCrypt::CSecurityVeNCrypt(CConnection* cc_, + SecurityClient* sec) + : CSecurity(cc_), csecurity(nullptr), security(sec) { haveRecvdMajorVersion = false; haveRecvdMinorVersion = false; diff --git a/common/rfb/CSecurityVncAuth.h b/common/rfb/CSecurityVncAuth.h index 66a6c92d..9a9cf6e0 100644 --- a/common/rfb/CSecurityVncAuth.h +++ b/common/rfb/CSecurityVncAuth.h @@ -25,7 +25,7 @@ namespace rfb { class CSecurityVncAuth : public CSecurity { public: - CSecurityVncAuth(CConnection* cc) : CSecurity(cc) {} + CSecurityVncAuth(CConnection* cc_) : CSecurity(cc_) {} virtual ~CSecurityVncAuth() {} bool processMsg() override; int getType() const override {return secTypeVncAuth;}; diff --git a/common/rfb/Configuration.cxx b/common/rfb/Configuration.cxx index a423770d..f58a9c2f 100644 --- a/common/rfb/Configuration.cxx +++ b/common/rfb/Configuration.cxx @@ -76,13 +76,13 @@ bool Configuration::set(const char* n, const char* v, bool immutable) { return set(n, strlen(n), v, immutable); } -bool Configuration::set(const char* name, int len, +bool Configuration::set(const char* paramName, int len, const char* val, bool immutable) { VoidParameter* current = head; while (current) { if ((int)strlen(current->getName()) == len && - strncasecmp(current->getName(), name, len) == 0) + strncasecmp(current->getName(), paramName, len) == 0) { bool b = current->setParam(val); if (b && immutable) @@ -91,7 +91,7 @@ bool Configuration::set(const char* name, int len, } current = current->_next; } - return _next ? _next->set(name, len, val, immutable) : false; + return _next ? _next->set(paramName, len, val, immutable) : false; } bool Configuration::set(const char* config, bool immutable) { diff --git a/common/rfb/Cursor.cxx b/common/rfb/Cursor.cxx index f0c72eed..fa596bc5 100644 --- a/common/rfb/Cursor.cxx +++ b/common/rfb/Cursor.cxx @@ -33,11 +33,11 @@ using namespace rfb; static LogWriter vlog("Cursor"); Cursor::Cursor(int width, int height, const Point& hotspot, - const uint8_t* data) : + const uint8_t* data_) : width_(width), height_(height), hotspot_(hotspot) { - this->data = new uint8_t[width_*height_*4]; - memcpy(this->data, data, width_*height_*4); + data = new uint8_t[width_*height_*4]; + memcpy(data, data_, width_*height_*4); } Cursor::Cursor(const Cursor& other) : diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx index 63ab987d..ef415886 100644 --- a/common/rfb/DecodeManager.cxx +++ b/common/rfb/DecodeManager.cxx @@ -40,8 +40,8 @@ using namespace rfb; static LogWriter vlog("DecodeManager"); -DecodeManager::DecodeManager(CConnection *conn) : - conn(conn), threadException(nullptr) +DecodeManager::DecodeManager(CConnection *conn_) : + conn(conn_), threadException(nullptr) { size_t cpuCount; @@ -268,12 +268,9 @@ void DecodeManager::throwThreadException() throw e; } -DecodeManager::DecodeThread::DecodeThread(DecodeManager* manager) +DecodeManager::DecodeThread::DecodeThread(DecodeManager* manager_) + : manager(manager_), stopRequested(false) { - this->manager = manager; - - stopRequested = false; - start(); } diff --git a/common/rfb/Decoder.cxx b/common/rfb/Decoder.cxx index a6d9b17c..e9bc9a4f 100644 --- a/common/rfb/Decoder.cxx +++ b/common/rfb/Decoder.cxx @@ -37,7 +37,7 @@ using namespace rfb; -Decoder::Decoder(enum DecoderFlags flags) : flags(flags) +Decoder::Decoder(enum DecoderFlags flags_) : flags(flags_) { } diff --git a/common/rfb/H264Decoder.cxx b/common/rfb/H264Decoder.cxx index 26bb9348..53b223db 100644 --- a/common/rfb/H264Decoder.cxx +++ b/common/rfb/H264Decoder.cxx @@ -79,9 +79,9 @@ bool H264Decoder::readRect(const Rect& /*r*/, len = is->readU32(); os->writeU32(len); - uint32_t flags = is->readU32(); + uint32_t reset = is->readU32(); - os->writeU32(flags); + os->writeU32(reset); if (!is->hasDataOrRestore(len)) return false; @@ -100,15 +100,15 @@ void H264Decoder::decodeRect(const Rect& r, const uint8_t* buffer, { rdr::MemInStream is(buffer, buflen); uint32_t len = is.readU32(); - uint32_t flags = is.readU32(); + uint32_t reset = is.readU32(); H264DecoderContext* ctx = nullptr; - if (flags & resetAllContexts) + if (reset & resetAllContexts) { resetContexts(); if (!len) return; - flags &= ~(resetContext | resetAllContexts); + reset &= ~(resetContext | resetAllContexts); } else { ctx = findContext(r); } diff --git a/common/rfb/H264WinDecoderContext.cxx b/common/rfb/H264WinDecoderContext.cxx index e2196520..8422b5c4 100644 --- a/common/rfb/H264WinDecoderContext.cxx +++ b/common/rfb/H264WinDecoderContext.cxx @@ -32,6 +32,11 @@ using namespace rfb; static LogWriter vlog("H264WinDecoderContext"); +// Older MinGW lacks this definition +#ifndef HAVE_VIDEO_PROCESSOR_MFT +static GUID CLSID_VideoProcessorMFT = { 0x88753b26, 0x5b24, 0x49bd, { 0xb2, 0xe7, 0xc, 0x44, 0x5c, 0x78, 0xc9, 0x82 } }; +#endif + bool H264WinDecoderContext::initCodec() { os::AutoMutex lock(&mutex); @@ -47,7 +52,6 @@ bool H264WinDecoderContext::initCodec() { return false; } - GUID CLSID_VideoProcessorMFT = { 0x88753b26, 0x5b24, 0x49bd, { 0xb2, 0xe7, 0xc, 0x44, 0x5c, 0x78, 0xc9, 0x82 } }; if (FAILED(CoCreateInstance(CLSID_VideoProcessorMFT, nullptr, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&converter))) { vlog.error("Cannot create MediaFoundation Video Processor (available only on Windows 8+). Trying ColorConvert DMO."); @@ -342,8 +346,8 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer, vlog.debug("Frame converted to RGB"); BYTE* out; - DWORD len; - converted_buffer->Lock(&out, nullptr, &len); + DWORD buflen; + converted_buffer->Lock(&out, nullptr, &buflen); pb->imageRect(rect, out + offset_y * stride + offset_x * 4, (int)stride / 4); converted_buffer->Unlock(); } @@ -359,20 +363,20 @@ void H264WinDecoderContext::ParseSPS(const uint8_t* buffer, int length) if (available == 0) \ { \ if (length == 0) return; \ - byte = *buffer++; \ + byte_ = *buffer++; \ length--; \ available = 8; \ } \ - bit = (byte >> --available) & 1; \ + bit = (byte_ >> --available) & 1; \ } while (0) #define GET_BITS(n, var) do { \ var = 0; \ - for (int i = n-1; i >= 0; i--) \ + for (int b = n-1; b >= 0; b--) \ { \ unsigned bit; \ GET_BIT(bit); \ - var |= bit << i; \ + var |= bit << b; \ } \ } while (0) @@ -411,7 +415,7 @@ void H264WinDecoderContext::ParseSPS(const uint8_t* buffer, int length) length--; int available = 0; - uint8_t byte = 0; + uint8_t byte_ = 0; unsigned profile_idc; unsigned seq_parameter_set_id; diff --git a/common/rfb/HextileDecoder.cxx b/common/rfb/HextileDecoder.cxx index 2243d67f..dc9b9be7 100644 --- a/common/rfb/HextileDecoder.cxx +++ b/common/rfb/HextileDecoder.cxx @@ -191,10 +191,10 @@ void HextileDecoder::hextileDecode(const Rect& r, rdr::InStream* is, if (x + w > 16 || y + h > 16) { throw rfb::Exception("HEXTILE_DECODE: Hextile out of bounds"); } - T* ptr = buf + y * t.width() + x; + ptr = buf + y * t.width() + x; int rowAdd = t.width() - w; while (h-- > 0) { - int len = w; + len = w; while (len-- > 0) *ptr++ = fg; ptr += rowAdd; } diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx index 729043f0..0666d02d 100644 --- a/common/rfb/HextileEncoder.cxx +++ b/common/rfb/HextileEncoder.cxx @@ -38,8 +38,8 @@ BoolParameter improvedHextile("ImprovedHextile", "ratios by the cost of using more CPU time", true); -HextileEncoder::HextileEncoder(SConnection* conn) : - Encoder(conn, encodingHextile, EncoderPlain) +HextileEncoder::HextileEncoder(SConnection* conn_) : + Encoder(conn_, encodingHextile, EncoderPlain) { } diff --git a/common/rfb/RREEncoder.cxx b/common/rfb/RREEncoder.cxx index e73a23bf..f3e3b68a 100644 --- a/common/rfb/RREEncoder.cxx +++ b/common/rfb/RREEncoder.cxx @@ -31,8 +31,8 @@ using namespace rfb; -RREEncoder::RREEncoder(SConnection* conn) : - Encoder(conn, encodingRRE, EncoderPlain) +RREEncoder::RREEncoder(SConnection* conn_) : + Encoder(conn_, encodingRRE, EncoderPlain) { } diff --git a/common/rfb/RawEncoder.cxx b/common/rfb/RawEncoder.cxx index 2fa1af36..eff8999d 100644 --- a/common/rfb/RawEncoder.cxx +++ b/common/rfb/RawEncoder.cxx @@ -29,8 +29,8 @@ using namespace rfb; -RawEncoder::RawEncoder(SConnection* conn) : - Encoder(conn, encodingRaw, EncoderPlain) +RawEncoder::RawEncoder(SConnection* conn_) : + Encoder(conn_, encodingRaw, EncoderPlain) { } diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index 98fa730b..866d19a2 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -46,12 +46,12 @@ using namespace rfb; static LogWriter vlog("SConnection"); -SConnection::SConnection(AccessRights accessRights) +SConnection::SConnection(AccessRights accessRights_) : readyForSetColourMapEntries(false), is(nullptr), os(nullptr), reader_(nullptr), writer_(nullptr), ssecurity(nullptr), authFailureTimer(this, &SConnection::handleAuthFailureTimeout), state_(RFBSTATE_UNINITIALISED), preferredEncoding(encodingRaw), - accessRights(accessRights), hasRemoteClipboard(false), + accessRights(accessRights_), hasRemoteClipboard(false), hasLocalClipboard(false), unsolicitedClipboardAttempt(false) { @@ -587,7 +587,7 @@ void SConnection::sendClipboardData(const char* data) // FIXME: This conversion magic should be in SMsgWriter std::string filtered(convertCRLF(data)); size_t sizes[1] = { filtered.size() + 1 }; - const uint8_t* data[1] = { (const uint8_t*)filtered.c_str() }; + const uint8_t* datas[1] = { (const uint8_t*)filtered.c_str() }; if (unsolicitedClipboardAttempt) { unsolicitedClipboardAttempt = false; @@ -599,7 +599,7 @@ void SConnection::sendClipboardData(const char* data) } } - writer()->writeClipboardProvide(rfb::clipboardUTF8, sizes, data); + writer()->writeClipboardProvide(rfb::clipboardUTF8, sizes, datas); } else { writer()->writeServerCutText(data); } diff --git a/common/rfb/SSecurityNone.h b/common/rfb/SSecurityNone.h index 944edf8c..a10b4369 100644 --- a/common/rfb/SSecurityNone.h +++ b/common/rfb/SSecurityNone.h @@ -28,7 +28,7 @@ namespace rfb { class SSecurityNone : public SSecurity { public: - SSecurityNone(SConnection* sc) : SSecurity(sc) {} + SSecurityNone(SConnection* sc_) : SSecurity(sc_) {} bool processMsg() override { return true; } int getType() const override {return secTypeNone;} const char* getUserName() const override {return nullptr;} diff --git a/common/rfb/SSecurityPlain.cxx b/common/rfb/SSecurityPlain.cxx index 9bc07cb1..73a21335 100644 --- a/common/rfb/SSecurityPlain.cxx +++ b/common/rfb/SSecurityPlain.cxx @@ -68,7 +68,7 @@ bool PasswordValidator::validUser(const char* username) return false; } -SSecurityPlain::SSecurityPlain(SConnection* sc) : SSecurity(sc) +SSecurityPlain::SSecurityPlain(SConnection* sc_) : SSecurity(sc_) { #ifdef WIN32 valid = new WinPasswdValidator(); diff --git a/common/rfb/SSecurityRSAAES.cxx b/common/rfb/SSecurityRSAAES.cxx index 64a8b523..13e03b22 100644 --- a/common/rfb/SSecurityRSAAES.cxx +++ b/common/rfb/SSecurityRSAAES.cxx @@ -70,9 +70,9 @@ BoolParameter SSecurityRSAAES::requireUsername ("RequireUsername", "Require username for the RSA-AES security types", false, ConfServer); -SSecurityRSAAES::SSecurityRSAAES(SConnection* sc, uint32_t _secType, +SSecurityRSAAES::SSecurityRSAAES(SConnection* sc_, uint32_t _secType, int _keySize, bool _isAllEncrypted) - : SSecurity(sc), state(SendPublicKey), + : SSecurity(sc_), state(SendPublicKey), keySize(_keySize), isAllEncrypted(_isAllEncrypted), secType(_secType), serverKey(), clientKey(), serverKeyN(nullptr), serverKeyE(nullptr), diff --git a/common/rfb/SSecurityStack.cxx b/common/rfb/SSecurityStack.cxx index b306cd6a..0ce6d754 100644 --- a/common/rfb/SSecurityStack.cxx +++ b/common/rfb/SSecurityStack.cxx @@ -24,9 +24,9 @@ using namespace rfb; -SSecurityStack::SSecurityStack(SConnection* sc, int Type, +SSecurityStack::SSecurityStack(SConnection* sc_, int Type, SSecurity* s0, SSecurity* s1) - : SSecurity(sc), state(0), state0(s0), state1(s1), type(Type) + : SSecurity(sc_), state(0), state0(s0), state1(s1), type(Type) { } diff --git a/common/rfb/SSecurityTLS.cxx b/common/rfb/SSecurityTLS.cxx index c55f1be8..e2b82f89 100644 --- a/common/rfb/SSecurityTLS.cxx +++ b/common/rfb/SSecurityTLS.cxx @@ -66,8 +66,8 @@ StringParameter SSecurityTLS::X509_KeyFile static LogWriter vlog("TLS"); -SSecurityTLS::SSecurityTLS(SConnection* sc, bool _anon) - : SSecurity(sc), session(nullptr), anon_cred(nullptr), +SSecurityTLS::SSecurityTLS(SConnection* sc_, bool _anon) + : SSecurity(sc_), session(nullptr), anon_cred(nullptr), cert_cred(nullptr), anon(_anon), tlsis(nullptr), tlsos(nullptr), rawis(nullptr), rawos(nullptr) { diff --git a/common/rfb/SSecurityVeNCrypt.cxx b/common/rfb/SSecurityVeNCrypt.cxx index a6dc327e..ce160503 100644 --- a/common/rfb/SSecurityVeNCrypt.cxx +++ b/common/rfb/SSecurityVeNCrypt.cxx @@ -38,8 +38,9 @@ using namespace std; static LogWriter vlog("SVeNCrypt"); -SSecurityVeNCrypt::SSecurityVeNCrypt(SConnection* sc, SecurityServer *sec) - : SSecurity(sc), security(sec) +SSecurityVeNCrypt::SSecurityVeNCrypt(SConnection* sc_, + SecurityServer *sec) + : SSecurity(sc_), security(sec) { ssecurity = nullptr; haveSentVersion = false; diff --git a/common/rfb/SSecurityVncAuth.cxx b/common/rfb/SSecurityVncAuth.cxx index 7d5b2664..1276f68a 100644 --- a/common/rfb/SSecurityVncAuth.cxx +++ b/common/rfb/SSecurityVncAuth.cxx @@ -52,8 +52,8 @@ VncAuthPasswdParameter SSecurityVncAuth::vncAuthPasswd ("Password", "Obfuscated binary encoding of the password which clients must supply to " "access the server", &SSecurityVncAuth::vncAuthPasswdFile); -SSecurityVncAuth::SSecurityVncAuth(SConnection* sc) - : SSecurity(sc), sentChallenge(false), +SSecurityVncAuth::SSecurityVncAuth(SConnection* sc_) + : SSecurity(sc_), sentChallenge(false), pg(&vncAuthPasswd), accessRights(AccessNone) { } @@ -116,10 +116,10 @@ bool SSecurityVncAuth::processMsg() throw AuthFailureException(); } -VncAuthPasswdParameter::VncAuthPasswdParameter(const char* name, +VncAuthPasswdParameter::VncAuthPasswdParameter(const char* name_, const char* desc, StringParameter* passwdFile_) -: BinaryParameter(name, desc, nullptr, 0, ConfServer), +: BinaryParameter(name_, desc, nullptr, 0, ConfServer), passwdFile(passwdFile_) { } diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx index 213f872c..169b74f7 100644 --- a/common/rfb/TightEncoder.cxx +++ b/common/rfb/TightEncoder.cxx @@ -60,8 +60,8 @@ static const TightConf conf[10] = { { 9, 9, 9 } // 9 }; -TightEncoder::TightEncoder(SConnection* conn) : - Encoder(conn, encodingTight, EncoderPlain, 256) +TightEncoder::TightEncoder(SConnection* conn_) : + Encoder(conn_, encodingTight, EncoderPlain, 256) { setCompressLevel(-1); } diff --git a/common/rfb/TightJPEGEncoder.cxx b/common/rfb/TightJPEGEncoder.cxx index 5c8706ee..de8fd77f 100644 --- a/common/rfb/TightJPEGEncoder.cxx +++ b/common/rfb/TightJPEGEncoder.cxx @@ -68,8 +68,8 @@ static const struct TightJPEGConfiguration conf[10] = { }; -TightJPEGEncoder::TightJPEGEncoder(SConnection* conn) : - Encoder(conn, encodingTight, +TightJPEGEncoder::TightJPEGEncoder(SConnection* conn_) : + Encoder(conn_, encodingTight, (EncoderFlags)(EncoderUseNativePF | EncoderLossy), -1, 9), qualityLevel(-1), fineQuality(-1), fineSubsampling(subsampleUndefined) { diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index d18a7983..a8fa1739 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -182,14 +182,14 @@ void VNCServerST::removeSocket(network::Socket* sock) { handleClipboardAnnounce(*ci, false); clipboardRequestors.remove(*ci); - std::string name((*ci)->getPeerEndpoint()); + std::string peer((*ci)->getPeerEndpoint()); // - Delete the per-Socket resources delete *ci; clients.remove(*ci); - connectionsLog.status("closed: %s", name.c_str()); + connectionsLog.status("closed: %s", peer.c_str()); // - Check that the desktop object is still required if (authClientCount() == 0) diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx index c9677337..1e2c6ef4 100644 --- a/common/rfb/ZRLEEncoder.cxx +++ b/common/rfb/ZRLEEncoder.cxx @@ -36,8 +36,8 @@ static LogWriter vlog("ZRLEEncoder"); IntParameter zlibLevel("ZlibLevel","[DEPRECATED] Zlib compression level",-1); -ZRLEEncoder::ZRLEEncoder(SConnection* conn) - : Encoder(conn, encodingZRLE, EncoderPlain, 127), +ZRLEEncoder::ZRLEEncoder(SConnection* conn_) + : Encoder(conn_, encodingZRLE, EncoderPlain, 127), zos(nullptr, 2), mos(129*1024) { if (zlibLevel != -1) { diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx index 904363a0..25dca490 100644 --- a/tests/perf/encperf.cxx +++ b/tests/perf/encperf.cxx @@ -279,8 +279,8 @@ void CConn::serverCutText(const char*) { } -Manager::Manager(class rfb::SConnection *conn) : - EncodeManager(conn) +Manager::Manager(class rfb::SConnection *conn_) : + EncodeManager(conn_) { } @@ -388,13 +388,13 @@ static struct stats runTest(const char *fn) return s; } -static void sort(double *array, int count) +static void sort(double *array, int len) { bool sorted; int i; do { sorted = true; - for (i = 1; i < count; i++) { + for (i = 1; i < len; i++) { if (array[i-1] > array[i]) { double d; d = array[i]; diff --git a/tests/unit/pixelformat.cxx b/tests/unit/pixelformat.cxx index a2ca50d0..614d1255 100644 --- a/tests/unit/pixelformat.cxx +++ b/tests/unit/pixelformat.cxx @@ -36,7 +36,7 @@ static void doTest(bool should_fail, int b, int d, bool e, bool t, try { pf = new rfb::PixelFormat(b, d, e, t, rm, gm, bm, rs, gs, bs); - } catch(rfb::Exception &e) { + } catch(rfb::Exception&) { if (should_fail) printf("OK"); else diff --git a/unix/tx/TXDialog.h b/unix/tx/TXDialog.h index 8804e853..720c50d0 100644 --- a/unix/tx/TXDialog.h +++ b/unix/tx/TXDialog.h @@ -33,9 +33,9 @@ class TXDialog : public TXWindow, public TXDeleteWindowCallback { public: - TXDialog(Display* dpy, int width, int height, const char* name, + TXDialog(Display* dpy_, int width, int height, const char* name, bool modal_=false) - : TXWindow(dpy, width, height), done(false), ok(false), modal(modal_) + : TXWindow(dpy_, width, height), done(false), ok(false), modal(modal_) { toplevel(name, this); resize(width, height); diff --git a/unix/vncconfig/QueryConnectDialog.cxx b/unix/vncconfig/QueryConnectDialog.cxx index e725de7d..aa1b78ad 100644 --- a/unix/vncconfig/QueryConnectDialog.cxx +++ b/unix/vncconfig/QueryConnectDialog.cxx @@ -25,12 +25,12 @@ #include "QueryConnectDialog.h" #include "vncExt.h" -QueryConnectDialog::QueryConnectDialog(Display* dpy, +QueryConnectDialog::QueryConnectDialog(Display* dpy_, const char* address_, const char* user_, int timeout_, QueryResultCallback* cb) - : TXDialog(dpy, 300, 100, "VNC Server : Accept Connection?"), + : TXDialog(dpy_, 300, 100, "VNC Server : Accept Connection?"), addressLbl(dpy, "Host:",this), address(dpy, address_, this), userLbl(dpy, "User:", this), diff --git a/unix/vncconfig/vncconfig.cxx b/unix/vncconfig/vncconfig.cxx index 6f1f43dc..ab7c6315 100644 --- a/unix/vncconfig/vncconfig.cxx +++ b/unix/vncconfig/vncconfig.cxx @@ -66,10 +66,10 @@ char* programName = nullptr; Display* dpy; int vncExtEventBase, vncExtErrorBase; -static bool getBoolParam(Display* dpy, const char* param) { +static bool getBoolParam(Display* dpy_, const char* param) { char* data; int len; - if (XVncExtGetParam(dpy, param, &data, &len)) { + if (XVncExtGetParam(dpy_, param, &data, &len)) { if (strcmp(data,"1") == 0) return true; } return false; @@ -80,12 +80,12 @@ class VncConfigWindow : public TXWindow, public TXEventHandler, public TXCheckboxCallback, public QueryResultCallback { public: - VncConfigWindow(Display* dpy) - : TXWindow(dpy, 300, 100), - acceptClipboard(dpy, "Accept clipboard from viewers", this, false, this), - setPrimaryCB(dpy, "Also set primary selection", this, false, this), - sendClipboard(dpy, "Send clipboard to viewers", this, false, this), - sendPrimaryCB(dpy, "Send primary selection to viewers", this,false,this), + VncConfigWindow(Display* dpy_) + : TXWindow(dpy_, 300, 100), + acceptClipboard(dpy_, "Accept clipboard from viewers", this, false, this), + setPrimaryCB(dpy_, "Also set primary selection", this, false, this), + sendClipboard(dpy_, "Send clipboard to viewers", this, false, this), + sendPrimaryCB(dpy_, "Send primary selection to viewers", this,false,this), queryConnectDialog(nullptr) { int y = yPad; @@ -278,8 +278,8 @@ int main(int argc, char** argv) } else if (strcmp(argv[i], "-list") == 0) { int nParams; char** list = XVncExtListParams(dpy, &nParams); - for (int i = 0; i < nParams; i++) { - printf("%s\n",list[i]); + for (int n = 0; n < nParams; n++) { + printf("%s\n",list[n]); } XVncExtFreeParamList(list); } else if (strcmp(argv[i], "-set") == 0) { diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index b949b0d7..b0f79933 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -342,9 +342,9 @@ void DesktopWindow::resizeFramebuffer(int new_w, int new_h) XGetWindowProperty(fl_display, fl_xid(this), net_wm_state, 0, 1024, False, XA_ATOM, &type, &format, &nitems, &remain, (unsigned char**)&atoms); - for (unsigned long i = 0;i < nitems;i++) { - if ((atoms[i] == net_wm_state_maximized_vert) || - (atoms[i] == net_wm_state_maximized_horz)) { + for (unsigned long n = 0;n < nitems;n++) { + if ((atoms[n] == net_wm_state_maximized_vert) || + (atoms[n] == net_wm_state_maximized_horz)) { maximized = true; break; } @@ -513,8 +513,8 @@ void DesktopWindow::draw() windowRect.setXYWH(x(), y(), w(), h()); bool foundEnclosedScreen = false; - for (int i = 0; i < Fl::screen_count(); i++) { - Fl::screen_xywh(sx, sy, sw, sh, i); + for (int idx = 0; idx < Fl::screen_count(); idx++) { + Fl::screen_xywh(sx, sy, sw, sh, idx); // The screen with the smallest index that are enclosed by // the viewport will be used for showing the overlay. @@ -632,10 +632,10 @@ void DesktopWindow::resize(int x, int y, int w, int h) } if (resize_req) { - for (int i = 0;i < Fl::screen_count();i++) { + for (int idx = 0;idx < Fl::screen_count();idx++) { int sx, sy, sw, sh; - Fl::screen_xywh(sx, sy, sw, sh, i); + Fl::screen_xywh(sx, sy, sw, sh, idx); // We can't trust x and y if the window isn't mapped as the // window manager might adjust those numbers @@ -977,9 +977,8 @@ void DesktopWindow::fullscreen_on() std::set selected = fullScreenSelectedMonitors.getParam(); monitors.insert(selected.begin(), selected.end()); } else { - for (int i = 0; i < Fl::screen_count(); i++) { - monitors.insert(i); - } + for (int idx = 0; idx < Fl::screen_count(); idx++) + monitors.insert(idx); } // If no monitors were found in the selected monitors case, we want @@ -1332,7 +1331,6 @@ void DesktopWindow::remoteResize(int width, int height) layout.begin()->dimensions.br.x = width; layout.begin()->dimensions.br.y = height; } else { - int i; uint32_t id; int sx, sy, sw, sh; rfb::Rect viewport_rect, screen_rect; @@ -1348,8 +1346,8 @@ void DesktopWindow::remoteResize(int width, int height) // FIXME: We should really track screens better so we can handle // a resized one. // - for (i = 0;i < Fl::screen_count();i++) { - Fl::screen_xywh(sx, sy, sw, sh, i); + for (int idx = 0;idx < Fl::screen_count();idx++) { + Fl::screen_xywh(sx, sy, sw, sh, idx); // Check that the screen is fully inside the framebuffer screen_rect.setXYWH(sx, sy, sw, sh); diff --git a/vncviewer/MonitorIndicesParameter.cxx b/vncviewer/MonitorIndicesParameter.cxx index fe9a54a6..957ade06 100644 --- a/vncviewer/MonitorIndicesParameter.cxx +++ b/vncviewer/MonitorIndicesParameter.cxx @@ -71,11 +71,11 @@ std::set MonitorIndicesParameter::getParam() return indices; } -bool MonitorIndicesParameter::setParam(const char* value) +bool MonitorIndicesParameter::setParam(const char* v) { std::set indices; - if (!parseIndices(value, &indices, true)) { + if (!parseIndices(v, &indices, true)) { vlog.error(_("Invalid configuration specified for %s"), name); return false; } @@ -86,7 +86,7 @@ bool MonitorIndicesParameter::setParam(const char* value) vlog.error(_("Monitor index %d does not exist"), index); } - return StringParameter::setParam(value); + return StringParameter::setParam(v); } bool MonitorIndicesParameter::setParam(std::set indices) diff --git a/vncviewer/MonitorIndicesParameter.h b/vncviewer/MonitorIndicesParameter.h index e71439a8..d91c84fe 100644 --- a/vncviewer/MonitorIndicesParameter.h +++ b/vncviewer/MonitorIndicesParameter.h @@ -29,7 +29,7 @@ public: MonitorIndicesParameter(const char* name_, const char* desc_, const char* v); std::set getParam(); bool setParam(std::set indices); - bool setParam(const char* value) override; + bool setParam(const char* v) override; private: typedef struct { int x, y, w, h; diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx index ec274e74..e04065ec 100644 --- a/vncviewer/OptionsDialog.cxx +++ b/vncviewer/OptionsDialog.cxx @@ -328,9 +328,9 @@ void OptionsDialog::loadOptions(void) menuKeyChoice->value(0); menuKeyBuf = menuKey; - for (int i = 0; i < getMenuKeySymbolCount(); i++) - if (!strcmp(getMenuKeySymbols()[i].name, menuKeyBuf)) - menuKeyChoice->value(i + 1); + for (int idx = 0; idx < getMenuKeySymbolCount(); idx++) + if (!strcmp(getMenuKeySymbols()[idx].name, menuKeyBuf)) + menuKeyChoice->value(idx + 1); /* Display */ if (!fullScreen) { @@ -872,8 +872,8 @@ void OptionsDialog::createInputPage(int tx, int ty, int tw, int th) menuKeyChoice = new Fl_Choice(LBLLEFT(tx, ty, 150, CHOICE_HEIGHT, _("Menu key"))); fltk_menu_add(menuKeyChoice, _("None"), 0, nullptr, nullptr, FL_MENU_DIVIDER); - for (int i = 0; i < getMenuKeySymbolCount(); i++) - fltk_menu_add(menuKeyChoice, getMenuKeySymbols()[i].name, 0, nullptr, nullptr, 0); + for (int idx = 0; idx < getMenuKeySymbolCount(); idx++) + fltk_menu_add(menuKeyChoice, getMenuKeySymbols()[idx].name, 0, nullptr, nullptr, 0); ty += CHOICE_HEIGHT + TIGHT_MARGIN; } diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx index 4827c0fb..3bce2b51 100644 --- a/vncviewer/ServerDialog.cxx +++ b/vncviewer/ServerDialog.cxx @@ -395,8 +395,8 @@ void ServerDialog::saveServerHistory() filepath, strerror(errno)); // Save the last X elements to the config file. - for(size_t i=0; i < serverHistory.size() && i <= SERVER_HISTORY_SIZE; i++) - fprintf(f, "%s\n", serverHistory[i].c_str()); + for(size_t idx=0; idx < serverHistory.size() && idx <= SERVER_HISTORY_SIZE; idx++) + fprintf(f, "%s\n", serverHistory[idx].c_str()); fclose(f); } diff --git a/vncviewer/Surface.h b/vncviewer/Surface.h index 1cb87f50..60e452b1 100644 --- a/vncviewer/Surface.h +++ b/vncviewer/Surface.h @@ -41,11 +41,15 @@ public: void clear(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255); - void draw(int src_x, int src_y, int x, int y, int w, int h); - void draw(Surface* dst, int src_x, int src_y, int x, int y, int w, int h); + void draw(int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h); + void draw(Surface* dst, int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h); - void blend(int src_x, int src_y, int x, int y, int w, int h, int a=255); - void blend(Surface* dst, int src_x, int src_y, int x, int y, int w, int h, int a=255); + void blend(int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h, int a=255); + void blend(Surface* dst, int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h, int a=255); protected: void alloc(); diff --git a/vncviewer/Surface_OSX.cxx b/vncviewer/Surface_OSX.cxx index 864e3b51..673f37e9 100644 --- a/vncviewer/Surface_OSX.cxx +++ b/vncviewer/Surface_OSX.cxx @@ -137,7 +137,8 @@ void Surface::clear(unsigned char r, unsigned char g, unsigned char b, unsigned } } -void Surface::draw(int src_x, int src_y, int x, int y, int w, int h) +void Surface::draw(int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h) { CGColorSpaceRef lut; @@ -148,32 +149,34 @@ void Surface::draw(int src_x, int src_y, int x, int y, int w, int h) CGContextConcatCTM(fl_gc, CGAffineTransformInvert(CGContextGetCTM(fl_gc))); // macOS Coordinates are from bottom left, not top left - y = Fl_Window::current()->h() - (y + h); + dst_y = Fl_Window::current()->h() - (dst_y + dst_h); lut = cocoa_win_color_space(Fl_Window::current()); render(fl_gc, lut, data, kCGBlendModeCopy, 1.0, - src_x, src_y, width(), height(), x, y, w, h); + src_x, src_y, width(), height(), dst_x, dst_y, dst_w, dst_h); CGColorSpaceRelease(lut); CGContextRestoreGState(fl_gc); } -void Surface::draw(Surface* dst, int src_x, int src_y, int x, int y, int w, int h) +void Surface::draw(Surface* dst, int src_x, int src_y, + int dst_x, int dst_y, int dst_w, int dst_h) { CGContextRef bitmap; bitmap = make_bitmap(dst->width(), dst->height(), dst->data); // macOS Coordinates are from bottom left, not top left - y = dst->height() - (y + h); + dst_y = dst->height() - (dst_y + dst_h); render(bitmap, srgb, data, kCGBlendModeCopy, 1.0, - src_x, src_y, width(), height(), x, y, w, h); + src_x, src_y, width(), height(), dst_x, dst_y, dst_w, dst_h); CGContextRelease(bitmap); } -void Surface::blend(int src_x, int src_y, int x, int y, int w, int h, int a) +void Surface::blend(int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h, int a) { CGColorSpaceRef lut; @@ -184,27 +187,28 @@ void Surface::blend(int src_x, int src_y, int x, int y, int w, int h, int a) CGContextConcatCTM(fl_gc, CGAffineTransformInvert(CGContextGetCTM(fl_gc))); // macOS Coordinates are from bottom left, not top left - y = Fl_Window::current()->h() - (y + h); + dst_y = Fl_Window::current()->h() - (dst_y + dst_h); lut = cocoa_win_color_space(Fl_Window::current()); render(fl_gc, lut, data, kCGBlendModeNormal, (CGFloat)a/255.0, - src_x, src_y, width(), height(), x, y, w, h); + src_x, src_y, width(), height(), dst_x, dst_y, dst_w, dst_h); CGColorSpaceRelease(lut); CGContextRestoreGState(fl_gc); } -void Surface::blend(Surface* dst, int src_x, int src_y, int x, int y, int w, int h, int a) +void Surface::blend(Surface* dst, int src_x, int src_y, + int dst_x, int dst_y, int dst_w, int dst_h, int a) { CGContextRef bitmap; bitmap = make_bitmap(dst->width(), dst->height(), dst->data); // macOS Coordinates are from bottom left, not top left - y = dst->height() - (y + h); + dst_y = dst->height() - (dst_y + dst_h); render(bitmap, srgb, data, kCGBlendModeNormal, (CGFloat)a/255.0, - src_x, src_y, width(), height(), x, y, w, h); + src_x, src_y, width(), height(), dst_x, dst_y, dst_w, dst_h); CGContextRelease(bitmap); } diff --git a/vncviewer/Surface_Win32.cxx b/vncviewer/Surface_Win32.cxx index 1db5f718..46a2b055 100644 --- a/vncviewer/Surface_Win32.cxx +++ b/vncviewer/Surface_Win32.cxx @@ -50,7 +50,8 @@ void Surface::clear(unsigned char r, unsigned char g, unsigned char b, unsigned } } -void Surface::draw(int src_x, int src_y, int x, int y, int w, int h) +void Surface::draw(int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h) { HDC dc; @@ -61,7 +62,8 @@ void Surface::draw(int src_x, int src_y, int x, int y, int w, int h) if (!SelectObject(dc, bitmap)) throw rdr::SystemException("SelectObject", GetLastError()); - if (!BitBlt(fl_gc, x, y, w, h, dc, src_x, src_y, SRCCOPY)) { + if (!BitBlt(fl_gc, dst_x, dst_y, dst_w, dst_h, + dc, src_x, src_y, SRCCOPY)) { // If the desktop we're rendering to is inactive (like when the screen // is locked or the UAC is active), then GDI calls will randomly fail. // This is completely undocumented so we have no idea how best to deal @@ -74,7 +76,8 @@ void Surface::draw(int src_x, int src_y, int x, int y, int w, int h) DeleteDC(dc); } -void Surface::draw(Surface* dst, int src_x, int src_y, int x, int y, int w, int h) +void Surface::draw(Surface* dst, int src_x, int src_y, + int dst_x, int dst_y, int dst_w, int dst_h) { HDC origdc, dstdc; @@ -87,21 +90,23 @@ void Surface::draw(Surface* dst, int src_x, int src_y, int x, int y, int w, int origdc = fl_gc; fl_gc = dstdc; - draw(src_x, src_y, x, y, w, h); + draw(src_x, src_y, dst_x, dst_y, dst_w, dst_h); fl_gc = origdc; DeleteDC(dstdc); } void Surface::blend(int /*src_x*/, int /*src_y*/, - int /*x*/, int /*y*/, int /*w*/, int /*h*/, + int /*dst_x*/, int /*dst_y*/, + int /*dst_w*/, int /*dst_h*/, int /*a*/) { // Compositing doesn't work properly for window DC:s assert(false); } -void Surface::blend(Surface* dst, int src_x, int src_y, int x, int y, int w, int h, int a) +void Surface::blend(Surface* dst, int src_x, int src_y, + int dst_x, int dst_y, int dst_w, int dst_h, int a) { HDC dstdc, srcdc; BLENDFUNCTION blend; @@ -123,7 +128,8 @@ void Surface::blend(Surface* dst, int src_x, int src_y, int x, int y, int w, int blend.SourceConstantAlpha = a; blend.AlphaFormat = AC_SRC_ALPHA; - if (!AlphaBlend(dstdc, x, y, w, h, srcdc, src_x, src_y, w, h, blend)) { + if (!AlphaBlend(dstdc, dst_x, dst_y, dst_w, dst_h, + srcdc, src_x, src_y, dst_w, dst_h, blend)) { // If the desktop we're rendering to is inactive (like when the screen // is locked or the UAC is active), then GDI calls will randomly fail. // This is completely undocumented so we have no idea how best to deal diff --git a/vncviewer/Surface_X11.cxx b/vncviewer/Surface_X11.cxx index d4d92cf3..d27fcd26 100644 --- a/vncviewer/Surface_X11.cxx +++ b/vncviewer/Surface_X11.cxx @@ -43,20 +43,22 @@ void Surface::clear(unsigned char r, unsigned char g, unsigned char b, unsigned 0, 0, width(), height()); } -void Surface::draw(int src_x, int src_y, int x, int y, int w, int h) +void Surface::draw(int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h) { Picture winPict; winPict = XRenderCreatePicture(fl_display, fl_window, visFormat, 0, nullptr); XRenderComposite(fl_display, PictOpSrc, picture, None, winPict, - src_x, src_y, 0, 0, x, y, w, h); + src_x, src_y, 0, 0, dst_x, dst_y, dst_w, dst_h); XRenderFreePicture(fl_display, winPict); } -void Surface::draw(Surface* dst, int src_x, int src_y, int x, int y, int w, int h) +void Surface::draw(Surface* dst, int src_x, int src_y, + int dst_x, int dst_y, int dst_w, int dst_h) { XRenderComposite(fl_display, PictOpSrc, picture, None, dst->picture, - src_x, src_y, 0, 0, x, y, w, h); + src_x, src_y, 0, 0, dst_x, dst_y, dst_w, dst_h); } static Picture alpha_mask(int a) @@ -86,27 +88,29 @@ static Picture alpha_mask(int a) return pict; } -void Surface::blend(int src_x, int src_y, int x, int y, int w, int h, int a) +void Surface::blend(int src_x, int src_y, int dst_x, int dst_y, + int dst_w, int dst_h, int a) { Picture winPict, alpha; winPict = XRenderCreatePicture(fl_display, fl_window, visFormat, 0, nullptr); alpha = alpha_mask(a); XRenderComposite(fl_display, PictOpOver, picture, alpha, winPict, - src_x, src_y, 0, 0, x, y, w, h); + src_x, src_y, 0, 0, dst_x, dst_y, dst_w, dst_h); XRenderFreePicture(fl_display, winPict); if (alpha != None) XRenderFreePicture(fl_display, alpha); } -void Surface::blend(Surface* dst, int src_x, int src_y, int x, int y, int w, int h, int a) +void Surface::blend(Surface* dst, int src_x, int src_y, + int dst_x, int dst_y, int dst_w, int dst_h, int a) { Picture alpha; alpha = alpha_mask(a); XRenderComposite(fl_display, PictOpOver, picture, alpha, dst->picture, - src_x, src_y, 0, 0, x, y, w, h); + src_x, src_y, 0, 0, dst_x, dst_y, dst_w, dst_h); if (alpha != None) XRenderFreePicture(fl_display, alpha); } diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx index 41df5bb4..958b9d66 100644 --- a/vncviewer/UserDialog.cxx +++ b/vncviewer/UserDialog.cxx @@ -70,7 +70,7 @@ UserDialog::~UserDialog() { } -void UserDialog::getUserPasswd(bool secure, std::string* user, +void UserDialog::getUserPasswd(bool secure_, std::string* user, std::string* password) { const char *passwordFileName(passwordFile); @@ -121,7 +121,7 @@ void UserDialog::getUserPasswd(bool secure, std::string* user, banner = new Fl_Box(0, 0, win->w(), 20); banner->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE|FL_ALIGN_IMAGE_NEXT_TO_TEXT); banner->box(FL_FLAT_BOX); - if (secure) { + if (secure_) { banner->label(_("This connection is secure")); banner->color(FL_GREEN); banner->image(secure_icon); diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 0c2cb862..032fd322 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -329,9 +329,9 @@ void Viewport::handleClipboardData(const char* data) Fl::copy(data, len, 1); } -void Viewport::setLEDState(unsigned int state) +void Viewport::setLEDState(unsigned int ledState) { - vlog.debug("Got server LED state: 0x%08x", state); + vlog.debug("Got server LED state: 0x%08x", ledState); // The first message is just considered to be the server announcing // support for this extension. We will push our state to sync up the @@ -355,7 +355,7 @@ void Viewport::setLEDState(unsigned int state) memset(input, 0, sizeof(input)); count = 0; - if (!!(state & ledCapsLock) != !!(GetKeyState(VK_CAPITAL) & 0x1)) { + if (!!(ledState & ledCapsLock) != !!(GetKeyState(VK_CAPITAL) & 0x1)) { input[count].type = input[count+1].type = INPUT_KEYBOARD; input[count].ki.wVk = input[count+1].ki.wVk = VK_CAPITAL; input[count].ki.wScan = input[count+1].ki.wScan = SCAN_FAKE; @@ -364,7 +364,7 @@ void Viewport::setLEDState(unsigned int state) count += 2; } - if (!!(state & ledNumLock) != !!(GetKeyState(VK_NUMLOCK) & 0x1)) { + if (!!(ledState & ledNumLock) != !!(GetKeyState(VK_NUMLOCK) & 0x1)) { input[count].type = input[count+1].type = INPUT_KEYBOARD; input[count].ki.wVk = input[count+1].ki.wVk = VK_NUMLOCK; input[count].ki.wScan = input[count+1].ki.wScan = SCAN_FAKE; @@ -373,7 +373,7 @@ void Viewport::setLEDState(unsigned int state) count += 2; } - if (!!(state & ledScrollLock) != !!(GetKeyState(VK_SCROLL) & 0x1)) { + if (!!(ledState & ledScrollLock) != !!(GetKeyState(VK_SCROLL) & 0x1)) { input[count].type = input[count+1].type = INPUT_KEYBOARD; input[count].ki.wVk = input[count+1].ki.wVk = VK_SCROLL; input[count].ki.wScan = input[count+1].ki.wScan = SCAN_FAKE; @@ -391,13 +391,13 @@ void Viewport::setLEDState(unsigned int state) #elif defined(__APPLE__) int ret; - ret = cocoa_set_caps_lock_state(state & ledCapsLock); + ret = cocoa_set_caps_lock_state(ledState & ledCapsLock); if (ret != 0) { vlog.error(_("Failed to update keyboard LED state: %d"), ret); return; } - ret = cocoa_set_num_lock_state(state & ledNumLock); + ret = cocoa_set_num_lock_state(ledState & ledNumLock); if (ret != 0) { vlog.error(_("Failed to update keyboard LED state: %d"), ret); return; @@ -414,17 +414,17 @@ void Viewport::setLEDState(unsigned int state) affect = values = 0; affect |= LockMask; - if (state & ledCapsLock) + if (ledState & ledCapsLock) values |= LockMask; mask = getModifierMask(XK_Num_Lock); affect |= mask; - if (state & ledNumLock) + if (ledState & ledNumLock) values |= mask; mask = getModifierMask(XK_Scroll_Lock); affect |= mask; - if (state & ledScrollLock) + if (ledState & ledScrollLock) values |= mask; ret = XkbLockModifiers(fl_display, XkbUseCoreKbd, affect, values); @@ -435,21 +435,21 @@ void Viewport::setLEDState(unsigned int state) void Viewport::pushLEDState() { - unsigned int state; + unsigned int ledState; // Server support? if (cc->server.ledState() == ledUnknown) return; - state = 0; + ledState = 0; #if defined(WIN32) if (GetKeyState(VK_CAPITAL) & 0x1) - state |= ledCapsLock; + ledState |= ledCapsLock; if (GetKeyState(VK_NUMLOCK) & 0x1) - state |= ledNumLock; + ledState |= ledNumLock; if (GetKeyState(VK_SCROLL) & 0x1) - state |= ledScrollLock; + ledState |= ledScrollLock; #elif defined(__APPLE__) int ret; bool on; @@ -460,7 +460,7 @@ void Viewport::pushLEDState() return; } if (on) - state |= ledCapsLock; + ledState |= ledCapsLock; ret = cocoa_get_num_lock_state(&on); if (ret != 0) { @@ -468,10 +468,10 @@ void Viewport::pushLEDState() return; } if (on) - state |= ledNumLock; + ledState |= ledNumLock; // No support for Scroll Lock // - state |= (cc->server.ledState() & ledScrollLock); + ledState |= (cc->server.ledState() & ledScrollLock); #else unsigned int mask; @@ -486,28 +486,28 @@ void Viewport::pushLEDState() } if (xkbState.locked_mods & LockMask) - state |= ledCapsLock; + ledState |= ledCapsLock; mask = getModifierMask(XK_Num_Lock); if (xkbState.locked_mods & mask) - state |= ledNumLock; + ledState |= ledNumLock; mask = getModifierMask(XK_Scroll_Lock); if (xkbState.locked_mods & mask) - state |= ledScrollLock; + ledState |= ledScrollLock; #endif - if ((state & ledCapsLock) != (cc->server.ledState() & ledCapsLock)) { + if ((ledState & ledCapsLock) != (cc->server.ledState() & ledCapsLock)) { vlog.debug("Inserting fake CapsLock to get in sync with server"); handleKeyPress(0x3a, XK_Caps_Lock); handleKeyRelease(0x3a); } - if ((state & ledNumLock) != (cc->server.ledState() & ledNumLock)) { + if ((ledState & ledNumLock) != (cc->server.ledState() & ledNumLock)) { vlog.debug("Inserting fake NumLock to get in sync with server"); handleKeyPress(0x45, XK_Num_Lock); handleKeyRelease(0x45); } - if ((state & ledScrollLock) != (cc->server.ledState() & ledScrollLock)) { + if ((ledState & ledScrollLock) != (cc->server.ledState() & ledScrollLock)) { vlog.debug("Inserting fake ScrollLock to get in sync with server"); handleKeyPress(0x46, XK_Scroll_Lock); handleKeyRelease(0x46); diff --git a/vncviewer/Win32TouchHandler.cxx b/vncviewer/Win32TouchHandler.cxx index 5353127d..e21768f9 100644 --- a/vncviewer/Win32TouchHandler.cxx +++ b/vncviewer/Win32TouchHandler.cxx @@ -37,8 +37,8 @@ static const DWORD MOUSEMOVE_FLAGS = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | static const unsigned SINGLE_PAN_THRESHOLD = 50; -Win32TouchHandler::Win32TouchHandler(HWND hWnd) : - hWnd(hWnd), gesturesConfigured(false), gestureActive(false), +Win32TouchHandler::Win32TouchHandler(HWND hWnd_) : + hWnd(hWnd_), gesturesConfigured(false), gestureActive(false), ignoringGesture(false), fakeButtonMask(0) { // If window is registered as touch we can not receive gestures, diff --git a/vncviewer/XInputTouchHandler.cxx b/vncviewer/XInputTouchHandler.cxx index 8fdb46a3..2b2e02c6 100644 --- a/vncviewer/XInputTouchHandler.cxx +++ b/vncviewer/XInputTouchHandler.cxx @@ -43,8 +43,8 @@ static rfb::LogWriter vlog("XInputTouchHandler"); static bool grabbed = false; -XInputTouchHandler::XInputTouchHandler(Window wnd) - : wnd(wnd), fakeStateMask(0) +XInputTouchHandler::XInputTouchHandler(Window wnd_) + : wnd(wnd_), fakeStateMask(0) { XIEventMask eventmask; unsigned char flags[XIMaskLen(XI_LASTEVENT)] = { 0 }; @@ -314,7 +314,7 @@ void XInputTouchHandler::preparePointerEvent(XEvent* dst, const GestureEvent src { Window root, child; int rootX, rootY; - XkbStateRec state; + XkbStateRec xkbState; // We don't have a real event to steal things from, so we'll have // to fake these events based on the current state of things @@ -324,7 +324,7 @@ void XInputTouchHandler::preparePointerEvent(XEvent* dst, const GestureEvent src src.eventX, src.eventY, &rootX, &rootY, &child); - XkbGetState(fl_display, XkbUseCoreKbd, &state); + XkbGetState(fl_display, XkbUseCoreKbd, &xkbState); // XButtonEvent and XMotionEvent are almost identical, so we // don't have to care which it is for these fields @@ -338,8 +338,8 @@ void XInputTouchHandler::preparePointerEvent(XEvent* dst, const GestureEvent src dst->xbutton.y = src.eventY; dst->xbutton.x_root = rootX; dst->xbutton.y_root = rootY; - dst->xbutton.state = state.mods; - dst->xbutton.state |= ((state.ptr_buttons >> 1) & 0x1f) << 8; + dst->xbutton.state = xkbState.mods; + dst->xbutton.state |= ((xkbState.ptr_buttons >> 1) & 0x1f) << 8; dst->xbutton.same_screen = True; } @@ -390,7 +390,7 @@ void XInputTouchHandler::fakeKeyEvent(bool press, int keysym, Window root, child; int rootX, rootY; - XkbStateRec state; + XkbStateRec xkbState; int modmask; @@ -399,7 +399,7 @@ void XInputTouchHandler::fakeKeyEvent(bool press, int keysym, origEvent.eventX, origEvent.eventY, &rootX, &rootY, &child); - XkbGetState(fl_display, XkbUseCoreKbd, &state); + XkbGetState(fl_display, XkbUseCoreKbd, &xkbState); KeyCode kc = XKeysymToKeycode(fl_display, keysym); @@ -418,8 +418,8 @@ void XInputTouchHandler::fakeKeyEvent(bool press, int keysym, fakeEvent.xkey.y = origEvent.eventY; fakeEvent.xkey.x_root = rootX; fakeEvent.xkey.y_root = rootY; - fakeEvent.xkey.state = state.mods; - fakeEvent.xkey.state |= ((state.ptr_buttons >> 1) & 0x1f) << 8; + fakeEvent.xkey.state = xkbState.mods; + fakeEvent.xkey.state |= ((xkbState.ptr_buttons >> 1) & 0x1f) << 8; fakeEvent.xkey.same_screen = True; // Apply our fake mask diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 16396659..6ddff947 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -487,17 +487,17 @@ static void usage(const char *programName) } static void -potentiallyLoadConfigurationFile(char *vncServerName) +potentiallyLoadConfigurationFile(const char *filename) { - const bool hasPathSeparator = (strchr(vncServerName, '/') != nullptr || - (strchr(vncServerName, '\\')) != nullptr); + const bool hasPathSeparator = (strchr(filename, '/') != nullptr || + (strchr(filename, '\\')) != nullptr); if (hasPathSeparator) { #ifndef WIN32 struct stat sb; // This might be a UNIX socket, we need to check - if (stat(vncServerName, &sb) == -1) { + if (stat(filename, &sb) == -1) { // Some access problem; let loadViewerParameters() deal with it... } else { if ((sb.st_mode & S_IFMT) == S_IFSOCK) @@ -507,7 +507,7 @@ potentiallyLoadConfigurationFile(char *vncServerName) try { const char* newServerName; - newServerName = loadViewerParameters(vncServerName); + newServerName = loadViewerParameters(filename); // This might be empty, but we still need to clear it so we // don't try to connect to the filename strncpy(vncServerName, newServerName, VNCSERVERNAMELEN-1); diff --git a/win/rfb_win32/DeviceFrameBuffer.cxx b/win/rfb_win32/DeviceFrameBuffer.cxx index 090846f2..bba1dbdb 100644 --- a/win/rfb_win32/DeviceFrameBuffer.cxx +++ b/win/rfb_win32/DeviceFrameBuffer.cxx @@ -223,19 +223,19 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) uint8_t* rwbuffer = buffer.data(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - int byte = y * maskInfo.bmWidthBytes + x / 8; + int byte_ = y * maskInfo.bmWidthBytes + x / 8; int bit = 7 - x % 8; - if (!(andMask[byte] & (1 << bit))) { + if (!(andMask[byte_] & (1 << bit))) { // Valid pixel, so make it opaque rwbuffer[3] = 0xff; // Black or white? - if (xorMask[byte] & (1 << bit)) + if (xorMask[byte_] & (1 << bit)) rwbuffer[0] = rwbuffer[1] = rwbuffer[2] = 0xff; else rwbuffer[0] = rwbuffer[1] = rwbuffer[2] = 0; - } else if (xorMask[byte] & (1 << bit)) { + } else if (xorMask[byte_] & (1 << bit)) { // Replace any XORed pixels with black, because RFB doesn't support // XORing of cursors. XORing is used for the I-beam cursor, which is most // often used over a white background, but also sometimes over a black diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx index 7c1574e9..432439ce 100644 --- a/win/rfb_win32/Dialog.cxx +++ b/win/rfb_win32/Dialog.cxx @@ -151,7 +151,7 @@ BOOL Dialog::dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } -PropSheetPage::PropSheetPage(HINSTANCE inst, const char* id) : Dialog(inst), propSheet(nullptr) { +PropSheetPage::PropSheetPage(HINSTANCE inst_, const char* id) : Dialog(inst_), propSheet(nullptr) { page.dwSize = sizeof(page); page.dwFlags = 0; // PSP_USECALLBACK; page.hInstance = inst; @@ -241,7 +241,7 @@ static int CALLBACK removeCtxtHelp(HWND /*hwnd*/, UINT message, LPARAM lParam) { } -bool PropSheet::showPropSheet(HWND owner, bool showApply, bool showCtxtHelp, bool capture) { +bool PropSheet::showPropSheet(HWND owner_, bool showApply, bool showCtxtHelp, bool capture) { if (alreadyShowing) return false; alreadyShowing = true; int count = pages.size(); @@ -262,7 +262,7 @@ bool PropSheet::showPropSheet(HWND owner, bool showApply, bool showCtxtHelp, boo header.dwSize = sizeof(PROPSHEETHEADER); // Requires comctl32.dll 4.71 or greater, ie IE 4 or later header.dwFlags = PSH_MODELESS | (showApply ? 0 : PSH_NOAPPLYNOW) | (showCtxtHelp ? 0 : PSH_USECALLBACK); header.pfnCallback = removeCtxtHelp; - header.hwndParent = owner; + header.hwndParent = owner_; header.hInstance = inst; header.pszCaption = title.c_str(); header.nPages = count; @@ -276,7 +276,7 @@ bool PropSheet::showPropSheet(HWND owner, bool showApply, bool showCtxtHelp, boo handle = (HWND)PropertySheet(&header); if ((handle == nullptr) || (handle == (HWND)-1)) throw rdr::SystemException("PropertySheet failed", GetLastError()); - centerWindow(handle, owner); + centerWindow(handle, owner_); plog.info("created %p", handle); (void)capture; @@ -314,8 +314,8 @@ bool PropSheet::showPropSheet(HWND owner, bool showApply, bool showCtxtHelp, boo } else { #endif try { - if (owner) - EnableWindow(owner, FALSE); + if (owner_) + EnableWindow(owner_, FALSE); // Run the PropertySheet MSG msg; while (GetMessage(&msg, nullptr, 0, 0)) { @@ -324,11 +324,11 @@ bool PropSheet::showPropSheet(HWND owner, bool showApply, bool showCtxtHelp, boo if (!PropSheet_GetCurrentPageHwnd(handle)) break; } - if (owner) - EnableWindow(owner, TRUE); + if (owner_) + EnableWindow(owner_, TRUE); } catch (...) { - if (owner) - EnableWindow(owner, TRUE); + if (owner_) + EnableWindow(owner_, TRUE); throw; } #ifdef _DIALOG_CAPTURE diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx index 3b12dab9..bcb98704 100644 --- a/win/rfb_win32/Registry.cxx +++ b/win/rfb_win32/Registry.cxx @@ -244,11 +244,11 @@ std::string RegKey::getRepresentation(const char* valname) const { DWORD required = ExpandEnvironmentStrings(str.c_str(), nullptr, 0); if (required==0) throw rdr::SystemException("ExpandEnvironmentStrings", GetLastError()); - std::vector result(required); - length = ExpandEnvironmentStrings(str.c_str(), result.data(), required); + std::vector expanded(required); + length = ExpandEnvironmentStrings(str.c_str(), expanded.data(), required); if (requiredgetFd(), event, &events) == SOCKET_ERROR) + if (WSAEnumNetworkEvents(ci.sock->getFd(), event, &network_events) == SOCKET_ERROR) throw rdr::SystemException("unable to get WSAEnumNetworkEvents:%u", WSAGetLastError()); // Cancel event notification for this socket @@ -245,14 +245,14 @@ void SocketManager::processEvent(HANDLE event) { // Call the socket server to process the event - if (events.lNetworkEvents & FD_WRITE) { + if (network_events.lNetworkEvents & FD_WRITE) { ci.server->processSocketWriteEvent(ci.sock); if (ci.sock->isShutdown()) { remSocket(ci.sock); return; } } - if (events.lNetworkEvents & (FD_READ | FD_CLOSE)) { + if (network_events.lNetworkEvents & (FD_READ | FD_CLOSE)) { ci.server->processSocketReadEvent(ci.sock); if (ci.sock->isShutdown()) { remSocket(ci.sock); diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx index b32f7607..b8cb5dc8 100644 --- a/win/vncconfig/vncconfig.cxx +++ b/win/vncconfig/vncconfig.cxx @@ -86,7 +86,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /* freopen("CONOUT$","wb",stderr); setbuf(stderr, nullptr); initStdIOLoggers(); - LogWriter vlog("main"); logParams.setParam("*:stderr:100"); vlog.info("Starting vncconfig applet"); #endif diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx index 0a7128f1..140d82ad 100644 --- a/win/winvnc/VNCServerWin32.cxx +++ b/win/winvnc/VNCServerWin32.cxx @@ -179,13 +179,12 @@ int VNCServerWin32::run() { // - Set the address-changed handler for the RFB socket rfbSock.setAddressChangeNotifier(this); - DWORD result = 0; + int result = 0; try { vlog.debug("Entering message loop"); // - Run the server until we're told to quit MSG msg; - int result = 0; while (runServer) { result = sockMgr.getMessage(&msg, nullptr, 0, 0); if (result < 0) diff --git a/win/wm_hooks/wm_hooks.cxx b/win/wm_hooks/wm_hooks.cxx index ecff85cb..a48a1738 100644 --- a/win/wm_hooks/wm_hooks.cxx +++ b/win/wm_hooks/wm_hooks.cxx @@ -138,8 +138,8 @@ bool NotifyRectangle(RECT* rect) { LPARAM l = MAKELONG((SHORT)rect->right, (SHORT)rect->bottom); return NotifyHookOwner(WM_HK_RectangleChanged, w, l); } -bool NotifyCursor(HCURSOR cursor) { - return NotifyHookOwner(WM_HK_CursorChanged, 0, (LPARAM)cursor); +bool NotifyCursor(HCURSOR cursor_) { + return NotifyHookOwner(WM_HK_CursorChanged, 0, (LPARAM)cursor_); } void ProcessWindowMessage(UINT msg, HWND wnd, WPARAM wParam, LPARAM /*lParam*/) {