#581541 libsqlite3-dev: sqlite3_int64 is long long int, not equivalent to int64_t

Package:
libsqlite3-dev
Source:
sqlite3
Description:
SQLite 3 development files
Submitter:
Julian Andres Klode
Date:
2010-05-14 17:51:04 UTC
Severity:
minor
#581541#5
Date:
2010-05-13 14:07:21 UTC
From:
To:
Hi, the type sqlite3_int64 is defined as long long int. Other int64
types (such as int64_t in stdlib.h or gint64 in glib) are defined as
"long int" on AMD64.

It would be great if sqlite3 could also use "long int" if it already
is 64-bit, as I currently get warnings from gcc when passing an
sqlite3_int64 to a function expecting gint64 or int64_t. It could
also use int64_t for sqlite3_int64 if available.

The same applies to sqlite3_uint64 as well.

The following hack might work, though I think there should be a
better way to do this; for example, in the configure script
(glib2.0 does this).
--- sqlite3-3.6.23.1.orig/src/sqlite.h.in
+++ sqlite3-3.6.23.1/src/sqlite.h.in
@@ -240,6 +240,10 @@ typedef struct sqlite3 sqlite3;
 #ifdef SQLITE_INT64_TYPE
   typedef SQLITE_INT64_TYPE sqlite_int64;
   typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
+#elif defined(__GLIBC__)
+  #include <stdint.h>
+  typedef int64_t sqlite_int64;
+  typedef uint64_t sqlite_uint64;
 #elif defined(_MSC_VER) || defined(__BORLANDC__)
   typedef __int64 sqlite_int64;
   typedef unsigned __int64 sqlite_uint64;

#581541#10
Date:
2010-05-14 17:05:06 UTC
From:
To:
* Julian Andres Klode:

This will cause warnings with code which uses the other types, so I
don't see how this is an improvement.  You could sqlite3_int64 in your
code, though.