From 9e9083cbedc0e98a03a0da370dd49375dc1cdc91 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 3 Sep 2024 07:31:15 +0200 Subject: [PATCH] Subclass exceptions from std::exception Make sure our exceptions are part of the standard exception class hierarchy. --- common/rdr/Exception.cxx | 10 --------- common/rdr/Exception.h | 13 +++++------ common/rdr/TLSInStream.cxx | 4 ++-- common/rdr/TLSInStream.h | 2 +- common/rdr/TLSOutStream.cxx | 4 ++-- common/rdr/TLSOutStream.h | 2 +- common/rdr/ZlibOutStream.cxx | 2 +- common/rfb/CConnection.cxx | 2 +- common/rfb/DecodeManager.cxx | 8 +++---- common/rfb/DecodeManager.h | 5 ++--- common/rfb/SConnection.cxx | 4 ++-- common/rfb/VNCSConnectionST.cxx | 32 +++++++++++++-------------- common/rfb/VNCServerST.cxx | 2 +- tests/perf/encperf.cxx | 4 ++-- tests/unit/pixelformat.cxx | 2 +- unix/vncconfig/vncconfig.cxx | 2 +- unix/x0vncserver/XDesktop.cxx | 2 +- unix/x0vncserver/x0vncserver.cxx | 2 +- unix/xserver/hw/vnc/RFBGlue.cc | 2 +- unix/xserver/hw/vnc/XserverDesktop.cc | 21 +++++++++--------- unix/xserver/hw/vnc/vncExtInit.cc | 18 +++++++-------- vncviewer/CConn.cxx | 4 ++-- vncviewer/ServerDialog.cxx | 12 +++++----- vncviewer/Viewport.cxx | 14 ++++++------ vncviewer/parameters.cxx | 16 +++++++------- vncviewer/touch.cxx | 3 +-- vncviewer/vncviewer.cxx | 10 ++++----- vncviewer/vncviewer.h | 6 +---- win/rfb_win32/CleanDesktop.cxx | 12 +++++----- win/rfb_win32/Clipboard.cxx | 2 +- win/rfb_win32/DeviceFrameBuffer.cxx | 2 +- win/rfb_win32/Dialog.cxx | 2 +- win/rfb_win32/MsgWindow.cxx | 2 +- win/rfb_win32/RegConfig.cxx | 2 +- win/rfb_win32/Registry.cxx | 8 +++---- win/rfb_win32/SDisplay.cxx | 6 ++--- win/rfb_win32/SocketManager.cxx | 4 ++-- win/vncconfig/Connections.h | 4 ++-- win/vncconfig/Legacy.cxx | 10 ++++----- win/vncconfig/vncconfig.cxx | 2 +- win/winvnc/ManagedListener.cxx | 2 +- win/winvnc/STrayIcon.cxx | 2 +- win/winvnc/VNCServerWin32.cxx | 2 +- win/winvnc/winvnc.cxx | 4 ++-- 44 files changed, 128 insertions(+), 146 deletions(-) diff --git a/common/rdr/Exception.cxx b/common/rdr/Exception.cxx index 53637cac..b2c7e7d0 100644 --- a/common/rdr/Exception.cxx +++ b/common/rdr/Exception.cxx @@ -42,16 +42,6 @@ using namespace rdr; -Exception::Exception(const char *message) -{ - snprintf(str_, sizeof(str_), "%s", message); -} - -Exception::Exception(const std::string& message) -{ - snprintf(str_, sizeof(str_), "%s", message.c_str()); -} - GAIException::GAIException(const char* s, int err_) : Exception(rfb::format("%s: %s (%d)", s, strerror(err_).c_str(), err_)), diff --git a/common/rdr/Exception.h b/common/rdr/Exception.h index bdb2061c..9ce0462a 100644 --- a/common/rdr/Exception.h +++ b/common/rdr/Exception.h @@ -1,6 +1,7 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright (C) 2004 Red Hat Inc. * Copyright (C) 2010 TigerVNC Team + * Copyright 2015-2024 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,17 +22,15 @@ #ifndef __RDR_EXCEPTION_H__ #define __RDR_EXCEPTION_H__ +#include #include namespace rdr { - struct Exception { - Exception(const char* message); - Exception(const std::string& message); - virtual ~Exception() {} - virtual const char* what() const { return str_; } - private: - char str_[256]; + class Exception : public std::runtime_error { + public: + Exception(const char* what_arg) : std::runtime_error(what_arg) {} + Exception(const std::string& what_arg) : std::runtime_error(what_arg) {} }; struct PosixException : public Exception { diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx index c0252122..3418c68e 100644 --- a/common/rdr/TLSInStream.cxx +++ b/common/rdr/TLSInStream.cxx @@ -61,10 +61,10 @@ ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size) gnutls_transport_set_errno(self->session, e.err); self->saved_exception = new SocketException(e); return -1; - } catch (Exception& e) { + } catch (std::exception& e) { vlog.error("Failure reading TLS data: %s", e.what()); gnutls_transport_set_errno(self->session, EINVAL); - self->saved_exception = new Exception(e); + self->saved_exception = new std::exception(e); return -1; } diff --git a/common/rdr/TLSInStream.h b/common/rdr/TLSInStream.h index ca69ddde..2269b09d 100644 --- a/common/rdr/TLSInStream.h +++ b/common/rdr/TLSInStream.h @@ -41,7 +41,7 @@ namespace rdr { InStream* in; bool streamEmpty; - Exception* saved_exception; + std::exception* saved_exception; }; }; diff --git a/common/rdr/TLSOutStream.cxx b/common/rdr/TLSOutStream.cxx index 69d0fe3a..4c6c3f47 100644 --- a/common/rdr/TLSOutStream.cxx +++ b/common/rdr/TLSOutStream.cxx @@ -51,10 +51,10 @@ ssize_t TLSOutStream::push(gnutls_transport_ptr_t str, const void* data, gnutls_transport_set_errno(self->session, e.err); self->saved_exception = new SocketException(e); return -1; - } catch (Exception& e) { + } catch (std::exception& e) { vlog.error("Failure sending TLS data: %s", e.what()); gnutls_transport_set_errno(self->session, EINVAL); - self->saved_exception = new Exception(e); + self->saved_exception = new std::exception(e); return -1; } diff --git a/common/rdr/TLSOutStream.h b/common/rdr/TLSOutStream.h index 35714238..659f16f0 100644 --- a/common/rdr/TLSOutStream.h +++ b/common/rdr/TLSOutStream.h @@ -42,7 +42,7 @@ namespace rdr { gnutls_session_t session; OutStream* out; - Exception* saved_exception; + std::exception* saved_exception; }; }; diff --git a/common/rdr/ZlibOutStream.cxx b/common/rdr/ZlibOutStream.cxx index 0b167711..1b59f54e 100644 --- a/common/rdr/ZlibOutStream.cxx +++ b/common/rdr/ZlibOutStream.cxx @@ -54,7 +54,7 @@ ZlibOutStream::~ZlibOutStream() { try { flush(); - } catch (Exception&) { + } catch (std::exception&) { } deflateEnd(zs); delete zs; diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 7a9570ad..3a34740f 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -387,7 +387,7 @@ void CConnection::close() */ try { decoder.flush(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); } diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx index 77beb620..6000063f 100644 --- a/common/rfb/DecodeManager.cxx +++ b/common/rfb/DecodeManager.cxx @@ -148,7 +148,7 @@ bool DecodeManager::decodeRect(const Rect& r, int encoding, try { if (!decoder->readRect(r, conn->getInStream(), conn->server, bufferStream)) return false; - } catch (rdr::Exception& e) { + } catch (std::exception& e) { throw Exception(format("Error reading rect: %s", e.what())); } @@ -243,7 +243,7 @@ void DecodeManager::logStats() iecPrefix(bytes, "B").c_str(), ratio); } -void DecodeManager::setThreadException(const rdr::Exception& e) +void DecodeManager::setThreadException(const std::exception& e) { os::AutoMutex a(queueMutex); @@ -260,7 +260,7 @@ void DecodeManager::throwThreadException() if (threadException == nullptr) return; - rdr::Exception e(*threadException); + std::exception e(*threadException); delete threadException; threadException = nullptr; @@ -318,7 +318,7 @@ void DecodeManager::DecodeThread::worker() entry->decoder->decodeRect(entry->rect, entry->bufferStream->data(), entry->bufferStream->length(), *entry->server, entry->pb); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { manager->setThreadException(e); } catch(...) { assert(false); diff --git a/common/rfb/DecodeManager.h b/common/rfb/DecodeManager.h index 5435bfc1..b11b7044 100644 --- a/common/rfb/DecodeManager.h +++ b/common/rfb/DecodeManager.h @@ -32,7 +32,6 @@ namespace os { } namespace rdr { - struct Exception; class MemOutStream; } @@ -55,7 +54,7 @@ namespace rfb { private: void logStats(); - void setThreadException(const rdr::Exception& e); + void setThreadException(const std::exception& e); void throwThreadException(); private: @@ -108,7 +107,7 @@ namespace rfb { }; std::list threads; - rdr::Exception *threadException; + std::exception *threadException; }; } diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index d96ad178..c43ed493 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -223,7 +223,7 @@ void SConnection::processSecurityType(int secType) try { state_ = RFBSTATE_SECURITY; ssecurity = security.GetSSecurity(this, secType); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { failConnection(e.what()); } } @@ -293,7 +293,7 @@ void SConnection::handleAuthFailureTimeout(Timer* /*t*/) authFailureMsg.size()); } os->flush(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { close(e.what()); return; } diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index e0fb69dc..9cdf289d 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -129,7 +129,7 @@ void VNCSConnectionST::close(const char* reason) if (sock->outStream().hasBufferedData()) vlog.error("Failed to flush remaining socket data on close"); } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("Failed to flush remaining socket data on close: %s", e.what()); } @@ -146,7 +146,7 @@ bool VNCSConnectionST::init() { try { initialiseProtocol(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { close(e.what()); return false; } @@ -189,7 +189,7 @@ void VNCSConnectionST::processMessages() writeFramebufferUpdate(); } catch (rdr::EndOfStream&) { close("Clean disconnection"); - } catch (rdr::Exception &e) { + } catch (std::exception& e) { close(e.what()); } } @@ -203,7 +203,7 @@ void VNCSConnectionST::flushSocket() // delayed because of congestion. if (!sock->outStream().hasBufferedData()) writeFramebufferUpdate(); - } catch (rdr::Exception &e) { + } catch (std::exception& e) { close(e.what()); } } @@ -252,7 +252,7 @@ void VNCSConnectionST::pixelBufferChange() updates.clear(); updates.add_changed(server->getPixelBuffer()->getRect()); writeFramebufferUpdate(); - } catch(rdr::Exception &e) { + } catch(std::exception& e) { close(e.what()); } } @@ -261,7 +261,7 @@ void VNCSConnectionST::writeFramebufferUpdateOrClose() { try { writeFramebufferUpdate(); - } catch(rdr::Exception &e) { + } catch(std::exception& e) { close(e.what()); } } @@ -271,7 +271,7 @@ void VNCSConnectionST::screenLayoutChangeOrClose(uint16_t reason) try { screenLayoutChange(reason); writeFramebufferUpdate(); - } catch(rdr::Exception &e) { + } catch(std::exception& e) { close(e.what()); } } @@ -280,7 +280,7 @@ void VNCSConnectionST::bellOrClose() { try { if (state() == RFBSTATE_NORMAL) writer()->writeBell(); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { close(e.what()); } } @@ -290,7 +290,7 @@ void VNCSConnectionST::setDesktopNameOrClose(const char *name) try { setDesktopName(name); writeFramebufferUpdate(); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { close(e.what()); } } @@ -300,7 +300,7 @@ void VNCSConnectionST::setCursorOrClose() try { setCursor(); writeFramebufferUpdate(); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { close(e.what()); } } @@ -310,7 +310,7 @@ void VNCSConnectionST::setLEDStateOrClose(unsigned int state) try { setLEDState(state); writeFramebufferUpdate(); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { close(e.what()); } } @@ -322,7 +322,7 @@ void VNCSConnectionST::requestClipboardOrClose() if (!accessCheck(AccessCutText)) return; if (!rfb::Server::acceptCutText) return; requestClipboard(); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { close(e.what()); } } @@ -334,7 +334,7 @@ void VNCSConnectionST::announceClipboardOrClose(bool available) if (!accessCheck(AccessCutText)) return; if (!rfb::Server::sendCutText) return; announceClipboard(available); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { close(e.what()); } } @@ -346,7 +346,7 @@ void VNCSConnectionST::sendClipboardDataOrClose(const char* data) if (!accessCheck(AccessCutText)) return; if (!rfb::Server::sendCutText) return; sendClipboardData(data); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { close(e.what()); } } @@ -418,7 +418,7 @@ void VNCSConnectionST::approveConnectionOrClose(bool accept, { try { approveConnection(accept, reason); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { close(e.what()); } } @@ -805,7 +805,7 @@ void VNCSConnectionST::handleTimeout(Timer* t) if ((t == &congestionTimer) || (t == &losslessTimer)) writeFramebufferUpdate(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { close(e.what()); } diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 66b05fae..f1ea2958 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -151,7 +151,7 @@ void VNCServerST::addSocket(network::Socket* sock, bool outgoing, AccessRights a os.writeU32(strlen(reason)); os.writeBytes((const uint8_t*)reason, strlen(reason)); os.flush(); - } catch (rdr::Exception&) { + } catch (std::exception&) { } sock->shutdown(); closingSockets.push_back(sock); diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx index 610fc4ec..63794340 100644 --- a/tests/perf/encperf.cxx +++ b/tests/perf/encperf.cxx @@ -372,7 +372,7 @@ static struct stats runTest(const char *fn) try { cc = new CConn(fn); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { fprintf(stderr, "Failed to open rfb file: %s\n", e.what()); exit(1); } @@ -381,7 +381,7 @@ static struct stats runTest(const char *fn) while (true) cc->processMsg(); } catch (rdr::EndOfStream& e) { - } catch (rdr::Exception& e) { + } catch (std::exception& e) { fprintf(stderr, "Failed to run rfb file: %s\n", e.what()); exit(1); } diff --git a/tests/unit/pixelformat.cxx b/tests/unit/pixelformat.cxx index 614d1255..9d86fb9f 100644 --- a/tests/unit/pixelformat.cxx +++ b/tests/unit/pixelformat.cxx @@ -36,7 +36,7 @@ static void doTest(bool should_fail, int b, int d, bool e, bool t, try { pf = new rfb::PixelFormat(b, d, e, t, rm, gm, bm, rs, gs, bs); - } catch(rfb::Exception&) { + } catch(std::exception&) { if (should_fail) printf("OK"); else diff --git a/unix/vncconfig/vncconfig.cxx b/unix/vncconfig/vncconfig.cxx index 94d81cc7..421b45f9 100644 --- a/unix/vncconfig/vncconfig.cxx +++ b/unix/vncconfig/vncconfig.cxx @@ -335,7 +335,7 @@ int main(int argc, char** argv) XCloseDisplay(dpy); - } catch (rdr::Exception &e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); } diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index a083e01e..9251e371 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -1049,7 +1049,7 @@ bool XDesktop::setCursor() try { server->setCursor(cim->width, cim->height, Point(cim->xhot, cim->yhot), cursorData); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::setCursor: %s",e.what()); } diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx index cc668628..81e07d57 100644 --- a/unix/x0vncserver/x0vncserver.cxx +++ b/unix/x0vncserver/x0vncserver.cxx @@ -475,7 +475,7 @@ int main(int argc, char** argv) } } - } catch (rdr::Exception &e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); return 1; } diff --git a/unix/xserver/hw/vnc/RFBGlue.cc b/unix/xserver/hw/vnc/RFBGlue.cc index 2cbee35c..2295bee8 100644 --- a/unix/xserver/hw/vnc/RFBGlue.cc +++ b/unix/xserver/hw/vnc/RFBGlue.cc @@ -216,7 +216,7 @@ int vncIsTCPPortUsed(int port) delete dummy.back(); dummy.pop_back(); } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { return 1; } return 0; diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index 7ad65d06..9c4486c8 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -195,7 +194,7 @@ void XserverDesktop::requestClipboard() { try { server->requestClipboard(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::requestClipboard: %s",e.what()); } } @@ -204,7 +203,7 @@ void XserverDesktop::announceClipboard(bool available) { try { server->announceClipboard(available); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::announceClipboard: %s",e.what()); } } @@ -213,7 +212,7 @@ void XserverDesktop::sendClipboardData(const char* data_) { try { server->sendClipboardData(data_); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::sendClipboardData: %s",e.what()); } } @@ -232,7 +231,7 @@ void XserverDesktop::setDesktopName(const char* name) { try { server->setName(name); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::setDesktopName: %s",e.what()); } } @@ -267,7 +266,7 @@ void XserverDesktop::setCursor(int width, int height, int hotX, int hotY, try { server->setCursor(width, height, Point(hotX, hotY), cursorData); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::setCursor: %s",e.what()); } @@ -278,7 +277,7 @@ void XserverDesktop::setCursorPos(int x, int y, bool warped) { try { server->setCursorPos(Point(x, y), warped); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::setCursorPos: %s",e.what()); } } @@ -287,7 +286,7 @@ void XserverDesktop::add_changed(const rfb::Region ®ion) { try { server->add_changed(region); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::add_changed: %s",e.what()); } } @@ -296,7 +295,7 @@ void XserverDesktop::add_copied(const rfb::Region &dest, const rfb::Point &delta { try { server->add_copied(dest, delta); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::add_copied: %s",e.what()); } } @@ -313,7 +312,7 @@ void XserverDesktop::handleSocketEvent(int fd, bool read, bool write) return; vlog.error("Cannot find file descriptor for socket event"); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::handleSocketEvent: %s",e.what()); } } @@ -406,7 +405,7 @@ void XserverDesktop::blockHandler(int* timeout) int nextTimeout = Timer::checkTimeouts(); if (nextTimeout >= 0 && (*timeout == -1 || nextTimeout < *timeout)) *timeout = nextTimeout; - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("XserverDesktop::blockHandler: %s", e.what()); } } diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index b39366a8..ab4b28d3 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -274,7 +274,7 @@ void vncExtensionInit(void) vncHooksInit(scr); } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vncFatalError("vncExtInit: %s\n",e.what()); } @@ -288,7 +288,7 @@ void vncExtensionClose(void) delete desktop[scr]; desktop[scr] = nullptr; } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vncFatalError("vncExtInit: %s\n",e.what()); } } @@ -348,7 +348,7 @@ int vncConnectClient(const char *addr, int viewOnly) if (strlen(addr) == 0) { try { desktop[0]->disconnectClients(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("Disconnecting all clients: %s", e.what()); return -1; } @@ -365,7 +365,7 @@ int vncConnectClient(const char *addr, int viewOnly) vlog.info("Reverse connection: %s:%d%s", host.c_str(), port, viewOnly ? " (view only)" : ""); desktop[0]->addClient(sock, true, (bool)viewOnly); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("Reverse connection: %s", e.what()); return -1; } @@ -462,7 +462,7 @@ void vncPostScreenResize(int scrIdx, int success, int width, int height) desktop[scrIdx]->setFramebuffer(width, height, vncFbptr[scrIdx], vncFbstride[scrIdx]); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vncFatalError("vncPostScreenResize: %s\n", e.what()); } } @@ -479,7 +479,7 @@ void vncRefreshScreenLayout(int scrIdx) { try { desktop[scrIdx]->refreshScreenLayout(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vncFatalError("vncRefreshScreenLayout: %s\n", e.what()); } } @@ -488,7 +488,7 @@ uint64_t vncGetMsc(int scrIdx) { try { return desktop[scrIdx]->getMsc(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vncFatalError("vncGetMsc: %s\n", e.what()); } } @@ -497,7 +497,7 @@ void vncQueueMsc(int scrIdx, uint64_t id, uint64_t msc) { try { desktop[scrIdx]->queueMsc(id, msc); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vncFatalError("vncQueueMsc: %s\n", e.what()); } } @@ -506,7 +506,7 @@ void vncAbortMsc(int scrIdx, uint64_t id) { try { desktop[scrIdx]->abortMsc(id); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vncFatalError("vncAbortMsc: %s\n", e.what()); } } diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 57904b64..265e2491 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -107,7 +107,7 @@ CConn::CConn(const char* vncServerName, network::Socket* socket=nullptr) vlog.info(_("Connected to host %s port %d"), serverHost.c_str(), serverPort); } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection(_("Failed to connect to \"%s\":\n\n%s"), vncServerName, e.what()); @@ -279,7 +279,7 @@ void CConn::socketEvent(FL_SOCKET fd, void *data) vlog.error(_("Authentication failed: %s"), e.what()); abort_connection(_("Failed to authenticate with the server. Reason " "given by the server:\n\n%s"), e.what()); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx index a1f4d23c..3de4e388 100644 --- a/vncviewer/ServerDialog.cxx +++ b/vncviewer/ServerDialog.cxx @@ -140,7 +140,7 @@ void ServerDialog::run(const char* servername, char *newservername) for (const string& entry : dialog.serverHistory) fltk_menu_add(dialog.serverName->menubutton(), entry.c_str(), 0, nullptr); - } catch (Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); fl_alert(_("Unable to load the server history:\n\n%s"), e.what()); @@ -192,7 +192,7 @@ void ServerDialog::handleLoad(Fl_Widget* /*widget*/, void* data) try { dialog->serverName->value(loadViewerParameters(filename)); - } catch (Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); fl_alert(_("Unable to load the specified configuration file:\n\n%s"), e.what()); @@ -253,7 +253,7 @@ void ServerDialog::handleSaveAs(Fl_Widget* /*widget*/, void* data) try { saveViewerParameters(filename, servername); - } catch (Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); fl_alert(_("Unable to save the specified configuration " "file:\n\n%s"), e.what()); @@ -287,7 +287,7 @@ void ServerDialog::handleConnect(Fl_Widget* /*widget*/, void *data) try { saveViewerParameters(nullptr, servername); - } catch (Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); fl_alert(_("Unable to save the default configuration:\n\n%s"), e.what()); @@ -299,7 +299,7 @@ void ServerDialog::handleConnect(Fl_Widget* /*widget*/, void *data) try { dialog->saveServerHistory(); - } catch (Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); fl_alert(_("Unable to save the server history:\n\n%s"), e.what()); @@ -320,7 +320,7 @@ static bool same_server(const string& a, const string& b) try { getHostAndPort(a.c_str(), &hostA, &portA); getHostAndPort(b.c_str(), &hostB, &portB); - } catch (Exception& e) { + } catch (std::exception& e) { return false; } diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 5163535d..42a5d002 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -575,7 +575,7 @@ int Viewport::handle(int event) try { cc->sendClipboardData(filtered.c_str()); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } @@ -668,7 +668,7 @@ void Viewport::sendPointerEvent(const rfb::Point& pos, uint8_t buttonMask) if ((pointerEventInterval == 0) || (buttonMask != lastButtonMask)) { try { cc->writer()->writePointerEvent(pos, buttonMask); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } @@ -775,7 +775,7 @@ void Viewport::handleClipboardChange(int source, void *data) vlog.debug("Local clipboard changed, notifying server"); try { self->cc->announceClipboard(true); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } @@ -788,7 +788,7 @@ void Viewport::flushPendingClipboard() vlog.debug("Focus regained after local clipboard change, notifying server"); try { cc->announceClipboard(true); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } @@ -813,7 +813,7 @@ void Viewport::handlePointerTimeout(void *data) try { self->cc->writer()->writePointerEvent(self->lastPointerPos, self->lastButtonMask); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } @@ -885,7 +885,7 @@ void Viewport::handleKeyPress(int keyCode, uint32_t keySym) cc->writer()->writeKeyEvent(keySym, 0, true); else cc->writer()->writeKeyEvent(keySym, keyCode, true); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } @@ -915,7 +915,7 @@ void Viewport::handleKeyRelease(int keyCode) cc->writer()->writeKeyEvent(iter->second, 0, false); else cc->writer()->writeKeyEvent(iter->second, keyCode, false); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx index 1eac8f9d..f1b5a852 100644 --- a/vncviewer/parameters.cxx +++ b/vncviewer/parameters.cxx @@ -440,7 +440,7 @@ void saveHistoryToRegKey(const list& serverHistory) { setKeyString(indexString, entry.c_str(), &hKey); index++; } - } catch (Exception& e) { + } catch (std::exception& e) { RegCloseKey(hKey); throw; } @@ -463,7 +463,7 @@ static void saveToReg(const char* servername) { try { setKeyString("ServerName", servername, &hKey); - } catch (Exception& e) { + } catch (std::exception& e) { RegCloseKey(hKey); throw Exception(format(_("Failed to save \"%s\": %s"), "ServerName", e.what())); @@ -480,7 +480,7 @@ static void saveToReg(const char* servername) { } else { throw Exception(_("Unknown parameter type")); } - } catch (Exception& e) { + } catch (std::exception& e) { RegCloseKey(hKey); throw Exception(format(_("Failed to save \"%s\": %s"), parameterArray[i]->getName(), e.what())); @@ -493,7 +493,7 @@ static void saveToReg(const char* servername) { for (size_t i = 0; i < sizeof(readOnlyParameterArray)/sizeof(VoidParameter*); i++) { try { removeValue(readOnlyParameterArray[i]->getName(), &hKey); - } catch (Exception& e) { + } catch (std::exception& e) { RegCloseKey(hKey); throw Exception(format(_("Failed to remove \"%s\": %s"), readOnlyParameterArray[i]->getName(), @@ -534,7 +534,7 @@ list loadHistoryFromRegKey() { if (!getKeyString(indexString, servernameBuffer, buffersize, &hKey)) break; - } catch (Exception& e) { + } catch (std::exception& e) { // Just ignore this entry and try the next one vlog.error(_("Failed to read server history entry %d: %s"), (int)index, e.what()); @@ -572,7 +572,7 @@ static void getParametersFromReg(VoidParameter* parameters[], } else { throw Exception(_("Unknown parameter type")); } - } catch(Exception& e) { + } catch(std::exception& e) { // Just ignore this entry and continue with the rest vlog.error(_("Failed to read parameter \"%s\": %s"), parameters[i]->getName(), e.what()); @@ -603,7 +603,7 @@ static char* loadFromReg() { try { if (getKeyString("ServerName", servernameBuffer, buffersize, &hKey)) snprintf(servername, buffersize, "%s", servernameBuffer); - } catch(Exception& e) { + } catch(std::exception& e) { vlog.error(_("Failed to read parameter \"%s\": %s"), "ServerName", e.what()); strcpy(servername, ""); @@ -835,7 +835,7 @@ char* loadViewerParameters(const char *filename) { value, line); } } - } catch(Exception& e) { + } catch(std::exception& e) { // Just ignore this entry and continue with the rest vlog.error(_("Failed to read line %d in file %s: %s"), lineNr, filepath, e.what()); diff --git a/vncviewer/touch.cxx b/vncviewer/touch.cxx index 0b2e4bc6..572e726e 100644 --- a/vncviewer/touch.cxx +++ b/vncviewer/touch.cxx @@ -36,7 +36,6 @@ #include #include -#include #include #include "i18n.h" @@ -180,7 +179,7 @@ static int handleTouchEvent(void *event, void* /*data*/) if (msg->message == WM_PAINT && handlers.count(msg->hwnd) == 0) { try { handlers[msg->hwnd] = new Win32TouchHandler(msg->hwnd); - } catch (rfb::Exception& e) { + } catch (std::exception& e) { vlog.error(_("Failed to create touch handler: %s"), e.what()); abort_vncviewer(_("Failed to create touch handler: %s"), e.what()); } diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 6a063382..78a44f12 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -155,7 +155,7 @@ void abort_connection(const char *error, ...) exitMainloop = true; } -void abort_connection_with_unexpected_error(const rdr::Exception &e) { +void abort_connection_with_unexpected_error(const std::exception &e) { abort_connection(_("An unexpected error occurred when communicating " "with the server:\n\n%s"), e.what()); } @@ -513,7 +513,7 @@ potentiallyLoadConfigurationFile(const char *filename) // don't try to connect to the filename strncpy(vncServerName, newServerName, VNCSERVERNAMELEN-1); vncServerName[VNCSERVERNAMELEN-1] = '\0'; - } catch (rfb::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_vncviewer(_("Unable to load the specified configuration " "file:\n\n%s"), e.what()); @@ -671,7 +671,7 @@ int main(int argc, char** argv) strncpy(defaultServerName, configServerName, VNCSERVERNAMELEN-1); defaultServerName[VNCSERVERNAMELEN-1] = '\0'; } - } catch (rfb::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); } @@ -786,7 +786,7 @@ int main(int argc, char** argv) break; } } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_vncviewer(_("Failure waiting for incoming VNC connection:\n\n%s"), e.what()); return 1; /* Not reached */ @@ -807,7 +807,7 @@ int main(int argc, char** argv) if (strlen(via) > 0) { try { mktunnel(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); abort_vncviewer(_("Failure setting up encrypted tunnel:\n\n%s"), e.what()); } diff --git a/vncviewer/vncviewer.h b/vncviewer/vncviewer.h index f39a5776..57fd845d 100644 --- a/vncviewer/vncviewer.h +++ b/vncviewer/vncviewer.h @@ -21,15 +21,11 @@ #define VNCSERVERNAMELEN 256 -namespace rdr { - struct Exception; -}; - void abort_vncviewer(const char *error, ...) __attribute__((__format__ (__printf__, 1, 2))); void abort_connection(const char *error, ...) __attribute__((__format__ (__printf__, 1, 2))); -void abort_connection_with_unexpected_error(const rdr::Exception &); +void abort_connection_with_unexpected_error(const std::exception &); void disconnect(); bool should_disconnect(); diff --git a/win/rfb_win32/CleanDesktop.cxx b/win/rfb_win32/CleanDesktop.cxx index 8e0b70bc..6634d445 100644 --- a/win/rfb_win32/CleanDesktop.cxx +++ b/win/rfb_win32/CleanDesktop.cxx @@ -173,7 +173,7 @@ void CleanDesktop::disableWallpaper() { ActiveDesktop ad; if (ad.enable(false)) restoreActiveDesktop = true; - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); } @@ -181,7 +181,7 @@ void CleanDesktop::disableWallpaper() { SysParamsInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) "", SPIF_SENDCHANGE); restoreWallpaper = true; - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.info("%s", e.what()); } } @@ -198,7 +198,7 @@ void CleanDesktop::enableWallpaper() { ActiveDesktop ad; ad.enable(true); restoreActiveDesktop = false; - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); } } @@ -211,7 +211,7 @@ void CleanDesktop::enableWallpaper() { restoreWallpaper = false; } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.info("%s", e.what()); } } @@ -243,7 +243,7 @@ void CleanDesktop::disableEffects() { } restoreEffects = true; - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.info("%s", e.what()); } } @@ -268,7 +268,7 @@ void CleanDesktop::enableEffects() { restoreEffects = false; } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.info("%s", e.what()); } } diff --git a/win/rfb_win32/Clipboard.cxx b/win/rfb_win32/Clipboard.cxx index 5a3e3aba..5bda26b2 100644 --- a/win/rfb_win32/Clipboard.cxx +++ b/win/rfb_win32/Clipboard.cxx @@ -150,7 +150,7 @@ Clipboard::setClipText(const char* text) { clip_handle = nullptr; vlog.debug("set clipboard"); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.debug("%s", e.what()); } diff --git a/win/rfb_win32/DeviceFrameBuffer.cxx b/win/rfb_win32/DeviceFrameBuffer.cxx index 2cf8adae..752aeb4c 100644 --- a/win/rfb_win32/DeviceFrameBuffer.cxx +++ b/win/rfb_win32/DeviceFrameBuffer.cxx @@ -308,7 +308,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) server->setCursor(width, height, hotspot, buffer.data()); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); } } diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx index 35ec065e..3fcb96f7 100644 --- a/win/rfb_win32/Dialog.cxx +++ b/win/rfb_win32/Dialog.cxx @@ -347,7 +347,7 @@ bool PropSheet::showPropSheet(HWND owner_, bool showApply, bool showCtxtHelp, bo delete [] hpages; hpages = nullptr; return true; - } catch (rdr::Exception&) { + } catch (std::exception&) { alreadyShowing = false; std::list::iterator pspi; diff --git a/win/rfb_win32/MsgWindow.cxx b/win/rfb_win32/MsgWindow.cxx index 25d8ee2c..a5770e67 100644 --- a/win/rfb_win32/MsgWindow.cxx +++ b/win/rfb_win32/MsgWindow.cxx @@ -61,7 +61,7 @@ LRESULT CALLBACK MsgWindowProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) try { result = _this->processMessage(msg, wParam, lParam); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("untrapped: %s", e.what()); } diff --git a/win/rfb_win32/RegConfig.cxx b/win/rfb_win32/RegConfig.cxx index e4ad5be5..d93e8eb4 100644 --- a/win/rfb_win32/RegConfig.cxx +++ b/win/rfb_win32/RegConfig.cxx @@ -53,7 +53,7 @@ bool RegConfig::setKey(const HKEY rootkey, const char* keyname) { key.createKey(rootkey, keyname); processEvent(event); return true; - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.debug("%s", e.what()); return false; } diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx index bbe15f47..15b25776 100644 --- a/win/rfb_win32/Registry.cxx +++ b/win/rfb_win32/Registry.cxx @@ -173,7 +173,7 @@ std::string RegKey::getString(const char* valname) const { std::string RegKey::getString(const char* valname, const char* def) const { try { return getString(valname); - } catch(rdr::Exception&) { + } catch(std::exception&) { return def; } } @@ -185,7 +185,7 @@ std::vector RegKey::getBinary(const char* valname) const { std::vector RegKey::getBinary(const char* valname, const uint8_t* def, size_t deflen) const { try { return getBinary(valname); - } catch(rdr::Exception&) { + } catch(std::exception&) { std::vector out(deflen); memcpy(out.data(), def, deflen); return out; @@ -198,7 +198,7 @@ int RegKey::getInt(const char* valname) const { int RegKey::getInt(const char* valname, int def) const { try { return getInt(valname); - } catch(rdr::Exception&) { + } catch(std::exception&) { return def; } } @@ -262,7 +262,7 @@ bool RegKey::isValue(const char* valname) const { try { getRepresentation(valname); return true; - } catch(rdr::Exception&) { + } catch(std::exception&) { return false; } } diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx index ea64dbe9..703334f3 100644 --- a/win/rfb_win32/SDisplay.cxx +++ b/win/rfb_win32/SDisplay.cxx @@ -197,7 +197,7 @@ void SDisplay::startCore() { else core = new SDisplayCorePolling(this, &updates); core->setScreenRect(screenRect); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { delete core; core = nullptr; if (tryMethod == 0) throw rdr::Exception("unable to access desktop"); @@ -287,7 +287,7 @@ void SDisplay::restartCore() { // Start a new Core if possible startCore(); vlog.info("restarted"); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { // If startCore() fails then we MUST disconnect all clients, // to cause the server to stop() the desktop. // Otherwise, the SDesktop is in an inconsistent state @@ -400,7 +400,7 @@ SDisplay::processEvent(HANDLE event) { // - Flush any updates from the core try { core->flushUpdates(); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); restartCore(); return; diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx index cdc65409..6226e033 100644 --- a/win/rfb_win32/SocketManager.cxx +++ b/win/rfb_win32/SocketManager.cxx @@ -76,7 +76,7 @@ void SocketManager::addListener(network::SocketListener* sock_, // addEvent is the last thing we do, so that the event is NOT registered if previous steps fail if (!event || !addEvent(event, this)) throw rdr::Exception("Unable to add listener"); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { if (event) WSACloseEvent(event); delete sock_; @@ -267,7 +267,7 @@ void SocketManager::processEvent(HANDLE event) { eventMask |= FD_WRITE; if (WSAEventSelect(ci.sock->getFd(), event, eventMask) == SOCKET_ERROR) throw rdr::SocketException("unable to re-enable WSAEventSelect:%u", WSAGetLastError()); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); remSocket(ci.sock); } diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h index 8c8bb9aa..dfa5c79f 100644 --- a/win/vncconfig/Connections.h +++ b/win/vncconfig/Connections.h @@ -73,7 +73,7 @@ namespace rfb { try { network::TcpFilter::Pattern pat(network::TcpFilter::parsePattern(newPat.c_str())); pattern = network::TcpFilter::patternToStr(pat); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { MsgBox(nullptr, e.what(), MB_ICONEXCLAMATION | MB_OK); return false; } @@ -235,7 +235,7 @@ namespace rfb { (localHost != isItemChecked(IDC_LOCALHOST)) || (port_number != getItemInt(IDC_PORT)) || (rfb::Server::idleTimeout != getItemInt(IDC_IDLE_TIMEOUT)); - } catch (rdr::Exception&) { + } catch (std::exception&) { return false; } } diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx index 3dae1c99..855d7363 100644 --- a/win/vncconfig/Legacy.cxx +++ b/win/vncconfig/Legacy.cxx @@ -114,7 +114,7 @@ void LegacyPage::LoadPrefs() // Finally, save the Hosts value regKey.setString("Hosts", newHosts.c_str()); - } catch (rdr::Exception&) { + } catch (std::exception&) { MsgBox(nullptr, "Unable to convert AuthHosts setting to Hosts format.", MB_ICONWARNING | MB_OK); } @@ -135,7 +135,7 @@ void LegacyPage::LoadPrefs() regKey.setBool("AlwaysShared", connectPriority == 1); regKey.setBool("NeverShared", connectPriority == 2); - } catch(rdr::Exception&) { + } catch(std::exception&) { } // Open the local, default-user settings @@ -145,7 +145,7 @@ void LegacyPage::LoadPrefs() userKey.openKey(winvnc3, "Default"); vlog.info("loading Default prefs"); LoadUserPrefs(userKey); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { vlog.error("error reading Default settings:%s", e.what()); } @@ -156,7 +156,7 @@ void LegacyPage::LoadPrefs() userKey.openKey(winvnc3, username.c_str()); vlog.info("loading local User prefs"); LoadUserPrefs(userKey); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { vlog.error("error reading local User settings:%s", e.what()); } @@ -167,7 +167,7 @@ void LegacyPage::LoadPrefs() userKey.openKey(HKEY_CURRENT_USER, "Software\\ORL\\WinVNC3"); vlog.info("loading global User prefs"); LoadUserPrefs(userKey); - } catch(rdr::Exception& e) { + } catch(std::exception& e) { vlog.error("error reading global User settings:%s", e.what()); } } diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx index bfe4e640..de3a4620 100644 --- a/win/vncconfig/vncconfig.cxx +++ b/win/vncconfig/vncconfig.cxx @@ -179,7 +179,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /* throw; } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { MsgBox(nullptr, e.what(), MB_ICONEXCLAMATION | MB_OK); return 1; } diff --git a/win/winvnc/ManagedListener.cxx b/win/winvnc/ManagedListener.cxx index 43fe863a..78f383a6 100644 --- a/win/winvnc/ManagedListener.cxx +++ b/win/winvnc/ManagedListener.cxx @@ -100,7 +100,7 @@ void ManagedListener::refresh() { else network::createTcpListeners(&sockets, nullptr, port); } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { vlog.error("%s", e.what()); } if (!sockets.empty()) { diff --git a/win/winvnc/STrayIcon.cxx b/win/winvnc/STrayIcon.cxx index 3dbe2c81..4420b574 100644 --- a/win/winvnc/STrayIcon.cxx +++ b/win/winvnc/STrayIcon.cxx @@ -159,7 +159,7 @@ public: if (isServiceProcess()) { try { rfb::win32::stopService(VNCServerService::Name); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { MsgBox(nullptr, e.what(), MB_ICONERROR | MB_OK); } } else { diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx index 9d722740..d98aaa10 100644 --- a/win/winvnc/VNCServerWin32.cxx +++ b/win/winvnc/VNCServerWin32.cxx @@ -199,7 +199,7 @@ int VNCServerWin32::run() { } catch (rdr::Win32Exception &s) { vlog.error("%s", s.what()); result = s.err; - } catch (rdr::Exception &e) { + } catch (std::exception &e) { vlog.error("%s", e.what()); } diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx index e6f8abe7..25e6875f 100644 --- a/win/winvnc/winvnc.cxx +++ b/win/winvnc/winvnc.cxx @@ -228,7 +228,7 @@ static void processParams(int argc, char** argv) { break; } - } catch (rdr::Exception& e) { + } catch (std::exception& e) { MsgBoxOrLog(e.what(), true); } } @@ -284,7 +284,7 @@ int WINAPI WinMain(HINSTANCE /*inst*/, HINSTANCE /*prevInst*/, char* /*cmdLine*/ } vlog.debug("WinVNC service destroyed"); - } catch (rdr::Exception& e) { + } catch (std::exception& e) { MsgBoxOrLog(e.what(), true); } -- 2.39.5