Browse Source

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.
0.8
Jeff Garzik 13 years ago committed by Jeff Garzik
parent
commit
10ab9c2f42
  1. 2
      src/main.cpp

2
src/main.cpp

@ -1836,7 +1836,7 @@ bool CheckDiskSpace(uint64 nAdditionalBytes) @@ -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)

Loading…
Cancel
Save