X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fserialize.h;h=ca1205102d174503c5698a37b0a915fae4512c42;hb=3176e0f244d929669aa3e1d81e0787d82d9150d3;hp=12ea1ec695f0f0068f3aa3fe67fd48a574c9f0c6;hpb=6b6aaa1698838278a547f16a15e635bd58ec867d;p=novacoin.git diff --git a/src/serialize.h b/src/serialize.h index 12ea1ec..ca12051 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1,7 +1,8 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers +// Copyright (c) 2012 The PPCoin developers // Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SERIALIZE_H #define BITCOIN_SERIALIZE_H @@ -155,8 +156,14 @@ template inline void Unserialize(Stream& s, bool& a, int, int=0 - - +#ifndef THROW_WITH_STACKTRACE +#define THROW_WITH_STACKTRACE(exception) \ +{ \ + LogStackTrace(); \ + throw (exception); \ +} +void LogStackTrace(); +#endif // // Compact size @@ -234,7 +241,7 @@ uint64 ReadCompactSize(Stream& is) nSizeRet = xSize; } if (nSizeRet > (uint64)MAX_SIZE) - throw std::ios_base::failure("ReadCompactSize() : size too large"); + THROW_WITH_STACKTRACE(std::ios_base::failure("ReadCompactSize() : size too large")); return nSizeRet; } @@ -905,7 +912,7 @@ public: { state |= bits; if (state & exceptmask) - throw std::ios_base::failure(psz); + THROW_WITH_STACKTRACE(std::ios_base::failure(psz)); } bool eof() const { return size() == 0; } @@ -1083,8 +1090,6 @@ public: int nType; int nVersion; - typedef FILE element_type; - CAutoFile(FILE* filenew, int nTypeIn, int nVersionIn) { file = filenew; @@ -1122,7 +1127,7 @@ public: { state |= bits; if (state & exceptmask) - throw std::ios_base::failure(psz); + THROW_WITH_STACKTRACE(std::ios_base::failure(psz)); } bool fail() const { return state & (std::ios::badbit | std::ios::failbit); }