OpenBlockFile(): cast to eliminate signed/unsigned comparison warning

nFile's null value is -1.  Cast that to unsigned int, to avoid warning.

Additionally, avoid nFile==0 because the first valid value is 1.
This commit is contained in:
Jeff Garzik 2012-05-01 17:50:33 -04:00 committed by Jeff Garzik
parent 24de922636
commit 10ab9c2f42

View File

@ -1836,7 +1836,7 @@ bool CheckDiskSpace(uint64 nAdditionalBytes)
FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode)
{
if (nFile == -1)
if ((nFile < 1) || (nFile == (unsigned int) -1))
return NULL;
FILE* file = fopen((GetDataDir() / strprintf("blk%04d.dat", nFile)).string().c_str(), pszMode);
if (!file)