Einzelnen Beitrag anzeigen

Peter Müller

Registriert seit: 15. Mär 2006
Ort: Stuttgart
22 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#1

AsyncPro 5: Fehler beim Compilieren

  Alt 11. Nov 2014, 19:29
Hallo,

bin gerade dabei, TurboPower AsyncPro 5.01 unter Delphi XE7 zu installieren, was damals bei XE2 soweit ganz gut funktioniert hat.

Dabei kommen in der Unit AdPager.pas die folgenden Fehlermeldungen:
[dcc32 Fehler] AdPager.pas(1379): E2251 Doppeldeutiger überladener Aufruf von 'StrLen'
System.SysUtils.pas(10741): Verwandte Methode: function StrLen(const PAnsiChar): Cardinal;
System.AnsiStrings.pas(3167): Verwandte Methode: function StrLen(const PAnsiChar): Cardinal;
und
[dcc32 Fehler] AdPager.pas(1380): E2251 Doppeldeutiger überladener Aufruf von 'StrDispose'
System.SysUtils.pas(11965): Verwandte Methode: procedure StrDispose(PAnsiChar);
System.AnsiStrings.pas(3932): Verwandte Methode: procedure StrDispose(PAnsiChar);

Es handelt sich um diese Zeilen (im Quelltext unten Zeilen 5 und 6 nach dem begin):
OutMsg := TAdStr.Create(StrLen(MsgPtr)*2);
StrDispose(MsgPtr);

Da MsgPtr eindeutig als PAnsiChar deklariert wird, ist mir nicht klar, was dem Compiler dabei doppeldeutig ist. Hat jemand von euch eine Idee, was ihm da nicht gefallen könnte?

Vielen Dank

Peter

Die komplette Prozedur im Quelltext:
Delphi-Quellcode:
procedure BuildTapMessages
  (
  const ID: string;
  {in}  Msg:TStrings;
  const UseEscapes: Boolean;
  const MaxLen: Integer;
  {out} Blocks: TStrings);
var
  OutMsg: TAdStr;
  Ct: Integer;
  EOMsg: Boolean;
  MsgPtr : PAnsiChar;
  AnsiMsg : AnsiString;
begin
  Blocks.Clear;

  { build long message from string list }
  MsgPtr := PAnsiChar(Msg.GetText);
  OutMsg := TAdStr.Create(StrLen(MsgPtr)*2);
  StrDispose(MsgPtr);
  OutMsg.Clear;

  for Ct := 0 to Pred(Msg.Count) do begin
    AnsiMsg := AnsiString(Msg[Ct]);
    if UseEscapes then
      OutMsg.Append(ExpandCtrlChars(AnsiMsg))
    else
      OutMsg.Append(StripCtrlChars(AnsiMsg));
  end;

  { Add header and trailer }
  OutMsg.PrePend(AnsiString(cStx + ID + cCr));
  OutMsg.Append(cCr);
  { start counting at beginning of string }
  Ct := 1;

  EOMsg := False;
  while not EOMsg do begin
    { Block full and not end of message }
    if (Ct = MaxLen) and (Ct <= OutMsg.Len) then begin { reached block length }

      if OutMsg[Ct-1] = cCr then begin
        {at end of field: insert <ETB> + CheckSum + <CR> }
        OutMsg.Insert(cEtb, Ct);
        Inc(Ct);
        OutMsg.Insert(CheckSum(SumChars(OutMsg.Copy(1,Ct-1))) + cCr, Ct);
      end

      else begin
      {inside a field: insert <US> + CheckSum + <CR>}
        OutMsg.Insert(cUs, Ct);
        Inc(Ct);
        OutMsg.Insert(CheckSum(SumChars(OutMsg.Copy(1,Ct-1))) + cCr, Ct);
      end;

      { save block into block list }
      Inc(Ct, 3); {move to end of block}
      Blocks.Add(string(OutMsg.Copy(1,Ct)));

      { and start new block }
      OutMsg.Delete(1,Ct); { start new block }
      OutMsg.PrePend(AnsiString(cStx));
      Ct := 1;
    end

    { End of message }
    else if Ct = OutMsg.Len then begin
    { at end of message: append <ETX> + CheckSum + <CR> }
      OutMsg.Append(cEtx);
      Inc(Ct);
      Blocks.Add(string(OutMsg.Copy(1,Ct)) + string(CheckSum(SumChars(OutMsg.Copy(1,Ct)))) + cCr);
      EOMsg := True;
    end

    { counting chars }
    else begin
      Inc(Ct);
    end;
  end;
  OutMsg.Free;
end;
"Der Erfolg besteht manchmal in der Kunst, das für sich zu behalten, was man nicht weiß." Sir Peter Ustinov
  Mit Zitat antworten Zitat