How to adjust the level of compression with TZCompressionStream?

When I create a TZCompressionStream object with:

var
  cs: TZCompressionStream; 
  dest: TStream;
  level: TZCompressionLevel;
...
  cs := TZCompressionStream.Create(level, dest);

I get this compiler error:

E2250 There is no overloaded version of 'Create' that can be called with these arguments

But my code is according to the constructor declaration:

Create(compressionLevel: TZCompressionLevel; dest: TStream); overload; 

When I used XE, everything was OK. But now with XE5 there is this error. Why?

Update:

I also tried to change the order of the arguments, which was unsuccessful.

Upvotes: 1

Views: 1557

Answers (1)

David Heffernan
David Heffernan

Reputation: 613322

I'm assuming that your code is as stated in your edit:

cs:=TZCompressionStream.Create(clMax, dest);

The obvious explanation is that clMax is not what you think it is. There is probably another unit that defines clMax and that unit appears after ZLib in your list of uses. Solve the problem by either:

  • fully qualifying the enumerated value: ZLib.clMax, or
  • change the order of the uses so that ZLib appears after the unit which defines the other clMax.

Upvotes: 5

Related Questions