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

Function FlatStream_Close

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

Source from the content-addressed store, hash-verified

1255}
1256
1257static void FlatStream_Close(TBlockStream * pStream)
1258{
1259 FILE_BITMAP_FOOTER Footer;
1260
1261 if(pStream->FileBitmap && pStream->IsModified)
1262 {
1263 // Write the file bitmap
1264 pStream->BaseWrite(pStream, &pStream->StreamSize, pStream->FileBitmap, pStream->BitmapSize);
1265
1266 // Prepare and write the file footer
1267 Footer.Signature = ID_FILE_BITMAP_FOOTER;
1268 Footer.Version = 3;
1269 Footer.BuildNumber = pStream->BuildNumber;
1270 Footer.MapOffsetLo = (DWORD)(pStream->StreamSize & 0xFFFFFFFF);
1271 Footer.MapOffsetHi = (DWORD)(pStream->StreamSize >> 0x20);
1272 Footer.BlockSize = pStream->BlockSize;
1273 BSWAP_ARRAY32_UNSIGNED(&Footer, sizeof(FILE_BITMAP_FOOTER));
1274 pStream->BaseWrite(pStream, NULL, &Footer, sizeof(FILE_BITMAP_FOOTER));
1275 }
1276
1277 // Close the base class
1278 BlockStream_Close(pStream);
1279}
1280
1281static bool FlatStream_CreateMirror(TBlockStream * pStream)
1282{

Callers

nothing calls this directly

Calls 1

BlockStream_CloseFunction · 0.85

Tested by

no test coverage detected