Topic Path: Symbol Reference > Classes > TIdCompressionIntercept Class
ContentsIndexHome
PreviousUpNext
TIdCompressionIntercept Class

Implements an intercept that compresses a data stream using zlib.

File
TIdCompressionIntercept = class(TIdConnectionIntercept);

TIdCompressionIntercept is a TIdConnectionIntercept descendant that implements an Indy intercept component that compresses a data stream using the open-source zlib compression library. Set the CompressionLevel property to a value between 1 and 9 to enable compressing of the data stream. A setting of 0(zero) disables compression and the component is dormant. The sender *and* received must have compression enabled in order to properly decompress the data stream. They do *not* have to use the same CompressionLevel as long as they are both set to a value between 1 and 9. 

In order for this file to compile on Windows, the follow .obj files must be provided as delivered with this file: 

  • deflate.obj
  • inflate.obj
  • inftrees.obj
  • trees.obj
  • adler32.obj
  • infblock.obj
  • infcodes.obj
  • infutil.obj
  • inffast.obj
 

On Linux, the shared-object file libz.so.1 must be available on the system. Most modern Linux distributions include this file. 

You may sometimes get the following compiler errors with this file: 

 

IdCompressionIntercept.pas(331) Error: Incompatible types
IdCompressionIntercept.pas(152) Error: Unsatisfied forward or external declaration: '_tr_init'
IdCompressionIntercept.pas(153) Error: Unsatisfied forward or external declaration: '_tr_tally'
IdCompressionIntercept.pas(154) Error: Unsatisfied forward or external declaration: '_tr_flush_block'
IdCompressionIntercept.pas(155) Error: Unsatisfied forward or external declaration: '_tr_align'
IdCompressionIntercept.pas(156) Error: Unsatisfied forward or external declaration: '_tr_stored_block'
IdCompressionIntercept.pas(157) Error: Unsatisfied forward or external declaration: 'adler32'
IdCompressionIntercept.pas(158) Error: Unsatisfied forward or external declaration: 'inflate_blocks_new'
IdCompressionIntercept.pas(159) Error: Unsatisfied forward or external declaration: 'inflate_blocks'
IdCompressionIntercept.pas(160) Error: Unsatisfied forward or external declaration: 'inflate_blocks_reset'
IdCompressionIntercept.pas(161) Error: Unsatisfied forward or external declaration: 'inflate_blocks_free'
IdCompressionIntercept.pas(162) Error: Unsatisfied forward or external declaration: 'inflate_set_dictionary'
IdCompressionIntercept.pas(163) Error: Unsatisfied forward or external declaration: 'inflate_trees_bits'
IdCompressionIntercept.pas(164) Error: Unsatisfied forward or external declaration: 'inflate_trees_dynamic'
IdCompressionIntercept.pas(165) Error: Unsatisfied forward or external declaration: 'inflate_trees_fixed'
IdCompressionIntercept.pas(166) Error: Unsatisfied forward or external declaration: 'inflate_trees_free'
IdCompressionIntercept.pas(167) Error: Unsatisfied forward or external declaration: 'inflate_codes_new'
IdCompressionIntercept.pas(168) Error: Unsatisfied forward or external declaration: 'inflate_codes'
IdCompressionIntercept.pas(169) Error: Unsatisfied forward or external declaration: 'inflate_codes_free'
IdCompressionIntercept.pas(170) Error: Unsatisfied forward or external declaration: '_inflate_mask'
IdCompressionIntercept.pas(171) Error: Unsatisfied forward or external declaration: 'inflate_flush'
IdCompressionIntercept.pas(172) Error: Unsatisfied forward or external declaration: 'inflate_fast'
IdCompressionIntercept.pas(189) Error: Unsatisfied forward or external declaration: 'deflateInit_'
IdCompressionIntercept.pas(196) Error: Unsatisfied forward or external declaration: 'deflate'
IdCompressionIntercept.pas(203) Error: Unsatisfied forward or external declaration: 'deflateEnd'
IdCompressionIntercept.pas(213) Error: Unsatisfied forward or external declaration: 'inflateInit_'
IdCompressionIntercept.pas(220) Error: Unsatisfied forward or external declaration: 'inflate'
IdCompressionIntercept.pas(227) Error: Unsatisfied forward or external declaration: 'inflateEnd'
IdCompressionIntercept.pas(234) Error: Unsatisfied forward or external declaration: 'inflateReset'
Indy40.dpk(196) Fatal: Could not compile used unit 'IdCompressionIntercept.pas'

 

Do not be alarmed. This is due to a bug in DCC32 in Delphi 4, 5, 6, plus C++Builder, 4, 5, and 6. 

There is a workaround for this issue. The workaround is to compile this unit separately from the other units and than build Indy with a command such as DCC32 using the /M parameter. DO not use the /B parameter as that does force everything to be recompiled triggering the DCC32 error. 

The batch files FULLC4.BAT, FULLC5.BAT, FULLC6.BAT, FULLD4.BAT, FULLD5.BAT and FULLD6.BAT now have the workaround in them so we recommend that you use those to build Indy. 

Borland is aware of the issue. 

Original Author: Allen Bauer 

This source file is submitted to the Indy project on behalf of Borland Sofware Corporation. No warranties, express or implied are given with this source file.

Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.