Patch 7.4RC1 pgtcl to restore Tcl-8.0 compatibility for large obj fix - Mailing list pgsql-patches

From ljb
Subject Patch 7.4RC1 pgtcl to restore Tcl-8.0 compatibility for large obj fix
Date
Msg-id bohhdv$1h5r$1@news.hub.org
Whole thread Raw
In response to (repost) pgtcl: restore 8.0 compatibility for large obj fix  (ljb <ljb220@mindspring.com>)
Responses Re: Patch 7.4RC1 pgtcl to restore Tcl-8.0 compatibility for large obj fix  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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;

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: (repost) pgtcl: restore 8.0 compatibility for large obj fix
Next
From: Christopher Kings-Lynne
Date:
Subject: FAQ_MSWIN update