aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/network/Socket.cxx12
-rw-r--r--common/network/TcpSocket.cxx44
-rw-r--r--common/os/Mutex.cxx4
-rw-r--r--common/os/Thread.cxx16
-rw-r--r--common/os/os.cxx24
-rw-r--r--common/rdr/BufferedInStream.cxx8
-rw-r--r--common/rdr/BufferedOutStream.cxx8
-rw-r--r--common/rdr/Exception.cxx6
-rw-r--r--common/rdr/Exception.h2
-rw-r--r--common/rdr/FdInStream.cxx2
-rw-r--r--common/rdr/FdOutStream.cxx6
-rw-r--r--common/rdr/FileInStream.cxx2
-rw-r--r--common/rdr/InStream.h12
-rw-r--r--common/rdr/OutStream.h2
-rw-r--r--common/rdr/RandomStream.cxx8
-rw-r--r--common/rdr/TLSInStream.cxx6
-rw-r--r--common/rdr/TLSOutStream.cxx6
-rw-r--r--common/rdr/ZlibInStream.cxx22
-rw-r--r--common/rdr/ZlibOutStream.cxx12
-rw-r--r--common/rdr/ZlibOutStream.h2
-rw-r--r--common/rfb/Blacklist.cxx2
-rw-r--r--common/rfb/CConnection.cxx26
-rw-r--r--common/rfb/CMsgReader.cxx2
-rw-r--r--common/rfb/CMsgWriter.cxx2
-rw-r--r--common/rfb/CSecurityRSAAES.cxx19
-rw-r--r--common/rfb/CSecurityStack.h2
-rw-r--r--common/rfb/CSecurityTLS.cxx37
-rw-r--r--common/rfb/CSecurityVeNCrypt.cxx4
-rw-r--r--common/rfb/CSecurityVncAuth.cxx2
-rw-r--r--common/rfb/ClientParams.cxx2
-rw-r--r--common/rfb/Configuration.cxx17
-rw-r--r--common/rfb/Configuration.h3
-rw-r--r--common/rfb/Congestion.cxx22
-rw-r--r--common/rfb/DecodeManager.cxx16
-rw-r--r--common/rfb/Decoder.cxx2
-rw-r--r--common/rfb/EncodeManager.cxx4
-rw-r--r--common/rfb/H264Decoder.cxx4
-rw-r--r--common/rfb/H264LibavDecoderContext.cxx14
-rw-r--r--common/rfb/H264WinDecoderContext.cxx22
-rw-r--r--common/rfb/H264WinDecoderContext.h16
-rw-r--r--common/rfb/HextileEncoder.cxx2
-rw-r--r--common/rfb/Hostname.h16
-rw-r--r--common/rfb/JpegCompressor.cxx4
-rw-r--r--common/rfb/JpegDecompressor.cxx4
-rw-r--r--common/rfb/LogWriter.cxx7
-rw-r--r--common/rfb/Logger.cxx8
-rw-r--r--common/rfb/Logger_file.cxx6
-rw-r--r--common/rfb/Logger_syslog.cxx2
-rw-r--r--common/rfb/Palette.h10
-rw-r--r--common/rfb/PixelBuffer.cxx10
-rw-r--r--common/rfb/SConnection.cxx10
-rw-r--r--common/rfb/SConnection.h2
-rw-r--r--common/rfb/SDesktop.h10
-rw-r--r--common/rfb/SMsgReader.cxx2
-rw-r--r--common/rfb/SMsgWriter.cxx2
-rw-r--r--common/rfb/SSecurityNone.h2
-rw-r--r--common/rfb/SSecurityPlain.cxx2
-rw-r--r--common/rfb/SSecurityRSAAES.cxx13
-rw-r--r--common/rfb/SSecurityStack.cxx2
-rw-r--r--common/rfb/SSecurityStack.h2
-rw-r--r--common/rfb/SSecurityTLS.cxx26
-rw-r--r--common/rfb/SSecurityTLS.h2
-rw-r--r--common/rfb/SSecurityVeNCrypt.cxx10
-rw-r--r--common/rfb/SSecurityVncAuth.cxx8
-rw-r--r--common/rfb/SSecurityVncAuth.h2
-rw-r--r--common/rfb/SecurityClient.cxx8
-rw-r--r--common/rfb/ServerParams.cxx2
-rw-r--r--common/rfb/TightDecoder.cxx4
-rw-r--r--common/rfb/TightEncoder.cxx4
-rw-r--r--common/rfb/Timer.cxx10
-rw-r--r--common/rfb/UpdateTracker.h2
-rw-r--r--common/rfb/VNCSConnectionST.cxx14
-rw-r--r--common/rfb/VNCServer.h2
-rw-r--r--common/rfb/VNCServerST.cxx32
-rw-r--r--common/rfb/VNCServerST.h2
-rw-r--r--common/rfb/ZRLEDecoder.cxx2
-rw-r--r--common/rfb/ZRLEEncoder.cxx4
-rw-r--r--common/rfb/obfuscate.cxx4
-rw-r--r--common/rfb/util.cxx8
79 files changed, 353 insertions, 331 deletions
diff --git a/common/network/Socket.cxx b/common/network/Socket.cxx
index 78484f51..971a7170 100644
--- a/common/network/Socket.cxx
+++ b/common/network/Socket.cxx
@@ -71,7 +71,7 @@ bool network::isSocketListening(int sock)
}
Socket::Socket(int fd)
- : instream(0), outstream(0),
+ : instream(nullptr), outstream(nullptr),
isShutdown_(false), queryConnection(false)
{
initSockets();
@@ -79,7 +79,7 @@ Socket::Socket(int fd)
}
Socket::Socket()
- : instream(0), outstream(0),
+ : instream(nullptr), outstream(nullptr),
isShutdown_(false), queryConnection(false)
{
initSockets();
@@ -129,13 +129,13 @@ void Socket::setFd(int fd)
}
SocketListener::SocketListener(int fd)
- : fd(fd), filter(0)
+ : fd(fd), filter(nullptr)
{
initSockets();
}
SocketListener::SocketListener()
- : fd(-1), filter(0)
+ : fd(-1), filter(nullptr)
{
initSockets();
}
@@ -160,14 +160,14 @@ Socket* SocketListener::accept() {
int new_sock = -1;
// Accept an incoming connection
- if ((new_sock = ::accept(fd, 0, 0)) < 0)
+ if ((new_sock = ::accept(fd, nullptr, nullptr)) < 0)
throw SocketException("unable to accept new connection", errorNumber);
// Create the socket object & check connection is allowed
Socket* s = createSocket(new_sock);
if (filter && !filter->verifyConnection(s)) {
delete s;
- return NULL;
+ return nullptr;
}
return s;
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx
index 15730cfd..d9b376c9 100644
--- a/common/network/TcpSocket.cxx
+++ b/common/network/TcpSocket.cxx
@@ -129,17 +129,17 @@ TcpSocket::TcpSocket(const char *host, int port)
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
- hints.ai_canonname = NULL;
- hints.ai_addr = NULL;
- hints.ai_next = NULL;
+ hints.ai_canonname = nullptr;
+ hints.ai_addr = nullptr;
+ hints.ai_next = nullptr;
- if ((result = getaddrinfo(host, NULL, &hints, &ai)) != 0) {
+ if ((result = getaddrinfo(host, nullptr, &hints, &ai)) != 0) {
throw GAIException("unable to resolve host by name", result);
}
sock = -1;
err = 0;
- for (current = ai; current != NULL; current = current->ai_next) {
+ for (current = ai; current != nullptr; current = current->ai_next) {
int family;
vnc_sockaddr_t sa;
socklen_t salen;
@@ -168,7 +168,7 @@ TcpSocket::TcpSocket(const char *host, int port)
else
sa.u.sin6.sin6_port = htons(port);
- getnameinfo(&sa.u.sa, salen, ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST);
+ getnameinfo(&sa.u.sa, salen, ntop, sizeof(ntop), nullptr, 0, NI_NUMERICHOST);
vlog.debug("Connecting to %s [%s] port %d", host, ntop, port);
sock = socket (family, SOCK_STREAM, 0);
@@ -228,7 +228,7 @@ const char* TcpSocket::getPeerAddress() {
buffer[0] = '[';
ret = getnameinfo(&sa.u.sa, sizeof(sa.u.sin6),
- buffer + 1, sizeof(buffer) - 2, NULL, 0,
+ buffer + 1, sizeof(buffer) - 2, nullptr, 0,
NI_NUMERICHOST);
if (ret != 0) {
vlog.error("unable to convert peer name to a string");
@@ -244,7 +244,7 @@ const char* TcpSocket::getPeerAddress() {
char *name;
name = inet_ntoa(sa.u.sin.sin_addr);
- if (name == NULL) {
+ if (name == nullptr) {
vlog.error("unable to convert peer name to a string");
return "(N/A)";
}
@@ -352,15 +352,15 @@ std::list<std::string> TcpListener::getMyAddresses() {
hints.ai_flags = AI_PASSIVE | AI_NUMERICSERV;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
- hints.ai_canonname = NULL;
- hints.ai_addr = NULL;
- hints.ai_next = NULL;
+ hints.ai_canonname = nullptr;
+ hints.ai_addr = nullptr;
+ hints.ai_next = nullptr;
// Windows doesn't like NULL for service, so specify something
- if ((getaddrinfo(NULL, "1", &hints, &ai)) != 0)
+ if ((getaddrinfo(nullptr, "1", &hints, &ai)) != 0)
return result;
- for (current= ai; current != NULL; current = current->ai_next) {
+ for (current= ai; current != nullptr; current = current->ai_next) {
char addr[INET6_ADDRSTRLEN];
switch (current->ai_family) {
@@ -377,7 +377,7 @@ std::list<std::string> TcpListener::getMyAddresses() {
}
getnameinfo(current->ai_addr, current->ai_addrlen, addr, INET6_ADDRSTRLEN,
- NULL, 0, NI_NUMERICHOST);
+ nullptr, 0, NI_NUMERICHOST);
result.push_back(addr);
}
@@ -417,7 +417,7 @@ void network::createLocalTcpListeners(std::list<SocketListener*> *listeners,
ai[1].ai_family = sa[1].u.sin6.sin6_family;
ai[1].ai_addr = &sa[1].u.sa;
ai[1].ai_addrlen = sizeof(sa[1].u.sin6);
- ai[1].ai_next = NULL;
+ ai[1].ai_next = nullptr;
createTcpListeners(listeners, ai);
}
@@ -436,9 +436,9 @@ void network::createTcpListeners(std::list<SocketListener*> *listeners,
hints.ai_flags = AI_PASSIVE | AI_NUMERICSERV;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
- hints.ai_canonname = NULL;
- hints.ai_addr = NULL;
- hints.ai_next = NULL;
+ hints.ai_canonname = nullptr;
+ hints.ai_addr = nullptr;
+ hints.ai_next = nullptr;
snprintf (service, sizeof (service) - 1, "%d", port);
service[sizeof (service) - 1] = '\0';
@@ -463,7 +463,7 @@ void network::createTcpListeners(std::list<SocketListener*> *listeners,
initSockets();
- for (current = ai; current != NULL; current = current->ai_next) {
+ for (current = ai; current != nullptr; current = current->ai_next) {
switch (current->ai_family) {
case AF_INET:
if (!UseIPv4)
@@ -629,7 +629,7 @@ TcpFilter::Pattern TcpFilter::parsePattern(const char* p) {
parts[0].erase(parts.size()-1, 1);
}
- if ((result = getaddrinfo (parts[0].c_str(), NULL, &hints, &ai)) != 0) {
+ if ((result = getaddrinfo (parts[0].c_str(), nullptr, &hints, &ai)) != 0) {
throw GAIException("unable to resolve host by name", result);
}
@@ -711,11 +711,11 @@ std::string TcpFilter::patternToStr(const TcpFilter::Pattern& p) {
if (p.address.u.sa.sa_family == AF_INET) {
getnameinfo(&p.address.u.sa, sizeof(p.address.u.sin),
- addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
+ addr, sizeof(addr), nullptr, 0, NI_NUMERICHOST);
} else if (p.address.u.sa.sa_family == AF_INET6) {
addr[0] = '[';
getnameinfo(&p.address.u.sa, sizeof(p.address.u.sin6),
- addr + 1, sizeof(addr) - 2, NULL, 0, NI_NUMERICHOST);
+ addr + 1, sizeof(addr) - 2, nullptr, 0, NI_NUMERICHOST);
strcat(addr, "]");
} else
addr[0] = '\0';
diff --git a/common/os/Mutex.cxx b/common/os/Mutex.cxx
index e6532a7d..5e245a6d 100644
--- a/common/os/Mutex.cxx
+++ b/common/os/Mutex.cxx
@@ -41,7 +41,7 @@ Mutex::Mutex()
int ret;
systemMutex = new pthread_mutex_t;
- ret = pthread_mutex_init((pthread_mutex_t*)systemMutex, NULL);
+ ret = pthread_mutex_init((pthread_mutex_t*)systemMutex, nullptr);
if (ret != 0)
throw rdr::SystemException("Failed to create mutex", ret);
#endif
@@ -95,7 +95,7 @@ Condition::Condition(Mutex* mutex)
int ret;
systemCondition = new pthread_cond_t;
- ret = pthread_cond_init((pthread_cond_t*)systemCondition, NULL);
+ ret = pthread_cond_init((pthread_cond_t*)systemCondition, nullptr);
if (ret != 0)
throw rdr::SystemException("Failed to create condition variable", ret);
#endif
diff --git a/common/os/Thread.cxx b/common/os/Thread.cxx
index 92cc68d5..91f7fd07 100644
--- a/common/os/Thread.cxx
+++ b/common/os/Thread.cxx
@@ -35,7 +35,7 @@
using namespace os;
-Thread::Thread() : running(false), threadId(NULL)
+Thread::Thread() : running(false), threadId(nullptr)
{
mutex = new Mutex;
@@ -64,8 +64,8 @@ void Thread::start()
AutoMutex a(mutex);
#ifdef WIN32
- *(HANDLE*)threadId = CreateThread(NULL, 0, startRoutine, this, 0, NULL);
- if (*(HANDLE*)threadId == NULL)
+ *(HANDLE*)threadId = CreateThread(nullptr, 0, startRoutine, this, 0, nullptr);
+ if (*(HANDLE*)threadId == nullptr)
throw rdr::SystemException("Failed to create thread", GetLastError());
#else
int ret;
@@ -78,9 +78,9 @@ void Thread::start()
if (ret != 0)
throw rdr::SystemException("Failed to mask signals", ret);
- ret = pthread_create((pthread_t*)threadId, NULL, startRoutine, this);
+ ret = pthread_create((pthread_t*)threadId, nullptr, startRoutine, this);
- pthread_sigmask(SIG_SETMASK, &old, NULL);
+ pthread_sigmask(SIG_SETMASK, &old, nullptr);
if (ret != 0)
throw rdr::SystemException("Failed to create thread", ret);
@@ -103,7 +103,7 @@ void Thread::wait()
#else
int ret;
- ret = pthread_join(*(pthread_t*)threadId, NULL);
+ ret = pthread_join(*(pthread_t*)threadId, nullptr);
if (ret != 0)
throw rdr::SystemException("Failed to join thread", ret);
#endif
@@ -165,5 +165,9 @@ void* Thread::startRoutine(void* data)
self->running = false;
self->mutex->unlock();
+#ifdef WIN32
return 0;
+#else
+ return nullptr;
+#endif
}
diff --git a/common/os/os.cxx b/common/os/os.cxx
index 83995d0d..2ac70550 100644
--- a/common/os/os.cxx
+++ b/common/os/os.cxx
@@ -58,12 +58,12 @@ static const char* getvncdir(bool userDir, const char *xdg_env, const char *xdg_
#ifndef WIN32
homedir = getenv("HOME");
- if (homedir == NULL) {
+ if (homedir == nullptr) {
uid = getuid();
passwd = getpwuid(uid);
- if (passwd == NULL) {
+ if (passwd == nullptr) {
/* Do we want emit error msg here? */
- return NULL;
+ return nullptr;
}
homedir = passwd->pw_dir;
}
@@ -72,7 +72,7 @@ static const char* getvncdir(bool userDir, const char *xdg_env, const char *xdg_
return homedir;
xdgdir = getenv(xdg_env);
- if (xdgdir != NULL && xdgdir[0] == '/')
+ if (xdgdir != nullptr && xdgdir[0] == '/')
snprintf(dir, sizeof(dir), "%s/tigervnc", xdgdir);
else
snprintf(dir, sizeof(dir), "%s/%s/tigervnc", homedir, xdg_def);
@@ -83,25 +83,25 @@ static const char* getvncdir(bool userDir, const char *xdg_env, const char *xdg_
(void) xdg_env;
if (userDir)
- ret = SHGetSpecialFolderPath(NULL, dir, CSIDL_PROFILE, FALSE);
+ ret = SHGetSpecialFolderPath(nullptr, dir, CSIDL_PROFILE, FALSE);
else
- ret = SHGetSpecialFolderPath(NULL, dir, CSIDL_APPDATA, FALSE);
+ ret = SHGetSpecialFolderPath(nullptr, dir, CSIDL_APPDATA, FALSE);
if (ret == FALSE)
- return NULL;
+ return nullptr;
if (userDir)
return dir;
- ret = SHGetSpecialFolderPath(NULL, legacy, CSIDL_APPDATA, FALSE);
+ ret = SHGetSpecialFolderPath(nullptr, legacy, CSIDL_APPDATA, FALSE);
if (ret == FALSE)
- return NULL;
+ return nullptr;
if (strlen(dir) + strlen("\\TigerVNC") >= sizeof(dir))
- return NULL;
+ return nullptr;
if (strlen(legacy) + strlen("\\vnc") >= sizeof(legacy))
- return NULL;
+ return nullptr;
strcat(dir, "\\TigerVNC");
strcat(legacy, "\\vnc");
@@ -111,7 +111,7 @@ static const char* getvncdir(bool userDir, const char *xdg_env, const char *xdg_
const char* os::getuserhomedir()
{
- return getvncdir(true, NULL, NULL);
+ return getvncdir(true, nullptr, nullptr);
}
const char* os::getvncconfigdir()
diff --git a/common/rdr/BufferedInStream.cxx b/common/rdr/BufferedInStream.cxx
index 5978a8c9..3c04bafc 100644
--- a/common/rdr/BufferedInStream.cxx
+++ b/common/rdr/BufferedInStream.cxx
@@ -35,7 +35,7 @@ BufferedInStream::BufferedInStream()
: bufSize(DEFAULT_BUF_SIZE), offset(0)
{
ptr = end = start = new uint8_t[bufSize];
- gettimeofday(&lastSizeCheck, NULL);
+ gettimeofday(&lastSizeCheck, nullptr);
peakUsage = 0;
}
@@ -80,7 +80,7 @@ void BufferedInStream::ensureSpace(size_t needed)
end = newBuffer + (end - ptr);
ptr = start = newBuffer;
- gettimeofday(&lastSizeCheck, NULL);
+ gettimeofday(&lastSizeCheck, nullptr);
peakUsage = needed;
}
@@ -88,7 +88,7 @@ void BufferedInStream::ensureSpace(size_t needed)
peakUsage = needed;
// Time to shrink an excessive buffer?
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nullptr);
if ((avail() == 0) && (bufSize > DEFAULT_BUF_SIZE) &&
((now.tv_sec < lastSizeCheck.tv_sec) ||
(now.tv_sec > (lastSizeCheck.tv_sec + 5)))) {
@@ -105,7 +105,7 @@ void BufferedInStream::ensureSpace(size_t needed)
bufSize = newSize;
}
- gettimeofday(&lastSizeCheck, NULL);
+ gettimeofday(&lastSizeCheck, nullptr);
peakUsage = needed;
}
diff --git a/common/rdr/BufferedOutStream.cxx b/common/rdr/BufferedOutStream.cxx
index 640f6007..0ee3d644 100644
--- a/common/rdr/BufferedOutStream.cxx
+++ b/common/rdr/BufferedOutStream.cxx
@@ -36,7 +36,7 @@ BufferedOutStream::BufferedOutStream(bool emulateCork)
{
ptr = start = sentUpTo = new uint8_t[bufSize];
end = start + bufSize;
- gettimeofday(&lastSizeCheck, NULL);
+ gettimeofday(&lastSizeCheck, nullptr);
peakUsage = 0;
}
@@ -75,7 +75,7 @@ void BufferedOutStream::flush()
ptr = sentUpTo = start;
// Time to shrink an excessive buffer?
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nullptr);
if ((sentUpTo == ptr) && (bufSize > DEFAULT_BUF_SIZE) &&
((now.tv_sec < lastSizeCheck.tv_sec) ||
(now.tv_sec > (lastSizeCheck.tv_sec + 5)))) {
@@ -93,7 +93,7 @@ void BufferedOutStream::flush()
bufSize = newSize;
}
- gettimeofday(&lastSizeCheck, NULL);
+ gettimeofday(&lastSizeCheck, nullptr);
peakUsage = 0;
}
}
@@ -156,7 +156,7 @@ void BufferedOutStream::overrun(size_t needed)
sentUpTo = start = newBuffer;
end = newBuffer + newSize;
- gettimeofday(&lastSizeCheck, NULL);
+ gettimeofday(&lastSizeCheck, nullptr);
peakUsage = totalNeeded;
return;
diff --git a/common/rdr/Exception.cxx b/common/rdr/Exception.cxx
index b1e0a841..f5ad1819 100644
--- a/common/rdr/Exception.cxx
+++ b/common/rdr/Exception.cxx
@@ -59,7 +59,7 @@ GAIException::GAIException(const char* s, int err)
wchar_t *currStr = new wchar_t[len-strlen(str_)];
wcsncpy(currStr, gai_strerrorW(err), len-1-strlen(str_));
WideCharToMultiByte(CP_UTF8, 0, currStr, -1, str_+strlen(str_),
- len-1-strlen(str_), 0, 0);
+ len-1-strlen(str_), nullptr, nullptr);
delete [] currStr;
#else
strncat(str_, gai_strerror(err), len-1-strlen(str_));
@@ -83,9 +83,9 @@ SystemException::SystemException(const char* s, int err_)
#ifdef _WIN32
wchar_t *currStr = new wchar_t[len-strlen(str_)];
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- 0, err, 0, currStr, len-1-strlen(str_), 0);
+ nullptr, err, 0, currStr, len-1-strlen(str_), nullptr);
WideCharToMultiByte(CP_UTF8, 0, currStr, -1, str_+strlen(str_),
- len-1-strlen(str_), 0, 0);
+ len-1-strlen(str_), nullptr, nullptr);
delete [] currStr;
int l = strlen(str_);
diff --git a/common/rdr/Exception.h b/common/rdr/Exception.h
index 2c66ffca..f1a167e5 100644
--- a/common/rdr/Exception.h
+++ b/common/rdr/Exception.h
@@ -26,7 +26,7 @@ namespace rdr {
struct Exception {
enum { len = 256 };
char str_[len];
- Exception(const char *format = 0, ...)
+ Exception(const char *format=nullptr, ...)
__attribute__((__format__ (__printf__, 2, 3)));
virtual ~Exception() {}
virtual const char* str() const { return str_; }
diff --git a/common/rdr/FdInStream.cxx b/common/rdr/FdInStream.cxx
index 8e12f3a4..491dc008 100644
--- a/common/rdr/FdInStream.cxx
+++ b/common/rdr/FdInStream.cxx
@@ -88,7 +88,7 @@ size_t FdInStream::readFd(uint8_t* buf, size_t len)
FD_ZERO(&fds);
FD_SET(fd, &fds);
- n = select(fd+1, &fds, 0, 0, &tv);
+ n = select(fd+1, &fds, nullptr, nullptr, &tv);
} while (n < 0 && errorNumber == EINTR);
if (n < 0)
diff --git a/common/rdr/FdOutStream.cxx b/common/rdr/FdOutStream.cxx
index 6827655f..1f60d45b 100644
--- a/common/rdr/FdOutStream.cxx
+++ b/common/rdr/FdOutStream.cxx
@@ -59,7 +59,7 @@ FdOutStream::FdOutStream(int fd_)
#endif
fd(fd_)
{
- gettimeofday(&lastWrite, NULL);
+ gettimeofday(&lastWrite, nullptr);
}
FdOutStream::~FdOutStream()
@@ -113,7 +113,7 @@ size_t FdOutStream::writeFd(const uint8_t* data, size_t length)
FD_ZERO(&fds);
FD_SET(fd, &fds);
- n = select(fd+1, 0, &fds, 0, &tv);
+ n = select(fd+1, nullptr, &fds, nullptr, &tv);
} while (n < 0 && errorNumber == EINTR);
if (n < 0)
@@ -136,7 +136,7 @@ size_t FdOutStream::writeFd(const uint8_t* data, size_t length)
if (n < 0)
throw SystemException("write", errorNumber);
- gettimeofday(&lastWrite, NULL);
+ gettimeofday(&lastWrite, nullptr);
return n;
}
diff --git a/common/rdr/FileInStream.cxx b/common/rdr/FileInStream.cxx
index 6de1a5b2..4239a238 100644
--- a/common/rdr/FileInStream.cxx
+++ b/common/rdr/FileInStream.cxx
@@ -39,7 +39,7 @@ FileInStream::FileInStream(const char *fileName)
FileInStream::~FileInStream(void) {
if (file) {
fclose(file);
- file = NULL;
+ file = nullptr;
}
}
diff --git a/common/rdr/InStream.h b/common/rdr/InStream.h
index 019ca5a7..939439e1 100644
--- a/common/rdr/InStream.h
+++ b/common/rdr/InStream.h
@@ -64,7 +64,7 @@ namespace rdr {
#endif
if (length > (size_t)(end - ptr)) {
- if (restorePoint != NULL) {
+ if (restorePoint != nullptr) {
bool ret;
size_t restoreDiff;
@@ -100,21 +100,21 @@ namespace rdr {
inline void setRestorePoint() {
#ifdef RFB_INSTREAM_CHECK
- if (restorePoint != NULL)
+ if (restorePoint != nullptr)
throw Exception("Nested use of input stream restore point");
#endif
restorePoint = ptr;
}
inline void clearRestorePoint() {
#ifdef RFB_INSTREAM_CHECK
- if (restorePoint == NULL)
+ if (restorePoint == nullptr)
throw Exception("Incorrect clearing of input stream restore point");
#endif
- restorePoint = NULL;
+ restorePoint = nullptr;
}
inline void gotoRestorePoint() {
#ifdef RFB_INSTREAM_CHECK
- if (restorePoint == NULL)
+ if (restorePoint == nullptr)
throw Exception("Incorrect activation of input stream restore point");
#endif
ptr = restorePoint;
@@ -204,7 +204,7 @@ namespace rdr {
protected:
- InStream() : restorePoint(NULL)
+ InStream() : restorePoint(nullptr)
#ifdef RFB_INSTREAM_CHECK
,checkedBytes(0)
#endif
diff --git a/common/rdr/OutStream.h b/common/rdr/OutStream.h
index 8450efd0..2921b232 100644
--- a/common/rdr/OutStream.h
+++ b/common/rdr/OutStream.h
@@ -36,7 +36,7 @@ namespace rdr {
protected:
- OutStream() : ptr(NULL), end(NULL), corked(false) {}
+ OutStream() : ptr(nullptr), end(nullptr), corked(false) {}
public:
diff --git a/common/rdr/RandomStream.cxx b/common/rdr/RandomStream.cxx
index 79a1a0f7..9813abdd 100644
--- a/common/rdr/RandomStream.cxx
+++ b/common/rdr/RandomStream.cxx
@@ -45,9 +45,11 @@ RandomStream::RandomStream()
{
#ifdef RFB_HAVE_WINCRYPT
provider = 0;
- if (!CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL, 0)) {
+ if (!CryptAcquireContext(&provider, nullptr, nullptr,
+ PROV_RSA_FULL, 0)) {
if (GetLastError() == (DWORD)NTE_BAD_KEYSET) {
- if (!CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
+ if (!CryptAcquireContext(&provider, nullptr, nullptr,
+ PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
vlog.error("unable to create keyset");
provider = 0;
}
@@ -68,7 +70,7 @@ RandomStream::RandomStream()
#endif
#endif
vlog.error("no OS supplied random source - using rand()");
- seed += (unsigned int) time(0) + getpid() + getpid() * 987654 + rand();
+ seed += (unsigned int) time(nullptr) + getpid() + getpid() * 987654 + rand();
srand(seed);
}
}
diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx
index 7ba98155..d13cee1f 100644
--- a/common/rdr/TLSInStream.cxx
+++ b/common/rdr/TLSInStream.cxx
@@ -41,7 +41,7 @@ ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size)
self->streamEmpty = false;
delete self->saved_exception;
- self->saved_exception = NULL;
+ self->saved_exception = nullptr;
try {
if (!in->hasData(1)) {
@@ -72,7 +72,7 @@ ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size)
}
TLSInStream::TLSInStream(InStream* _in, gnutls_session_t _session)
- : session(_session), in(_in), saved_exception(NULL)
+ : session(_session), in(_in), saved_exception(nullptr)
{
gnutls_transport_ptr_t recv, send;
@@ -83,7 +83,7 @@ TLSInStream::TLSInStream(InStream* _in, gnutls_session_t _session)
TLSInStream::~TLSInStream()
{
- gnutls_transport_set_pull_function(session, NULL);
+ gnutls_transport_set_pull_function(session, nullptr);
delete saved_exception;
}
diff --git a/common/rdr/TLSOutStream.cxx b/common/rdr/TLSOutStream.cxx
index a06dd285..c2f69310 100644
--- a/common/rdr/TLSOutStream.cxx
+++ b/common/rdr/TLSOutStream.cxx
@@ -41,7 +41,7 @@ ssize_t TLSOutStream::push(gnutls_transport_ptr_t str, const void* data,
OutStream *out = self->out;
delete self->saved_exception;
- self->saved_exception = NULL;
+ self->saved_exception = nullptr;
try {
out->writeBytes((const uint8_t*)data, size);
@@ -62,7 +62,7 @@ ssize_t TLSOutStream::push(gnutls_transport_ptr_t str, const void* data,
}
TLSOutStream::TLSOutStream(OutStream* _out, gnutls_session_t _session)
- : session(_session), out(_out), saved_exception(NULL)
+ : session(_session), out(_out), saved_exception(nullptr)
{
gnutls_transport_ptr_t recv, send;
@@ -79,7 +79,7 @@ TLSOutStream::~TLSOutStream()
} catch (Exception&) {
}
#endif
- gnutls_transport_set_push_function(session, NULL);
+ gnutls_transport_set_push_function(session, nullptr);
delete saved_exception;
}
diff --git a/common/rdr/ZlibInStream.cxx b/common/rdr/ZlibInStream.cxx
index 6441f0a1..a90d50f7 100644
--- a/common/rdr/ZlibInStream.cxx
+++ b/common/rdr/ZlibInStream.cxx
@@ -29,7 +29,7 @@
using namespace rdr;
ZlibInStream::ZlibInStream()
- : underlying(0), zs(NULL), bytesIn(0)
+ : underlying(nullptr), zs(nullptr), bytesIn(0)
{
init();
}
@@ -54,7 +54,7 @@ void ZlibInStream::flushUnderlying()
skip(avail());
}
- setUnderlying(NULL, 0);
+ setUnderlying(nullptr, 0);
}
void ZlibInStream::reset()
@@ -65,28 +65,28 @@ void ZlibInStream::reset()
void ZlibInStream::init()
{
- assert(zs == NULL);
+ assert(zs == nullptr);
zs = new z_stream;
- zs->zalloc = Z_NULL;
- zs->zfree = Z_NULL;
- zs->opaque = Z_NULL;
- zs->next_in = Z_NULL;
+ zs->zalloc = nullptr;
+ zs->zfree = nullptr;
+ zs->opaque = nullptr;
+ zs->next_in = nullptr;
zs->avail_in = 0;
if (inflateInit(zs) != Z_OK) {
delete zs;
- zs = NULL;
+ zs = nullptr;
throw Exception("ZlibInStream: inflateInit failed");
}
}
void ZlibInStream::deinit()
{
- assert(zs != NULL);
- setUnderlying(NULL, 0);
+ assert(zs != nullptr);
+ setUnderlying(nullptr, 0);
inflateEnd(zs);
delete zs;
- zs = NULL;
+ zs = nullptr;
}
bool ZlibInStream::fillBuffer()
diff --git a/common/rdr/ZlibOutStream.cxx b/common/rdr/ZlibOutStream.cxx
index 63820b8e..0b167711 100644
--- a/common/rdr/ZlibOutStream.cxx
+++ b/common/rdr/ZlibOutStream.cxx
@@ -39,10 +39,10 @@ ZlibOutStream::ZlibOutStream(OutStream* os, int compressLevel)
: underlying(os), compressionLevel(compressLevel), newLevel(compressLevel)
{
zs = new z_stream;
- zs->zalloc = Z_NULL;
- zs->zfree = Z_NULL;
- zs->opaque = Z_NULL;
- zs->next_in = Z_NULL;
+ zs->zalloc = nullptr;
+ zs->zfree = nullptr;
+ zs->opaque = nullptr;
+ zs->next_in = nullptr;
zs->avail_in = 0;
if (deflateInit(zs, compressLevel) != Z_OK) {
delete zs;
@@ -78,14 +78,14 @@ void ZlibOutStream::setCompressionLevel(int level)
void ZlibOutStream::flush()
{
BufferedOutStream::flush();
- if (underlying != NULL)
+ if (underlying != nullptr)
underlying->flush();
}
void ZlibOutStream::cork(bool enable)
{
BufferedOutStream::cork(enable);
- if (underlying != NULL)
+ if (underlying != nullptr)
underlying->cork(enable);
}
diff --git a/common/rdr/ZlibOutStream.h b/common/rdr/ZlibOutStream.h
index 8061a58c..f6c86895 100644
--- a/common/rdr/ZlibOutStream.h
+++ b/common/rdr/ZlibOutStream.h
@@ -35,7 +35,7 @@ namespace rdr {
public:
- ZlibOutStream(OutStream* os=0, int compressionLevel=-1);
+ ZlibOutStream(OutStream* os=nullptr, int compressionLevel=-1);
virtual ~ZlibOutStream();
void setUnderlying(OutStream* os);
diff --git a/common/rfb/Blacklist.cxx b/common/rfb/Blacklist.cxx
index 12a54c45..68420ae2 100644
--- a/common/rfb/Blacklist.cxx
+++ b/common/rfb/Blacklist.cxx
@@ -67,7 +67,7 @@ bool Blacklist::isBlackmarked(const char* name) {
// Entry exists - has it reached the threshold yet?
if ((*i).second.marks >= threshold) {
// Yes - entry is blocked - has the timeout expired?
- time_t now = time(0);
+ time_t now = time(nullptr);
if (now >= (*i).second.blockUntil) {
// Timeout has expired. Reset timeout and allow
// a re-try.
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index 0f4fc4f8..2d1c20b6 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -48,10 +48,10 @@ using namespace rfb;
static LogWriter vlog("CConnection");
CConnection::CConnection()
- : csecurity(0),
+ : csecurity(nullptr),
supportsLocalCursor(false), supportsCursorPosition(false),
supportsDesktopResize(false), supportsLEDState(false),
- is(0), os(0), reader_(0), writer_(0),
+ is(nullptr), os(nullptr), reader_(nullptr), writer_(nullptr),
shared(false),
state_(RFBSTATE_UNINITIALISED),
pendingPFChange(false), preferredEncoding(encodingTight),
@@ -59,7 +59,7 @@ CConnection::CConnection()
formatChange(false), encodingChange(false),
firstUpdate(true), pendingUpdate(false), continuousUpdates(false),
forceNonincremental(true),
- framebuffer(NULL), decoder(this),
+ framebuffer(nullptr), decoder(this),
hasRemoteClipboard(false), hasLocalClipboard(false)
{
}
@@ -71,7 +71,7 @@ CConnection::~CConnection()
void CConnection::setServerName(const char* name_)
{
- if (name_ == NULL)
+ if (name_ == nullptr)
name_ = "";
serverName = name_;
}
@@ -91,7 +91,7 @@ void CConnection::setFramebuffer(ModifiablePixelBuffer* fb)
assert(fb->height() == server.height());
}
- if ((framebuffer != NULL) && (fb != NULL)) {
+ if ((framebuffer != nullptr) && (fb != nullptr)) {
Rect rect;
const uint8_t* data;
@@ -399,13 +399,13 @@ void CConnection::close()
vlog.error("%s", e.str());
}
- setFramebuffer(NULL);
+ setFramebuffer(nullptr);
delete csecurity;
- csecurity = NULL;
+ csecurity = nullptr;
delete reader_;
- reader_ = NULL;
+ reader_ = nullptr;
delete writer_;
- writer_ = NULL;
+ writer_ = nullptr;
}
void CConnection::setDesktopSize(int w, int h)
@@ -420,7 +420,7 @@ void CConnection::setDesktopSize(int w, int h)
server.height());
resizeFramebuffer();
- assert(framebuffer != NULL);
+ assert(framebuffer != nullptr);
assert(framebuffer->width() == server.width());
assert(framebuffer->height() == server.height());
}
@@ -440,7 +440,7 @@ void CConnection::setExtendedDesktopSize(unsigned reason,
server.height());
resizeFramebuffer();
- assert(framebuffer != NULL);
+ assert(framebuffer != nullptr);
assert(framebuffer->width() == server.width());
assert(framebuffer->height() == server.height());
}
@@ -471,7 +471,7 @@ void CConnection::serverInit(int width, int height,
vlog.debug("initialisation done");
initDone();
- assert(framebuffer != NULL);
+ assert(framebuffer != nullptr);
assert(framebuffer->width() == server.width());
assert(framebuffer->height() == server.height());
@@ -501,7 +501,7 @@ void CConnection::framebufferUpdateStart()
{
CMsgHandler::framebufferUpdateStart();
- assert(framebuffer != NULL);
+ assert(framebuffer != nullptr);
// Note: This might not be true if continuous updates are supported
pendingUpdate = false;
diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx
index 006645df..c10b7033 100644
--- a/common/rfb/CMsgReader.cxx
+++ b/common/rfb/CMsgReader.cxx
@@ -385,7 +385,7 @@ bool CMsgReader::readExtendedClipboard(int32_t len)
}
zis.flushUnderlying();
- zis.setUnderlying(NULL, 0);
+ zis.setUnderlying(nullptr, 0);
handler->handleClipboardProvide(flags, lengths, buffers);
diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx
index e941aaa7..8e3f1c27 100644
--- a/common/rfb/CMsgWriter.cxx
+++ b/common/rfb/CMsgWriter.cxx
@@ -192,7 +192,7 @@ void CMsgWriter::writePointerEvent(const Point& pos, int buttonMask)
void CMsgWriter::writeClientCutText(const char* str)
{
- if (strchr(str, '\r') != NULL)
+ if (strchr(str, '\r') != nullptr)
throw Exception("Invalid carriage return in clipboard data");
std::string latin1(utf8ToLatin1(str));
diff --git a/common/rfb/CSecurityRSAAES.cxx b/common/rfb/CSecurityRSAAES.cxx
index 5a4bc9c9..832574a0 100644
--- a/common/rfb/CSecurityRSAAES.cxx
+++ b/common/rfb/CSecurityRSAAES.cxx
@@ -61,9 +61,9 @@ CSecurityRSAAES::CSecurityRSAAES(CConnection* cc, uint32_t _secType,
: CSecurity(cc), state(ReadPublicKey),
keySize(_keySize), isAllEncrypted(_isAllEncrypted), secType(_secType),
clientKey(), clientPublicKey(), serverKey(),
- serverKeyN(NULL), serverKeyE(NULL),
- clientKeyN(NULL), clientKeyE(NULL),
- rais(NULL), raos(NULL), rawis(NULL), rawos(NULL)
+ serverKeyN(nullptr), serverKeyE(nullptr),
+ clientKeyN(nullptr), clientKeyE(nullptr),
+ rais(nullptr), raos(nullptr), rawis(nullptr), rawos(nullptr)
{
assert(keySize == 128 || keySize == 256);
}
@@ -154,7 +154,8 @@ void CSecurityRSAAES::writePublicKey()
// set e = 65537
mpz_set_ui(clientPublicKey.e, 65537);
if (!rsa_generate_keypair(&clientPublicKey, &clientKey,
- &rs, random_func, NULL, NULL, clientKeyLength, 0))
+ &rs, random_func, nullptr, nullptr,
+ clientKeyLength, 0))
throw AuthFailureException("failed to generate key");
clientKeyN = new uint8_t[rsaKeySize];
clientKeyE = new uint8_t[rsaKeySize];
@@ -413,10 +414,10 @@ void CSecurityRSAAES::clearSecrets()
delete[] serverKeyE;
delete[] clientKeyN;
delete[] clientKeyE;
- serverKeyN = NULL;
- serverKeyE = NULL;
- clientKeyN = NULL;
- clientKeyE = NULL;
+ serverKeyN = nullptr;
+ serverKeyE = nullptr;
+ clientKeyN = nullptr;
+ clientKeyE = nullptr;
memset(serverRandom, 0, sizeof(serverRandom));
memset(clientRandom, 0, sizeof(clientRandom));
}
@@ -439,7 +440,7 @@ void CSecurityRSAAES::writeCredentials()
if (subtype == secTypeRA2UserPass)
(CSecurity::upg)->getUserPasswd(isSecure(), &username, &password);
else
- (CSecurity::upg)->getUserPasswd(isSecure(), NULL, &password);
+ (CSecurity::upg)->getUserPasswd(isSecure(), nullptr, &password);
if (subtype == secTypeRA2UserPass) {
if (username.size() > 255)
diff --git a/common/rfb/CSecurityStack.h b/common/rfb/CSecurityStack.h
index 56ac3fea..8eadc151 100644
--- a/common/rfb/CSecurityStack.h
+++ b/common/rfb/CSecurityStack.h
@@ -28,7 +28,7 @@ namespace rfb {
class CSecurityStack : public CSecurity {
public:
CSecurityStack(CConnection* cc, int Type,
- CSecurity* s0 = NULL, CSecurity* s1 = NULL);
+ CSecurity* s0 = nullptr, CSecurity* s1 = nullptr);
~CSecurityStack();
virtual bool processMsg();
virtual int getType() const {return type;};
diff --git a/common/rfb/CSecurityTLS.cxx b/common/rfb/CSecurityTLS.cxx
index 11e6dfe3..0633dbce 100644
--- a/common/rfb/CSecurityTLS.cxx
+++ b/common/rfb/CSecurityTLS.cxx
@@ -75,7 +75,7 @@ static const char* configdirfn(const char* fn)
const char* configdir;
configdir = os::getvncconfigdir();
- if (configdir == NULL)
+ if (configdir == nullptr)
return "";
snprintf(full_path, sizeof(full_path), "%s/%s", configdir, fn);
@@ -83,8 +83,10 @@ static const char* configdirfn(const char* fn)
}
CSecurityTLS::CSecurityTLS(CConnection* cc, bool _anon)
- : CSecurity(cc), session(NULL), anon_cred(NULL), cert_cred(NULL),
- anon(_anon), tlsis(NULL), tlsos(NULL), rawis(NULL), rawos(NULL)
+ : CSecurity(cc), session(nullptr),
+ anon_cred(nullptr), cert_cred(nullptr),
+ anon(_anon), tlsis(nullptr), tlsos(nullptr),
+ rawis(nullptr), rawos(nullptr)
{
if (gnutls_global_init() != GNUTLS_E_SUCCESS)
throw AuthFailureException("gnutls_global_init failed");
@@ -103,32 +105,32 @@ void CSecurityTLS::shutdown()
if (anon_cred) {
gnutls_anon_free_client_credentials(anon_cred);
- anon_cred = 0;
+ anon_cred = nullptr;
}
if (cert_cred) {
gnutls_certificate_free_credentials(cert_cred);
- cert_cred = 0;
+ cert_cred = nullptr;
}
if (rawis && rawos) {
cc->setStreams(rawis, rawos);
- rawis = NULL;
- rawos = NULL;
+ rawis = nullptr;
+ rawos = nullptr;
}
if (tlsis) {
delete tlsis;
- tlsis = NULL;
+ tlsis = nullptr;
}
if (tlsos) {
delete tlsos;
- tlsos = NULL;
+ tlsos = nullptr;
}
if (session) {
gnutls_deinit(session);
- session = 0;
+ session = nullptr;
}
}
@@ -206,7 +208,7 @@ void CSecurityTLS::setParam()
prio = (char*)malloc(strlen(Security::GnuTLSPriority) +
strlen(kx_anon_priority) + 1);
- if (prio == NULL)
+ if (prio == nullptr)
throw AuthFailureException("Not enough memory for GnuTLS priority string");
strcpy(prio, Security::GnuTLSPriority);
@@ -242,7 +244,7 @@ void CSecurityTLS::setParam()
prio = (char*)malloc(strlen(gnutls_default_priority) +
strlen(kx_anon_priority) + 1);
- if (prio == NULL)
+ if (prio == nullptr)
throw AuthFailureException("Not enough memory for GnuTLS priority string");
strcpy(prio, gnutls_default_priority);
@@ -385,7 +387,7 @@ void CSecurityTLS::checkSession()
/* Certificate has some user overridable problems, so TOFU time */
hostsDir = os::getvncstatedir();
- if (hostsDir == NULL) {
+ if (hostsDir == nullptr) {
throw AuthFailureException("Could not obtain VNC state directory "
"path for known hosts storage");
}
@@ -393,8 +395,8 @@ void CSecurityTLS::checkSession()
std::string dbPath;
dbPath = (std::string)hostsDir + "/x509_known_hosts";
- err = gnutls_verify_stored_pubkey(dbPath.c_str(), NULL,
- client->getServerName(), NULL,
+ err = gnutls_verify_stored_pubkey(dbPath.c_str(), nullptr,
+ client->getServerName(), nullptr,
GNUTLS_CRT_X509, &cert_list[0], 0);
/* Previously known? */
@@ -648,8 +650,9 @@ void CSecurityTLS::checkSession()
}
}
- if (gnutls_store_pubkey(dbPath.c_str(), NULL, client->getServerName(),
- NULL, GNUTLS_CRT_X509, &cert_list[0], 0, 0))
+ if (gnutls_store_pubkey(dbPath.c_str(), nullptr,
+ client->getServerName(), nullptr,
+ GNUTLS_CRT_X509, &cert_list[0], 0, 0))
vlog.error("Failed to store server certificate to known hosts database");
vlog.info("Exception added for server host");
diff --git a/common/rfb/CSecurityVeNCrypt.cxx b/common/rfb/CSecurityVeNCrypt.cxx
index 3c8e91ba..ef149c43 100644
--- a/common/rfb/CSecurityVeNCrypt.cxx
+++ b/common/rfb/CSecurityVeNCrypt.cxx
@@ -41,7 +41,7 @@ using namespace std;
static LogWriter vlog("CVeNCrypt");
CSecurityVeNCrypt::CSecurityVeNCrypt(CConnection* cc, SecurityClient* sec)
- : CSecurity(cc), csecurity(NULL), security(sec)
+ : CSecurity(cc), csecurity(nullptr), security(sec)
{
haveRecvdMajorVersion = false;
haveRecvdMinorVersion = false;
@@ -54,7 +54,7 @@ CSecurityVeNCrypt::CSecurityVeNCrypt(CConnection* cc, SecurityClient* sec)
minorVersion = 0;
chosenType = secTypeVeNCrypt;
nAvailableTypes = 0;
- availableTypes = NULL;
+ availableTypes = nullptr;
}
CSecurityVeNCrypt::~CSecurityVeNCrypt()
diff --git a/common/rfb/CSecurityVncAuth.cxx b/common/rfb/CSecurityVncAuth.cxx
index f6a5e07a..e5f842ba 100644
--- a/common/rfb/CSecurityVncAuth.cxx
+++ b/common/rfb/CSecurityVncAuth.cxx
@@ -54,7 +54,7 @@ bool CSecurityVncAuth::processMsg()
uint8_t challenge[vncAuthChallengeSize];
is->readBytes(challenge, vncAuthChallengeSize);
std::string passwd;
- (CSecurity::upg)->getUserPasswd(cc->isSecure(), 0, &passwd);
+ (CSecurity::upg)->getUserPasswd(cc->isSecure(), nullptr, &passwd);
// Calculate the correct response
uint8_t key[8];
diff --git a/common/rfb/ClientParams.cxx b/common/rfb/ClientParams.cxx
index ade99018..bc20c3d7 100644
--- a/common/rfb/ClientParams.cxx
+++ b/common/rfb/ClientParams.cxx
@@ -39,7 +39,7 @@ ClientParams::ClientParams()
{
setName("");
- cursor_ = new Cursor(0, 0, Point(), NULL);
+ cursor_ = new Cursor(0, 0, Point(), nullptr);
clipFlags = clipboardUTF8 | clipboardRTF | clipboardHTML |
clipboardRequest | clipboardNotify | clipboardProvide;
diff --git a/common/rfb/Configuration.cxx b/common/rfb/Configuration.cxx
index 1c215c7f..a423770d 100644
--- a/common/rfb/Configuration.cxx
+++ b/common/rfb/Configuration.cxx
@@ -48,9 +48,9 @@ static LogWriter vlog("Config");
// -=- The Global/server/viewer Configuration objects
-Configuration* Configuration::global_ = 0;
-Configuration* Configuration::server_ = 0;
-Configuration* Configuration::viewer_ = 0;
+Configuration* Configuration::global_ = nullptr;
+Configuration* Configuration::server_ = nullptr;
+Configuration* Configuration::viewer_ = nullptr;
Configuration* Configuration::global() {
if (!global_)
@@ -127,7 +127,7 @@ VoidParameter* Configuration::get(const char* param)
return current;
current = current->_next;
}
- return _next ? _next->get(param) : 0;
+ return _next ? _next->get(param) : nullptr;
}
void Configuration::list(int width, int nameWidth) {
@@ -195,7 +195,7 @@ VoidParameter::VoidParameter(const char* name_, const char* desc_,
ConfigurationObject co)
: immutable(false), name(name_), description(desc_)
{
- Configuration *conf = NULL;
+ Configuration *conf = nullptr;
switch (co) {
case ConfGlobal: conf = Configuration::global();
@@ -339,7 +339,7 @@ IntParameter::IntParameter(const char* name_, const char* desc_, int v,
bool
IntParameter::setParam(const char* v) {
if (immutable) return true;
- return setParam(strtol(v, NULL, 0));
+ return setParam(strtol(v, nullptr, 0));
}
bool
@@ -410,7 +410,8 @@ StringParameter::operator const char *() const {
BinaryParameter::BinaryParameter(const char* name_, const char* desc_,
const uint8_t* v, size_t l, ConfigurationObject co)
-: VoidParameter(name_, desc_, co), value(0), length(0), def_value(0), def_length(0) {
+: VoidParameter(name_, desc_, co),
+ value(nullptr), length(0), def_value(nullptr), def_length(0) {
if (l) {
assert(v);
value = new uint8_t[l];
@@ -440,7 +441,7 @@ void BinaryParameter::setParam(const uint8_t* v, size_t len) {
if (immutable) return;
vlog.debug("set %s(Binary)", getName());
delete [] value;
- value = NULL;
+ value = nullptr;
length = 0;
if (len) {
assert(v);
diff --git a/common/rfb/Configuration.h b/common/rfb/Configuration.h
index d73d8005..0c572cfa 100644
--- a/common/rfb/Configuration.h
+++ b/common/rfb/Configuration.h
@@ -64,7 +64,8 @@ namespace rfb {
class Configuration {
public:
// - Create a new Configuration object
- Configuration(const char* name_) : name(name_), head(0), _next(0) {}
+ Configuration(const char* name_)
+ : name(name_), head(nullptr), _next(nullptr) {}
// - Return the buffer containing the Configuration's name
const char* getName() const { return name.c_str(); }
diff --git a/common/rfb/Congestion.cxx b/common/rfb/Congestion.cxx
index 1e252165..94f07055 100644
--- a/common/rfb/Congestion.cxx
+++ b/common/rfb/Congestion.cxx
@@ -85,11 +85,11 @@ Congestion::Congestion() :
baseRTT(-1), congWindow(INITIAL_WINDOW), inSlowStart(true),
safeBaseRTT(-1), measurements(0), minRTT(-1), minCongestedRTT(-1)
{
- gettimeofday(&lastUpdate, NULL);
- gettimeofday(&lastSent, NULL);
+ gettimeofday(&lastUpdate, nullptr);
+ gettimeofday(&lastSent, nullptr);
memset(&lastPong, 0, sizeof(lastPong));
- gettimeofday(&lastPongArrival, NULL);
- gettimeofday(&lastAdjustment, NULL);
+ gettimeofday(&lastPongArrival, nullptr);
+ gettimeofday(&lastAdjustment, nullptr);
}
Congestion::~Congestion()
@@ -101,7 +101,7 @@ void Congestion::updatePosition(unsigned pos)
struct timeval now;
unsigned delta, consumed;
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nullptr);
delta = pos - lastPosition;
if ((delta > 0) || (extraBuffer > 0))
@@ -121,7 +121,7 @@ void Congestion::updatePosition(unsigned pos)
congWindow = __rfbmin(INITIAL_WINDOW, congWindow);
baseRTT = -1;
measurements = 0;
- gettimeofday(&lastAdjustment, NULL);
+ gettimeofday(&lastAdjustment, nullptr);
minRTT = minCongestedRTT = -1;
inSlowStart = true;
}
@@ -149,7 +149,7 @@ void Congestion::sentPing()
memset(&rttInfo, 0, sizeof(struct RTTInfo));
- gettimeofday(&rttInfo.tv, NULL);
+ gettimeofday(&rttInfo.tv, nullptr);
rttInfo.pos = lastPosition;
rttInfo.extra = getExtraBuffer();
rttInfo.congested = isCongested();
@@ -166,7 +166,7 @@ void Congestion::gotPong()
if (pings.empty())
return;
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nullptr);
rttInfo = pings.front();
pings.pop_front();
@@ -320,7 +320,7 @@ void Congestion::debugTrace(const char* filename, int fd)
#ifdef __linux__
FILE *f;
f = fopen(filename, "ab");
- if (f != NULL) {
+ if (f != nullptr) {
struct tcp_info info;
int buffered;
socklen_t len;
@@ -329,7 +329,7 @@ void Congestion::debugTrace(const char* filename, int fd)
TCP_INFO, &info, &len) == 0) &&
(ioctl(fd, SIOCOUTQ, &buffered) == 0)) {
struct timeval now;
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nullptr);
fprintf(f, "%u.%06u,%u,%u,%u,%u\n",
(unsigned)now.tv_sec, (unsigned)now.tv_usec,
congWindow, info.tcpi_snd_cwnd * info.tcpi_snd_mss,
@@ -494,7 +494,7 @@ void Congestion::updateCongestion()
#endif
measurements = 0;
- gettimeofday(&lastAdjustment, NULL);
+ gettimeofday(&lastAdjustment, nullptr);
minRTT = minCongestedRTT = -1;
}
diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx
index e39a3943..1e71b8b9 100644
--- a/common/rfb/DecodeManager.cxx
+++ b/common/rfb/DecodeManager.cxx
@@ -41,7 +41,7 @@ using namespace rfb;
static LogWriter vlog("DecodeManager");
DecodeManager::DecodeManager(CConnection *conn) :
- conn(conn), threadException(NULL)
+ conn(conn), threadException(nullptr)
{
size_t cpuCount;
@@ -110,7 +110,7 @@ bool DecodeManager::decodeRect(const Rect& r, int encoding,
QueueEntry *entry;
- assert(pb != NULL);
+ assert(pb != nullptr);
if (!Decoder::supported(encoding)) {
vlog.error("Unknown encoding %d", encoding);
@@ -247,7 +247,7 @@ void DecodeManager::setThreadException(const rdr::Exception& e)
{
os::AutoMutex a(queueMutex);
- if (threadException != NULL)
+ if (threadException != nullptr)
return;
threadException = new rdr::Exception("Exception on worker thread: %s", e.str());
@@ -257,13 +257,13 @@ void DecodeManager::throwThreadException()
{
os::AutoMutex a(queueMutex);
- if (threadException == NULL)
+ if (threadException == nullptr)
return;
rdr::Exception e(*threadException);
delete threadException;
- threadException = NULL;
+ threadException = nullptr;
throw e;
}
@@ -305,7 +305,7 @@ void DecodeManager::DecodeThread::worker()
// Look for an available entry in the work queue
entry = findEntry();
- if (entry == NULL) {
+ if (entry == nullptr) {
// Wait and try again
manager->consumerCond->wait();
continue;
@@ -351,7 +351,7 @@ DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry()
Region lockedRegion;
if (manager->workQueue.empty())
- return NULL;
+ return nullptr;
if (!manager->workQueue.front()->active)
return manager->workQueue.front();
@@ -405,5 +405,5 @@ next:
lockedRegion.assign_union(entry->affectedRegion);
}
- return NULL;
+ return nullptr;
}
diff --git a/common/rfb/Decoder.cxx b/common/rfb/Decoder.cxx
index 78c54ec3..a6d9b17c 100644
--- a/common/rfb/Decoder.cxx
+++ b/common/rfb/Decoder.cxx
@@ -103,6 +103,6 @@ Decoder* Decoder::createDecoder(int encoding)
return new H264Decoder();
#endif
default:
- return NULL;
+ return nullptr;
}
}
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx
index c2658a70..7a15e0c2 100644
--- a/common/rfb/EncodeManager.cxx
+++ b/common/rfb/EncodeManager.cxx
@@ -138,7 +138,7 @@ EncodeManager::EncodeManager(SConnection* conn_)
{
StatsVector::iterator iter;
- encoders.resize(encoderClassMax, NULL);
+ encoders.resize(encoderClassMax, nullptr);
activeEncoders.resize(encoderTypeMax, encoderRaw);
encoders[encoderRaw] = new RawEncoder(conn);
@@ -332,7 +332,7 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_,
* We need to render the cursor seperately as it has its own
* magical pixel buffer, so split it out from the changed region.
*/
- if (renderedCursor != NULL) {
+ if (renderedCursor != nullptr) {
cursorRegion = changed.intersect(renderedCursor->getEffectiveRect());
changed.assign_subtract(renderedCursor->getEffectiveRect());
}
diff --git a/common/rfb/H264Decoder.cxx b/common/rfb/H264Decoder.cxx
index f18554ef..1f79c4ff 100644
--- a/common/rfb/H264Decoder.cxx
+++ b/common/rfb/H264Decoder.cxx
@@ -62,7 +62,7 @@ H264DecoderContext* H264Decoder::findContext(const Rect& r)
for (std::deque<H264DecoderContext*>::iterator it = contexts.begin(); it != contexts.end(); it++)
if ((*it)->isEqualRect(r))
return *it;
- return NULL;
+ return nullptr;
}
bool H264Decoder::readRect(const Rect& /*r*/,
@@ -102,7 +102,7 @@ void H264Decoder::decodeRect(const Rect& r, const uint8_t* buffer,
uint32_t len = is.readU32();
uint32_t flags = is.readU32();
- H264DecoderContext* ctx = NULL;
+ H264DecoderContext* ctx = nullptr;
if (flags & resetAllContexts)
{
resetContexts();
diff --git a/common/rfb/H264LibavDecoderContext.cxx b/common/rfb/H264LibavDecoderContext.cxx
index 8697a5a5..5bd1dbbf 100644
--- a/common/rfb/H264LibavDecoderContext.cxx
+++ b/common/rfb/H264LibavDecoderContext.cxx
@@ -42,9 +42,9 @@ static LogWriter vlog("H264LibavDecoderContext");
bool H264LibavDecoderContext::initCodec() {
os::AutoMutex lock(&mutex);
- sws = NULL;
- swsBuffer = NULL;
- h264WorkBuffer = NULL;
+ sws = nullptr;
+ swsBuffer = nullptr;
+ h264WorkBuffer = nullptr;
h264WorkBufferLength = 0;
const AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_H264);
@@ -78,7 +78,7 @@ bool H264LibavDecoderContext::initCodec() {
return false;
}
- if (avcodec_open2(avctx, codec, NULL) < 0)
+ if (avcodec_open2(avctx, codec, nullptr) < 0)
{
av_parser_close(parser);
avcodec_free_context(&avctx);
@@ -117,7 +117,7 @@ uint8_t* H264LibavDecoderContext::makeH264WorkBuffer(const uint8_t* buffer, uint
if (!h264WorkBuffer || reserve_len > h264WorkBufferLength)
{
h264WorkBuffer = (uint8_t*)realloc(h264WorkBuffer, reserve_len);
- if (h264WorkBuffer == NULL) {
+ if (h264WorkBuffer == nullptr) {
throw Exception("H264LibavDecoderContext: Unable to allocate memory");
}
h264WorkBufferLength = reserve_len;
@@ -204,7 +204,7 @@ void H264LibavDecoderContext::decode(const uint8_t* h264_in_buffer,
#ifdef FFMPEG_INIT_PACKET_DEPRECATED
packet->size = 0;
- packet->data = NULL;
+ packet->data = nullptr;
av_packet_free(&packet);
#else
delete packet;
@@ -218,7 +218,7 @@ void H264LibavDecoderContext::decode(const uint8_t* h264_in_buffer,
sws = sws_getCachedContext(sws, frame->width, frame->height, avctx->pix_fmt,
frame->width, frame->height, AV_PIX_FMT_RGB32,
- 0, NULL, NULL, NULL);
+ 0, nullptr, nullptr, nullptr);
int stride;
pb->getBuffer(rect, &stride);
diff --git a/common/rfb/H264WinDecoderContext.cxx b/common/rfb/H264WinDecoderContext.cxx
index bb29edb6..e2196520 100644
--- a/common/rfb/H264WinDecoderContext.cxx
+++ b/common/rfb/H264WinDecoderContext.cxx
@@ -21,7 +21,7 @@
#include <mfapi.h>
#include <mferror.h>
#include <wmcodecdsp.h>
-#define SAFE_RELEASE(obj) if (obj) { obj->Release(); obj = NULL; }
+#define SAFE_RELEASE(obj) if (obj) { obj->Release(); obj = nullptr; }
#include <os/Mutex.h>
#include <rfb/LogWriter.h>
@@ -41,17 +41,17 @@ bool H264WinDecoderContext::initCodec() {
return false;
}
- if (FAILED(CoCreateInstance(CLSID_CMSH264DecoderMFT, NULL, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&decoder)))
+ if (FAILED(CoCreateInstance(CLSID_CMSH264DecoderMFT, nullptr, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&decoder)))
{
vlog.error("MediaFoundation H264 codec not found");
return false;
}
GUID CLSID_VideoProcessorMFT = { 0x88753b26, 0x5b24, 0x49bd, { 0xb2, 0xe7, 0xc, 0x44, 0x5c, 0x78, 0xc9, 0x82 } };
- if (FAILED(CoCreateInstance(CLSID_VideoProcessorMFT, NULL, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&converter)))
+ 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.");
- if (FAILED(CoCreateInstance(CLSID_CColorConvertDMO, NULL, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&converter)))
+ if (FAILED(CoCreateInstance(CLSID_CColorConvertDMO, nullptr, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&converter)))
{
decoder->Release();
vlog.error("ColorConvert DMO not found");
@@ -87,7 +87,7 @@ bool H264WinDecoderContext::initCodec() {
// set decoder output type (NV12)
DWORD output_index = 0;
- IMFMediaType* output_type = NULL;
+ IMFMediaType* output_type = nullptr;
while (SUCCEEDED(decoder->GetOutputAvailableType(0, output_index++, &output_type)))
{
GUID subtype;
@@ -175,7 +175,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
}
BYTE* locked;
- input_buffer->Lock(&locked, NULL, NULL);
+ input_buffer->Lock(&locked, nullptr, nullptr);
memcpy(locked, h264_buffer, len);
input_buffer->Unlock();
@@ -203,7 +203,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
decoded_data.dwStreamID = 0;
decoded_data.pSample = decoded_sample;
decoded_data.dwStatus = 0;
- decoded_data.pEvents = NULL;
+ decoded_data.pEvents = nullptr;
DWORD status;
HRESULT hr = decoder->ProcessOutput(0, 1, &decoded_data, &status);
@@ -232,7 +232,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
// need to setup output type and try decoding again
DWORD output_index = 0;
- IMFMediaType* output_type = NULL;
+ IMFMediaType* output_type = nullptr;
while (SUCCEEDED(decoder->GetOutputAvailableType(0, output_index++, &output_type)))
{
GUID subtype;
@@ -242,7 +242,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
break;
}
output_type->Release();
- output_type = NULL;
+ output_type = nullptr;
}
// reinitialize output type (NV12) that now has correct properties (width/height/framerate)
@@ -327,7 +327,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
converted_data.dwStreamID = 0;
converted_data.pSample = converted_sample;
converted_data.dwStatus = 0;
- converted_data.pEvents = NULL;
+ converted_data.pEvents = nullptr;
DWORD status;
HRESULT hr = converter->ProcessOutput(0, 1, &converted_data, &status);
@@ -343,7 +343,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
BYTE* out;
DWORD len;
- converted_buffer->Lock(&out, NULL, &len);
+ converted_buffer->Lock(&out, nullptr, &len);
pb->imageRect(rect, out + offset_y * stride + offset_x * 4, (int)stride / 4);
converted_buffer->Unlock();
}
diff --git a/common/rfb/H264WinDecoderContext.h b/common/rfb/H264WinDecoderContext.h
index de51576c..702d8dd6 100644
--- a/common/rfb/H264WinDecoderContext.h
+++ b/common/rfb/H264WinDecoderContext.h
@@ -48,14 +48,14 @@ namespace rfb {
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;
- IMFSample *decoded_sample = NULL;
- IMFSample *converted_sample = NULL;
- IMFMediaBuffer *input_buffer = NULL;
- IMFMediaBuffer *decoded_buffer = NULL;
- IMFMediaBuffer *converted_buffer = NULL;
+ IMFTransform *decoder = nullptr;
+ IMFTransform *converter = nullptr;
+ IMFSample *input_sample = nullptr;
+ IMFSample *decoded_sample = nullptr;
+ IMFSample *converted_sample = nullptr;
+ IMFMediaBuffer *input_buffer = nullptr;
+ IMFMediaBuffer *decoded_buffer = nullptr;
+ IMFMediaBuffer *converted_buffer = nullptr;
void ParseSPS(const uint8_t* buffer, int length);
};
diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx
index a63cf1fb..729043f0 100644
--- a/common/rfb/HextileEncoder.cxx
+++ b/common/rfb/HextileEncoder.cxx
@@ -365,7 +365,7 @@ class HextileTile {
template<class T>
HextileTile<T>::HextileTile()
- : m_tile(NULL), m_width(0), m_height(0),
+ : m_tile(nullptr), m_width(0), m_height(0),
m_size(0), m_flags(0), m_background(0), m_foreground(0),
m_numSubrects(0)
{
diff --git a/common/rfb/Hostname.h b/common/rfb/Hostname.h
index 1971e343..a09cca3f 100644
--- a/common/rfb/Hostname.h
+++ b/common/rfb/Hostname.h
@@ -29,7 +29,7 @@
namespace rfb {
static bool isAllSpace(const char *string) {
- if (string == NULL)
+ if (string == nullptr)
return false;
while(*string != '\0') {
if (! isspace(*string))
@@ -46,7 +46,7 @@ namespace rfb {
const char* hostEnd;
const char* portStart;
- if (hi == NULL)
+ if (hi == nullptr)
throw rdr::Exception("NULL host specified");
// Trim leading whitespace
@@ -59,19 +59,19 @@ namespace rfb {
if (hi[0] == '[') {
hostStart = &hi[1];
hostEnd = strchr(hostStart, ']');
- if (hostEnd == NULL)
+ if (hostEnd == nullptr)
throw rdr::Exception("unmatched [ in host");
portStart = hostEnd + 1;
if (isAllSpace(portStart))
- portStart = NULL;
+ portStart = nullptr;
} else {
hostStart = &hi[0];
hostEnd = strrchr(hostStart, ':');
- if (hostEnd == NULL) {
+ if (hostEnd == nullptr) {
hostEnd = hostStart + strlen(hostStart);
- portStart = NULL;
+ portStart = nullptr;
} else {
if ((hostEnd > hostStart) && (hostEnd[-1] == ':'))
hostEnd--;
@@ -79,7 +79,7 @@ namespace rfb {
if (portStart != hostEnd) {
// We found more : in the host. This is probably an IPv6 address
hostEnd = hostStart + strlen(hostStart);
- portStart = NULL;
+ portStart = nullptr;
}
}
}
@@ -93,7 +93,7 @@ namespace rfb {
else
*host = std::string(hostStart, hostEnd - hostStart);
- if (portStart == NULL)
+ if (portStart == nullptr)
*port = basePort;
else {
char* end;
diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx
index a4dd5f39..42d5c475 100644
--- a/common/rfb/JpegCompressor.cxx
+++ b/common/rfb/JpegCompressor.cxx
@@ -162,9 +162,9 @@ void JpegCompressor::compress(const uint8_t *buf, volatile int stride,
int w = r.width();
int h = r.height();
int pixelsize;
- uint8_t * volatile srcBuf = NULL;
+ uint8_t * volatile srcBuf = nullptr;
volatile bool srcBufIsTemp = false;
- JSAMPROW * volatile rowPointer = NULL;
+ JSAMPROW * volatile rowPointer = nullptr;
if(setjmp(err->jmpBuffer)) {
// this will execute if libjpeg has an error
diff --git a/common/rfb/JpegDecompressor.cxx b/common/rfb/JpegDecompressor.cxx
index 44c54fb2..92ef014f 100644
--- a/common/rfb/JpegDecompressor.cxx
+++ b/common/rfb/JpegDecompressor.cxx
@@ -159,9 +159,9 @@ void JpegDecompressor::decompress(const uint8_t *jpegBuf,
int h = r.height();
int pixelsize;
int dstBufStride;
- uint8_t * volatile dstBuf = NULL;
+ uint8_t * volatile dstBuf = nullptr;
volatile bool dstBufIsTemp = false;
- JSAMPROW * volatile rowPointer = NULL;
+ JSAMPROW * volatile rowPointer = nullptr;
if(setjmp(err->jmpBuffer)) {
// this will execute if libjpeg has an error
diff --git a/common/rfb/LogWriter.cxx b/common/rfb/LogWriter.cxx
index dc9db9d1..b222d268 100644
--- a/common/rfb/LogWriter.cxx
+++ b/common/rfb/LogWriter.cxx
@@ -34,7 +34,8 @@ rfb::LogParameter rfb::logParams;
using namespace rfb;
-LogWriter::LogWriter(const char* name) : m_name(name), m_level(0), m_log(0), m_next(log_writers) {
+LogWriter::LogWriter(const char* name)
+ : m_name(name), m_level(0), m_log(nullptr), m_next(log_writers) {
log_writers = this;
}
@@ -72,7 +73,7 @@ LogWriter::getLogWriter(const char* name) {
if (strcasecmp(name, current->m_name) == 0) return current;
current = current->m_next;
}
- return 0;
+ return nullptr;
}
bool LogWriter::setLogParams(const char* params) {
@@ -83,7 +84,7 @@ bool LogWriter::setLogParams(const char* params) {
return false;
}
int level = atoi(parts[2].c_str());
- Logger* logger = 0;
+ Logger* logger = nullptr;
if (!parts[1].empty()) {
logger = Logger::getLogger(parts[1].c_str());
if (!logger)
diff --git a/common/rfb/Logger.cxx b/common/rfb/Logger.cxx
index 7e0895e4..25f7ccb7 100644
--- a/common/rfb/Logger.cxx
+++ b/common/rfb/Logger.cxx
@@ -31,9 +31,11 @@
using namespace rfb;
-Logger* Logger::loggers = 0;
+Logger* Logger::loggers = nullptr;
-Logger::Logger(const char* name) : registered(false), m_name(name), m_next(0) {
+Logger::Logger(const char* name)
+ : registered(false), m_name(name), m_next(nullptr)
+{
}
Logger::~Logger() {
@@ -78,7 +80,7 @@ Logger::getLogger(const char* name) {
if (strcasecmp(name, current->m_name) == 0) return current;
current = current->m_next;
}
- return 0;
+ return nullptr;
}
void
diff --git a/common/rfb/Logger_file.cxx b/common/rfb/Logger_file.cxx
index 099a3501..eabe420a 100644
--- a/common/rfb/Logger_file.cxx
+++ b/common/rfb/Logger_file.cxx
@@ -33,7 +33,7 @@
using namespace rfb;
Logger_File::Logger_File(const char* loggerName)
- : Logger(loggerName), indent(13), width(79), m_file(0),
+ : Logger(loggerName), indent(13), width(79), m_file(nullptr),
m_lastLogTime(0)
{
m_filename[0] = '\0';
@@ -65,7 +65,7 @@ void Logger_File::write(int /*level*/, const char *logname, const char *message)
if (!m_file) return;
}
- time_t current = time(0);
+ time_t current = time(nullptr);
if (current != m_lastLogTime) {
m_lastLogTime = current;
fprintf(m_file, "\n%s", ctime(&m_lastLogTime));
@@ -115,7 +115,7 @@ void Logger_File::closeFile()
{
if (m_file) {
fclose(m_file);
- m_file = 0;
+ m_file = nullptr;
}
}
diff --git a/common/rfb/Logger_syslog.cxx b/common/rfb/Logger_syslog.cxx
index 320ab4b0..de9e425e 100644
--- a/common/rfb/Logger_syslog.cxx
+++ b/common/rfb/Logger_syslog.cxx
@@ -35,7 +35,7 @@ using namespace rfb;
Logger_Syslog::Logger_Syslog(const char* loggerName)
: Logger(loggerName)
{
- openlog(0, LOG_CONS | LOG_PID, LOG_USER);
+ openlog(nullptr, LOG_CONS | LOG_PID, LOG_USER);
}
Logger_Syslog::~Logger_Syslog()
diff --git a/common/rfb/Palette.h b/common/rfb/Palette.h
index 6b8cc57e..d22af0dc 100644
--- a/common/rfb/Palette.h
+++ b/common/rfb/Palette.h
@@ -75,10 +75,10 @@ inline bool rfb::Palette::insert(uint32_t colour, int numPixels)
hash_key = genHash(colour);
pnode = hash[hash_key];
- prev_pnode = NULL;
+ prev_pnode = nullptr;
// Do we already have an entry for this colour?
- while (pnode != NULL) {
+ while (pnode != nullptr) {
if (pnode->colour == colour) {
// Yup
@@ -114,12 +114,12 @@ inline bool rfb::Palette::insert(uint32_t colour, int numPixels)
// Create a new colour entry
pnode = &list[numColours];
- pnode->next = NULL;
+ pnode->next = nullptr;
pnode->idx = 0;
pnode->colour = colour;
// Add it to the hash table
- if (prev_pnode != NULL)
+ if (prev_pnode != nullptr)
prev_pnode->next = pnode;
else
hash[hash_key] = pnode;
@@ -152,7 +152,7 @@ inline unsigned char rfb::Palette::lookup(uint32_t colour) const
hash_key = genHash(colour);
pnode = hash[hash_key];
- while (pnode != NULL) {
+ while (pnode != nullptr) {
if (pnode->colour == colour)
return pnode->idx;
pnode = pnode->next;
diff --git a/common/rfb/PixelBuffer.cxx b/common/rfb/PixelBuffer.cxx
index c8b5f3d7..f1354a43 100644
--- a/common/rfb/PixelBuffer.cxx
+++ b/common/rfb/PixelBuffer.cxx
@@ -326,7 +326,7 @@ FullFramePixelBuffer::FullFramePixelBuffer(const PixelFormat& pf, int w, int h,
{
}
-FullFramePixelBuffer::FullFramePixelBuffer() : data(0) {}
+FullFramePixelBuffer::FullFramePixelBuffer() : data(nullptr) {}
FullFramePixelBuffer::~FullFramePixelBuffer() {}
@@ -365,7 +365,7 @@ void FullFramePixelBuffer::setBuffer(int width, int height,
throw rfb::Exception("Invalid PixelBuffer height of %d pixels requested", height);
if ((stride_ < 0) || (stride_ > maxPixelBufferStride) || (stride_ < width))
throw rfb::Exception("Invalid PixelBuffer stride of %d pixels requested", stride_);
- if ((width != 0) && (height != 0) && (data_ == NULL))
+ if ((width != 0) && (height != 0) && (data_ == nullptr))
throw rfb::Exception("PixelBuffer requested without a valid memory area");
ModifiablePixelBuffer::setSize(width, height);
@@ -383,12 +383,12 @@ void FullFramePixelBuffer::setSize(int /*w*/, int /*h*/)
// Automatically allocates enough space for the specified format & area
ManagedPixelBuffer::ManagedPixelBuffer()
- : data_(NULL), datasize(0)
+ : data_(nullptr), datasize(0)
{
}
ManagedPixelBuffer::ManagedPixelBuffer(const PixelFormat& pf, int w, int h)
- : FullFramePixelBuffer(pf, 0, 0, NULL, 0), data_(NULL), datasize(0)
+ : FullFramePixelBuffer(pf, 0, 0, nullptr, 0), data_(nullptr), datasize(0)
{
setSize(w, h);
}
@@ -413,7 +413,7 @@ void ManagedPixelBuffer::setSize(int w, int h)
if (datasize < new_datasize) {
if (data_) {
delete [] data_;
- data_ = NULL;
+ data_ = nullptr;
datasize = 0;
}
if (new_datasize) {
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index 12ba0f1a..8f109a06 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -44,8 +44,8 @@ using namespace rfb;
static LogWriter vlog("SConnection");
SConnection::SConnection(AccessRights accessRights)
- : readyForSetColourMapEntries(false),
- is(0), os(0), reader_(0), writer_(0), ssecurity(0),
+ : 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),
@@ -607,11 +607,11 @@ void SConnection::sendClipboardData(const char* data)
void SConnection::cleanup()
{
delete ssecurity;
- ssecurity = NULL;
+ ssecurity = nullptr;
delete reader_;
- reader_ = NULL;
+ reader_ = nullptr;
delete writer_;
- writer_ = NULL;
+ writer_ = nullptr;
}
void SConnection::writeFakeColourMap(void)
diff --git a/common/rfb/SConnection.h b/common/rfb/SConnection.h
index 5bc61677..fb3ae15a 100644
--- a/common/rfb/SConnection.h
+++ b/common/rfb/SConnection.h
@@ -71,7 +71,7 @@ namespace rfb {
// later, after queryConnection() has returned. It can only be called when
// in state RFBSTATE_QUERYING. On rejection, an AuthFailureException is
// thrown, so this must be handled appropriately by the caller.
- void approveConnection(bool accept, const char* reason=0);
+ void approveConnection(bool accept, const char* reason=nullptr);
// Methods to terminate the connection
diff --git a/common/rfb/SDesktop.h b/common/rfb/SDesktop.h
index 94e4b028..b660f496 100644
--- a/common/rfb/SDesktop.h
+++ b/common/rfb/SDesktop.h
@@ -124,14 +124,18 @@ namespace rfb {
// a plain black desktop of the specified format.
class SStaticDesktop : public SDesktop {
public:
- SStaticDesktop(const Point& size) : server(0), buffer(0) {
+ SStaticDesktop(const Point& size)
+ : server(nullptr), buffer(nullptr)
+ {
PixelFormat pf;
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) {
+ SStaticDesktop(const Point& size, const PixelFormat& pf)
+ : buffer(nullptr)
+ {
const uint8_t black[4] = { 0, 0, 0, 0 };
buffer = new ManagedPixelBuffer(pf, size.x, size.y);
if (buffer)
@@ -147,7 +151,7 @@ namespace rfb {
}
virtual void queryConnection(network::Socket* sock,
const char* /*userName*/) {
- server->approveConnection(sock, true, NULL);
+ server->approveConnection(sock, true, nullptr);
}
protected:
diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx
index 0792639a..9ddea53d 100644
--- a/common/rfb/SMsgReader.cxx
+++ b/common/rfb/SMsgReader.cxx
@@ -418,7 +418,7 @@ bool SMsgReader::readExtendedClipboard(int32_t len)
}
zis.flushUnderlying();
- zis.setUnderlying(NULL, 0);
+ zis.setUnderlying(nullptr, 0);
handler->handleClipboardProvide(flags, lengths, buffers);
diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx
index 8592e6f4..43d97853 100644
--- a/common/rfb/SMsgWriter.cxx
+++ b/common/rfb/SMsgWriter.cxx
@@ -93,7 +93,7 @@ void SMsgWriter::writeBell()
void SMsgWriter::writeServerCutText(const char* str)
{
- if (strchr(str, '\r') != NULL)
+ if (strchr(str, '\r') != nullptr)
throw Exception("Invalid carriage return in clipboard data");
std::string latin1(utf8ToLatin1(str));
diff --git a/common/rfb/SSecurityNone.h b/common/rfb/SSecurityNone.h
index f14d83a4..019fc133 100644
--- a/common/rfb/SSecurityNone.h
+++ b/common/rfb/SSecurityNone.h
@@ -31,7 +31,7 @@ namespace rfb {
SSecurityNone(SConnection* sc) : SSecurity(sc) {}
virtual bool processMsg() { return true; }
virtual int getType() const {return secTypeNone;}
- virtual const char* getUserName() const {return 0;}
+ virtual const char* getUserName() const {return nullptr;}
};
}
#endif
diff --git a/common/rfb/SSecurityPlain.cxx b/common/rfb/SSecurityPlain.cxx
index a100a757..9bc07cb1 100644
--- a/common/rfb/SSecurityPlain.cxx
+++ b/common/rfb/SSecurityPlain.cxx
@@ -75,7 +75,7 @@ SSecurityPlain::SSecurityPlain(SConnection* sc) : SSecurity(sc)
#elif !defined(__APPLE__)
valid = new UnixPasswordValidator();
#else
- valid = NULL;
+ valid = nullptr;
#endif
state = 0;
diff --git a/common/rfb/SSecurityRSAAES.cxx b/common/rfb/SSecurityRSAAES.cxx
index cea62644..64a8b523 100644
--- a/common/rfb/SSecurityRSAAES.cxx
+++ b/common/rfb/SSecurityRSAAES.cxx
@@ -75,9 +75,10 @@ SSecurityRSAAES::SSecurityRSAAES(SConnection* sc, uint32_t _secType,
: SSecurity(sc), state(SendPublicKey),
keySize(_keySize), isAllEncrypted(_isAllEncrypted), secType(_secType),
serverKey(), clientKey(),
- serverKeyN(NULL), serverKeyE(NULL), clientKeyN(NULL), clientKeyE(NULL),
+ serverKeyN(nullptr), serverKeyE(nullptr),
+ clientKeyN(nullptr), clientKeyE(nullptr),
accessRights(AccessDefault),
- rais(NULL), raos(NULL), rawis(NULL), rawos(NULL)
+ rais(nullptr), raos(nullptr), rawis(nullptr), rawos(nullptr)
{
assert(keySize == 128 || keySize == 256);
}
@@ -514,10 +515,10 @@ void SSecurityRSAAES::clearSecrets()
delete[] serverKeyE;
delete[] clientKeyN;
delete[] clientKeyE;
- serverKeyN = NULL;
- serverKeyE = NULL;
- clientKeyN = NULL;
- clientKeyE = NULL;
+ serverKeyN = nullptr;
+ serverKeyE = nullptr;
+ clientKeyN = nullptr;
+ clientKeyE = nullptr;
memset(serverRandom, 0, sizeof(serverRandom));
memset(clientRandom, 0, sizeof(clientRandom));
}
diff --git a/common/rfb/SSecurityStack.cxx b/common/rfb/SSecurityStack.cxx
index 9c0321d4..b306cd6a 100644
--- a/common/rfb/SSecurityStack.cxx
+++ b/common/rfb/SSecurityStack.cxx
@@ -61,7 +61,7 @@ bool SSecurityStack::processMsg()
const char* SSecurityStack::getUserName() const
{
- const char* c = 0;
+ const char* c = nullptr;
if (state1 && !c)
c = state1->getUserName();
diff --git a/common/rfb/SSecurityStack.h b/common/rfb/SSecurityStack.h
index cf7b10d0..90a6e7c0 100644
--- a/common/rfb/SSecurityStack.h
+++ b/common/rfb/SSecurityStack.h
@@ -27,7 +27,7 @@ namespace rfb {
class SSecurityStack : public SSecurity {
public:
SSecurityStack(SConnection* sc, int Type,
- SSecurity* s0 = NULL, SSecurity* s1 = NULL);
+ SSecurity* s0 = nullptr, SSecurity* s1 = nullptr);
~SSecurityStack();
virtual bool processMsg();
virtual int getType() const { return type; };
diff --git a/common/rfb/SSecurityTLS.cxx b/common/rfb/SSecurityTLS.cxx
index 1abfd774..0b8f0ff2 100644
--- a/common/rfb/SSecurityTLS.cxx
+++ b/common/rfb/SSecurityTLS.cxx
@@ -67,12 +67,12 @@ StringParameter SSecurityTLS::X509_KeyFile
static LogWriter vlog("TLS");
SSecurityTLS::SSecurityTLS(SConnection* sc, bool _anon)
- : SSecurity(sc), session(NULL), anon_cred(NULL),
- cert_cred(NULL), anon(_anon), tlsis(NULL), tlsos(NULL),
- rawis(NULL), rawos(NULL)
+ : SSecurity(sc), session(nullptr), anon_cred(nullptr),
+ cert_cred(nullptr), anon(_anon), tlsis(nullptr), tlsos(nullptr),
+ rawis(nullptr), rawos(nullptr)
{
#if defined (SSECURITYTLS__USE_DEPRECATED_DH)
- dh_params = NULL;
+ dh_params = nullptr;
#endif
if (gnutls_global_init() != GNUTLS_E_SUCCESS)
@@ -99,32 +99,32 @@ void SSecurityTLS::shutdown()
if (anon_cred) {
gnutls_anon_free_server_credentials(anon_cred);
- anon_cred = 0;
+ anon_cred = nullptr;
}
if (cert_cred) {
gnutls_certificate_free_credentials(cert_cred);
- cert_cred = 0;
+ cert_cred = nullptr;
}
if (rawis && rawos) {
sc->setStreams(rawis, rawos);
- rawis = NULL;
- rawos = NULL;
+ rawis = nullptr;
+ rawos = nullptr;
}
if (tlsis) {
delete tlsis;
- tlsis = NULL;
+ tlsis = nullptr;
}
if (tlsos) {
delete tlsos;
- tlsos = NULL;
+ tlsos = nullptr;
}
if (session) {
gnutls_deinit(session);
- session = 0;
+ session = nullptr;
}
}
@@ -203,7 +203,7 @@ void SSecurityTLS::setParams(gnutls_session_t session)
prio = (char*)malloc(strlen(Security::GnuTLSPriority) +
strlen(kx_anon_priority) + 1);
- if (prio == NULL)
+ if (prio == nullptr)
throw AuthFailureException("Not enough memory for GnuTLS priority string");
strcpy(prio, Security::GnuTLSPriority);
@@ -239,7 +239,7 @@ void SSecurityTLS::setParams(gnutls_session_t session)
prio = (char*)malloc(strlen(gnutls_default_priority) +
strlen(kx_anon_priority) + 1);
- if (prio == NULL)
+ if (prio == nullptr)
throw AuthFailureException("Not enough memory for GnuTLS priority string");
strcpy(prio, gnutls_default_priority);
diff --git a/common/rfb/SSecurityTLS.h b/common/rfb/SSecurityTLS.h
index d0f735fe..a68fd0f2 100644
--- a/common/rfb/SSecurityTLS.h
+++ b/common/rfb/SSecurityTLS.h
@@ -46,7 +46,7 @@ namespace rfb {
SSecurityTLS(SConnection* sc, bool _anon);
virtual ~SSecurityTLS();
virtual bool processMsg();
- virtual const char* getUserName() const {return 0;}
+ virtual const char* getUserName() const {return nullptr;}
virtual int getType() const { return anon ? secTypeTLSNone : secTypeX509None;}
static StringParameter X509_CertFile;
diff --git a/common/rfb/SSecurityVeNCrypt.cxx b/common/rfb/SSecurityVeNCrypt.cxx
index 2813f299..a6dc327e 100644
--- a/common/rfb/SSecurityVeNCrypt.cxx
+++ b/common/rfb/SSecurityVeNCrypt.cxx
@@ -41,7 +41,7 @@ static LogWriter vlog("SVeNCrypt");
SSecurityVeNCrypt::SSecurityVeNCrypt(SConnection* sc, SecurityServer *sec)
: SSecurity(sc), security(sec)
{
- ssecurity = NULL;
+ ssecurity = nullptr;
haveSentVersion = false;
haveRecvdMajorVersion = false;
haveRecvdMinorVersion = false;
@@ -51,7 +51,7 @@ SSecurityVeNCrypt::SSecurityVeNCrypt(SConnection* sc, SecurityServer *sec)
haveChosenType = false;
chosenType = secTypeVeNCrypt;
numTypes = 0;
- subTypes = NULL;
+ subTypes = nullptr;
}
SSecurityVeNCrypt::~SSecurityVeNCrypt()
@@ -175,14 +175,14 @@ bool SSecurityVeNCrypt::processMsg()
const char* SSecurityVeNCrypt::getUserName() const
{
- if (ssecurity == NULL)
- return NULL;
+ if (ssecurity == nullptr)
+ return nullptr;
return ssecurity->getUserName();
}
AccessRights SSecurityVeNCrypt::getAccessRights() const
{
- if (ssecurity == NULL)
+ if (ssecurity == nullptr)
return SSecurity::getAccessRights();
return ssecurity->getAccessRights();
}
diff --git a/common/rfb/SSecurityVncAuth.cxx b/common/rfb/SSecurityVncAuth.cxx
index c1ef1f1c..7d5b2664 100644
--- a/common/rfb/SSecurityVncAuth.cxx
+++ b/common/rfb/SSecurityVncAuth.cxx
@@ -119,7 +119,9 @@ bool SSecurityVncAuth::processMsg()
VncAuthPasswdParameter::VncAuthPasswdParameter(const char* name,
const char* desc,
StringParameter* passwdFile_)
-: BinaryParameter(name, desc, 0, 0, ConfServer), passwdFile(passwdFile_) {
+: BinaryParameter(name, desc, nullptr, 0, ConfServer),
+ passwdFile(passwdFile_)
+{
}
void VncAuthPasswdParameter::getVncAuthPasswd(std::string *password, std::string *readOnlyPassword) {
@@ -151,8 +153,8 @@ void VncAuthPasswdParameter::getVncAuthPasswd(std::string *password, std::string
}
}
- assert(password != NULL);
- assert(readOnlyPassword != NULL);
+ assert(password != nullptr);
+ assert(readOnlyPassword != nullptr);
try {
*password = deobfuscate(obfuscated.data(), obfuscated.size());
diff --git a/common/rfb/SSecurityVncAuth.h b/common/rfb/SSecurityVncAuth.h
index 7f27b02b..9c00aa52 100644
--- a/common/rfb/SSecurityVncAuth.h
+++ b/common/rfb/SSecurityVncAuth.h
@@ -54,7 +54,7 @@ namespace rfb {
SSecurityVncAuth(SConnection* sc);
virtual bool processMsg();
virtual int getType() const {return secTypeVncAuth;}
- virtual const char* getUserName() const {return 0;}
+ virtual const char* getUserName() const {return nullptr;}
virtual AccessRights getAccessRights() const { return accessRights; }
static StringParameter vncAuthPasswdFile;
static VncAuthPasswdParameter vncAuthPasswd;
diff --git a/common/rfb/SecurityClient.cxx b/common/rfb/SecurityClient.cxx
index 1350640d..12860662 100644
--- a/common/rfb/SecurityClient.cxx
+++ b/common/rfb/SecurityClient.cxx
@@ -41,9 +41,9 @@
using namespace rdr;
using namespace rfb;
-UserPasswdGetter *CSecurity::upg = NULL;
+UserPasswdGetter *CSecurity::upg = nullptr;
#if defined(HAVE_GNUTLS) || defined(HAVE_NETTLE)
-UserMsgBox *CSecurity::msg = NULL;
+UserMsgBox *CSecurity::msg = nullptr;
#endif
StringParameter SecurityClient::secTypes
@@ -67,9 +67,9 @@ ConfViewer);
CSecurity* SecurityClient::GetCSecurity(CConnection* cc, uint32_t secType)
{
- assert (CSecurity::upg != NULL); /* (upg == NULL) means bug in the viewer */
+ assert (CSecurity::upg != nullptr); /* (upg == nullptr) means bug in the viewer */
#if defined(HAVE_GNUTLS) || defined(HAVE_NETTLE)
- assert (CSecurity::msg != NULL);
+ assert (CSecurity::msg != nullptr);
#endif
if (!IsSupported(secType))
diff --git a/common/rfb/ServerParams.cxx b/common/rfb/ServerParams.cxx
index 6af446c2..9f6f5307 100644
--- a/common/rfb/ServerParams.cxx
+++ b/common/rfb/ServerParams.cxx
@@ -38,7 +38,7 @@ ServerParams::ServerParams()
{
setName("");
- cursor_ = new Cursor(0, 0, Point(), NULL);
+ cursor_ = new Cursor(0, 0, Point(), nullptr);
clipFlags = 0;
memset(clipSizes, 0, sizeof(clipSizes));
diff --git a/common/rfb/TightDecoder.cxx b/common/rfb/TightDecoder.cxx
index 54b620ea..807f71a5 100644
--- a/common/rfb/TightDecoder.cxx
+++ b/common/rfb/TightDecoder.cxx
@@ -345,7 +345,7 @@ void TightDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
size_t rowSize, dataSize;
uint8_t* netbuf;
- netbuf = NULL;
+ netbuf = nullptr;
if (palSize != 0) {
if (palSize <= 2)
@@ -387,7 +387,7 @@ void TightDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
zis[streamId].readBytes(netbuf, dataSize);
zis[streamId].flushUnderlying();
- zis[streamId].setUnderlying(NULL, 0);
+ zis[streamId].setUnderlying(nullptr, 0);
delete ms;
bufptr = netbuf;
diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx
index 1a169a3d..213f872c 100644
--- a/common/rfb/TightEncoder.cxx
+++ b/common/rfb/TightEncoder.cxx
@@ -260,12 +260,12 @@ void TightEncoder::flushZlibOutStream(rdr::OutStream* os_)
rdr::ZlibOutStream* zos;
zos = dynamic_cast<rdr::ZlibOutStream*>(os_);
- if (zos == NULL)
+ if (zos == nullptr)
return;
zos->cork(false);
zos->flush();
- zos->setUnderlying(NULL);
+ zos->setUnderlying(nullptr);
os = conn->getOutStream();
diff --git a/common/rfb/Timer.cxx b/common/rfb/Timer.cxx
index e9ae5227..b695df86 100644
--- a/common/rfb/Timer.cxx
+++ b/common/rfb/Timer.cxx
@@ -63,7 +63,7 @@ int Timer::checkTimeouts() {
if (pending.empty())
return -1;
- gettimeofday(&start, 0);
+ gettimeofday(&start, nullptr);
while (pending.front()->isBefore(start)) {
Timer* timer;
@@ -81,7 +81,7 @@ int Timer::checkTimeouts() {
int Timer::getNextTimeout() {
timeval now;
- gettimeofday(&now, 0);
+ gettimeofday(&now, nullptr);
if (pending.empty())
return -1;
@@ -115,7 +115,7 @@ void Timer::insertTimer(Timer* t) {
void Timer::start(int timeoutMs_) {
timeval now;
- gettimeofday(&now, 0);
+ gettimeofday(&now, nullptr);
stop();
timeoutMs = timeoutMs_;
dueTime = addMillis(now, timeoutMs);
@@ -125,7 +125,7 @@ void Timer::start(int timeoutMs_) {
void Timer::repeat(int timeoutMs_) {
timeval now;
- gettimeofday(&now, 0);
+ gettimeofday(&now, nullptr);
if (isStarted()) {
vlog.error("Incorrectly repeating already running timer");
@@ -167,7 +167,7 @@ int Timer::getTimeoutMs() {
int Timer::getRemainingMs() {
timeval now;
- gettimeofday(&now, 0);
+ gettimeofday(&now, nullptr);
return __rfbmax(0, diffTimeMillis(dueTime, now));
}
diff --git a/common/rfb/UpdateTracker.h b/common/rfb/UpdateTracker.h
index 8983b378..1c31a168 100644
--- a/common/rfb/UpdateTracker.h
+++ b/common/rfb/UpdateTracker.h
@@ -53,7 +53,7 @@ namespace rfb {
class ClippingUpdateTracker : public UpdateTracker {
public:
- ClippingUpdateTracker() : ut(0) {}
+ ClippingUpdateTracker() : ut(nullptr) {}
ClippingUpdateTracker(UpdateTracker* ut_, const Rect& r=Rect()) : ut(ut_), clipRect(r) {}
void setUpdateTracker(UpdateTracker* ut_) {ut = ut_;}
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 306bba1d..a40a1a30 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -48,7 +48,7 @@ using namespace rfb;
static LogWriter vlog("VNCSConnST");
-static Cursor emptyCursor(0, 0, Point(0, 0), NULL);
+static Cursor emptyCursor(0, 0, Point(0, 0), nullptr);
VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s,
bool reverse, AccessRights ar)
@@ -56,7 +56,7 @@ VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s,
sock(s), reverseConnection(reverse),
inProcessMessages(false),
pendingSyncFence(false), syncFence(false), fenceFlags(0),
- fenceDataLen(0), fenceData(NULL), congestionTimer(this),
+ fenceDataLen(0), fenceData(nullptr), congestionTimer(this),
losslessTimer(this), server(server_),
updateRenderedCursor(false), removeRenderedCursor(false),
continuousUpdates(false), encodeManager(this), idleTimer(this),
@@ -409,7 +409,7 @@ bool VNCSConnectionST::needRenderedCursor()
if (!client.supportsLocalCursor())
return true;
if ((server->getCursorPos() != pointerEventPos) &&
- (time(0) - pointerEventTime) > 0)
+ (time(nullptr) - pointerEventTime) > 0)
return true;
return false;
@@ -481,7 +481,7 @@ void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask)
{
if (rfb::Server::idleTimeout)
idleTimer.start(secsToMillis(rfb::Server::idleTimeout));
- pointerEventTime = time(0);
+ pointerEventTime = time(nullptr);
if (!accessCheck(AccessPtrEvents)) return;
if (!rfb::Server::acceptPointerEvents) return;
pointerEventPos = pos;
@@ -690,7 +690,7 @@ void VNCSConnectionST::fence(uint32_t flags, unsigned len, const uint8_t data[])
fenceFlags = flags & (fenceFlagBlockBefore | fenceFlagBlockAfter | fenceFlagSyncNext);
fenceDataLen = len;
delete [] fenceData;
- fenceData = NULL;
+ fenceData = nullptr;
if (len > 0) {
fenceData = new uint8_t[len];
memcpy(fenceData, data, len);
@@ -1001,7 +1001,7 @@ void VNCSConnectionST::writeDataUpdate()
// Does the client need a server-side rendered cursor?
- cursor = NULL;
+ cursor = nullptr;
if (needRenderedCursor()) {
Rect renderedCursorRect;
@@ -1083,7 +1083,7 @@ void VNCSConnectionST::writeLosslessRefresh()
// Prepare the cursor in case it overlaps with a region getting
// refreshed
- cursor = NULL;
+ cursor = nullptr;
if (needRenderedCursor())
cursor = server->getRenderedCursor();
diff --git a/common/rfb/VNCServer.h b/common/rfb/VNCServer.h
index 3ac9fb94..4e3a5b23 100644
--- a/common/rfb/VNCServer.h
+++ b/common/rfb/VNCServer.h
@@ -115,7 +115,7 @@ namespace rfb {
// acceptance, or false for rejection, in which case a string
// reason may also be given.
virtual void approveConnection(network::Socket* sock, bool accept,
- const char* reason = NULL) = 0;
+ const char* reason = nullptr) = 0;
// - Close all currently-connected clients, by calling
// their close() method with the supplied reason.
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index b9579f12..8db5d0fb 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -83,10 +83,10 @@ static LogWriter connectionsLog("Connections");
VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_)
: blHosts(&blacklist), desktop(desktop_), desktopStarted(false),
- blockCounter(0), pb(0), ledState(ledUnknown),
- name(name_), pointerClient(0), clipboardClient(0),
+ blockCounter(0), pb(nullptr), ledState(ledUnknown),
+ name(name_), pointerClient(nullptr), clipboardClient(nullptr),
pointerClientTime(0),
- comparer(0), cursor(new Cursor(0, 0, Point(), NULL)),
+ comparer(nullptr), cursor(new Cursor(0, 0, Point(), nullptr)),
renderedCursorInvalid(false),
keyRemapper(&KeyRemapper::defInstance),
idleTimer(this), disconnectTimer(this), connectTimer(this),
@@ -177,7 +177,7 @@ void VNCServerST::removeSocket(network::Socket* sock) {
if ((*ci)->getSock() == sock) {
// - Remove any references to it
if (pointerClient == *ci)
- pointerClient = NULL;
+ pointerClient = nullptr;
if (clipboardClient == *ci)
handleClipboardAnnounce(*ci, false);
clipboardRequestors.remove(*ci);
@@ -275,7 +275,7 @@ void VNCServerST::setPixelBuffer(PixelBuffer* pb_, const ScreenSet& layout)
pb = pb_;
delete comparer;
- comparer = 0;
+ comparer = nullptr;
if (!pb) {
screenLayout = ScreenSet();
@@ -355,7 +355,7 @@ void VNCServerST::setScreenLayout(const ScreenSet& layout)
void VNCServerST::requestClipboard()
{
- if (clipboardClient == NULL) {
+ if (clipboardClient == nullptr) {
slog.debug("Got request for client clipboard but no client currently owns the clipboard");
return;
}
@@ -379,7 +379,7 @@ void VNCServerST::sendClipboardData(const char* data)
{
std::list<VNCSConnectionST*>::iterator ci, ci_next;
- if (strchr(data, '\r') != NULL)
+ if (strchr(data, '\r') != nullptr)
throw Exception("Invalid carriage return in clipboard data");
for (ci = clipboardRequestors.begin();
@@ -412,7 +412,7 @@ void VNCServerST::setName(const char* name_)
void VNCServerST::add_changed(const Region& region)
{
- if (comparer == NULL)
+ if (comparer == nullptr)
return;
comparer->add_changed(region);
@@ -421,7 +421,7 @@ void VNCServerST::add_changed(const Region& region)
void VNCServerST::add_copied(const Region& dest, const Point& delta)
{
- if (comparer == NULL)
+ if (comparer == nullptr)
return;
comparer->add_copied(dest, delta);
@@ -498,14 +498,14 @@ void VNCServerST::keyEvent(uint32_t keysym, uint32_t keycode, bool down)
void VNCServerST::pointerEvent(VNCSConnectionST* client,
const Point& pos, int buttonMask)
{
- time_t now = time(0);
+ time_t now = time(nullptr);
if (rfb::Server::maxIdleTime)
idleTimer.start(secsToMillis(rfb::Server::maxIdleTime));
// Let one client own the cursor whilst buttons are pressed in order
// to provide a bit more sane user experience. But limit the time to
// prevent locking out all others when e.g. the network is down.
- if ((pointerClient != NULL) && (pointerClient != client) &&
+ if ((pointerClient != nullptr) && (pointerClient != client) &&
((now - pointerClientTime) < 10))
return;
@@ -513,7 +513,7 @@ void VNCServerST::pointerEvent(VNCSConnectionST* client,
if (buttonMask)
pointerClient = client;
else
- pointerClient = NULL;
+ pointerClient = nullptr;
desktop->pointerEvent(pos, buttonMask);
}
@@ -533,7 +533,7 @@ void VNCServerST::handleClipboardAnnounce(VNCSConnectionST* client,
else {
if (client != clipboardClient)
return;
- clipboardClient = NULL;
+ clipboardClient = nullptr;
}
desktop->handleClipboardAnnounce(available);
}
@@ -633,7 +633,7 @@ SConnection* VNCServerST::getConnection(network::Socket* sock) {
if ((*ci)->getSock() == sock)
return (SConnection*)*ci;
}
- return 0;
+ return nullptr;
}
void VNCServerST::handleTimeout(Timer* t)
@@ -697,14 +697,14 @@ void VNCServerST::queryConnection(VNCSConnectionST* client,
// - Are we configured to do queries?
if (!rfb::Server::queryConnect &&
!client->getSock()->requiresQuery()) {
- approveConnection(client->getSock(), true, NULL);
+ approveConnection(client->getSock(), true, nullptr);
return;
}
// - Does the client have the right to bypass the query?
if (client->accessCheck(AccessNoQuery))
{
- approveConnection(client->getSock(), true, NULL);
+ approveConnection(client->getSock(), true, nullptr);
return;
}
diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h
index 90c8d753..8fbbf971 100644
--- a/common/rfb/VNCServerST.h
+++ b/common/rfb/VNCServerST.h
@@ -92,7 +92,7 @@ namespace rfb {
virtual void approveConnection(network::Socket* sock, bool accept,
const char* reason);
- virtual void closeClients(const char* reason) {closeClients(reason, 0);}
+ virtual void closeClients(const char* reason) {closeClients(reason, nullptr);}
virtual SConnection* getConnection(network::Socket* sock);
virtual void add_changed(const Region &region);
diff --git a/common/rfb/ZRLEDecoder.cxx b/common/rfb/ZRLEDecoder.cxx
index 4b768afc..de919dc5 100644
--- a/common/rfb/ZRLEDecoder.cxx
+++ b/common/rfb/ZRLEDecoder.cxx
@@ -286,5 +286,5 @@ void ZRLEDecoder::zrleDecode(const Rect& r, rdr::InStream* is,
}
zis->flushUnderlying();
- zis->setUnderlying(NULL, 0);
+ zis->setUnderlying(nullptr, 0);
}
diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx
index ad3aec1a..c9677337 100644
--- a/common/rfb/ZRLEEncoder.cxx
+++ b/common/rfb/ZRLEEncoder.cxx
@@ -38,7 +38,7 @@ IntParameter zlibLevel("ZlibLevel","[DEPRECATED] Zlib compression level",-1);
ZRLEEncoder::ZRLEEncoder(SConnection* conn)
: Encoder(conn, encodingZRLE, EncoderPlain, 127),
- zos(0, 2), mos(129*1024)
+ zos(nullptr, 2), mos(129*1024)
{
if (zlibLevel != -1) {
vlog.info("Warning: The ZlibLevel option is deprecated and is "
@@ -50,7 +50,7 @@ ZRLEEncoder::ZRLEEncoder(SConnection* conn)
ZRLEEncoder::~ZRLEEncoder()
{
- zos.setUnderlying(NULL);
+ zos.setUnderlying(nullptr);
}
bool ZRLEEncoder::isSupported()
diff --git a/common/rfb/obfuscate.cxx b/common/rfb/obfuscate.cxx
index d40e25c3..2afc1512 100644
--- a/common/rfb/obfuscate.cxx
+++ b/common/rfb/obfuscate.cxx
@@ -41,7 +41,7 @@ std::vector<uint8_t> rfb::obfuscate(const char *str)
{
std::vector<uint8_t> buf(8);
- assert(str != NULL);
+ assert(str != nullptr);
size_t l = strlen(str), i;
for (i=0; i<8; i++)
@@ -59,7 +59,7 @@ std::string rfb::deobfuscate(const uint8_t *data, size_t len)
if (len != 8)
throw rdr::Exception("bad obfuscated password length");
- assert(data != NULL);
+ assert(data != nullptr);
deskey(d3desObfuscationKey, DE1);
des((uint8_t*)data, (uint8_t*)buf);
diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx
index 48f59846..3c62b1df 100644
--- a/common/rfb/util.cxx
+++ b/common/rfb/util.cxx
@@ -40,7 +40,7 @@ namespace rfb {
std::string out;
va_start(ap, fmt);
- len = vsnprintf(NULL, 0, fmt, ap);
+ len = vsnprintf(nullptr, 0, fmt, ap);
va_end(ap);
if (len < 0)
@@ -68,13 +68,13 @@ namespace rfb {
start = src;
do {
stop = strchr(start, delimiter);
- if (stop == NULL) {
+ if (stop == nullptr) {
out.push_back(start);
} else {
out.push_back(std::string(start, stop-start));
start = stop + 1;
}
- } while (stop != NULL);
+ } while (stop != nullptr);
return out;
}
@@ -621,7 +621,7 @@ namespace rfb {
{
struct timeval now;
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nullptr);
return msBetween(then, &now);
}