Skip to content

Commit

Permalink
Capitalize even more logging and exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
CendioOssman committed Nov 22, 2024
1 parent 213c12c commit 44f6771
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 57 deletions.
14 changes: 7 additions & 7 deletions unix/vncconfig/vncconfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class VncConfigWindow : public TXWindow, public TXEventHandler,

static void usage()
{
fprintf(stderr,"usage: %s [parameters]\n",
fprintf(stderr,"Usage: %s [parameters]\n",
programName);
fprintf(stderr," %s [parameters] -connect "
"[-view-only] <host>[:<port>]\n", programName);
Expand Down Expand Up @@ -248,11 +248,11 @@ int main(int argc, char** argv)
}
if (i >= argc) usage();
if (!XVncExtConnect(dpy, argv[i], viewOnly)) {
fprintf(stderr,"connecting to %s failed\n",argv[i]);
fprintf(stderr, "Connecting to %s failed\n",argv[i]);
}
} else if (strcmp(argv[i], "-disconnect") == 0) {
if (!XVncExtConnect(dpy, "", False)) {
fprintf(stderr,"disconnecting all clients failed\n");
fprintf(stderr, "Disconnecting all clients failed\n");
}
} else if (strcmp(argv[i], "-get") == 0) {
i++;
Expand All @@ -262,7 +262,7 @@ int main(int argc, char** argv)
if (XVncExtGetParam(dpy, argv[i], &data, &len)) {
printf("%.*s\n",len,data);
} else {
fprintf(stderr,"getting param %s failed\n",argv[i]);
fprintf(stderr, "Getting param %s failed\n",argv[i]);
}
XFree(data);
} else if (strcmp(argv[i], "-desc") == 0) {
Expand All @@ -272,7 +272,7 @@ int main(int argc, char** argv)
if (desc) {
printf("%s\n",desc);
} else {
fprintf(stderr,"getting description for param %s failed\n",argv[i]);
fprintf(stderr, "Getting description for param %s failed\n",argv[i]);
}
XFree(desc);
} else if (strcmp(argv[i], "-list") == 0) {
Expand All @@ -286,10 +286,10 @@ int main(int argc, char** argv)
i++;
if (i >= argc) usage();
if (!XVncExtSetParam(dpy, argv[i])) {
fprintf(stderr,"setting param %s failed\n",argv[i]);
fprintf(stderr, "Setting param %s failed\n",argv[i]);
}
} else if (XVncExtSetParam(dpy, argv[i])) {
fprintf(stderr,"set parameter %s\n",argv[i]);
fprintf(stderr, "Set parameter %s\n",argv[i]);
} else {
usage();
}
Expand Down
2 changes: 1 addition & 1 deletion unix/vncpasswd/vncpasswd.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ char* prog;

static void usage()
{
fprintf(stderr,"usage: %s [file]\n", prog);
fprintf(stderr,"Usage: %s [file]\n", prog);
fprintf(stderr," %s -f\n", prog);
exit(1);
}
Expand Down
6 changes: 3 additions & 3 deletions unix/x0vncserver/x0vncserver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ BoolParameter localhostOnly("localhost",
"Only allow connections from localhost",
false);
StringParameter interface("interface",
"listen on the specified network address",
"Listen on the specified network address",
"all");

