X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fserialize.h;h=bdcd830591d570dbde8aacb9d4ab8312b0cc406f;hb=cecf7a56ed5a5efd939b21c760c69da616306005;hp=03187b96b3e956bc7eb61de72efa70f2b35f6ce1;hpb=40a76f11c7056c53f71bfc60419ba7354016f55f;p=novacoin.git diff --git a/src/serialize.h b/src/serialize.h index 03187b9..bdcd830 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -56,56 +56,12 @@ enum SER_DISK = (1 << 1), SER_GETHASH = (1 << 2), - // modifiers - SER_SKIPSIG = (1 << 16), - SER_BLOCKHEADERONLY = (1 << 17) + // modifiers + SER_SKIPSIG = (1 << 16), + SER_BLOCKHEADERONLY = (1 << 17) }; -#ifdef _MSC_VER -#define IMPLEMENT_SERIALIZE(statements) \ - unsigned int GetSerializeSize(int nType, int nVersion) const \ - { \ - CSerActionGetSerializeSize ser_action; \ - const bool fGetSize = true; \ - const bool fWrite = false; \ - const bool fRead = false; \ - unsigned int nSerSize = 0; \ - ser_streamplaceholder s; \ - assert(fGetSize||fWrite||fRead); /* suppress warning */ \ - s.nType = nType; \ - s.nVersion = nVersion; \ - std::map mapUnkIds; \ - {statements} \ - return nSerSize; \ - } \ - template \ - void Serialize(Stream& s, int nType, int nVersion) const \ - { \ - CSerActionSerialize ser_action; \ - const bool fGetSize = false; \ - const bool fWrite = true; \ - const bool fRead = false; \ - unsigned int nSerSize = 0; \ - assert(fGetSize||fWrite||fRead); /* suppress warning */ \ - std::map mapUnkIds; \ - {statements} \ - } \ - template \ - void Unserialize(Stream& s, int nType, int nVersion) \ - { \ - CSerActionUnserialize ser_action; \ - const bool fGetSize = false; \ - const bool fWrite = false; \ - const bool fRead = true; \ - unsigned int nSerSize = 0; \ - std::map mapUnkIds; \ - assert(fGetSize||fWrite||fRead); /* suppress warning */ \ - {statements} \ - } - -#else - #define IMPLEMENT_SERIALIZE(statements) \ unsigned int GetSerializeSize(int nType, int nVersion) const \ { \ @@ -144,8 +100,6 @@ enum {statements} \ } -#endif - #define READWRITE(obj) (nSerSize += ::SerReadWrite(s, (obj), nType, nVersion, ser_action)) @@ -316,7 +270,7 @@ template inline unsigned int GetSizeOfVarInt(I n) { int nRet = 0; - while(true) { + for ( ; ; ) { nRet++; if (n <= 0x7F) break; @@ -330,7 +284,7 @@ void WriteVarInt(Stream& os, I n) { unsigned char tmp[(sizeof(n)*8+6)/7]; int len=0; - while(true) { + for ( ; ; ) { tmp[len] = (n & 0x7F) | (len ? 0x80 : 0x00); if (n <= 0x7F) break; @@ -346,7 +300,7 @@ template I ReadVarInt(Stream& is) { I n = 0; - while(true) { + for ( ; ; ) { unsigned char chData; READDATA(is, chData); n = (n << 7) | (chData & 0x7F);