diff --git a/src/net.cpp b/src/net.cpp index f71dc1a08..bd11ddaa9 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -27,6 +27,8 @@ #include #endif +#include + // Dump addresses to peers.dat every 15 minutes (900s) #define DUMP_ADDRESSES_INTERVAL 900 diff --git a/src/util.cpp b/src/util.cpp index adcdbe8fd..f8eb9a658 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1090,16 +1090,6 @@ void FileCommit(FILE *fileout) #endif } -int GetFilesize(FILE* file) -{ - int nSavePos = ftell(file); - int nFilesize = -1; - if (fseek(file, 0, SEEK_END) == 0) - nFilesize = ftell(file); - fseek(file, nSavePos, SEEK_SET); - return nFilesize; -} - bool TruncateFile(FILE *file, unsigned int length) { #if defined(WIN32) return _chsize(_fileno(file), length) == 0; @@ -1178,7 +1168,7 @@ void ShrinkDebugFile() // Scroll debug.log if it's getting too big boost::filesystem::path pathLog = GetDataDir() / "debug.log"; FILE* file = fopen(pathLog.string().c_str(), "r"); - if (file && GetFilesize(file) > 10 * 1000000) + if (file && boost::filesystem::file_size(pathLog) > 10 * 1000000) { // Restart the file with some of the end char pch[200000]; @@ -1197,13 +1187,6 @@ void ShrinkDebugFile() fclose(file); } - - - - - - - // // "Never go to sea with two chronometers; take one or three." // Our three time sources are: diff --git a/src/util.h b/src/util.h index 940bba186..63fce428b 100644 --- a/src/util.h +++ b/src/util.h @@ -186,7 +186,6 @@ std::string EncodeBase32(const unsigned char* pch, size_t len); std::string EncodeBase32(const std::string& str); void ParseParameters(int argc, const char*const argv[]); void FileCommit(FILE *fileout); -int GetFilesize(FILE* file); bool TruncateFile(FILE *file, unsigned int length); int RaiseFileDescriptorLimit(int nMinFD); void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);