Hi April,

I've just noticed the TOFIX line, and this lead me to the x64
issues I have already mentioned.

The problem here is that a pointer is stored inside an ULONG
variable (in this case with explicit cast, so a warning isn't
shown). On Win64 platform an ULONG is 32bit while a pointer
is 64bit, so the pointer will be corrupted on this platform.

All integer variables which are meant to store pointers should
be changed to HB_PTRUINT.

Brgds,
Viktor

On 2009.07.05., at 1:37, [email protected] wrote:

Revision: 11639
         
http://harbour-project.svn.sourceforge.net/harbour-project/?rev=11639&view=rev
Author:   april
Date:     2009-07-04 23:37:19 +0000 (Sat, 04 Jul 2009)

Log Message:
-----------

2009-07-04 19:16 UTC+0600 April White (april users.sourceforge.net)
 * contrib/hbbtree/hb_btree.c
   * fixed one warning: cast from pointer to integer of different size
   ; TOFIX:
hb_btree.c:739: warning: cast from pointer to integer of different size
 * contrib/hbbtree/tbtree.prg
   * clear class var when underlying hb_btree is closed

Modified Paths:
--------------
   trunk/harbour/ChangeLog
   trunk/harbour/contrib/hbbtree/hb_btree.c
   trunk/harbour/contrib/hbbtree/tbtree.prg

Modified: trunk/harbour/ChangeLog
===================================================================
--- trunk/harbour/ChangeLog     2009-07-04 08:23:21 UTC (rev 11638)
+++ trunk/harbour/ChangeLog     2009-07-04 23:37:19 UTC (rev 11639)
@@ -17,6 +17,14 @@
   past entries belonging to author(s): Viktor Szakats.
*/

+2009-07-04 19:16 UTC+0600 April White (april users.sourceforge.net)
+  * contrib/hbbtree/hb_btree.c
+ * fixed one warning: cast from pointer to integer of different size
+    ; TOFIX:
+ hb_btree.c:739: warning: cast from pointer to integer of different size
+  * contrib/hbbtree/tbtree.prg
+    * clear class var when underlying hb_btree is closed
+
2009-07-04 10:22 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
  * utils/hbmk2/hbmk2.prg
    * Using hb_FCopy() (now fixed)

Modified: trunk/harbour/contrib/hbbtree/hb_btree.c
===================================================================
--- trunk/harbour/contrib/hbbtree/hb_btree.c 2009-07-04 08:23:21 UTC (rev 11638) +++ trunk/harbour/contrib/hbbtree/hb_btree.c 2009-07-04 23:37:19 UTC (rev 11639)
@@ -640,7 +640,7 @@
      if ( STACKPOSITION( pStack ) > 0 )
ulNode = BranchGet( pBTree, STACKNODE( pStack ), -- STACKPOSITION( pStack ) );
      else
-        ulNode = (ULONG) NULL;
+        ulNode = NULLPAGE;
      if ( !BTREENODEISNULL( pBTree, ulNode ) )
      {
        StackPush( pStack, ulNode, CountGet( pBTree, ulNode ) );

Modified: trunk/harbour/contrib/hbbtree/tbtree.prg
===================================================================
--- trunk/harbour/contrib/hbbtree/tbtree.prg 2009-07-04 08:23:21 UTC (rev 11638) +++ trunk/harbour/contrib/hbbtree/tbtree.prg 2009-07-04 23:37:19 UTC (rev 11639)
@@ -45,7 +45,7 @@

  EXPORTED:
    METHOD New( cFileName, nPageSize, nKeySize, nFlags, nBuffers )
-    METHOD Close() INLINE hb_BTreeClose( ::nHandle )
+    METHOD Close() INLINE hb_BTreeClose( ::nHandle ) , ::nHandle := 0
METHOD Insert( cKey, lData ) INLINE hb_BTreeInsert( ::nHandle, cKey, lData ) METHOD Delete( cKey, lData ) INLINE hb_BTreeDelete( ::nHandle, cKey, lData )
    METHOD Key() INLINE hb_BTreeKey( ::nHandle )


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to