aboutsummaryrefslogtreecommitdiffstats
path: root/common/rdr
diff options
context:
space:
mode:
Diffstat (limited to 'common/rdr')
-rw-r--r--common/rdr/Exception.cxx18
-rw-r--r--common/rdr/Exception.h34
-rw-r--r--common/rdr/FdInStream.cxx6
-rw-r--r--common/rdr/FdOutStream.cxx4
-rw-r--r--common/rdr/FileInStream.cxx6
-rw-r--r--common/rdr/MemInStream.h2
-rw-r--r--common/rdr/RandomStream.cxx6
-rw-r--r--common/rdr/TLSException.cxx2
-rw-r--r--common/rdr/TLSException.h4
-rw-r--r--common/rdr/TLSInStream.cxx10
-rw-r--r--common/rdr/TLSOutStream.cxx6
11 files changed, 49 insertions, 49 deletions
diff --git a/common/rdr/Exception.cxx b/common/rdr/Exception.cxx
index 65bd9720..694ee359 100644
--- a/common/rdr/Exception.cxx
+++ b/common/rdr/Exception.cxx
@@ -43,21 +43,21 @@
using namespace rdr;
-GAIException::GAIException(const char* s, int err_)
+getaddrinfo_error::getaddrinfo_error(const char* s, int err_)
: std::runtime_error(rfb::format("%s: %s (%d)", s,
strerror(err_).c_str(), err_)),
err(err_)
{
}
-GAIException::GAIException(const std::string& s, int err_)
+getaddrinfo_error::getaddrinfo_error(const std::string& s, int err_)
: std::runtime_error(rfb::format("%s: %s (%d)", s.c_str(),
strerror(err_).c_str(), err_)),
err(err_)
{
}
-std::string GAIException::strerror(int err_) const
+std::string getaddrinfo_error::strerror(int err_) const
{
#ifdef _WIN32
char str[256];
@@ -71,21 +71,21 @@ std::string GAIException::strerror(int err_) const
#endif
}
-PosixException::PosixException(const char* what_arg, int err_)
+posix_error::posix_error(const char* what_arg, int err_)
: std::runtime_error(rfb::format("%s: %s (%d)", what_arg,
strerror(err_).c_str(), err_)),
err(err_)
{
}
-PosixException::PosixException(const std::string& what_arg, int err_)
+posix_error::posix_error(const std::string& what_arg, int err_)
: std::runtime_error(rfb::format("%s: %s (%d)", what_arg.c_str(),
strerror(err_).c_str(), err_)),
err(err_)
{
}
-std::string PosixException::strerror(int err_) const
+std::string posix_error::strerror(int err_) const
{
#ifdef _WIN32
char str[256];
@@ -100,21 +100,21 @@ std::string PosixException::strerror(int err_) const
}
#ifdef WIN32
-Win32Exception::Win32Exception(const char* what_arg, unsigned err_)
+win32_error::win32_error(const char* what_arg, unsigned err_)
: std::runtime_error(rfb::format("%s: %s (%d)", what_arg,
strerror(err_).c_str(), err_)),
err(err_)
{
}
-Win32Exception::Win32Exception(const std::string& what_arg, unsigned err_)
+win32_error::win32_error(const std::string& what_arg, unsigned err_)
: std::runtime_error(rfb::format("%s: %s (%d)", what_arg.c_str(),
strerror(err_).c_str(), err_)),
err(err_)
{
}
-std::string Win32Exception::strerror(unsigned err_) const
+std::string win32_error::strerror(unsigned err_) const
{
wchar_t wstr[256];
char str[256];
diff --git a/common/rdr/Exception.h b/common/rdr/Exception.h
index 3e0ec467..f3f878cb 100644
--- a/common/rdr/Exception.h
+++ b/common/rdr/Exception.h
@@ -27,52 +27,52 @@
namespace rdr {
- class PosixException : public std::runtime_error {
+ class posix_error : public std::runtime_error {
public:
int err;
- PosixException(const char* what_arg, int err_);
- PosixException(const std::string& what_arg, int err_);
+ posix_error(const char* what_arg, int err_);
+ posix_error(const std::string& what_arg, int err_);
private:
std::string strerror(int err_) const;
};
#ifdef WIN32
- class Win32Exception : public std::runtime_error {
+ class win32_error : public std::runtime_error {
public:
unsigned err;
- Win32Exception(const char* what_arg, unsigned err_);
- Win32Exception(const std::string& what_arg, unsigned err_);
+ win32_error(const char* what_arg, unsigned err_);
+ win32_error(const std::string& what_arg, unsigned err_);
private:
std::string strerror(unsigned err_) const;
};
#endif
#ifdef WIN32
- class SocketException : public Win32Exception {
+ class socket_error : public win32_error {
public:
- SocketException(const char* what_arg, unsigned err_) : Win32Exception(what_arg, err_) {}
- SocketException(const std::string& what_arg, unsigned err_) : Win32Exception(what_arg, err_) {}
+ socket_error(const char* what_arg, unsigned err_) : win32_error(what_arg, err_) {}
+ socket_error(const std::string& what_arg, unsigned err_) : win32_error(what_arg, err_) {}
};
#else
- class SocketException : public PosixException {
+ class socket_error : public posix_error {
public:
- SocketException(const char* what_arg, unsigned err_) : PosixException(what_arg, err_) {}
- SocketException(const std::string& what_arg, unsigned err_) : PosixException(what_arg, err_) {}
+ socket_error(const char* what_arg, unsigned err_) : posix_error(what_arg, err_) {}
+ socket_error(const std::string& what_arg, unsigned err_) : posix_error(what_arg, err_) {}
};
#endif
- class GAIException : public std::runtime_error {
+ class getaddrinfo_error : public std::runtime_error {
public:
int err;
- GAIException(const char* s, int err_);
- GAIException(const std::string& s, int err_);
+ getaddrinfo_error(const char* s, int err_);
+ getaddrinfo_error(const std::string& s, int err_);
private:
std::string strerror(int err_) const;
};
- class EndOfStream : public std::runtime_error {
+ class end_of_stream : public std::runtime_error {
public:
- EndOfStream() : std::runtime_error("End of stream") {}
+ end_of_stream() : std::runtime_error("End of stream") {}
};
}
diff --git a/common/rdr/FdInStream.cxx b/common/rdr/FdInStream.cxx
index bddee482..23ea2f8c 100644
--- a/common/rdr/FdInStream.cxx
+++ b/common/rdr/FdInStream.cxx
@@ -92,7 +92,7 @@ size_t FdInStream::readFd(uint8_t* buf, size_t len)
} while (n < 0 && errorNumber == EINTR);
if (n < 0)
- throw SocketException("select", errorNumber);
+ throw socket_error("select", errorNumber);
if (n == 0)
return 0;
@@ -102,9 +102,9 @@ size_t FdInStream::readFd(uint8_t* buf, size_t len)
} while (n < 0 && errorNumber == EINTR);
if (n < 0)
- throw SocketException("read", errorNumber);
+ throw socket_error("read", errorNumber);
if (n == 0)
- throw EndOfStream();
+ throw end_of_stream();
return n;
}
diff --git a/common/rdr/FdOutStream.cxx b/common/rdr/FdOutStream.cxx
index 1b6049ca..6db8c0bb 100644
--- a/common/rdr/FdOutStream.cxx
+++ b/common/rdr/FdOutStream.cxx
@@ -117,7 +117,7 @@ size_t FdOutStream::writeFd(const uint8_t* data, size_t length)
} while (n < 0 && errorNumber == EINTR);
if (n < 0)
- throw SocketException("select", errorNumber);
+ throw socket_error("select", errorNumber);
if (n == 0)
return 0;
@@ -134,7 +134,7 @@ size_t FdOutStream::writeFd(const uint8_t* data, size_t length)
} while (n < 0 && (errorNumber == EINTR));
if (n < 0)
- throw SocketException("write", errorNumber);
+ throw socket_error("write", errorNumber);
gettimeofday(&lastWrite, nullptr);
diff --git a/common/rdr/FileInStream.cxx b/common/rdr/FileInStream.cxx
index db646a7e..df09ea76 100644
--- a/common/rdr/FileInStream.cxx
+++ b/common/rdr/FileInStream.cxx
@@ -33,7 +33,7 @@ FileInStream::FileInStream(const char *fileName)
{
file = fopen(fileName, "rb");
if (!file)
- throw PosixException("fopen", errno);
+ throw posix_error("fopen", errno);
}
FileInStream::~FileInStream(void) {
@@ -48,9 +48,9 @@ bool FileInStream::fillBuffer()
size_t n = fread((uint8_t*)end, 1, availSpace(), file);
if (n == 0) {
if (ferror(file))
- throw PosixException("fread", errno);
+ throw posix_error("fread", errno);
if (feof(file))
- throw EndOfStream();
+ throw end_of_stream();
return false;
}
end += n;
diff --git a/common/rdr/MemInStream.h b/common/rdr/MemInStream.h
index e10273b1..78ee2dee 100644
--- a/common/rdr/MemInStream.h
+++ b/common/rdr/MemInStream.h
@@ -59,7 +59,7 @@ namespace rdr {
private:
- bool overrun(size_t /*needed*/) override { throw EndOfStream(); }
+ bool overrun(size_t /*needed*/) override { throw end_of_stream(); }
const uint8_t* start;
bool deleteWhenDone;
};
diff --git a/common/rdr/RandomStream.cxx b/common/rdr/RandomStream.cxx
index 449a84c0..485259cf 100644
--- a/common/rdr/RandomStream.cxx
+++ b/common/rdr/RandomStream.cxx
@@ -89,7 +89,7 @@ bool RandomStream::fillBuffer() {
#ifdef RFB_HAVE_WINCRYPT
if (provider) {
if (!CryptGenRandom(provider, availSpace(), (uint8_t*)end))
- throw rdr::Win32Exception("unable to CryptGenRandom", GetLastError());
+ throw rdr::win32_error("unable to CryptGenRandom", GetLastError());
end += availSpace();
} else {
#else
@@ -97,8 +97,8 @@ bool RandomStream::fillBuffer() {
if (fp) {
size_t n = fread((uint8_t*)end, 1, availSpace(), fp);
if (n <= 0)
- throw rdr::PosixException("reading /dev/urandom or /dev/random failed",
- errno);
+ throw rdr::posix_error("reading /dev/urandom or /dev/random "
+ "failed", errno);
end += n;
} else {
#else
diff --git a/common/rdr/TLSException.cxx b/common/rdr/TLSException.cxx
index 7061f38b..ccff6090 100644
--- a/common/rdr/TLSException.cxx
+++ b/common/rdr/TLSException.cxx
@@ -35,7 +35,7 @@
using namespace rdr;
#ifdef HAVE_GNUTLS
-TLSException::TLSException(const char* s, int err_)
+tls_error::tls_error(const char* s, int err_)
: std::runtime_error(rfb::format("%s: %s (%d)", s,
gnutls_strerror(err_), err_)),
err(err_)
diff --git a/common/rdr/TLSException.h b/common/rdr/TLSException.h
index f58b618d..cfa73f69 100644
--- a/common/rdr/TLSException.h
+++ b/common/rdr/TLSException.h
@@ -25,10 +25,10 @@
namespace rdr {
- class TLSException : public std::runtime_error {
+ class tls_error : public std::runtime_error {
public:
int err;
- TLSException(const char* s, int err_);
+ tls_error(const char* s, int err_);
};
}
diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx
index 3418c68e..7c867e88 100644
--- a/common/rdr/TLSInStream.cxx
+++ b/common/rdr/TLSInStream.cxx
@@ -54,12 +54,12 @@ ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size)
size = in->avail();
in->readBytes((uint8_t*)data, size);
- } catch (EndOfStream&) {
+ } catch (end_of_stream&) {
return 0;
- } catch (SocketException& e) {
+ } catch (socket_error& e) {
vlog.error("Failure reading TLS data: %s", e.what());
gnutls_transport_set_errno(self->session, e.err);
- self->saved_exception = new SocketException(e);
+ self->saved_exception = new socket_error(e);
return -1;
} catch (std::exception& e) {
vlog.error("Failure reading TLS data: %s", e.what());
@@ -121,10 +121,10 @@ size_t TLSInStream::readTLS(uint8_t* buf, size_t len)
throw *saved_exception;
if (n < 0)
- throw TLSException("readTLS", n);
+ throw tls_error("readTLS", n);
if (n == 0)
- throw EndOfStream();
+ throw end_of_stream();
return n;
}
diff --git a/common/rdr/TLSOutStream.cxx b/common/rdr/TLSOutStream.cxx
index 4c6c3f47..1e555fc1 100644
--- a/common/rdr/TLSOutStream.cxx
+++ b/common/rdr/TLSOutStream.cxx
@@ -46,10 +46,10 @@ ssize_t TLSOutStream::push(gnutls_transport_ptr_t str, const void* data,
try {
out->writeBytes((const uint8_t*)data, size);
out->flush();
- } catch (SocketException& e) {
+ } catch (socket_error& e) {
vlog.error("Failure sending TLS data: %s", e.what());
gnutls_transport_set_errno(self->session, e.err);
- self->saved_exception = new SocketException(e);
+ self->saved_exception = new socket_error(e);
return -1;
} catch (std::exception& e) {
vlog.error("Failure sending TLS data: %s", e.what());
@@ -118,7 +118,7 @@ size_t TLSOutStream::writeTLS(const uint8_t* data, size_t length)
throw *saved_exception;
if (n < 0)
- throw TLSException("writeTLS", n);
+ throw tls_error("writeTLS", n);
return n;
}