static const char* defaultDesktopName()
Expand Down Expand Up @@ -169,7 +169,7 @@ class FileTcpFilter : public TcpFilter
bool verifyConnection(Socket* s) override
{
if (!reloadRules()) {
vlog.error("Could not read IP filtering rules: rejecting all clients");
vlog.error("Could not read IP filtering rules, rejecting all clients");
filter.clear();
filter.push_back(parsePattern("-"));
return false;
Expand Down Expand Up @@ -310,7 +310,7 @@ int main(int argc, char** argv)

if (!(dpy = XOpenDisplay(displayname))) {
// FIXME: Why not vlog.error(...)?
fprintf(stderr,"%s: unable to open display \"%s\"\r\n",
fprintf(stderr,"%s: Unable to open display \"%s\"\r\n",
programName, XDisplayName(displayname));
exit(1);
}
Expand Down
6 changes: 3 additions & 3 deletions unix/xserver/hw/vnc/vncExtInit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ rfb::BoolParameter localhostOnly("localhost",
"Only allow connections from localhost",
false);
rfb::StringParameter interface("interface",
"listen on the specified network address",
"Listen on the specified network address",
"all");
rfb::BoolParameter avoidShiftNumLock("AvoidShiftNumLock",
"Avoid fake Shift presses for keys affected by NumLock.",
Expand Down Expand Up @@ -173,13 +173,13 @@ static void parseOverrideList(const char *text, ParamSet &out)
void vncExtensionInit(void)
{
if (vncExtGeneration == vncGetServerGeneration()) {
vlog.error("vncExtensionInit: called twice in same generation?");
vlog.error("vncExtensionInit: Called twice in same generation?");
return;
}
vncExtGeneration = vncGetServerGeneration();

if (vncGetScreenCount() > MAXSCREENS)
vncFatalError("vncExtensionInit: too many screens\n");
vncFatalError("vncExtensionInit: Too many screens\n");

vncAddExtension();

Expand Down
4 changes: 2 additions & 2 deletions unix/xserver/hw/vnc/vncHooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ static Bool vncHooksCloseScreen(ScreenPtr pScreen_)
unwrap(vncHooksScreen, rp, rrCrtcSet);
}

DBGPRINT((stderr,"vncHooksCloseScreen: unwrapped screen functions\n"));
DBGPRINT((stderr,"vncHooksCloseScreen: Unwrapped screen functions\n"));

return (*pScreen->CloseScreen)(pScreen);
}
Expand Down Expand Up @@ -1214,7 +1214,7 @@ static void vncHooksValidateGC(GCPtr pGC, unsigned long changes,
(*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
if (is_visible(pDrawable)) {
pGCPriv->ops = pGC->ops;
DBGPRINT((stderr,"vncHooksValidateGC: wrapped GC ops\n"));
DBGPRINT((stderr,"vncHooksValidateGC: Wrapped GC ops\n"));
} else {
pGCPriv->ops = NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions unix/xserver/hw/vnc/xvnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ ddxProcessArgument(int argc, char *argv[], int i)

if ((vncInetdSock = dup(0)) == -1)
FatalError
("Xvnc error: failed to allocate a new file descriptor for -inetd: %s\n", strerror(errno));
("Xvnc error: Failed to allocate a new file descriptor for -inetd: %s\n", strerror(errno));


/* Avoid xserver >= 1.19's epoll-fd becoming fd 2 / stderr only to be
Expand All @@ -396,7 +396,7 @@ ddxProcessArgument(int argc, char *argv[], int i)

if (displayNum == 100)
FatalError
("Xvnc error: no free display number for -inetd\n");
("Xvnc error: No free display number for -inetd\n");
}

display = displayNumStr;
Expand Down
2 changes: 1 addition & 1 deletion vncviewer/vncviewer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ static void usage(const char *programName)

fprintf(stderr,
"\n"
"usage: %s [parameters] [host][:displayNum]\n"
"Usage: %s [parameters] [host][:displayNum]\n"
" %s [parameters] [host][::port]\n"
#ifndef WIN32
" %s [parameters] [unix socket]\n"
Expand Down
2 changes: 1 addition & 1 deletion win/rfb_win32/CleanDesktop.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct ActiveDesktop {
HRESULT result = CoCreateInstance(CLSID_ActiveDesktop, nullptr, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (PVOID*)&handle);
if (result != S_OK)
throw rdr::win32_error("failed to contact Active Desktop", HRESULT_CODE(result));
throw rdr::win32_error("Failed to contact Active Desktop", HRESULT_CODE(result));
}
~ActiveDesktop() {
if (handle)
Expand Down
6 changes: 3 additions & 3 deletions win/rfb_win32/Clipboard.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Clipboard::setClipText(const char* text) {

// - Firstly, we must open the clipboard
if (!OpenClipboard(getHandle()))
throw rdr::win32_error("unable to open Win32 clipboard", GetLastError());
throw rdr::win32_error("Unable to open Win32 clipboard", GetLastError());

// - Convert the supplied clipboard text into UTF-16 format with CRLF
std::string filtered(convertCRLF(text));
Expand All @@ -144,11 +144,11 @@ Clipboard::setClipText(const char* text) {

// - Next, we must clear out any existing data
if (!EmptyClipboard())
throw rdr::win32_error("unable to empty Win32 clipboard", GetLastError());
throw rdr::win32_error("Unable to empty Win32 clipboard", GetLastError());

// - Set the new clipboard data
if (!SetClipboardData(CF_UNICODETEXT, clip_handle))
throw rdr::win32_error("unable to set Win32 clipboard", GetLastError());
throw rdr::win32_error("Unable to set Win32 clipboard", GetLastError());
clip_handle = nullptr;

vlog.debug("Set clipboard");
Expand Down
4 changes: 2 additions & 2 deletions win/rfb_win32/DIBSectionBuffer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) {
uint8_t* new_data = nullptr;

if (!pf.trueColour)
throw std::invalid_argument("palette format not supported");
throw std::invalid_argument("Palette format not supported");

format = pf;

Expand Down Expand Up @@ -87,7 +87,7 @@ void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) {

if (!new_bitmap) {
int err = GetLastError();
throw rdr::win32_error("unable to create DIB section", err);
throw rdr::win32_error("Unable to create DIB section", err);
}

vlog.debug("recreateBuffer()");
Expand Down
10 changes: 5 additions & 5 deletions win/rfb_win32/DeviceContext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ PixelFormat DeviceContext::getPF(HDC dc) {
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biBitCount = 0;
if (!::GetDIBits(dc, bitmap, 0, 1, nullptr, (BITMAPINFO*)&bi, DIB_RGB_COLORS)) {
throw rdr::win32_error("unable to determine device pixel format", GetLastError());
throw rdr::win32_error("Unable to determine device pixel format", GetLastError());
}
if (!::GetDIBits(dc, bitmap, 0, 1, nullptr, (BITMAPINFO*)&bi, DIB_RGB_COLORS)) {
throw rdr::win32_error("unable to determine pixel shifts/palette", GetLastError());
throw rdr::win32_error("Unable to determine pixel shifts/palette", GetLastError());
}

// Set the initial format information
Expand Down Expand Up @@ -87,7 +87,7 @@ PixelFormat DeviceContext::getPF(HDC dc) {
break;
default:
vlog.error("Bits per pixel %u not supported", bi.bmiHeader.biBitCount);
throw std::invalid_argument("unknown bits per pixel specified");
throw std::invalid_argument("Unknown bits per pixel specified");
};
break;
case BI_BITFIELDS:
Expand Down Expand Up @@ -115,7 +115,7 @@ PixelFormat DeviceContext::getPF(HDC dc) {

// Check that the depth & bpp are valid
if (depth > bpp) {
vlog.error("depth exceeds bits per pixel!");
vlog.error("Depth exceeds bits per pixel!");
bpp = depth;
}

Expand Down Expand Up @@ -159,7 +159,7 @@ Rect DeviceContext::getClipBox(HDC dc) {
DeviceDC::DeviceDC(const char* deviceName) {
dc = ::CreateDC("DISPLAY", deviceName, nullptr, nullptr);
if (!dc)
throw rdr::win32_error("failed to create DeviceDC", GetLastError());
throw rdr::win32_error("Failed to create DeviceDC", GetLastError());
}

DeviceDC::~DeviceDC() {
Expand Down
12 changes: 6 additions & 6 deletions win/rfb_win32/DeviceFrameBuffer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ DeviceFrameBuffer::DeviceFrameBuffer(HDC deviceContext, const Rect& wRect)

int capabilities = GetDeviceCaps(device, RASTERCAPS);
if (!(capabilities & RC_BITBLT)) {
throw std::invalid_argument("device does not support BitBlt");
throw std::invalid_argument("Device does not support BitBlt");
}
if (!(capabilities & RC_DI_BITMAP)) {
throw std::invalid_argument("device does not support GetDIBits");
throw std::invalid_argument("Device does not support GetDIBits");
}
/*
if (GetDeviceCaps(device, PLANES) != 1) {
throw std::invalid_argument("device does not support planar displays");
throw std::invalid_argument("Device does not support planar displays");
}
*/

Expand Down Expand Up @@ -140,9 +140,9 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
if (!GetObject(iconInfo.hbmMask, sizeof(BITMAP), &maskInfo))
throw rdr::win32_error("GetObject() failed", GetLastError());
if (maskInfo.bmPlanes != 1)
throw std::invalid_argument("unsupported multi-plane cursor");
throw std::invalid_argument("Unsupported multi-plane cursor");
if (maskInfo.bmBitsPixel != 1)
throw std::invalid_argument("unsupported cursor mask format");
throw std::invalid_argument("Unsupported cursor mask format");

width = maskInfo.bmWidth;
height = maskInfo.bmHeight;
Expand Down Expand Up @@ -188,7 +188,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
if ((bi.bV5RedMask != ((unsigned)0xff << ridx*8)) ||
(bi.bV5GreenMask != ((unsigned)0xff << gidx*8)) ||
(bi.bV5BlueMask != ((unsigned)0xff << bidx*8)))
throw std::invalid_argument("unsupported cursor colour format");
throw std::invalid_argument("Unsupported cursor colour format");

uint8_t* rwbuffer = buffer.data();
for (int y = 0; y < height; y++) {
Expand Down
8 changes: 4 additions & 4 deletions win/rfb_win32/Dialog.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int Dialog::getItemInt(int id) {
BOOL trans;
int result = GetDlgItemInt(handle, id, &trans, TRUE);
if (!trans)
throw std::runtime_error("unable to read dialog Int");
throw std::runtime_error("Unable to read dialog Int");
return result;
}
const char* Dialog::getItemString(int id) {
Expand Down Expand Up @@ -277,12 +277,12 @@ bool PropSheet::showPropSheet(HWND owner_, bool showApply, bool showCtxtHelp, bo
if ((handle == nullptr) || (handle == (HWND)-1))
throw rdr::win32_error("PropertySheet failed", GetLastError());
centerWindow(handle, owner_);
plog.info("created %p", handle);
plog.info("Created %p", handle);

(void)capture;
#ifdef _DIALOG_CAPTURE
if (capture) {
plog.info("capturing \"%s\"", title.c_str());
plog.info("Capturing \"%s\"", title.c_str());
char* tmpdir = getenv("TEMP");
HDC dc = GetWindowDC(handle);
DeviceFrameBuffer fb(dc);
Expand Down Expand Up @@ -335,7 +335,7 @@ bool PropSheet::showPropSheet(HWND owner_, bool showApply, bool showCtxtHelp, bo
}
#endif

plog.info("finished %p", handle);
plog.info("Finished %p", handle);

DestroyWindow(handle);
handle = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions win/rfb_win32/LaunchProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void LaunchProcess::start(HANDLE userToken, bool createConsole) {
char buf[256];
HDESK desktop = GetThreadDesktop(GetCurrentThreadId());
if (!GetUserObjectInformation(desktop, UOI_NAME, buf, 256, &size))
throw rdr::win32_error("unable to launch process", GetLastError());
throw rdr::win32_error("Unable to launch process", GetLastError());

snprintf(desktopName, 256, "WinSta0\\%s", buf);

Expand Down Expand Up @@ -95,7 +95,7 @@ void LaunchProcess::start(HANDLE userToken, bool createConsole) {
flags, nullptr, nullptr,
&sinfo, &procInfo);
if (!success)
throw rdr::win32_error("unable to launch process", GetLastError());
throw rdr::win32_error("Unable to launch process", GetLastError());

// Wait for it to finish initialising
WaitForInputIdle(procInfo.hProcess, 15000);
Expand Down
6 changes: 3 additions & 3 deletions win/rfb_win32/MonitorInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static void fillMonitorInfo(HMONITOR monitor, MONITORINFOEXA* mi) {
memset(mi, 0, sizeof(MONITORINFOEXA));
mi->cbSize = sizeof(MONITORINFOEXA);
if (!GetMonitorInfo(monitor, mi))
throw rdr::win32_error("failed to GetMonitorInfo", GetLastError());
throw rdr::win32_error("Failed to GetMonitorInfo", GetLastError());
vlog.debug("Monitor is %ld,%ld-%ld,%ld", mi->rcMonitor.left, mi->rcMonitor.top, mi->rcMonitor.right, mi->rcMonitor.bottom);
vlog.debug("Work area is %ld,%ld-%ld,%ld", mi->rcWork.left, mi->rcWork.top, mi->rcWork.right, mi->rcWork.bottom);
vlog.debug("Device is \"%s\"", mi->szDevice);
Expand All @@ -57,7 +57,7 @@ MonitorInfo::MonitorInfo(HWND window) {

HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST);
if (!monitor)
throw rdr::win32_error("failed to get monitor", GetLastError());
throw rdr::win32_error("Failed to get monitor", GetLastError());
fillMonitorInfo(monitor, this);
}

Expand All @@ -67,7 +67,7 @@ MonitorInfo::MonitorInfo(const RECT& r) {

HMONITOR monitor = MonitorFromRect(&r, MONITOR_DEFAULTTONEAREST);
if (!monitor)
throw rdr::win32_error("failed to get monitor", GetLastError());
throw rdr::win32_error("Failed to get monitor", GetLastError());
fillMonitorInfo(monitor, this);
}

Expand Down
4 changes: 2 additions & 2 deletions win/rfb_win32/MsgWindow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ MsgWindowClass::MsgWindowClass() : classAtom(0) {
wndClass.lpszClassName = "rfb::win32::MsgWindowClass";
classAtom = RegisterClass(&wndClass);
if (!classAtom) {
throw rdr::win32_error("unable to register MsgWindow window class", GetLastError());
throw rdr::win32_error("Unable to register MsgWindow window class", GetLastError());
}
}

Expand All @@ -104,7 +104,7 @@ MsgWindow::MsgWindow(const char* name_) : name(name_), handle(nullptr) {
name.c_str(), WS_OVERLAPPED, 0, 0, 10, 10,
nullptr, nullptr, baseClass.instance, this);
if (!handle) {
throw rdr::win32_error("unable to create WMNotifier window instance", GetLastError());
throw rdr::win32_error("Unable to create WMNotifier window instance", GetLastError());
}
vlog.debug("Created window \"%s\" (%p)", name.c_str(), handle);
}
Expand Down
Loading

0 comments on commit 44f6771

Please sign in to comment.