diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-12-03 10:14:54 +0100 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-12-03 10:19:17 +0100 |
commit | a8a4b9673e1f4acabe835a692840c54c50862449 (patch) | |
tree | 7df2cdf42e78d72e78b9ac27a7f584fdd84ecdfd /src/main.h | |
parent | cd7fb7d1deece9da15d7750b3e05f729555a2cbe (diff) |
add 2 constructors in CDiskBlockPos to simplify class usage
- add a default-constructor, which simply calls SetNull() and a
constructor to directly pass nFile and nPos
- change code to use that new constructors
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main.h b/src/main.h index 4bd4782ccb..fbd68127a4 100644 --- a/src/main.h +++ b/src/main.h @@ -192,6 +192,15 @@ public: READWRITE(VARINT(nPos)); ) + CDiskBlockPos() { + SetNull(); + } + + CDiskBlockPos(int nFileIn, unsigned int nPosIn) { + nFile = nFileIn; + nPos = nPosIn; + } + friend bool operator==(const CDiskBlockPos &a, const CDiskBlockPos &b) { return (a.nFile == b.nFile && a.nPos == b.nPos); } @@ -1493,8 +1502,7 @@ public: if (nStatus & BLOCK_HAVE_DATA) { ret.nFile = nFile; ret.nPos = nDataPos; - } else - ret.SetNull(); + } return ret; } @@ -1503,8 +1511,7 @@ public: if (nStatus & BLOCK_HAVE_UNDO) { ret.nFile = nFile; ret.nPos = nUndoPos; - } else - ret.SetNull(); + } return ret; } |