mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Portability fixes.
committer: mfx <mfx> 1043693750 +0000
This commit is contained in:
parent
a282171318
commit
fd525ae7df
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
long Throwable::counter = 0;
|
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)
|
: super(), msg(NULL), err(e), is_warning(w)
|
||||||
{
|
{
|
||||||
if (m)
|
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)
|
: super(other), msg(NULL), err(other.err), is_warning(other.is_warning)
|
||||||
{
|
{
|
||||||
if (other.msg)
|
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)
|
if (n == NULL)
|
||||||
return "(null)";
|
return "(null)";
|
||||||
|
@ -192,11 +192,6 @@ const char *prettyName(const char *n)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *prettyName(const std::type_info &ti)
|
|
||||||
{
|
|
||||||
return prettyName(ti.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
vi:ts=4:et
|
vi:ts=4:et
|
||||||
|
|
43
src/except.h
43
src/except.h
|
@ -31,8 +31,7 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
const char *prettyName(const char *n);
|
const char *prettyName(const char *n) NOTHROW;
|
||||||
const char *prettyName(const std::type_info &ti);
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -43,13 +42,13 @@ class Throwable : public std::exception
|
||||||
{
|
{
|
||||||
typedef std::exception super;
|
typedef std::exception super;
|
||||||
protected:
|
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:
|
public:
|
||||||
Throwable(const Throwable &);
|
Throwable(const Throwable &) NOTHROW;
|
||||||
virtual ~Throwable() NOTHROW;
|
virtual ~Throwable() NOTHROW;
|
||||||
const char *getMsg() const { return msg; }
|
const char *getMsg() const NOTHROW { return msg; }
|
||||||
int getErrno() const { return err; }
|
int getErrno() const NOTHROW { return err; }
|
||||||
bool isWarning() const { return is_warning; }
|
bool isWarning() const NOTHROW { return is_warning; }
|
||||||
private:
|
private:
|
||||||
char *msg;
|
char *msg;
|
||||||
int err;
|
int err;
|
||||||
|
@ -72,7 +71,7 @@ class Exception : public Throwable
|
||||||
{
|
{
|
||||||
typedef Throwable super;
|
typedef Throwable super;
|
||||||
public:
|
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;
|
typedef Throwable super;
|
||||||
public:
|
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;
|
typedef Exception super;
|
||||||
public:
|
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;
|
typedef Exception super;
|
||||||
public:
|
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;
|
typedef IOException super;
|
||||||
public:
|
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;
|
typedef IOException super;
|
||||||
public:
|
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;
|
typedef IOException super;
|
||||||
public:
|
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;
|
typedef Exception super;
|
||||||
public:
|
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
|
class CantPackException : public Exception
|
||||||
{
|
{
|
||||||
typedef Exception super;
|
typedef Exception super;
|
||||||
public:
|
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
|
class UnknownExecutableFormatException : public CantPackException
|
||||||
{
|
{
|
||||||
typedef CantPackException super;
|
typedef CantPackException super;
|
||||||
public:
|
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
|
class AlreadyPackedException : public CantPackException
|
||||||
{
|
{
|
||||||
typedef CantPackException super;
|
typedef CantPackException super;
|
||||||
public:
|
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
|
class NotCompressibleException : public CantPackException
|
||||||
{
|
{
|
||||||
typedef CantPackException super;
|
typedef CantPackException super;
|
||||||
public:
|
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;
|
typedef Exception super;
|
||||||
public:
|
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
|
class NotPackedException : public CantUnpackException
|
||||||
{
|
{
|
||||||
typedef CantUnpackException super;
|
typedef CantUnpackException super;
|
||||||
public:
|
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;
|
typedef Error super;
|
||||||
public:
|
public:
|
||||||
InternalError(const char *m = 0) : super(m,0) { }
|
InternalError(const char *m = 0) NOTHROW : super(m,0) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ void printErr(const char *iname, const Throwable *e)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
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())
|
if (e->getMsg())
|
||||||
upx_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),": %s", e->getMsg());
|
upx_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),": %s", e->getMsg());
|
||||||
if (e->getErrno())
|
if (e->getErrno())
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#if defined(new) || defined(delete)
|
#if defined(new) || defined(delete)
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
# define DISABLE_NEW_DELETE
|
# define DISABLE_NEW_DELETE private:
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -95,8 +95,6 @@ private:
|
||||||
#include <typeinfo.h>
|
#include <typeinfo.h>
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
#undef type_info
|
|
||||||
typedef ::Type_info type_info;
|
|
||||||
class exception
|
class exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user