Description: Pointer to int variable assignments
 Likewise to the Mysql and Postgresql drivers also the driver for ODBC suffers for
 the same problem patched introducing the tdbc_intptr_t data type based on the
 intptr_t data type defined in <stdint.h>. If not existing the code reverts to int
Author: Massimo Manghi <mxmanghi@apache.org> 
Bug: http://core.tcl.tk/tdbcodbc/tktview/df3a7fd993cce16ec0e8d9042b27266e0f8614b6
Last-Update: 2016-02-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/generic/tdbcodbc.c
+++ b/generic/tdbcodbc.c
@@ -23,6 +23,12 @@
 #include <stdio.h>
 #include <string.h>
 
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+typedef intptr_t tdbc_intptr_t;
+#else
+typedef int tdbc_intptr_t;
+#endif
 
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN
@@ -1229,7 +1235,7 @@
 				 * uniqueness. */
     Tcl_HashEntry* nameEntry;	/* Hash table entry for the current name */
     int new;			/* Flag that column name is unique */
-    int count;			/* Count to append to the name */
+    tdbc_intptr_t count;	/* Count to append to the name */
     char numbuf[16];		/* Buffer to hold the appended count */
     SQLSMALLINT i;
     int retry;
@@ -1324,10 +1330,10 @@
 		 * we've seen it before.
 		 */
 
-		count = (int) Tcl_GetHashValue(nameEntry);
+		count = (tdbc_intptr_t) Tcl_GetHashValue(nameEntry);
 		++count;
 		Tcl_SetHashValue(nameEntry, (ClientData) count);
-		sprintf(numbuf, "#%d", count);
+		sprintf(numbuf, "#%ld", count);
 		Tcl_AppendToObj(colNameObj, numbuf, -1);
 	    }
 
@@ -1687,7 +1693,7 @@
 		return status;
 	    }
 	    Tcl_ResetResult(interp);
-	    *hParentWindowPtr = (HWND) w;
+	    *hParentWindowPtr = (HWND) (tdbc_intptr_t) w;
 	    *connectFlagsPtr = SQL_DRIVER_COMPLETE_REQUIRED;
 	    break;
 
@@ -2006,7 +2012,7 @@
     int objc,			/* Parameter count */
     Tcl_Obj *const objv[]	/* Parameter vector */
 ) {
-    SQLSMALLINT completionType = (SQLSMALLINT) (int) (clientData);
+    SQLSMALLINT completionType = (SQLSMALLINT) (tdbc_intptr_t) (clientData);
     Tcl_Object thisObject = Tcl_ObjectContextObject(objectContext);
 				/* The current connection object */
     ConnectionData* cdata = (ConnectionData*)
@@ -3959,7 +3965,7 @@
     Tcl_Obj *const objv[]	/* Parameter vector */
 ) {
 
-    int lists = (int) clientData;
+    int lists = (tdbc_intptr_t) clientData;
 				/* Flag == 1 if lists are to be returned,
 				 * 0 if dicts are to be returned */
 
