SteB
SteB

Reputation: 2007

Delphi 2007 and Indy10 compile error in IdGlobal

I've just updated my Indy10 installation to the latest revision (5260) and I now get an error when trying to compile a Windows service that receives emails from an email server.

[DCC Error] IdGlobal.pas(8657): F2084 Internal Error: C4963

Reverting back to revision 5239 doesn't cause an issue.

The issue seems to be in IdGlobal.ReadLnFromStream on line 8633:

LBufSize := ReadTIdBytesFromStream(AStream, LBuf, LBufSize);

I'm wondering if this is a 64-bit issue, has anyone else encountered this issue? I'm using Delphi 2007 on Windows 7 Professional x64.

Upvotes: 3

Views: 1235

Answers (1)

Mike Taylor
Mike Taylor

Reputation: 2514

I don't know when and why this changed but I have the same issue (Delphi 2007). it appears that ReadTIdBytesFromStream is expecting an int64 (TIdStreamSize) to be passed as the Count parameter but the variable being passed (LBufSize) is an integer.

This appears to cause the complier considerable problems and it throws an internal error. I browsed around the Indy code until I found other examples of this function call that generated no errors.

I found this snippet of code in the TIdHashIntf.GetHashBytes method and borrowed from it

 repeat
   LSize := ReadTIdBytesFromStream(AStream,LBuf,IndyMin(ASize, 2048));

I then changed the code in ReadLnFromStream from this:

repeat
  LBufSize := IndyMin(LStrmSize - LStrmPos, LBUFMAXSZE);
  LBufSize := ReadTIdBytesFromStream(AStream, LBuf, LBufSize);

to this

repeat
  LBufSize := ReadTIdBytesFromStream(AStream, LBuf, IndyMin(LStrmSize - LStrmPos, LBUFMAXSIZE));

And now Indy builds and complies again.

As far as I can tell this change will not effect anything (apart from fixing the broken build), but I can appreciate it is a bit of a WTF. Without going deep into the reasons as to why some variables are int, others int64 and yet others are TIdStreamSize, this is the best I can do. Maybe Remy could enlighten us all.

Incidentally I noticed if complied in debug mode the fatal complier error did not occur.

Upvotes: 3

Related Questions