---------------------------------------------------------------------
| 372 | } |
| 373 | //--------------------------------------------------------------------- |
| 374 | void StreamSerialiser::writeChunkEnd(uint32 id) |
| 375 | { |
| 376 | checkStream(false, false, true); |
| 377 | |
| 378 | Chunk* c = popChunk(id); |
| 379 | |
| 380 | // update the sizes |
| 381 | size_t currPos = mStream->tell(); |
| 382 | c->length = static_cast<uint32>(currPos - c->offset - CHUNK_HEADER_SIZE); |
| 383 | |
| 384 | // seek to 'length' position in stream for this chunk |
| 385 | // skip id (32) and version (16) |
| 386 | mStream->seek(c->offset + sizeof(uint32) + sizeof(uint16)); |
| 387 | write(&c->length); |
| 388 | // write updated checksum |
| 389 | uint32 checksum = calculateChecksum(c); |
| 390 | write(&checksum); |
| 391 | |
| 392 | // seek back to previous position |
| 393 | mStream->seek(currPos); |
| 394 | |
| 395 | OGRE_DELETE c; |
| 396 | |
| 397 | } |
| 398 | //--------------------------------------------------------------------- |
| 399 | size_t StreamSerialiser::getOffsetFromChunkStart() const |
| 400 | { |