Drop padding in blk* when finalizing file

This commit is contained in:
Pieter Wuille
2013-01-30 04:17:33 +01:00
committed by Pieter Wuille
parent 288fdc092a
commit 1eb578796c
3 changed files with 15 additions and 2 deletions

View File

@@ -1161,6 +1161,14 @@ int GetFilesize(FILE* file)
return nFilesize;
}
bool TruncateFile(FILE *file, unsigned int length) {
#if defined(WIN32)
return _chsize(_fileno(file), length) == 0;
#else
return ftruncate(fileno(file), length) == 0;
#endif
}
// this function tries to make a particular range of a file allocated (corresponding to disk space)
// it is advisory, and the range specified in the arguments will never contain live data
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {