MCPcopy Create free account
hub / github.com/diasurgical/devilution / PartStream_CheckFile

Function PartStream_CheckFile

3rdParty/StormLib/src/FileStream.cpp:1452–1475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1450}
1451
1452static DWORD PartStream_CheckFile(TBlockStream * pStream)
1453{
1454 PPART_FILE_MAP_ENTRY FileBitmap = (PPART_FILE_MAP_ENTRY)pStream->FileBitmap;
1455 DWORD dwBlockCount;
1456
1457 // Get the number of blocks
1458 dwBlockCount = (DWORD)((pStream->StreamSize + pStream->BlockSize - 1) / pStream->BlockSize);
1459
1460 // Check all blocks
1461 for(DWORD i = 0; i < dwBlockCount; i++, FileBitmap++)
1462 {
1463 // Few sanity checks
1464 assert(FileBitmap->LargeValueHi == 0);
1465 assert(FileBitmap->LargeValueLo == 0);
1466 assert(FileBitmap->Flags == 0 || FileBitmap->Flags == 3);
1467
1468 // Check if this block is present
1469 if(FileBitmap->Flags != 3)
1470 return 0;
1471 }
1472
1473 // Yes, the file is complete
1474 return 1;
1475}
1476
1477static bool PartStream_LoadBitmap(TBlockStream * pStream)
1478{

Callers 1

PartStream_LoadBitmapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected