I have the same problem as mentioned in the section " Delphi XE4 compatibility problem between TBytes and TidBytes ", that is, the compatibility problem between TBytes (Delphi RTL) and TIdBytes (Indy) when compiling with Delphi XE4. The source of my problem is that the code does not exactly match the Indy interface, and some functions use TBytes instead of TIdBytes when invoking Indy's own I / O routines.
So, I was wondering what would be the best solution?
As I can see, there are two approaches:
Restore all functions in the project to use TIdBytes, not TBytes.
Implement the TBytesToTidBytes conversion procedure (converts TBytes to TIdBytes) and call this procedure before the Indy calls are made.
Which approach is better / better? Do you have any other ideas on how I can do this?
FYI: the project I'm trying to set up with XE4 is available online at sourceforge: http://sourceforge.net/projects/indy10clieservr/?source=directory
The proposed conversion procedure should look something like this:
procedure TBytesToTIdBytes(const Input:TBytes, var Output: TIdBytes)
var
i,L : Integer;
allocate : Boolean;
begin
L := Length(Input);
if(Length(Output) <> L) then
begin
SetLength(Output,L);
end;
if(L > 0) then
move(Pointer(Input)^,Pointer(Output)^,L);
end;
kenny source
share