diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-09-02 17:03:10 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-11-06 21:06:27 +0100 |
commit | f25de739ea359c2843a596457bcd22a28175b7a4 (patch) | |
tree | ae7bed3ed0d7e61938922540c7abdafbaa7e8938 | |
parent | bdeaeebd48ad39898b804e0083ed1456cc64f24b (diff) | |
download | tigervnc-f25de739ea359c2843a596457bcd22a28175b7a4.tar.gz tigervnc-f25de739ea359c2843a596457bcd22a28175b7a4.zip |
Use what() to access exception description
Harmonize with the standard C++ exceptions.
34 files changed, 122 insertions, 122 deletions
diff --git a/common/rdr/Exception.h b/common/rdr/Exception.h index c6be8fcc..bdb2061c 100644 --- a/common/rdr/Exception.h +++ b/common/rdr/Exception.h @@ -29,7 +29,7 @@ namespace rdr { Exception(const char* message); Exception(const std::string& message); virtual ~Exception() {} - virtual const char* str() const { return str_; } + virtual const char* what() const { return str_; } private: char str_[256]; }; diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx index f8f4fcf9..c0252122 100644 --- a/common/rdr/TLSInStream.cxx +++ b/common/rdr/TLSInStream.cxx @@ -57,12 +57,12 @@ ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size) } catch (EndOfStream&) { return 0; } catch (SocketException& e) { - vlog.error("Failure reading TLS data: %s", e.str()); + vlog.error("Failure reading TLS data: %s", e.what()); gnutls_transport_set_errno(self->session, e.err); self->saved_exception = new SocketException(e); return -1; } catch (Exception& e) { - vlog.error("Failure reading TLS data: %s", e.str()); + vlog.error("Failure reading TLS data: %s", e.what()); gnutls_transport_set_errno(self->session, EINVAL); self->saved_exception = new Exception(e); return -1; diff --git a/common/rdr/TLSOutStream.cxx b/common/rdr/TLSOutStream.cxx index ccb229e1..69d0fe3a 100644 --- a/common/rdr/TLSOutStream.cxx +++ b/common/rdr/TLSOutStream.cxx @@ -47,12 +47,12 @@ ssize_t TLSOutStream::push(gnutls_transport_ptr_t str, const void* data, out->writeBytes((const uint8_t*)data, size); out->flush(); } catch (SocketException& e) { - vlog.error("Failure sending TLS data: %s", e.str()); + vlog.error("Failure sending TLS data: %s", e.what()); gnutls_transport_set_errno(self->session, e.err); self->saved_exception = new SocketException(e); return -1; } catch (Exception& e) { - vlog.error("Failure sending TLS data: %s", e.str()); + vlog.error("Failure sending TLS data: %s", e.what()); gnutls_transport_set_errno(self->session, EINVAL); self->saved_exception = new Exception(e); return -1; diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 61ef7d98..7a9570ad 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -388,7 +388,7 @@ void CConnection::close() try { decoder.flush(); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } setFramebuffer(nullptr); diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx index 269e818d..77beb620 100644 --- a/common/rfb/DecodeManager.cxx +++ b/common/rfb/DecodeManager.cxx @@ -149,7 +149,7 @@ bool DecodeManager::decodeRect(const Rect& r, int encoding, if (!decoder->readRect(r, conn->getInStream(), conn->server, bufferStream)) return false; } catch (rdr::Exception& e) { - throw Exception(format("Error reading rect: %s", e.str())); + throw Exception(format("Error reading rect: %s", e.what())); } stats[encoding].rects++; @@ -250,7 +250,7 @@ void DecodeManager::setThreadException(const rdr::Exception& e) if (threadException != nullptr) return; - threadException = new rdr::Exception(format("Exception on worker thread: %s", e.str())); + threadException = new rdr::Exception(format("Exception on worker thread: %s", e.what())); } void DecodeManager::throwThreadException() diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index 04cf60b9..d96ad178 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -224,7 +224,7 @@ void SConnection::processSecurityType(int secType) state_ = RFBSTATE_SECURITY; ssecurity = security.GetSSecurity(this, secType); } catch (rdr::Exception& e) { - failConnection(e.str()); + failConnection(e.what()); } } @@ -235,11 +235,11 @@ bool SConnection::processSecurityMsg() if (!ssecurity->processMsg()) return false; } catch (AuthFailureException& e) { - vlog.error("AuthFailureException: %s", e.str()); + vlog.error("AuthFailureException: %s", e.what()); state_ = RFBSTATE_SECURITY_FAILURE; // Introduce a slight delay of the authentication failure response // to make it difficult to brute force a password - authFailureMsg = e.str(); + authFailureMsg = e.what(); authFailureTimer.start(100); return true; } @@ -294,7 +294,7 @@ void SConnection::handleAuthFailureTimeout(Timer* /*t*/) } os->flush(); } catch (rdr::Exception& e) { - close(e.str()); + close(e.what()); return; } diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 7dc2a0b8..e0fb69dc 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -130,7 +130,7 @@ void VNCSConnectionST::close(const char* reason) vlog.error("Failed to flush remaining socket data on close"); } } catch (rdr::Exception& e) { - vlog.error("Failed to flush remaining socket data on close: %s", e.str()); + vlog.error("Failed to flush remaining socket data on close: %s", e.what()); } // Just shutdown the socket and mark our state as closing. Eventually the @@ -147,7 +147,7 @@ bool VNCSConnectionST::init() try { initialiseProtocol(); } catch (rdr::Exception& e) { - close(e.str()); + close(e.what()); return false; } return true; @@ -190,7 +190,7 @@ void VNCSConnectionST::processMessages() } catch (rdr::EndOfStream&) { close("Clean disconnection"); } catch (rdr::Exception &e) { - close(e.str()); + close(e.what()); } } @@ -204,7 +204,7 @@ void VNCSConnectionST::flushSocket() if (!sock->outStream().hasBufferedData()) writeFramebufferUpdate(); } catch (rdr::Exception &e) { - close(e.str()); + close(e.what()); } } @@ -253,7 +253,7 @@ void VNCSConnectionST::pixelBufferChange() updates.add_changed(server->getPixelBuffer()->getRect()); writeFramebufferUpdate(); } catch(rdr::Exception &e) { - close(e.str()); + close(e.what()); } } @@ -262,7 +262,7 @@ void VNCSConnectionST::writeFramebufferUpdateOrClose() try { writeFramebufferUpdate(); } catch(rdr::Exception &e) { - close(e.str()); + close(e.what()); } } @@ -272,7 +272,7 @@ void VNCSConnectionST::screenLayoutChangeOrClose(uint16_t reason) screenLayoutChange(reason); writeFramebufferUpdate(); } catch(rdr::Exception &e) { - close(e.str()); + close(e.what()); } } @@ -281,7 +281,7 @@ void VNCSConnectionST::bellOrClose() try { if (state() == RFBSTATE_NORMAL) writer()->writeBell(); } catch(rdr::Exception& e) { - close(e.str()); + close(e.what()); } } @@ -291,7 +291,7 @@ void VNCSConnectionST::setDesktopNameOrClose(const char *name) setDesktopName(name); writeFramebufferUpdate(); } catch(rdr::Exception& e) { - close(e.str()); + close(e.what()); } } @@ -301,7 +301,7 @@ void VNCSConnectionST::setCursorOrClose() setCursor(); writeFramebufferUpdate(); } catch(rdr::Exception& e) { - close(e.str()); + close(e.what()); } } @@ -311,7 +311,7 @@ void VNCSConnectionST::setLEDStateOrClose(unsigned int state) setLEDState(state); writeFramebufferUpdate(); } catch(rdr::Exception& e) { - close(e.str()); + close(e.what()); } } @@ -323,7 +323,7 @@ void VNCSConnectionST::requestClipboardOrClose() if (!rfb::Server::acceptCutText) return; requestClipboard(); } catch(rdr::Exception& e) { - close(e.str()); + close(e.what()); } } @@ -335,7 +335,7 @@ void VNCSConnectionST::announceClipboardOrClose(bool available) if (!rfb::Server::sendCutText) return; announceClipboard(available); } catch(rdr::Exception& e) { - close(e.str()); + close(e.what()); } } @@ -347,7 +347,7 @@ void VNCSConnectionST::sendClipboardDataOrClose(const char* data) if (!rfb::Server::sendCutText) return; sendClipboardData(data); } catch(rdr::Exception& e) { - close(e.str()); + close(e.what()); } } @@ -419,7 +419,7 @@ void VNCSConnectionST::approveConnectionOrClose(bool accept, try { approveConnection(accept, reason); } catch (rdr::Exception& e) { - close(e.str()); + close(e.what()); } } @@ -806,7 +806,7 @@ void VNCSConnectionST::handleTimeout(Timer* t) (t == &losslessTimer)) writeFramebufferUpdate(); } catch (rdr::Exception& e) { - close(e.str()); + close(e.what()); } if (t == &idleTimer) diff --git a/tests/perf/decperf.cxx b/tests/perf/decperf.cxx index fb2390be..cc8b39d0 100644 --- a/tests/perf/decperf.cxx +++ b/tests/perf/decperf.cxx @@ -203,7 +203,7 @@ static struct stats runTest(const char *fn) try { cc = new CConn(fn); } catch (rdr::Exception& e) { - fprintf(stderr, "Failed to open rfb file: %s\n", e.str()); + fprintf(stderr, "Failed to open rfb file: %s\n", e.what()); exit(1); } @@ -212,7 +212,7 @@ static struct stats runTest(const char *fn) cc->processMsg(); } catch (rdr::EndOfStream& e) { } catch (rdr::Exception& e) { - fprintf(stderr, "Failed to run rfb file: %s\n", e.str()); + fprintf(stderr, "Failed to run rfb file: %s\n", e.what()); exit(1); } diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx index c6e2d3b7..610fc4ec 100644 --- a/tests/perf/encperf.cxx +++ b/tests/perf/encperf.cxx @@ -373,7 +373,7 @@ static struct stats runTest(const char *fn) try { cc = new CConn(fn); } catch (rdr::Exception& e) { - fprintf(stderr, "Failed to open rfb file: %s\n", e.str()); + fprintf(stderr, "Failed to open rfb file: %s\n", e.what()); exit(1); } @@ -382,7 +382,7 @@ static struct stats runTest(const char *fn) cc->processMsg(); } catch (rdr::EndOfStream& e) { } catch (rdr::Exception& e) { - fprintf(stderr, "Failed to run rfb file: %s\n", e.str()); + fprintf(stderr, "Failed to run rfb file: %s\n", e.what()); exit(1); } diff --git a/unix/vncconfig/vncconfig.cxx b/unix/vncconfig/vncconfig.cxx index 1498bbdb..94d81cc7 100644 --- a/unix/vncconfig/vncconfig.cxx +++ b/unix/vncconfig/vncconfig.cxx @@ -336,7 +336,7 @@ int main(int argc, char** argv) XCloseDisplay(dpy); } catch (rdr::Exception &e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } return 0; diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index 1dc76718..a083e01e 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -1050,7 +1050,7 @@ bool XDesktop::setCursor() server->setCursor(cim->width, cim->height, Point(cim->xhot, cim->yhot), cursorData); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::setCursor: %s",e.str()); + vlog.error("XserverDesktop::setCursor: %s",e.what()); } delete [] cursorData; diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx index fce32c74..cc668628 100644 --- a/unix/x0vncserver/x0vncserver.cxx +++ b/unix/x0vncserver/x0vncserver.cxx @@ -476,7 +476,7 @@ int main(int argc, char** argv) } } catch (rdr::Exception &e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); return 1; } diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index e3bc57d8..7ad65d06 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -196,7 +196,7 @@ void XserverDesktop::requestClipboard() try { server->requestClipboard(); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::requestClipboard: %s",e.str()); + vlog.error("XserverDesktop::requestClipboard: %s",e.what()); } } @@ -205,7 +205,7 @@ void XserverDesktop::announceClipboard(bool available) try { server->announceClipboard(available); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::announceClipboard: %s",e.str()); + vlog.error("XserverDesktop::announceClipboard: %s",e.what()); } } @@ -214,7 +214,7 @@ void XserverDesktop::sendClipboardData(const char* data_) try { server->sendClipboardData(data_); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::sendClipboardData: %s",e.str()); + vlog.error("XserverDesktop::sendClipboardData: %s",e.what()); } } @@ -233,7 +233,7 @@ void XserverDesktop::setDesktopName(const char* name) try { server->setName(name); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::setDesktopName: %s",e.str()); + vlog.error("XserverDesktop::setDesktopName: %s",e.what()); } } @@ -268,7 +268,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) { - vlog.error("XserverDesktop::setCursor: %s",e.str()); + vlog.error("XserverDesktop::setCursor: %s",e.what()); } delete [] cursorData; @@ -279,7 +279,7 @@ void XserverDesktop::setCursorPos(int x, int y, bool warped) try { server->setCursorPos(Point(x, y), warped); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::setCursorPos: %s",e.str()); + vlog.error("XserverDesktop::setCursorPos: %s",e.what()); } } @@ -288,7 +288,7 @@ void XserverDesktop::add_changed(const rfb::Region ®ion) try { server->add_changed(region); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::add_changed: %s",e.str()); + vlog.error("XserverDesktop::add_changed: %s",e.what()); } } @@ -297,7 +297,7 @@ void XserverDesktop::add_copied(const rfb::Region &dest, const rfb::Point &delta try { server->add_copied(dest, delta); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::add_copied: %s",e.str()); + vlog.error("XserverDesktop::add_copied: %s",e.what()); } } @@ -314,7 +314,7 @@ void XserverDesktop::handleSocketEvent(int fd, bool read, bool write) vlog.error("Cannot find file descriptor for socket event"); } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::handleSocketEvent: %s",e.str()); + vlog.error("XserverDesktop::handleSocketEvent: %s",e.what()); } } @@ -407,7 +407,7 @@ void XserverDesktop::blockHandler(int* timeout) if (nextTimeout >= 0 && (*timeout == -1 || nextTimeout < *timeout)) *timeout = nextTimeout; } catch (rdr::Exception& e) { - vlog.error("XserverDesktop::blockHandler: %s",e.str()); + vlog.error("XserverDesktop::blockHandler: %s", e.what()); } } diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index 073b07e2..b39366a8 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -275,7 +275,7 @@ void vncExtensionInit(void) vncHooksInit(scr); } } catch (rdr::Exception& e) { - vncFatalError("vncExtInit: %s\n",e.str()); + vncFatalError("vncExtInit: %s\n",e.what()); } vncRegisterBlockHandlers(); @@ -289,7 +289,7 @@ void vncExtensionClose(void) desktop[scr] = nullptr; } } catch (rdr::Exception& e) { - vncFatalError("vncExtInit: %s\n",e.str()); + vncFatalError("vncExtInit: %s\n",e.what()); } } @@ -349,7 +349,7 @@ int vncConnectClient(const char *addr, int viewOnly) try { desktop[0]->disconnectClients(); } catch (rdr::Exception& e) { - vlog.error("Disconnecting all clients: %s",e.str()); + vlog.error("Disconnecting all clients: %s", e.what()); return -1; } return 0; @@ -366,7 +366,7 @@ int vncConnectClient(const char *addr, int viewOnly) viewOnly ? " (view only)" : ""); desktop[0]->addClient(sock, true, (bool)viewOnly); } catch (rdr::Exception& e) { - vlog.error("Reverse connection: %s",e.str()); + vlog.error("Reverse connection: %s", e.what()); return -1; } @@ -463,7 +463,7 @@ void vncPostScreenResize(int scrIdx, int success, int width, int height) vncFbptr[scrIdx], vncFbstride[scrIdx]); } catch (rdr::Exception& e) { - vncFatalError("vncPostScreenResize: %s\n", e.str()); + vncFatalError("vncPostScreenResize: %s\n", e.what()); } } @@ -480,7 +480,7 @@ void vncRefreshScreenLayout(int scrIdx) try { desktop[scrIdx]->refreshScreenLayout(); } catch (rdr::Exception& e) { - vncFatalError("vncRefreshScreenLayout: %s\n", e.str()); + vncFatalError("vncRefreshScreenLayout: %s\n", e.what()); } } @@ -489,7 +489,7 @@ uint64_t vncGetMsc(int scrIdx) try { return desktop[scrIdx]->getMsc(); } catch (rdr::Exception& e) { - vncFatalError("vncGetMsc: %s\n", e.str()); + vncFatalError("vncGetMsc: %s\n", e.what()); } } @@ -498,7 +498,7 @@ void vncQueueMsc(int scrIdx, uint64_t id, uint64_t msc) try { desktop[scrIdx]->queueMsc(id, msc); } catch (rdr::Exception& e) { - vncFatalError("vncQueueMsc: %s\n", e.str()); + vncFatalError("vncQueueMsc: %s\n", e.what()); } } @@ -507,7 +507,7 @@ void vncAbortMsc(int scrIdx, uint64_t id) try { desktop[scrIdx]->abortMsc(id); } catch (rdr::Exception& e) { - vncFatalError("vncAbortMsc: %s\n", e.str()); + vncFatalError("vncAbortMsc: %s\n", e.what()); } } diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 81bea534..57904b64 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -108,9 +108,9 @@ CConn::CConn(const char* vncServerName, network::Socket* socket=nullptr) serverHost.c_str(), serverPort); } } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection(_("Failed to connect to \"%s\":\n\n%s"), - vncServerName, e.str()); + vncServerName, e.what()); return; } } @@ -262,7 +262,7 @@ void CConn::socketEvent(FL_SOCKET fd, void *data) cc->getOutStream()->cork(false); } catch (rdr::EndOfStream& e) { - vlog.info("%s", e.str()); + vlog.info("%s", e.what()); if (!cc->desktop) { vlog.error(_("The connection was dropped by the server before " "the session could be established.")); @@ -272,15 +272,15 @@ void CConn::socketEvent(FL_SOCKET fd, void *data) disconnect(); } } catch (rfb::AuthCancelledException& e) { - vlog.info("%s", e.str()); + vlog.info("%s", e.what()); disconnect(); } catch (rfb::AuthFailureException& e) { cc->resetPassword(); - vlog.error(_("Authentication failed: %s"), e.str()); + vlog.error(_("Authentication failed: %s"), e.what()); abort_connection(_("Failed to authenticate with the server. Reason " - "given by the server:\n\n%s"), e.str()); + "given by the server:\n\n%s"), e.what()); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx index 7b334bca..a1f4d23c 100644 --- a/vncviewer/ServerDialog.cxx +++ b/vncviewer/ServerDialog.cxx @@ -141,9 +141,9 @@ void ServerDialog::run(const char* servername, char *newservername) fltk_menu_add(dialog.serverName->menubutton(), entry.c_str(), 0, nullptr); } catch (Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); fl_alert(_("Unable to load the server history:\n\n%s"), - e.str()); + e.what()); } while (dialog.shown()) Fl::wait(); @@ -193,9 +193,9 @@ void ServerDialog::handleLoad(Fl_Widget* /*widget*/, void* data) try { dialog->serverName->value(loadViewerParameters(filename)); } catch (Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); fl_alert(_("Unable to load the specified configuration file:\n\n%s"), - e.str()); + e.what()); } delete(file_chooser); @@ -254,9 +254,9 @@ void ServerDialog::handleSaveAs(Fl_Widget* /*widget*/, void* data) try { saveViewerParameters(filename, servername); } catch (Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); fl_alert(_("Unable to save the specified configuration " - "file:\n\n%s"), e.str()); + "file:\n\n%s"), e.what()); } delete(file_chooser); @@ -288,9 +288,9 @@ void ServerDialog::handleConnect(Fl_Widget* /*widget*/, void *data) try { saveViewerParameters(nullptr, servername); } catch (Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); fl_alert(_("Unable to save the default configuration:\n\n%s"), - e.str()); + e.what()); } // avoid duplicates in the history @@ -300,9 +300,9 @@ void ServerDialog::handleConnect(Fl_Widget* /*widget*/, void *data) try { dialog->saveServerHistory(); } catch (Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); fl_alert(_("Unable to save the server history:\n\n%s"), - e.str()); + e.what()); } } diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index e29c877c..5163535d 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -576,7 +576,7 @@ int Viewport::handle(int event) try { cc->sendClipboardData(filtered.c_str()); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } @@ -669,7 +669,7 @@ void Viewport::sendPointerEvent(const rfb::Point& pos, uint8_t buttonMask) try { cc->writer()->writePointerEvent(pos, buttonMask); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } } else { @@ -776,7 +776,7 @@ void Viewport::handleClipboardChange(int source, void *data) try { self->cc->announceClipboard(true); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } } @@ -789,7 +789,7 @@ void Viewport::flushPendingClipboard() try { cc->announceClipboard(true); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } } @@ -814,7 +814,7 @@ void Viewport::handlePointerTimeout(void *data) self->cc->writer()->writePointerEvent(self->lastPointerPos, self->lastButtonMask); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } } @@ -886,7 +886,7 @@ void Viewport::handleKeyPress(int keyCode, uint32_t keySym) else cc->writer()->writeKeyEvent(keySym, keyCode, true); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } } @@ -916,7 +916,7 @@ void Viewport::handleKeyRelease(int keyCode) else cc->writer()->writeKeyEvent(iter->second, keyCode, false); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_connection_with_unexpected_error(e); } diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx index 2beae930..1eac8f9d 100644 --- a/vncviewer/parameters.cxx +++ b/vncviewer/parameters.cxx @@ -466,7 +466,7 @@ static void saveToReg(const char* servername) { } catch (Exception& e) { RegCloseKey(hKey); throw Exception(format(_("Failed to save \"%s\": %s"), - "ServerName", e.str())); + "ServerName", e.what())); } for (size_t i = 0; i < sizeof(parameterArray)/sizeof(VoidParameter*); i++) { @@ -483,7 +483,7 @@ static void saveToReg(const char* servername) { } catch (Exception& e) { RegCloseKey(hKey); throw Exception(format(_("Failed to save \"%s\": %s"), - parameterArray[i]->getName(), e.str())); + parameterArray[i]->getName(), e.what())); } } @@ -497,7 +497,7 @@ static void saveToReg(const char* servername) { RegCloseKey(hKey); throw Exception(format(_("Failed to remove \"%s\": %s"), readOnlyParameterArray[i]->getName(), - e.str())); + e.what())); } } @@ -537,7 +537,7 @@ list<string> loadHistoryFromRegKey() { } catch (Exception& e) { // Just ignore this entry and try the next one vlog.error(_("Failed to read server history entry %d: %s"), - (int)index, e.str()); + (int)index, e.what()); continue; } @@ -575,7 +575,7 @@ static void getParametersFromReg(VoidParameter* parameters[], } catch(Exception& e) { // Just ignore this entry and continue with the rest vlog.error(_("Failed to read parameter \"%s\": %s"), - parameters[i]->getName(), e.str()); + parameters[i]->getName(), e.what()); } } } @@ -605,7 +605,7 @@ static char* loadFromReg() { snprintf(servername, buffersize, "%s", servernameBuffer); } catch(Exception& e) { vlog.error(_("Failed to read parameter \"%s\": %s"), - "ServerName", e.str()); + "ServerName", e.what()); strcpy(servername, ""); } @@ -838,7 +838,7 @@ char* loadViewerParameters(const char *filename) { } catch(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.str()); + lineNr, filepath, e.what()); continue; } diff --git a/vncviewer/touch.cxx b/vncviewer/touch.cxx index 1efd3e46..0b2e4bc6 100644 --- a/vncviewer/touch.cxx +++ b/vncviewer/touch.cxx @@ -181,8 +181,8 @@ static int handleTouchEvent(void *event, void* /*data*/) try { handlers[msg->hwnd] = new Win32TouchHandler(msg->hwnd); } catch (rfb::Exception& e) { - vlog.error(_("Failed to create touch handler: %s"), e.str()); - abort_vncviewer(_("Failed to create touch handler: %s"), e.str()); + vlog.error(_("Failed to create touch handler: %s"), e.what()); + abort_vncviewer(_("Failed to create touch handler: %s"), e.what()); } // Add a special hook-in for handling events sent directly to WndProc if (!SetWindowSubclass(msg->hwnd, &win32WindowProc, 1, 0)) { diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index a1d9b39d..6a063382 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -157,7 +157,7 @@ void abort_connection(const char *error, ...) void abort_connection_with_unexpected_error(const rdr::Exception &e) { abort_connection(_("An unexpected error occurred when communicating " - "with the server:\n\n%s"), e.str()); + "with the server:\n\n%s"), e.what()); } void disconnect() @@ -514,9 +514,9 @@ potentiallyLoadConfigurationFile(const char *filename) strncpy(vncServerName, newServerName, VNCSERVERNAMELEN-1); vncServerName[VNCSERVERNAMELEN-1] = '\0'; } catch (rfb::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); abort_vncviewer(_("Unable to load the specified configuration " - "file:\n\n%s"), e.str()); + "file:\n\n%s"), e.what()); } } } @@ -672,7 +672,7 @@ int main(int argc, char** argv) defaultServerName[VNCSERVERNAMELEN-1] = '\0'; } } catch (rfb::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } for (int i = 1; i < argc;) { @@ -787,8 +787,8 @@ int main(int argc, char** argv) } } } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); - abort_vncviewer(_("Failure waiting for incoming VNC connection:\n\n%s"), e.str()); + vlog.error("%s", e.what()); + abort_vncviewer(_("Failure waiting for incoming VNC connection:\n\n%s"), e.what()); return 1; /* Not reached */ } @@ -808,8 +808,8 @@ int main(int argc, char** argv) try { mktunnel(); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); - abort_vncviewer(_("Failure setting up encrypted tunnel:\n\n%s"), e.str()); + vlog.error("%s", e.what()); + abort_vncviewer(_("Failure setting up encrypted tunnel:\n\n%s"), e.what()); } } #endif diff --git a/win/rfb_win32/CleanDesktop.cxx b/win/rfb_win32/CleanDesktop.cxx index 6d933b22..8e0b70bc 100644 --- a/win/rfb_win32/CleanDesktop.cxx +++ b/win/rfb_win32/CleanDesktop.cxx @@ -174,7 +174,7 @@ void CleanDesktop::disableWallpaper() { if (ad.enable(false)) restoreActiveDesktop = true; } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } // -=- Switch of normal wallpaper and notify apps @@ -182,7 +182,7 @@ void CleanDesktop::disableWallpaper() { restoreWallpaper = true; } catch (rdr::Exception& e) { - vlog.info("%s", e.str()); + vlog.info("%s", e.what()); } } @@ -199,7 +199,7 @@ void CleanDesktop::enableWallpaper() { ad.enable(true); restoreActiveDesktop = false; } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } } @@ -212,7 +212,7 @@ void CleanDesktop::enableWallpaper() { } } catch (rdr::Exception& e) { - vlog.info("%s", e.str()); + vlog.info("%s", e.what()); } } @@ -244,7 +244,7 @@ void CleanDesktop::disableEffects() { restoreEffects = true; } catch (rdr::Exception& e) { - vlog.info("%s", e.str()); + vlog.info("%s", e.what()); } } @@ -269,6 +269,6 @@ void CleanDesktop::enableEffects() { } } catch (rdr::Exception& e) { - vlog.info("%s", e.str()); + vlog.info("%s", e.what()); } } diff --git a/win/rfb_win32/Clipboard.cxx b/win/rfb_win32/Clipboard.cxx index 242ebf34..5a3e3aba 100644 --- a/win/rfb_win32/Clipboard.cxx +++ b/win/rfb_win32/Clipboard.cxx @@ -151,7 +151,7 @@ Clipboard::setClipText(const char* text) { vlog.debug("set clipboard"); } catch (rdr::Exception& e) { - vlog.debug("%s", e.str()); + vlog.debug("%s", e.what()); } // - Close the clipboard diff --git a/win/rfb_win32/DeviceFrameBuffer.cxx b/win/rfb_win32/DeviceFrameBuffer.cxx index ca2f57d4..2cf8adae 100644 --- a/win/rfb_win32/DeviceFrameBuffer.cxx +++ b/win/rfb_win32/DeviceFrameBuffer.cxx @@ -309,6 +309,6 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server) server->setCursor(width, height, hotspot, buffer.data()); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } } diff --git a/win/rfb_win32/MsgWindow.cxx b/win/rfb_win32/MsgWindow.cxx index e94b60a8..25d8ee2c 100644 --- a/win/rfb_win32/MsgWindow.cxx +++ b/win/rfb_win32/MsgWindow.cxx @@ -62,7 +62,7 @@ LRESULT CALLBACK MsgWindowProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) try { result = _this->processMessage(msg, wParam, lParam); } catch (rdr::Exception& e) { - vlog.error("untrapped: %s", e.str()); + vlog.error("untrapped: %s", e.what()); } return result; diff --git a/win/rfb_win32/RegConfig.cxx b/win/rfb_win32/RegConfig.cxx index fc006b21..e4ad5be5 100644 --- a/win/rfb_win32/RegConfig.cxx +++ b/win/rfb_win32/RegConfig.cxx @@ -54,7 +54,7 @@ bool RegConfig::setKey(const HKEY rootkey, const char* keyname) { processEvent(event); return true; } catch (rdr::Exception& e) { - vlog.debug("%s", e.str()); + vlog.debug("%s", e.what()); return false; } } @@ -71,7 +71,7 @@ void RegConfig::loadRegistryConfig(RegKey& key) { } } catch (rdr::Win32Exception& e) { if (e.err != ERROR_INVALID_HANDLE) - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } } diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx index 0ec5e231..ea64dbe9 100644 --- a/win/rfb_win32/SDisplay.cxx +++ b/win/rfb_win32/SDisplay.cxx @@ -202,7 +202,7 @@ void SDisplay::startCore() { if (tryMethod == 0) throw rdr::Exception("unable to access desktop"); tryMethod--; - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } } vlog.info("Started %s", core->methodName()); @@ -292,7 +292,7 @@ void SDisplay::restartCore() { // to cause the server to stop() the desktop. // Otherwise, the SDesktop is in an inconsistent state // and the server will crash. - server->closeClients(e.str()); + server->closeClients(e.what()); } } @@ -401,7 +401,7 @@ SDisplay::processEvent(HANDLE event) { try { core->flushUpdates(); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); restartCore(); return; } diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx index 2bc2f53e..cdc65409 100644 --- a/win/rfb_win32/SocketManager.cxx +++ b/win/rfb_win32/SocketManager.cxx @@ -80,7 +80,7 @@ void SocketManager::addListener(network::SocketListener* sock_, if (event) WSACloseEvent(event); delete sock_; - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); throw; } @@ -268,7 +268,7 @@ void SocketManager::processEvent(HANDLE event) { if (WSAEventSelect(ci.sock->getFd(), event, eventMask) == SOCKET_ERROR) throw rdr::SocketException("unable to re-enable WSAEventSelect:%u", WSAGetLastError()); } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); remSocket(ci.sock); } } diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h index a540bd76..8c8bb9aa 100644 --- a/win/vncconfig/Connections.h +++ b/win/vncconfig/Connections.h @@ -74,7 +74,7 @@ namespace rfb { network::TcpFilter::Pattern pat(network::TcpFilter::parsePattern(newPat.c_str())); pattern = network::TcpFilter::patternToStr(pat); } catch(rdr::Exception& e) { - MsgBox(nullptr, e.str(), MB_ICONEXCLAMATION | MB_OK); + MsgBox(nullptr, e.what(), MB_ICONEXCLAMATION | MB_OK); return false; } return true; diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx index 9300bb05..3dae1c99 100644 --- a/win/vncconfig/Legacy.cxx +++ b/win/vncconfig/Legacy.cxx @@ -146,7 +146,7 @@ void LegacyPage::LoadPrefs() vlog.info("loading Default prefs"); LoadUserPrefs(userKey); } catch(rdr::Exception& e) { - vlog.error("error reading Default settings:%s", e.str()); + vlog.error("error reading Default settings:%s", e.what()); } // Open the local, user-specific settings @@ -157,7 +157,7 @@ void LegacyPage::LoadPrefs() vlog.info("loading local User prefs"); LoadUserPrefs(userKey); } catch(rdr::Exception& e) { - vlog.error("error reading local User settings:%s", e.str()); + vlog.error("error reading local User settings:%s", e.what()); } // Open the user's own settings @@ -168,7 +168,7 @@ void LegacyPage::LoadPrefs() vlog.info("loading global User prefs"); LoadUserPrefs(userKey); } catch(rdr::Exception& e) { - vlog.error("error reading global User settings:%s", e.str()); + vlog.error("error reading global User settings:%s", e.what()); } } } diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx index 55f01d2e..bfe4e640 100644 --- a/win/vncconfig/vncconfig.cxx +++ b/win/vncconfig/vncconfig.cxx @@ -180,7 +180,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /* } } catch (rdr::Exception& e) { - MsgBox(nullptr, e.str(), MB_ICONEXCLAMATION | MB_OK); + MsgBox(nullptr, e.what(), MB_ICONEXCLAMATION | MB_OK); return 1; } diff --git a/win/winvnc/ManagedListener.cxx b/win/winvnc/ManagedListener.cxx index adc074cf..43fe863a 100644 --- a/win/winvnc/ManagedListener.cxx +++ b/win/winvnc/ManagedListener.cxx @@ -101,7 +101,7 @@ void ManagedListener::refresh() { network::createTcpListeners(&sockets, nullptr, port); } } catch (rdr::Exception& e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } if (!sockets.empty()) { if (!localOnly) { diff --git a/win/winvnc/STrayIcon.cxx b/win/winvnc/STrayIcon.cxx index d703f47a..3dbe2c81 100644 --- a/win/winvnc/STrayIcon.cxx +++ b/win/winvnc/STrayIcon.cxx @@ -160,7 +160,7 @@ public: try { rfb::win32::stopService(VNCServerService::Name); } catch (rdr::Exception& e) { - MsgBox(nullptr, e.str(), MB_ICONERROR | MB_OK); + MsgBox(nullptr, e.what(), MB_ICONERROR | MB_OK); } } else { thread.server.stop(); diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx index c1545ab6..9d722740 100644 --- a/win/winvnc/VNCServerWin32.cxx +++ b/win/winvnc/VNCServerWin32.cxx @@ -197,10 +197,10 @@ int VNCServerWin32::run() { vlog.debug("Server exited cleanly"); } catch (rdr::Win32Exception &s) { - vlog.error("%s", s.str()); + vlog.error("%s", s.what()); result = s.err; } catch (rdr::Exception &e) { - vlog.error("%s", e.str()); + vlog.error("%s", e.what()); } { diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx index ceee0c6f..e6f8abe7 100644 --- a/win/winvnc/winvnc.cxx +++ b/win/winvnc/winvnc.cxx @@ -229,7 +229,7 @@ static void processParams(int argc, char** argv) { } } catch (rdr::Exception& e) { - MsgBoxOrLog(e.str(), true); + MsgBoxOrLog(e.what(), true); } } } @@ -285,7 +285,7 @@ int WINAPI WinMain(HINSTANCE /*inst*/, HINSTANCE /*prevInst*/, char* /*cmdLine*/ vlog.debug("WinVNC service destroyed"); } catch (rdr::Exception& e) { - MsgBoxOrLog(e.str(), true); + MsgBoxOrLog(e.what(), true); } vlog.debug("WinVNC process quitting"); |