Logo Search packages:      
Sourcecode: djvulibre version File versions

void IFFByteStream::close_chunk (  ) 

Leaves the current chunk. This function leaves the chunk previously entered by a matching call to get_chunk# and put_chunk#. The IFFByteStream is then ready to process the next chunk at the same hierarchical level.

Definition at line 394 of file IFFByteStream.cpp.

Referenced by DjVuFile::change_meta(), compare(), DjVuFile::contains_anno(), DjVuFile::contains_meta(), DjVuFile::contains_text(), DjVuDocEditor::create_shared_anno_file(), DjVuAnno::decode(), DjVuAnno::encode(), IWPixmap::Encode::encode_iff(), IWBitmap::Encode::encode_iff(), DjVuFile::insert_file(), GIFFManager::load_chunk(), GIFFManager::load_file(), DjVmDoc::read(), DjVuFile::remove_anno(), DjVuFile::remove_meta(), DjVuFile::remove_text(), GIFFChunk::save(), DjVuDocEditor::save_as(), seek_close_chunk(), DjVuFile::unlink_file(), DjVmDoc::write(), DjVmDoc::write_index(), and DjVuImage::writeXML().

{
  // Check that this is ok
  if (!ctx)
    G_THROW( ERR_MSG("IFFByteStream.cant_close") );
  // Patch size field in new chunk
  if (dir > 0)
    {
      ctx->offEnd = offset;
      long size = ctx->offEnd - ctx->offStart;
      char buffer[4];
      buffer[0] = (unsigned char)(size>>24);
      buffer[1] = (unsigned char)(size>>16);
      buffer[2] = (unsigned char)(size>>8);
      buffer[3] = (unsigned char)(size);
      bs->seek(ctx->offStart - 4);
      bs->writall((void*)buffer, 4);
      bs->seek(offset);
    }
  // Arrange for reader to seek at next chunk
  seekto = ctx->offEnd;
  // Remove ctx record
  IFFContext *octx = ctx;
  ctx = octx->next;
  assert(ctx==0 || ctx->bComposite);
  delete octx;
}


Generated by  Doxygen 1.6.0   Back to index