Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   AsyncPro 5: Fehler beim Compilieren (https://www.delphipraxis.net/182698-asyncpro-5-fehler-beim-compilieren.html)

Peter Müller 11. Nov 2014 19:29

AsyncPro 5: Fehler beim Compilieren
 
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;

hoika 11. Nov 2014 20:03

AW: AsyncPro 5: Fehler beim Compilieren
 
Hallo,

ab XE4 sind die alten AnsiString-String-Funktionen ausgelagert worden.

siehe auch
http://embarcadero.newsgroups.archiv...304246489.html

also muss statt StrLen einfach AnsiStrings.StrLen benutzt werden (unit AnsiStrings einbinden).


Heiko

Peter Müller 11. Nov 2014 20:16

AW: AsyncPro 5: Fehler beim Compilieren
 
Super, vielen Dank, das hat funktioniert.

Peter


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:32 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz