From fd525ae7df984def99cde74793e60d9a18ef3798 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Mon, 27 Jan 2003 18:55:50 +0000 Subject: [PATCH] Portability fixes. committer: mfx 1043693750 +0000 --- src/except.cpp | 11 +++-------- src/except.h | 43 +++++++++++++++++++++---------------------- src/msg.cpp | 2 +- src/stdcxx.h | 4 +--- 4 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/except.cpp b/src/except.cpp index 8e636b15..b65b862a 100644 --- a/src/except.cpp +++ b/src/except.cpp @@ -35,7 +35,7 @@ long Throwable::counter = 0; -Throwable::Throwable(const char *m, int e, bool w) +Throwable::Throwable(const char *m, int e, bool w) NOTHROW : super(), msg(NULL), err(e), is_warning(w) { if (m) @@ -47,7 +47,7 @@ Throwable::Throwable(const char *m, int e, bool w) } -Throwable::Throwable(const Throwable &other) +Throwable::Throwable(const Throwable &other) NOTHROW : super(other), msg(NULL), err(other.err), is_warning(other.is_warning) { if (other.msg) @@ -174,7 +174,7 @@ void throwEOFException(const char *msg, int e) // **************************************************************************/ -const char *prettyName(const char *n) +const char *prettyName(const char *n) NOTHROW { if (n == NULL) return "(null)"; @@ -192,11 +192,6 @@ const char *prettyName(const char *n) return n; } -const char *prettyName(const std::type_info &ti) -{ - return prettyName(ti.name()); -} - /* vi:ts=4:et diff --git a/src/except.h b/src/except.h index aee37e7a..caf51def 100644 --- a/src/except.h +++ b/src/except.h @@ -31,8 +31,7 @@ #ifdef __cplusplus -const char *prettyName(const char *n); -const char *prettyName(const std::type_info &ti); +const char *prettyName(const char *n) NOTHROW; /************************************************************************* @@ -43,13 +42,13 @@ class Throwable : public std::exception { typedef std::exception super; protected: - Throwable(const char *m = 0, int e = 0, bool w = false); + Throwable(const char *m = 0, int e = 0, bool w = false) NOTHROW; public: - Throwable(const Throwable &); + Throwable(const Throwable &) NOTHROW; virtual ~Throwable() NOTHROW; - const char *getMsg() const { return msg; } - int getErrno() const { return err; } - bool isWarning() const { return is_warning; } + const char *getMsg() const NOTHROW { return msg; } + int getErrno() const NOTHROW { return err; } + bool isWarning() const NOTHROW { return is_warning; } private: char *msg; int err; @@ -72,7 +71,7 @@ class Exception : public Throwable { typedef Throwable super; public: - Exception(const char *m = 0, int e = 0, bool w = false) : super(m,e,w) { } + Exception(const char *m = 0, int e = 0, bool w = false) NOTHROW : super(m,e,w) { } }; @@ -81,7 +80,7 @@ class Error : public Throwable { typedef Throwable super; public: - Error(const char *m = 0, int e = 0) : super(m,e) { } + Error(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } }; @@ -93,7 +92,7 @@ class OutOfMemoryException : public Exception { typedef Exception super; public: - OutOfMemoryException(const char *m = 0, int e = 0) : super(m,e) { } + OutOfMemoryException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } }; @@ -101,7 +100,7 @@ class IOException : public Exception { typedef Exception super; public: - IOException(const char *m = 0, int e = 0) : super(m,e) { } + IOException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } }; @@ -109,7 +108,7 @@ class EOFException : public IOException { typedef IOException super; public: - EOFException(const char *m = 0, int e = 0) : super(m,e) { } + EOFException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } }; @@ -117,7 +116,7 @@ class FileNotFoundException : public IOException { typedef IOException super; public: - FileNotFoundException(const char *m = 0, int e = 0) : super(m,e) { } + FileNotFoundException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } }; @@ -125,7 +124,7 @@ class FileAlreadyExistsException : public IOException { typedef IOException super; public: - FileAlreadyExistsException(const char *m = 0, int e = 0) : super(m,e) { } + FileAlreadyExistsException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { } }; @@ -137,35 +136,35 @@ class OverlayException : public Exception { typedef Exception super; public: - OverlayException(const char *m = 0, bool w = false) : super(m,0,w) { } + OverlayException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { } }; class CantPackException : public Exception { typedef Exception super; public: - CantPackException(const char *m = 0, bool w = false) : super(m,0,w) { } + CantPackException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { } }; class UnknownExecutableFormatException : public CantPackException { typedef CantPackException super; public: - UnknownExecutableFormatException(const char *m = 0, bool w = false) : super(m,w) { } + UnknownExecutableFormatException(const char *m = 0, bool w = false) NOTHROW : super(m,w) { } }; class AlreadyPackedException : public CantPackException { typedef CantPackException super; public: - AlreadyPackedException(const char *m = 0) : super(m) { is_warning = true; } + AlreadyPackedException(const char *m = 0) NOTHROW : super(m) { is_warning = true; } }; class NotCompressibleException : public CantPackException { typedef CantPackException super; public: - NotCompressibleException(const char *m = 0) : super(m) { } + NotCompressibleException(const char *m = 0) NOTHROW : super(m) { } }; @@ -173,14 +172,14 @@ class CantUnpackException : public Exception { typedef Exception super; public: - CantUnpackException(const char *m = 0, bool w = false) : super(m,0,w) { } + CantUnpackException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { } }; class NotPackedException : public CantUnpackException { typedef CantUnpackException super; public: - NotPackedException(const char *m = 0) : super(m,true) { } + NotPackedException(const char *m = 0) NOTHROW : super(m,true) { } }; @@ -192,7 +191,7 @@ class InternalError : public Error { typedef Error super; public: - InternalError(const char *m = 0) : super(m,0) { } + InternalError(const char *m = 0) NOTHROW : super(m,0) { } }; diff --git a/src/msg.cpp b/src/msg.cpp index 2063ef1a..ac673aee 100644 --- a/src/msg.cpp +++ b/src/msg.cpp @@ -110,7 +110,7 @@ void printErr(const char *iname, const Throwable *e) { char buf[1024]; - upx_snprintf(buf, sizeof(buf), "%s", prettyName(typeid(*e))); + upx_snprintf(buf, sizeof(buf), "%s", prettyName(typeid(e).name())); if (e->getMsg()) upx_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),": %s", e->getMsg()); if (e->getErrno()) diff --git a/src/stdcxx.h b/src/stdcxx.h index 1e4fcd00..e265a354 100644 --- a/src/stdcxx.h +++ b/src/stdcxx.h @@ -44,7 +44,7 @@ #if defined(new) || defined(delete) // debug -# define DISABLE_NEW_DELETE +# define DISABLE_NEW_DELETE private: #else @@ -95,8 +95,6 @@ private: #include namespace std { -#undef type_info -typedef ::Type_info type_info; class exception { public: