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: 2016-02-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/generic/tdbcmysql.c
+++ b/generic/tdbcmysql.c
@@ -23,9 +23,21 @@
 
 #include <stdio.h>
 #include <string.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
 
 #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 +194,7 @@
 
 typedef struct ParamData {
     int flags;			/* Flags regarding the parameters - see below */
-    int dataType;		/* Data type */
+    int dataType;	        /* Data type */
     int precision;		/* Size of the expected data */
     int scale;			/* Digits after decimal point of the
 				 * expected data */
@@ -2317,7 +2329,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 */
+    int count;	                /* Number used to disambiguate a column name */
 
     Tcl_InitHashTable(&names, TCL_STRING_KEYS);
     if (result != NULL) {
@@ -2332,15 +2344,15 @@
 	    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);
+		Tcl_SetHashValue(entry, (ClientData) (TDBC_INTPTR_T) count);
 		sprintf(numbuf, "#%d", count);
 		Tcl_AppendToObj(nameObj, numbuf, -1);
 		entry = Tcl_CreateHashEntry(&names, Tcl_GetString(nameObj),
 					    &new);
 	    }
-	    Tcl_SetHashValue(entry, (ClientData) count);
+	    Tcl_SetHashValue(entry, (ClientData) (TDBC_INTPTR_T) count);
 	    Tcl_ListObjAppendElement(NULL, retval, nameObj);
 	    Tcl_DecrRefCount(nameObj);
 	}
@@ -2590,7 +2602,7 @@
 	}
 	typeHashEntry =
 	    Tcl_FindHashEntry(&(pidata->typeNumHash),
-			      (const char*) (sdata->params[i].dataType));
+			      (const char*) (TDBC_INTPTR_T) (sdata->params[i].dataType));
 	if (typeHashEntry != NULL) {
 	    dataTypeName = (Tcl_Obj*) Tcl_GetHashValue(typeHashEntry);
 	    Tcl_DictObjPut(NULL, paramDesc, literals[LIT_TYPE], dataTypeName);
@@ -3239,7 +3251,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 +3596,7 @@
 	int new;
 	Tcl_HashEntry* entry =
 	    Tcl_CreateHashEntry(&(pidata->typeNumHash),
-				(const char*) (int) (dataTypes[i].num),
+				(const char*) (TDBC_INTPTR_T) (dataTypes[i].num),
 				&new);
 	Tcl_Obj* nameObj = Tcl_NewStringObj(dataTypes[i].name, -1);
 	Tcl_IncrRefCount(nameObj);
