Good add sample to regression hbtest?

2009/11/26 Przemysław Czerpak <dru...@acn.waw.pl>:
> On Thu, 26 Nov 2009, bill robertson wrote:
>
> Hi,
>
>> There is a problem with fopen() and I suspect fcreate(), etc in
>> philes.c. In philes.c, you will notice that hb_fsOpen is cast to
>> HB_NHANDLE which is typedef as a pointer to unsigned int in
>> hbdefs.h. This means that the F_ERROR (-1) is made positive (2^32-1
>> or +4,294,967,295) so you have an invalid file pointer if a file
>> doesn't exist.
>> For example this pgm returns invalid handle 2^32-1
>> //-----------------------------------------
>> function main()
>> ? "File Handle:", fopen("Nonsense.file")
>> return 0
>
> You are right and it's side effect of hack I added here:
>
> 2009-11-14 04:21 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
>  * harbour/include/hbdefs.h
>    * added small hack to eliminate negative handles from 32 bit windows
>      builds. Please remember that this trick can work only in 32 bit
>      windows version. In 64 bit ones valid handle after casting to integer
>      value can give negative 64 bit number so checking for wrong handle
>      please compare them with FS_ERROR (-1) instead of using < 0 or sth
>      like that. Otherwise your code may not work properly with some new
>      windows versions or may even suddenly stop to work with existing
>      ones even if they worked for some time without problems.
>
> I'll remove it soon.
> Thank you for the information.
> To all users. Please remember that on some platforms negative handles
> can be valid and only -1 indicates wrong handle (0 is valid handle on
> all supported platforms).
>
> best regards,
> Przemek
> _______________________________________________
> Harbour mailing list (attachment size limit: 40KB)
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour
>



-- 
Massimo Belgrano
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to