[fpc-devel] SYSUTILS UTF8String Memory Bug

Marco van de Voort marcov at stack.nl
Mon Aug 11 06:36:17 CEST 2014


In our previous episode, mark diener said:
> Compile Error Message:
> 
> C:\pdev\rpzlib\rpzopsyswin32.pas(46,37) Error: range check error while
> evaluating constants
> 
> Offending code:
> 
> nres := ioctlsocket(socket,FIONBIO, at nblock) ;
> 
> So my FIONBIO constant is triggering a compile time error.
> 
> >From winsock2.pas:
> 
> const
>   FIONBIO      = ULONG(IOC_IN or { set/clear non-blocking i/o }
>     ((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or
>     (Longint(Byte('f')) shl 8) or 126);
> 
> function ioctlsocket( const s: TSocket; cmd: Longint; argp: pu_long ):
> Longint; stdcall;external WINSOCK2_DLL name 'ioctlsocket';

You pass an unsigned ULONG (FIONBIO) constant to a signed (cmd) parameter,
so that is correct, the ranges don't match.

Also, in the constant, most of the expression is longint, while IOC_IN
($8000000) is beyond that range.



More information about the fpc-devel mailing list