Improvements to the SQLITE_INT_TO_PTR macro to reduce the number of
warnings. For some platforms it might be necessary to compile with
the -DHAVE_STDINT_H flag. Ticket #3860. (CVS 6657)
FossilOrigin-Name: 1b0ee9d188c000a2331caae2e9c8b89b0bcbc0b0
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index e943412..e141c92 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.873 2009/05/18 13:34:38 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.874 2009/05/19 14:21:29 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -70,8 +70,13 @@
** compiler.
*/
#if defined(__GNUC__)
-# define SQLITE_INT_TO_PTR(X) ((void*)(X))
-# define SQLITE_PTR_TO_INT(X) ((int)(X))
+# if defined(HAVE_STDINT_H)
+# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
+# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
+# else
+# define SQLITE_INT_TO_PTR(X) ((void*)(X))
+# define SQLITE_PTR_TO_INT(X) ((int)(X))
+# endif
#else
# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))