aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-06-26 15:21:59 +0200
committerJonas Schnelli <jonas.schnelli@include7.ch>2015-07-02 20:29:36 +0200
commitdfa174c2957f2600f05bf0ee9dd17fe18fb54fd7 (patch)
treec6bed078f0ef76b2a9ae3e0b7f6fd2e69557a470 /src/net.cpp
parentf581d3d656cf269ea09ac6f130f4bd70b40a9e55 (diff)
CAddrDB/CBanDB: change filesize variables from int to uint64_t
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 3a549d65c4..03db1f06a4 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1973,11 +1973,11 @@ bool CAddrDB::Read(CAddrMan& addr)
return error("%s: Failed to open file %s", __func__, pathAddr.string());
// use file size to size memory buffer
- int fileSize = boost::filesystem::file_size(pathAddr);
- int dataSize = fileSize - sizeof(uint256);
+ uint64_t fileSize = boost::filesystem::file_size(pathAddr);
+ uint64_t dataSize = 0;
// Don't try to resize to a negative number if file is small
- if (dataSize < 0)
- dataSize = 0;
+ if (fileSize >= sizeof(uint256))
+ dataSize = fileSize - sizeof(uint256);
vector<unsigned char> vchData;
vchData.resize(dataSize);
uint256 hashIn;
@@ -2230,11 +2230,11 @@ bool CBanDB::Read(std::map<CSubNet, int64_t>& banSet)
return error("%s: Failed to open file %s", __func__, pathBanlist.string());
// use file size to size memory buffer
- int fileSize = boost::filesystem::file_size(pathBanlist);
- int dataSize = fileSize - sizeof(uint256);
+ uint64_t fileSize = boost::filesystem::file_size(pathBanlist);
+ uint64_t dataSize = 0;
// Don't try to resize to a negative number if file is small
- if (dataSize < 0)
- dataSize = 0;
+ if (fileSize >= sizeof(uint256))
+ dataSize = fileSize - sizeof(uint256);
vector<unsigned char> vchData;
vchData.resize(dataSize);
uint256 hashIn;