Skip to content

Commit

Permalink
Capitalize first letter in log, exception & error
Browse files Browse the repository at this point in the history
The reason for this is to keep a consistency through out the project.
  • Loading branch information
madnicendio committed Nov 11, 2024
1 parent 5b74bf1 commit 58257d3
Show file tree
Hide file tree
Showing 48 changed files with 212 additions and 212 deletions.
24 changes: 12 additions & 12 deletions common/network/TcpSocket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const char* TcpSocket::getPeerAddress() {
socklen_t sa_size = sizeof(sa);

if (getpeername(getFd(), &sa.u.sa, &sa_size) != 0) {
vlog.error("unable to get peer name for socket");
vlog.error("Unable to get peer name for socket");
return "(N/A)";
}

Expand All @@ -231,7 +231,7 @@ const char* TcpSocket::getPeerAddress() {
buffer + 1, sizeof(buffer) - 2, nullptr, 0,
NI_NUMERICHOST);
if (ret != 0) {
vlog.error("unable to convert peer name to a string");
vlog.error("Unable to convert peer name to a string");
return "(N/A)";
}

Expand All @@ -245,14 +245,14 @@ const char* TcpSocket::getPeerAddress() {

name = inet_ntoa(sa.u.sin.sin_addr);
if (name == nullptr) {
vlog.error("unable to convert peer name to a string");
vlog.error("Unable to convert peer name to a string");
return "(N/A)";
}

return name;
}

vlog.error("unknown address family for socket");
vlog.error("Unknown address family for socket");
return "";
}

Expand Down Expand Up @@ -281,7 +281,7 @@ bool TcpSocket::enableNagles(bool enable) {
if (setsockopt(getFd(), IPPROTO_TCP, TCP_NODELAY,
(char *)&one, sizeof(one)) < 0) {
int e = errorNumber;
vlog.error("unable to setsockopt TCP_NODELAY: %d", e);
vlog.error("Unable to setsockopt TCP_NODELAY: %d", e);
return false;
}
return true;
Expand All @@ -299,15 +299,15 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr,
int sock;

if ((sock = socket (listenaddr->sa_family, SOCK_STREAM, 0)) < 0)
throw SocketException("unable to create listening socket", errorNumber);
throw SocketException("Unable to create listening socket", errorNumber);

memcpy (&sa, listenaddr, listenaddrlen);
#ifdef IPV6_V6ONLY
if (listenaddr->sa_family == AF_INET6) {
if (setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&one, sizeof(one))) {
int e = errorNumber;
closesocket(sock);
throw SocketException("unable to set IPV6_V6ONLY", e);
throw SocketException("Unable to set IPV6_V6ONLY", e);
}
}
#endif /* defined(IPV6_V6ONLY) */
Expand All @@ -325,14 +325,14 @@ TcpListener::TcpListener(const struct sockaddr *listenaddr,
(char *)&one, sizeof(one)) < 0) {
int e = errorNumber;
closesocket(sock);
throw SocketException("unable to create listening socket", e);
throw SocketException("Unable to create listening socket", e);
}
#endif

if (bind(sock, &sa.u.sa, listenaddrlen) == -1) {
int e = errorNumber;
closesocket(sock);
throw SocketException("failed to bind socket", e);
throw SocketException("Failed to bind socket", e);
}

