From 4be6249a73d2fa652bf0573e6c9af27f0795e16a Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 14 Nov 2009 03:22:09 +0000 Subject: [PATCH] 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. * harbour/src/rdd/dbf1.c * pacified warning after adding above hack * harbour/tests/cpinfo.prg ! removed unnecessary EOL reported by Viktor --- harbour/ChangeLog | 17 +++++++++++++++++ harbour/include/hbdefs.h | 2 +- harbour/src/rdd/dbf1.c | 8 ++++---- harbour/tests/cpinfo.prg | 1 - 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9372d5f6fd..8fb5b02351 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to author(s): Viktor Szakats. */ +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. + + * harbour/src/rdd/dbf1.c + * pacified warning after adding above hack + + * harbour/tests/cpinfo.prg + ! removed unnecessary EOL reported by Viktor + 2009-11-13 17:43 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/generator/hbqtgen.prg diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index f68ce3ee0a..ad6f4716f7 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -609,7 +609,7 @@ typedef unsigned long HB_COUNTER; #else typedef void * HB_FHANDLE; #endif - typedef HB_PTRDIFF HB_NHANDLE; + typedef HB_PTRUINT HB_NHANDLE; # define hb_numToHandle( h ) ( ( HB_FHANDLE ) ( HB_NHANDLE ) ( h ) ) #else typedef int HB_FHANDLE; diff --git a/harbour/src/rdd/dbf1.c b/harbour/src/rdd/dbf1.c index ea547313a1..e745bf10e6 100644 --- a/harbour/src/rdd/dbf1.c +++ b/harbour/src/rdd/dbf1.c @@ -3298,13 +3298,13 @@ static HB_ERRCODE hb_dbfInfo( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) break; case DBI_FILEHANDLE: - hb_itemPutNInt( pItem, pArea->pDataFile ? - ( HB_NHANDLE ) hb_fileHandle( pArea->pDataFile ) : FS_ERROR ); + hb_itemPutNInt( pItem, !pArea->pDataFile ? FS_ERROR : + ( HB_LONG ) ( HB_NHANDLE ) hb_fileHandle( pArea->pDataFile ) ); break; case DBI_MEMOHANDLE: - hb_itemPutNInt( pItem, pArea->pMemoFile ? - ( HB_NHANDLE ) hb_fileHandle( pArea->pMemoFile ) : FS_ERROR ); + hb_itemPutNInt( pItem, ! pArea->pMemoFile ? FS_ERROR : + ( HB_LONG ) ( HB_NHANDLE ) hb_fileHandle( pArea->pMemoFile ) ); break; case DBI_SHARED: diff --git a/harbour/tests/cpinfo.prg b/harbour/tests/cpinfo.prg index 39ae504760..537c18fc5f 100644 --- a/harbour/tests/cpinfo.prg +++ b/harbour/tests/cpinfo.prg @@ -424,7 +424,6 @@ static function genCPfile( id, info, unicode, flags, upper, lower, sort, ; if !lBin cDef += ; '#endif' + EOL + EOL - EOL endif endif cDef += ;