4309129
Patch by Gustavo Luiz Duarte <gustavold@gmail.com> for sqlite >= 2.8.17,
4309129
which fixes the cast of a pointer to int that causes a segmentation fault
4309129
during the tests. On 64 bit machines, pointers are 64 bit and int is 32
4309129
bit. During casting the pointer is truncated, so the original code could
4309129
potentially also break x86_64, while it is doing not so at the moment.
4309129
4309129
--- sqlite-2.8.17/src/test2.c		2005-04-24 00:43:22.000000000 +0200
4309129
+++ sqlite-2.8.17/src/test2.c.ppc64     2012-03-23 10:47:07.000000000 +0100
4309129
@@ -82,7 +82,7 @@ static int pager_open(
4309129
     Tcl_AppendResult(interp, errorName(rc), 0);
4309129
     return TCL_ERROR;
4309129
   }
4309129
-  sprintf(zBuf,"0x%x",(int)pPager);
4309129
+  sprintf(zBuf,"%p", pPager);
4309129
   Tcl_AppendResult(interp, zBuf, 0);
4309129
   return TCL_OK;
4309129
 }
4309129
@@ -334,7 +334,7 @@ static int page_get(
4309129
     Tcl_AppendResult(interp, errorName(rc), 0);
4309129
     return TCL_ERROR;
4309129
   }
4309129
-  sprintf(zBuf,"0x%x",(int)pPage);
4309129
+  sprintf(zBuf,"%p", pPage);
4309129
   Tcl_AppendResult(interp, zBuf, 0);
4309129
   return TCL_OK;
4309129
 }
4309129
@@ -364,7 +364,7 @@ static int page_lookup(
4309129
   if( Tcl_GetInt(interp, argv[2], &pgno) ) return TCL_ERROR;
4309129
   pPage = sqlitepager_lookup(pPager, pgno);
4309129
   if( pPage ){
4309129
-    sprintf(zBuf,"0x%x",(int)pPage);
4309129
+    sprintf(zBuf,"%p", pPage);
4309129
     Tcl_AppendResult(interp, zBuf, 0);
4309129
   }
4309129
   return TCL_OK;
4309129
--- sqlite-2.8.17/src/test3.c		2005-04-24 00:43:22.000000000 +0200
4309129
+++ sqlite-2.8.17/src/test3.c.ppc64	2012-03-23 10:47:03.000000000 +0100
4309129
@@ -534,7 +534,7 @@ static int btree_cursor(
4309129
     Tcl_AppendResult(interp, errorName(rc), 0);
4309129
     return TCL_ERROR;
4309129
   }
4309129
-  sprintf(zBuf,"0x%x", (int)pCur);
4309129
+  sprintf(zBuf,"%p", pCur);
4309129
   Tcl_AppendResult(interp, zBuf, 0);
4309129
   return SQLITE_OK;
4309129
 }