Description: potentially unsafe pointer to int assignments
 pointer values are repeatedly assigned to int variables causing
 a potential loss of information and making GCC complain about it.
 We coped with the problem using intptr_t which is guaranteed to be
 the same size of a pointer (defined in <stdint.h>). 
 We check for HAVE_STDINT_H to define a TDBC_INTPTR_T data type
 and in case the test fails we revert to the original int definition
Author: Massimo Manghi <mxmanghi@apache.org>
Bug: http://core.tcl.tk/tdbcmysql/tktview?name=60999d7b92
Last-Update: 2013-08-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/generic/tdbcmysql.c
+++ b/generic/tdbcmysql.c
@@ -22,10 +22,23 @@
 #include <tdbc.h>
 
 #include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
 #include <string.h>
 
 #include "fakemysql.h"
 
+
+/* let's define the type for the integer of the same size of a pointer */
+
+#ifdef HAVE_STDINT_H
+typedef intptr_t TDBC_INTPTR_T;
+#else
+typedef int TDBC_INTPTR_T;
+#endif
+
 /* Static data contained in this file */
 
 TCL_DECLARE_MUTEX(mysqlMutex);	/* Mutex protecting the global environment
@@ -182,7 +195,7 @@
 
 typedef struct ParamData {
     int flags;			/* Flags regarding the parameters - see below */
-    int dataType;		/* Data type */
+    TDBC_INTPTR_T dataType;		/* Data type */
     int precision;		/* Size of the expected data */
     int scale;			/* Digits after decimal point of the
 				 * expected data */
@@ -233,7 +246,7 @@
 #define IS_BINARY	(1<<16)	/* Flag to OR in if a param is binary */
 typedef struct MysqlDataType {
     const char* name;		/* Type name */
-    int num;			/* Type number */
+    TDBC_INTPTR_T    num;		/* Type number */
 } MysqlDataType;
 static const MysqlDataType dataTypes[] = {
     { "tinyint",	MYSQL_TYPE_TINY },
@@ -2317,7 +2330,7 @@
     Tcl_Obj* nameObj;		/* Name of a result column */
     int new;			/* Flag == 1 if a result column is unique */
     Tcl_HashEntry* entry;	/* Hash table entry for a column name */
-    int count;			/* Number used to disambiguate a column name */
+    TDBC_INTPTR_T count;		/* Number used to disambiguate a column name */
 
     Tcl_InitHashTable(&names, TCL_STRING_KEYS);
     if (result != NULL) {
@@ -2332,10 +2345,10 @@
 	    entry = Tcl_CreateHashEntry(&names, field->name, &new);
 	    count = 1;
 	    while (!new) {
-		count = (int) Tcl_GetHashValue(entry);
+		count = (TDBC_INTPTR_T) Tcl_GetHashValue(entry);
 		++count;
 		Tcl_SetHashValue(entry, (ClientData) count);
-		sprintf(numbuf, "#%d", count);
+		sprintf(numbuf, "#%ld", count);
 		Tcl_AppendToObj(nameObj, numbuf, -1);
 		entry = Tcl_CreateHashEntry(&names, Tcl_GetString(nameObj),
 					    &new);
@@ -3239,7 +3252,7 @@
     Tcl_Obj *const objv[]	/* Parameter vector */
 ) {
 
-    int lists = (int) clientData;
+    TDBC_INTPTR_T lists = (TDBC_INTPTR_T) clientData;
 				/* Flag == 1 if lists are to be returned,
 				 * 0 if dicts are to be returned */
 
@@ -3584,7 +3597,7 @@
 	int new;
 	Tcl_HashEntry* entry =
 	    Tcl_CreateHashEntry(&(pidata->typeNumHash), 
-				(const char*) (int) (dataTypes[i].num),
+				(const char*) (dataTypes[i].num),
 				&new);
 	Tcl_Obj* nameObj = Tcl_NewStringObj(dataTypes[i].name, -1);
 	Tcl_IncrRefCount(nameObj);
