@@ -609,21 +609,18 @@ class CWalletTx : public CMerkleTx
609609
610610 template <typename Stream, typename Operation>
611611 inline void SerializationOp (Stream& s, Operation ser_action, int nType, int nVersion) {
612- bool fRead = ser_action.ForRead ();
613-
614- CWalletTx* pthis = const_cast <CWalletTx*>(this );
615- if (fRead )
616- pthis->Init (NULL );
612+ if (ser_action.ForRead ())
613+ Init (NULL );
617614 char fSpent = false ;
618615
619- if (!fRead )
616+ if (!ser_action. ForRead () )
620617 {
621- pthis-> mapValue [" fromaccount" ] = pthis-> strFromAccount ;
618+ mapValue[" fromaccount" ] = strFromAccount;
622619
623- WriteOrderPos (pthis-> nOrderPos , pthis-> mapValue );
620+ WriteOrderPos (nOrderPos, mapValue);
624621
625622 if (nTimeSmart)
626- pthis-> mapValue [" timesmart" ] = strprintf (" %u" , nTimeSmart);
623+ mapValue[" timesmart" ] = strprintf (" %u" , nTimeSmart);
627624 }
628625
629626 READWRITE (*(CMerkleTx*)this );
@@ -636,13 +633,13 @@ class CWalletTx : public CMerkleTx
636633 READWRITE (fFromMe );
637634 READWRITE (fSpent );
638635
639- if (fRead )
636+ if (ser_action. ForRead () )
640637 {
641- pthis-> strFromAccount = pthis-> mapValue [" fromaccount" ];
638+ strFromAccount = mapValue[" fromaccount" ];
642639
643- ReadOrderPos (pthis-> nOrderPos , pthis-> mapValue );
640+ ReadOrderPos (nOrderPos, mapValue);
644641
645- pthis-> nTimeSmart = mapValue.count (" timesmart" ) ? (unsigned int )atoi64 (pthis-> mapValue [" timesmart" ]) : 0 ;
642+ nTimeSmart = mapValue.count (" timesmart" ) ? (unsigned int )atoi64 (mapValue[" timesmart" ]) : 0 ;
646643 }
647644
648645 mapValue.erase (" fromaccount" );
@@ -979,46 +976,43 @@ class CAccountingEntry
979976
980977 template <typename Stream, typename Operation>
981978 inline void SerializationOp (Stream& s, Operation ser_action, int nType, int nVersion) {
982- bool fRead = ser_action.ForRead ();
983-
984- CAccountingEntry& me = *const_cast <CAccountingEntry*>(this );
985979 if (!(nType & SER_GETHASH))
986980 READWRITE (nVersion);
987981 // Note: strAccount is serialized as part of the key, not here.
988982 READWRITE (nCreditDebit);
989983 READWRITE (nTime);
990984 READWRITE (LIMITED_STRING (strOtherAccount, 65536 ));
991985
992- if (!fRead )
986+ if (!ser_action. ForRead () )
993987 {
994- WriteOrderPos (nOrderPos, me. mapValue );
988+ WriteOrderPos (nOrderPos, mapValue);
995989
996990 if (!(mapValue.empty () && _ssExtra.empty ()))
997991 {
998992 CDataStream ss (nType, nVersion);
999993 ss.insert (ss.begin (), ' \0 ' );
1000994 ss << mapValue;
1001995 ss.insert (ss.end (), _ssExtra.begin (), _ssExtra.end ());
1002- me. strComment .append (ss.str ());
996+ strComment.append (ss.str ());
1003997 }
1004998 }
1005999
10061000 READWRITE (LIMITED_STRING (strComment, 65536 ));
10071001
10081002 size_t nSepPos = strComment.find (" \0 " , 0 , 1 );
1009- if (fRead )
1003+ if (ser_action. ForRead () )
10101004 {
1011- me. mapValue .clear ();
1005+ mapValue.clear ();
10121006 if (std::string::npos != nSepPos)
10131007 {
10141008 CDataStream ss (std::vector<char >(strComment.begin () + nSepPos + 1 , strComment.end ()), nType, nVersion);
1015- ss >> me. mapValue ;
1016- me. _ssExtra = std::vector<char >(ss.begin (), ss.end ());
1009+ ss >> mapValue;
1010+ _ssExtra = std::vector<char >(ss.begin (), ss.end ());
10171011 }
1018- ReadOrderPos (me. nOrderPos , me. mapValue );
1012+ ReadOrderPos (nOrderPos, mapValue);
10191013 }
10201014 if (std::string::npos != nSepPos)
1021- me. strComment .erase (nSepPos);
1015+ strComment.erase (nSepPos);
10221016
10231017 mapValue.erase (" n" );
10241018 }
0 commit comments