From cfac94a260391f34e7e8b45248e5d04f13a6ace9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <rafael.carre@savoirfairelinux.com> Date: Thu, 28 Jul 2011 14:33:30 -0400 Subject: [PATCH] * #6547: VoipLinkException: use runtime exceptions Avoid using stack variables out of their scope --- sflphone-common/src/voiplink.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/sflphone-common/src/voiplink.h b/sflphone-common/src/voiplink.h index 37e36399da..79c6719a04 100644 --- a/sflphone-common/src/voiplink.h +++ b/sflphone-common/src/voiplink.h @@ -34,6 +34,8 @@ #ifndef __VOIP_LINK_H__ #define __VOIP_LINK_H__ +#include <stdexcept> + #include "call.h" class Account; @@ -44,20 +46,11 @@ typedef std::string AccountID; /** Define a map that associate a Call object to a call identifier */ typedef std::map<CallID, Call*> CallMap; -class VoipLinkException : public std::exception +class VoipLinkException : public std::runtime_error { public: - VoipLinkException (const std::string& str="") throw() : errstr (str) {} - - virtual ~VoipLinkException() throw() {} - - virtual const char *what() const throw() { - std::string expt ("UserAgent: VoipLinkException occured: "); - expt.append (errstr); - return expt.c_str(); - } - private: - std::string errstr; + VoipLinkException (const std::string& str="") : + std::runtime_error("UserAgent: VoipLinkException occured: " + str) {} }; /** -- GitLab