Article

From:
To:
Adriano Macome
Subject:
Re: Error compiling last Indy
Newsgroup:
embarcadero.public.delphi.internet.winsock

Re: Error compiling last Indy

Adriano wrotE:

> [DCC Error] IndyPeerImpl.pas(1800): E2033 Types of actual and formal
> var parameters must be identical

That line is calling TIdIOHandler.ReadBytes(), which expects a TIdBytes, 
but a TIPBytesPeer is being passed instead.  When XE2 was released, TIdBytes 
was just an alias for TBytes.  I suspect that TIPBytesPeer is likely also 
an alias for TBytes (I don't have IPPeerAPI.pas to check with), so the two 
types were compatible with each other.  TIdBytes is no longer a TBytes alias, 
though (that was causing other problems in Indy itself).  However, TIdBytes 
and TBytes are both dynamic arrays of Byte, so you should be able to work 
around this issue using a typecast:

{code} type   PIdBytes = ^TIdBytes; .... FHandler.ReadBytes(PIdBytes(@VBuffer)^, AByteCount, AAppend); {code}
> [DCC Error] IndyPeerImpl.pas(1806): E2250 There is no overloaded
> version of 'Write' that can be called with these arguments

Same thing, with TIdIOHandler.Write():

{code} type   PIdBytes = ^TIdBytes; .... FHandler.Write(PIdBytes(@ABuffer)^, ALength, AOffset); {code}
> [DCC Error] IndyPeerImpl.pas(1863): E2033 Types of actual and formal
> var parameters must be identical
> [DCC Error] IndyPeerImpl.pas(1869): E2250 There is no overloaded
> version of 'Write' that can be called with these arguments

Same as above.

> [DCC Error] IndyPeerImpl.pas(2401): E2010 Incompatible types:
> 'System.TArray<System.Byte>' and 'TIdBytes'

This is where the differences between TBytes an TIdBytes start showing, since 
they are not assignment-compatible with each other.

{code:delphi} PIdBytes(@Result)^ := IdFips.FinalHMACInst(ACtx); {code}
Alternatively:
{code:delphi} type   PIPBytesPeer = ^TIPBytesPeer;
var   Tmp: TIdBytes;
Tmp := IdFips.FinalHMACInst(ACtx); Result := PIPBytesPeer(@Tmp)^; {code}
> [DCC Error] IndyPeerImpl.pas(2406): E2010 Incompatible types:
> 'TIdBytes' and 'System.TArray<System.Byte>'
> [DCC Error] IndyPeerImpl.pas(2411): E2010 Incompatible types:
> 'TIdBytes' and 'System.TArray<System.Byte>'

Same as above.

> [DCC Error] IndyPeerImpl.pas(2442): E2003 Undeclared identifier:
> 'TIdTextEncoding'
> [DCC Error] IndyPeerImpl.pas(2442): E2037 Declaration of
> 'ReadStringFromStream' differs from previous declaration
> [DCC Error] IndyPeerImpl.pas(2444): E2250 There is no overloaded
> version of 'ReadStringFromStream' that can be called with these arguments

The TIdTextEncoding class was replaced with a new IIdTextEncoding interface 
in Indy 10.6.0.  TIdProc uses TIPTextEncodingPeer, which is an alias for 
Sysutils.TEncoding (which TIdTextEncoding was also an alias for).  With the 
switch to IIdTextEncoding, you will have to update the implementation of 
TIdProc.ReadStringFromStream() as follows:

1) fix the AByteEncoding parameter. It is declared as TIPTextEncodingPeer in the interface, but is declared as TIdTextEncoding in the implementation.  The implementation should be using TIPTextEncodingPeer.
2) use Indy's IndyTextEncoding() function to wrap the TIPTextEncodingPeer object inside of an Indy-managed IIdTextEncoding wrapper:
{code:delphi} function TIdProc.ReadStringFromStream(AStream: TStream; ASize: Integer;   AByteEncoding: TIPTextEncodingPeer): string; begin
Result := IdGlobal.ReadStringFromStream(AStream, ASize, IdGlobal.IndyTextEncoding(AByteEncoding));
end;
{code}

> [DCC Error] IndyPeerImpl.pas(2454): E2010 Incompatible types:
> 'TIdBytes' and 'System.TArray<System.Byte>'

Type-cast again:

{code:delphi} IdFIPS.UpdateHMACInst(ACtx, PIdBytes(@AIn)^); {code}
> [DCC Error] IndyPeerImpl.pas(2770): E2010 Incompatible types: 'string'
> and 'AnsiString'
> [DCC Error] IndyPeerImpl.pas(4086): E2010 Incompatible types: 'string'
> and 'AnsiString'

Indy's TPasswordEvent type was changed to use (Unicode)String instead of 
AnsiString, so the TIPTestServerPeer.TOnGetPassword class and the TIdServerIOHandlerSSLOpenSSLPeer.LOnGetPassEvent()
event handler will have to be updated accordingly.

> [DCC Error] IndyPeerImpl.pas(83): E2065 Unsatisfied forward or
> external declaration: 'TIdProc.ReadStringFromStream'

Side effect of the above typo in ReadStringFromStream().

-- Remy Lebeau (TeamB)
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sun, 19 May 2024 03:36:56 UTC
Copyright © 2009-2024
HREF Tools Corp.