Description: patching pointer to integer assignment potentially unsafe
 A TDBC_INTPTR_T datatype is defined as intptr_t if <stdint.h> is supported, otherwise
 the original int datatype is used
Author: Massimo Manghi <mxmanghi@apache.org>
Bug: http://core.tcl.tk/tdbcpostgres/tktview/582ee0100ceca8d0e520339914339c8c9e75a3bf
Last-Update: 2013-08-23
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/generic/tdbcpostgres.c
+++ b/generic/tdbcpostgres.c
@@ -53,6 +53,7 @@
 #define snprintf _snprintf
 #endif
 
+
 /* Static data contained within this file */
 
 static Tcl_Mutex pgMutex;	/* Mutex protecting per-process structures */
@@ -2086,7 +2087,8 @@
 	char numbuf[16];
 	for (i = 0; i < fieldCount; ++i) {
 	    int new;
-	    int count = 1;
+	    TDBC_INTPTR_T count = 1;
+
 	    Tcl_Obj* nameObj;
 	    Tcl_HashEntry* entry;
 	    fieldName = PQfname(result, i);
@@ -2095,10 +2097,10 @@
 	    entry =
 		Tcl_CreateHashEntry(&names, fieldName, &new);
 	    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);
@@ -2968,7 +2970,7 @@
     int objc, 			/* Parameter count */
     Tcl_Obj *const objv[]	/* Parameter vector */
 ) {
-    int lists = (int) clientData;
+    TDBC_INTPTR_T lists = (TDBC_INTPTR_T) clientData;
 
     Tcl_Object thisObject = Tcl_ObjectContextObject(context);
 				/* The current result set object */
@@ -3244,7 +3246,7 @@
 	int new;
 	Tcl_HashEntry* entry =
 	    Tcl_CreateHashEntry(&(pidata->typeNumHash), 
-				(const char*) (int) (dataTypes[i].oid),
+				(const char*) (TDBC_INTPTR_T) (dataTypes[i].oid),
 				&new);
 	Tcl_Obj* nameObj = Tcl_NewStringObj(dataTypes[i].name, -1);
 	Tcl_IncrRefCount(nameObj);
