summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-05-29 15:50:08 +0200
committerPierre Ossman <ossman@cendio.se>2018-05-29 15:50:08 +0200
commit8ee522a66e6d25aa1b89acb8a28c53cb63f781e5 (patch)
tree2df3e9bd238ba6b1bc34a887e0f800ce80c7e0d4
parent8750db35e8d2792b6d2063ccfc439c2854edd593 (diff)
downloadtigervnc-8ee522a66e6d25aa1b89acb8a28c53cb63f781e5.tar.gz
tigervnc-8ee522a66e6d25aa1b89acb8a28c53cb63f781e5.zip
Catch exceptions by reference
We use polymorphic exception objects, so catching by value invokes the copy constructor and stuff that we don't really want.
-rw-r--r--common/rfb/DecodeManager.cxx2
-rw-r--r--common/rfb/HTTPServer.cxx2
-rw-r--r--tests/decperf.cxx6
-rw-r--r--tests/encperf.cxx6
-rw-r--r--win/rfb_win32/Dialog.cxx2
-rw-r--r--win/rfb_win32/Registry.cxx8
-rw-r--r--win/vncconfig/Connections.h4
-rw-r--r--win/vncconfig/Legacy.cxx4
-rw-r--r--win/winvnc/winvnc.cxx4
9 files changed, 19 insertions, 19 deletions
diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx
index 774f7bb8..c509db09 100644
--- a/common/rfb/DecodeManager.cxx
+++ b/common/rfb/DecodeManager.cxx
@@ -277,7 +277,7 @@ void DecodeManager::DecodeThread::worker()
entry->decoder->decodeRect(entry->rect, entry->bufferStream->data(),
entry->bufferStream->length(),
*entry->cp, entry->pb);
- } catch (rdr::Exception e) {
+ } catch (rdr::Exception& e) {
manager->setThreadException(e);
} catch(...) {
assert(false);
diff --git a/common/rfb/HTTPServer.cxx b/common/rfb/HTTPServer.cxx
index 54becbb2..2895a690 100644
--- a/common/rfb/HTTPServer.cxx
+++ b/common/rfb/HTTPServer.cxx
@@ -125,7 +125,7 @@ copyStream(InStream& is, OutStream& os) {
while (1) {
os.writeU8(is.readU8());
}
- } catch (rdr::EndOfStream) {
+ } catch (rdr::EndOfStream&) {
}
}
diff --git a/tests/decperf.cxx b/tests/decperf.cxx
index 3b929a4b..9061cb53 100644
--- a/tests/decperf.cxx
+++ b/tests/decperf.cxx
@@ -142,7 +142,7 @@ static struct stats runTest(const char *fn)
try {
cc = new CConn(fn);
- } catch (rdr::Exception e) {
+ } catch (rdr::Exception& e) {
fprintf(stderr, "Failed to open rfb file: %s\n", e.str());
exit(1);
}
@@ -150,8 +150,8 @@ static struct stats runTest(const char *fn)
try {
while (true)
cc->processMsg();
- } catch (rdr::EndOfStream e) {
- } catch (rdr::Exception e) {
+ } catch (rdr::EndOfStream& e) {
+ } catch (rdr::Exception& e) {
fprintf(stderr, "Failed to run rfb file: %s\n", e.str());
exit(1);
}
diff --git a/tests/encperf.cxx b/tests/encperf.cxx
index 7b9ff816..4e7038fd 100644
--- a/tests/encperf.cxx
+++ b/tests/encperf.cxx
@@ -342,7 +342,7 @@ static struct stats runTest(const char *fn)
try {
cc = new CConn(fn);
- } catch (rdr::Exception e) {
+ } catch (rdr::Exception& e) {
fprintf(stderr, "Failed to open rfb file: %s\n", e.str());
exit(1);
}
@@ -350,8 +350,8 @@ static struct stats runTest(const char *fn)
try {
while (true)
cc->processMsg();
- } catch (rdr::EndOfStream e) {
- } catch (rdr::Exception e) {
+ } catch (rdr::EndOfStream& e) {
+ } catch (rdr::Exception& e) {
fprintf(stderr, "Failed to run rfb file: %s\n", e.str());
exit(1);
}
diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx
index c6f303c2..c9e333dd 100644
--- a/win/rfb_win32/Dialog.cxx
+++ b/win/rfb_win32/Dialog.cxx
@@ -344,7 +344,7 @@ bool PropSheet::showPropSheet(HWND owner, bool showApply, bool showCtxtHelp, boo
delete [] hpages; hpages = 0;
return true;
- } catch (rdr::Exception) {
+ } catch (rdr::Exception&) {
alreadyShowing = false;
std::list<PropSheetPage*>::iterator pspi;
diff --git a/win/rfb_win32/Registry.cxx b/win/rfb_win32/Registry.cxx
index afbdd067..963a36a2 100644
--- a/win/rfb_win32/Registry.cxx
+++ b/win/rfb_win32/Registry.cxx
@@ -164,7 +164,7 @@ TCHAR* RegKey::getString(const TCHAR* valname) const {return getRepresentation(v
TCHAR* RegKey::getString(const TCHAR* valname, const TCHAR* def) const {
try {
return getString(valname);
- } catch(rdr::Exception) {
+ } catch(rdr::Exception&) {
return tstrDup(def);
}
}
@@ -177,7 +177,7 @@ void RegKey::getBinary(const TCHAR* valname, void** data, int* length) const {
void RegKey::getBinary(const TCHAR* valname, void** data, int* length, void* def, int deflen) const {
try {
getBinary(valname, data, length);
- } catch(rdr::Exception) {
+ } catch(rdr::Exception&) {
if (deflen) {
*data = new char[deflen];
memcpy(*data, def, deflen);
@@ -194,7 +194,7 @@ int RegKey::getInt(const TCHAR* valname) const {
int RegKey::getInt(const TCHAR* valname, int def) const {
try {
return getInt(valname);
- } catch(rdr::Exception) {
+ } catch(rdr::Exception&) {
return def;
}
}
@@ -269,7 +269,7 @@ bool RegKey::isValue(const TCHAR* valname) const {
try {
TCharArray tmp(getRepresentation(valname));
return true;
- } catch(rdr::Exception) {
+ } catch(rdr::Exception&) {
return false;
}
}
diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h
index 3d3c06cb..b3402ab4 100644
--- a/win/vncconfig/Connections.h
+++ b/win/vncconfig/Connections.h
@@ -76,7 +76,7 @@ namespace rfb {
try {
network::TcpFilter::Pattern pat(network::TcpFilter::parsePattern(CStr(newPat.buf)));
pattern.replaceBuf(TCharArray(network::TcpFilter::patternToStr(pat)).takeBuf());
- } catch(rdr::Exception e) {
+ } catch(rdr::Exception& e) {
MsgBox(NULL, TStr(e.str()), MB_ICONEXCLAMATION | MB_OK);
return false;
}
@@ -261,7 +261,7 @@ namespace rfb {
(http_port != getItemInt(IDC_HTTP_PORT)) ||
((http_port!=0) != (isItemChecked(IDC_HTTP_ENABLE)!=0)) ||
(rfb::Server::idleTimeout != getItemInt(IDC_IDLE_TIMEOUT));
- } catch (rdr::Exception) {
+ } catch (rdr::Exception&) {
return false;
}
}
diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx
index 7d51de81..b56eb370 100644
--- a/win/vncconfig/Legacy.cxx
+++ b/win/vncconfig/Legacy.cxx
@@ -127,7 +127,7 @@ void LegacyPage::LoadPrefs()
// Finally, save the Hosts value
regKey.setString(_T("Hosts"), TStr(newHosts.buf));
- } catch (rdr::Exception) {
+ } catch (rdr::Exception&) {
MsgBox(0, _T("Unable to convert AuthHosts setting to Hosts format."),
MB_ICONWARNING | MB_OK);
}
@@ -148,7 +148,7 @@ void LegacyPage::LoadPrefs()
regKey.setBool(_T("AlwaysShared"), connectPriority == 1);
regKey.setBool(_T("NeverShared"), connectPriority == 2);
- } catch(rdr::Exception) {
+ } catch(rdr::Exception&) {
}
// Open the local, default-user settings
diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx
index 5623421b..43c852c4 100644
--- a/win/winvnc/winvnc.cxx
+++ b/win/winvnc/winvnc.cxx
@@ -172,13 +172,13 @@ static void processParams(int argc, char** argv) {
// Try to clean up earlier services we've had
try {
rfb::win32::unregisterService("WinVNC4");
- } catch (rdr::SystemException) {
+ } catch (rdr::SystemException&) {
// Do nothing as we might fail simply because there was no
// service to remove
}
try {
rfb::win32::unregisterService("TigerVNC Server");
- } catch (rdr::SystemException) {
+ } catch (rdr::SystemException&) {
}
if (rfb::win32::registerService(VNCServerService::Name,