Patch 7.4RC1 pgtcl to restore Tcl-8.0 compatibility for large obj fix

From: ljb <ljb220(at)mindspring(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Patch 7.4RC1 pgtcl to restore Tcl-8.0 compatibility for large obj fix
Date: 2003-11-08 01:38:08
Message-ID: bohhdv$1h5r$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Here's the patch to restore libpgtcl compatibility with Tcl-8.0, which was
lost in 7.4RC1 with my other patch to fix corrupt binary large-object reads
and writes. This patch is against PostgreSQL-7.4RC1. I've tested it with
Tcl-8.0.5 (minimally, since tcltest doesn't work with Tcl-8.0). At least I
can say it builds and handles binary large object data OK with Tcl-8.0.5.
Of course, it also builds and works with Tcl-8.4.4.

*** src/interfaces/libpgtcl/pgtclCmds.c.orig Thu Oct 30 19:18:55 2003
--- src/interfaces/libpgtcl/pgtclCmds.c Thu Nov 6 21:02:26 2003
***************
*** 1218,1224 ****
--- 1218,1228 ----

if (nbytes >= 0)
{
+ #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1 || TCL_MAJOR_VERSION > 8
bufObj = Tcl_NewByteArrayObj(buf, nbytes);
+ #else
+ bufObj = Tcl_NewStringObj(buf, nbytes);
+ #endif

if (Tcl_ObjSetVar2(interp, bufVar, NULL, bufObj,
TCL_LEAVE_ERR_MSG | TCL_PARSE_PART1) == NULL)
***************
*** 1313,1319 ****
--- 1317,1327 ----
if (Tcl_GetIntFromObj(interp, objv[2], &fd) != TCL_OK)
return TCL_ERROR;

+ #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1 || TCL_MAJOR_VERSION > 8
buf = Tcl_GetByteArrayFromObj(objv[3], &nbytes);
+ #else
+ buf = Tcl_GetStringFromObj(objv[3], &nbytes);
+ #endif

if (Tcl_GetIntFromObj(interp, objv[4], &len) != TCL_OK)
return TCL_ERROR;

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-11-08 02:37:47 FAQ_MSWIN update
Previous Message Tom Lane 2003-11-07 01:56:26 Re: (repost) pgtcl: restore 8.0 compatibility for large obj fix