1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

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
This commit is contained in:
drh
2009-05-19 14:21:28 +00:00
parent e255086bb2
commit 367882c27c
3 changed files with 15 additions and 10 deletions

View File

@@ -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))