listen(sock);
Expand Down Expand Up @@ -443,7 +443,7 @@ void network::createTcpListeners(std::list<SocketListener*> *listeners,
snprintf (service, sizeof (service) - 1, "%d", port);
service[sizeof (service) - 1] = '\0';
if ((result = getaddrinfo(addr, service, &hints, &ai)) != 0)
throw GAIException("unable to resolve listening address", result);
throw GAIException("Unable to resolve listening address", result);

try {
createTcpListeners(listeners, ai);
Expand Down Expand Up @@ -630,7 +630,7 @@ TcpFilter::Pattern TcpFilter::parsePattern(const char* p) {
}

if ((result = getaddrinfo (parts[0].c_str(), nullptr, &hints, &ai)) != 0) {
throw GAIException("unable to resolve host by name", result);
throw GAIException("Unable to resolve host by name", result);
}

memcpy (&pattern.address.u.sa, ai->ai_addr, ai->ai_addrlen);
Expand All @@ -641,7 +641,7 @@ TcpFilter::Pattern TcpFilter::parsePattern(const char* p) {
if (parts.size() > 1) {
if (family == AF_INET &&
(parts[1].find('.') != std::string::npos)) {
throw Exception("mask no longer supported for filter, "
throw Exception("Mask no longer supported for filter, "
"use prefix instead");
}

Expand Down
12 changes: 6 additions & 6 deletions common/network/UnixSocket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ UnixSocket::UnixSocket(const char *path)
}

if (result == -1)
throw SocketException("unable to connect to socket", err);
throw SocketException("Unable to connect to socket", err);

setFd(sock);
}
Expand All @@ -84,7 +84,7 @@ const char* UnixSocket::getPeerAddress() {

salen = sizeof(addr);
if (getpeername(getFd(), (struct sockaddr *)&addr, &salen) != 0) {
vlog.error("unable to get peer name for socket");
vlog.error("Unable to get peer name for socket");
return "";
}

Expand All @@ -93,7 +93,7 @@ const char* UnixSocket::getPeerAddress() {

salen = sizeof(addr);
if (getsockname(getFd(), (struct sockaddr *)&addr, &salen) != 0) {
vlog.error("unable to get local name for socket");
vlog.error("Unable to get local name for socket");
return "";
}

Expand All @@ -120,7 +120,7 @@ UnixListener::UnixListener(const char *path, int mode)

// - Create a socket
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
throw SocketException("unable to create listening socket", errno);
throw SocketException("Unable to create listening socket", errno);

// - Delete existing socket (ignore result)
unlink(path);
Expand All @@ -135,14 +135,14 @@ UnixListener::UnixListener(const char *path, int mode)
umask(saved_umask);
if (result < 0) {
close(fd);
throw SocketException("unable to bind listening socket", err);
throw SocketException("Unable to bind listening socket", err);
}

// - Set socket mode
if (chmod(path, mode) < 0) {
err = errno;
close(fd);
throw SocketException("unable to set socket mode", err);
throw SocketException("Unable to set socket mode", err);
}

listen(fd);
Expand Down
10 changes: 5 additions & 5 deletions common/rdr/RandomStream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ RandomStream::RandomStream()
if (GetLastError() == (DWORD)NTE_BAD_KEYSET) {
if (!CryptAcquireContext(&provider, nullptr, nullptr,
PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
vlog.error("unable to create keyset");
vlog.error("Unable to create keyset");
provider = 0;
}
} else {
vlog.error("unable to acquire context");
vlog.error("Unable to acquire context");
provider = 0;
}
}
Expand All @@ -69,7 +69,7 @@ RandomStream::RandomStream()
{
#endif
#endif
vlog.error("no OS supplied random source - using rand()");
vlog.error("No OS supplied random sourcer, using rand()");
seed += (unsigned int) time(nullptr) + getpid() + getpid() * 987654 + rand();
srand(seed);
}
Expand All @@ -89,15 +89,15 @@ 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::Win32Exception("Unable to CryptGenRandom", GetLastError());
end += availSpace();
} else {
#else
#ifndef WIN32
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",
throw rdr::PosixException("Reading /dev/urandom or /dev/random failed",
errno);
end += n;
} else {
Expand Down
8 changes: 4 additions & 4 deletions common/rdr/ZlibOutStream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool ZlibOutStream::flushBuffer()
zs->avail_in = ptr - sentUpTo;

#ifdef ZLIBOUT_DEBUG
vlog.debug("flush: avail_in %d",zs->avail_in);
vlog.debug("Flush: avail_in %d",zs->avail_in);
#endif

// Force out everything from the zlib encoder
Expand All @@ -124,7 +124,7 @@ void ZlibOutStream::deflate(int flush)
zs->avail_out = chunk = underlying->avail();

#ifdef ZLIBOUT_DEBUG
vlog.debug("calling deflate, avail_in %d, avail_out %d",
vlog.debug("Calling deflate, avail_in %d, avail_out %d",
zs->avail_in,zs->avail_out);
#endif

Expand All @@ -138,7 +138,7 @@ void ZlibOutStream::deflate(int flush)
}

#ifdef ZLIBOUT_DEBUG
vlog.debug("after deflate: %d bytes",
vlog.debug("After deflate: %d bytes",
zs->next_out-underlying->getptr());
#endif

Expand All @@ -152,7 +152,7 @@ void ZlibOutStream::checkCompressionLevel()

if (newLevel != compressionLevel) {
#ifdef ZLIBOUT_DEBUG
vlog.debug("change: avail_in %d",zs->avail_in);
vlog.debug("Change: avail_in %d",zs->avail_in);
#endif

// zlib is just horribly stupid. It does an implicit flush on
Expand Down
18 changes: 9 additions & 9 deletions common/rfb/CConnection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ bool CConnection::processVersionMsg()
int majorVersion;
int minorVersion;

vlog.debug("reading protocol version");
vlog.debug("Reading protocol version");

if (!is->hasData(12))
return false;
Expand Down Expand Up @@ -209,7 +209,7 @@ bool CConnection::processVersionMsg()

bool CConnection::processSecurityTypesMsg()
{
vlog.debug("processing security types message");
vlog.debug("Processing security types message");

int secType = secTypeInvalid;

Expand Down Expand Up @@ -294,7 +294,7 @@ bool CConnection::processSecurityTypesMsg()

bool CConnection::processSecurityMsg()
{
vlog.debug("processing security message");
vlog.debug("Processing security message");
if (!csecurity->processMsg())
return false;

Expand All @@ -305,7 +305,7 @@ bool CConnection::processSecurityMsg()

bool CConnection::processSecurityResultMsg()
{
vlog.debug("processing security result message");
vlog.debug("Processing security result message");
int result;

if (server.beforeVersion(3,8) && csecurity->getType() == secTypeNone) {
Expand All @@ -321,10 +321,10 @@ bool CConnection::processSecurityResultMsg()
securityCompleted();
return true;
case secResultFailed:
vlog.debug("auth failed");
vlog.debug("Auth failed");
break;
case secResultTooMany:
vlog.debug("auth failed - too many tries");
vlog.debug("Auth failed: Too many tries");
break;
default:
throw Exception("Unknown security result from server");
Expand All @@ -341,7 +341,7 @@ bool CConnection::processSecurityResultMsg()

bool CConnection::processSecurityReasonMsg()
{
vlog.debug("processing security reason message");
vlog.debug("Processing security reason message");

if (!is->hasData(4))
return false;
Expand All @@ -363,7 +363,7 @@ bool CConnection::processSecurityReasonMsg()

bool CConnection::processInitMsg()
{
vlog.debug("reading server initialisation");
vlog.debug("Reading server initialisation");
return reader_->readServerInit();
}

Expand Down Expand Up @@ -460,7 +460,7 @@ void CConnection::serverInit(int width, int height,
CMsgHandler::serverInit(width, height, pf, name);

state_ = RFBSTATE_NORMAL;
vlog.debug("initialisation done");
vlog.debug("Initialisation done");

initDone();
assert(framebuffer != nullptr);
Expand Down
4 changes: 2 additions & 2 deletions common/rfb/CMsgReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ bool CMsgReader::readServerCutText()

if (len > (size_t)maxCutText) {
is->skip(len);
vlog.error("cut text too long (%d bytes) - ignoring",len);
vlog.error("Cut text too long (%d bytes) - ignoring",len);
return true;
}

Expand Down Expand Up @@ -477,7 +477,7 @@ bool CMsgReader::readRect(const Rect& r, int encoding)
}

if (r.is_empty())
vlog.error("zero size rect");
vlog.error("Zero size rect");

return handler->dataRect(r, encoding);
}
Expand Down
4 changes: 2 additions & 2 deletions common/rfb/CSecurityTLS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ void CSecurityTLS::checkSession()
return;

if (gnutls_certificate_type_get(session) != GNUTLS_CRT_X509)
throw Exception("unsupported certificate type");
throw Exception("Unsupported certificate type");

err = gnutls_certificate_verify_peers2(session, &status);
if (err != 0) {
vlog.error("server certificate verification failed: %s", gnutls_strerror(err));
vlog.error("Server certificate verification failed: %s", gnutls_strerror(err));
throw rdr::TLSException("server certificate verification()", err);
}

Expand Down
12 changes: 6 additions & 6 deletions common/rfb/Configuration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ bool VoidParameter::isBool() const {

void
VoidParameter::setImmutable() {
vlog.debug("set immutable %s", getName());
vlog.debug("Set immutable %s", getName());
immutable = true;
}

Expand Down Expand Up @@ -270,7 +270,7 @@ bool AliasParameter::isBool() const {

void
AliasParameter::setImmutable() {
vlog.debug("set immutable %s (Alias)", getName());
vlog.debug("Set immutable %s (Alias)", getName());
param->setImmutable();
}

Expand Down Expand Up @@ -308,7 +308,7 @@ bool BoolParameter::setParam() {
void BoolParameter::setParam(bool b) {
if (immutable) return;
value = b;
vlog.debug("set %s(Bool) to %d", getName(), value);
vlog.debug("Set %s(Bool) to %d", getName(), value);
}

std::string BoolParameter::getDefaultStr() const {
Expand Down Expand Up @@ -345,7 +345,7 @@ IntParameter::setParam(const char* v) {
bool
IntParameter::setParam(int v) {
if (immutable) return true;
vlog.debug("set %s(Int) to %d", getName(), v);
vlog.debug("Set %s(Int) to %d", getName(), v);
if (v < minValue || v > maxValue)
return false;
value = v;
Expand Down Expand Up @@ -388,7 +388,7 @@ bool StringParameter::setParam(const char* v) {
if (immutable) return true;
if (!v)
throw rfb::Exception("setParam(<null>) not allowed");
vlog.debug("set %s(String) to %s", getName(), v);
vlog.debug("Set %s(String) to %s", getName(), v);
value = v;
return true;
}
Expand Down Expand Up @@ -439,7 +439,7 @@ bool BinaryParameter::setParam(const char* v) {
void BinaryParameter::setParam(const uint8_t* v, size_t len) {
LOCK_CONFIG;
if (immutable) return;
vlog.debug("set %s(Binary)", getName());
vlog.debug("Set %s(Binary)", getName());
delete [] value;
value = nullptr;
length = 0;
Expand Down
Loading

0 comments on commit 58257d3

Please sign in to comment.