Einzelnen Beitrag anzeigen

venice2
(Gast)

n/a Beiträge
 
#3

AW: Weitergabe eines Strings über Pointer funktioniert nicht - manchmal...

  Alt 28. Mai 2021, 17:14
Delphi-Quellcode:
   If PBinaryContentSize <> Nil Then
      BinaryContentSize := PBinaryContentSize^;
Das scheint mir schon mal falsch.
Welche größe hat BinaryContentSize wenn PBinaryContentSize = Nil ist?
Fehlt da nicht ein begin ?

Nur auf
Delphi-Quellcode:
   SetLength(sBinaryContent, BinaryContentSize);
   Move(PChar(BinaryContentAddress)^, sBinaryContent[1], BinaryContentSize);
zugreifen wenn PBinaryContentSize und PBinaryContentAddress wirklich nicht nil sind.

Delphi-Quellcode:
   If Assigned(PBinaryContentAddress) Then
   begin
     BinaryContentAddress := PBinaryContentAddress^;

     If Assigned(PBinaryContentSize) Then
     begin
       BinaryContentSize := PBinaryContentSize^;

       // Get the content
       SetLength(sBinaryContent, BinaryContentSize);
       Move(PChar(BinaryContentAddress)^, sBinaryContent[1], BinaryContentSize);

       sBase64Content := Coder.EncodeBase64(sBinaryContent);
     end;
   end;

Geändert von venice2 (28. Mai 2021 um 17:25 Uhr)
  Mit Zitat antworten Zitat