Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 06/10/21 in Posts

  1. Stefan Glienke

    Out parameter is read before set

    Out parameters are just bad var parameters - just saying.
  2. David Heffernan

    Out parameter is read before set

    It would be nice if that documentation was accurate, but it's not. You will have no problems passing a non-nil instance into that function using an out param. You'll find, at least for non-managed types, that out and var parameters behave identically.
  3. DelphiUdIT

    Stratched image is wrong if bmp dimention >32767 (RAD2007)

    Since 1996 all the bitmap relevant data is mapped on 4 bytes (included size, width and height). So I think that really in 2007 (release year of the Rad Studio version concerned) it is not likely that there was any bug about it. It is possible that what happens is related to the management of the memory linked to the bitmap (for example umpteenth temporary copies in memory) and above all linked to the use of pfdevice with modern hardware. In fact, currently with the trivial use of a TImage all this works very well. Be carefull that by now, the use of MSPaint or the Rad Studio designer with big picture is not possible, and is related to memory management not to Windows Api or VCL api.
  4. The low level socket server does not include any timers, but the higher level HTTP and FTP server component do include various timeouts. TWSocket itself includes a TWSocketCounter class which descendents can check periodically with a timer to close idle connections, depending on activity. For HTTP, the procedure HeartBeatOnTimer checks whether a request is being processed and disconnects according for KeepAliveTimeSec or KeepAliveTimeXferSec. You could add something similar including checking whether SSL has been negotiated. If you are concerned about hacking attempts, I find it's actually better to leave connections open for a long time, doing nothing, which stops the remote robot doing anything else with that connection, close it immediately and it moves on to the next attack attempt. The OverbyteIcsSslMultiWebServ sample includes various hacking tests, and sends a response after a one minute delay. One test I added to my public web server is any access by IP address instead of host name, immediately onto the hackers list. This is also in a new sample I added yesterday, OverbyteIcsDDWebService, which is similar to OverbyteIcsSslMultiWebServ but runs as a real Windows service or a GUI for debugging). and includes a new database REST server sample. Angus
  5. QP is merely a bug tracker meant for collecting bugs from users and solve them somewhere in the future (well, in theory). With that in mind, two days are nothing. As the issue is not even opened, probably no one in charge has even took notice. If you want instant support you better open a support case. With an active subscription you are entitled for three issues per year. IIRC the URL is https://idera.secure.force.com/embtsupport/
  6. Anders Melander

    Stratched image is wrong if bmp dimention >32767 (RAD2007)

    Try Graphics32: Use a TBitmap32 with a memory backend (instead of a GDI backend) and display it with a TImage32/TImgView32 control. That of course requires that the bitmap is 32-bit or that it's feasible to convert it to 32-bit in order to display it.
  7. David Heffernan

    Out parameter is read before set

    Out params in Delphi kinda suck because the compiler does nothing to enforce out semantics. Compare and contrast with C#.
  8. And here it is: program Project804; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.Classes; function AddItems(const aArray: array of string; out aList: TStrings): boolean; var S: string; begin { can we really omit this? No! } //aList := nil; for S in aArray do if S.Length > 0 then begin if aList = nil then aList := TStringList.Create; // only create aList if any items gets added aList.Add(S); end; Result := aList <> nil; end; var lst: TStrings; begin try lst := nil; try if AddItems(['Hello', 'World'], lst) then Writeln('True') else Writeln('False'); if lst <> nil then Writeln(lst.Text); finally { uncommenting this will raise an invalid pointer exception later } //lst.Free; end; try { Although being an out parameter, the current lst instance will be used inside AddItems } if AddItems(['Delphi'], lst) then Writeln('True') else Writeln('False'); if lst <> nil then Writeln(lst.Text); finally lst.Free; end; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end.
  9. Pascal Analyzer is trying to tell you: "Your method misses to initialize aList before entering the loop, because in case the loop is empty or condition is always false you end up with an uninitialized out parameter aList!" So, yes, it is a valid alert and although you may get away with it in most cases, it may fire back sometimes. It should be possible to create a use case where it fails.
  10. Sounds like bullshit to me. No random crashes that we didn't cause ourselves that I can remember, and I've used every Delphi version there is, on most of the Windows versions there has been.
×