(repost) pgtcl: restore 8.0 compatibility for large obj fix

From: ljb <ljb220(at)mindspring(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: (repost) pgtcl: restore 8.0 compatibility for large obj fix
Date: 2003-11-06 01:47:05
Message-ID: boc96o$190f$2@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

This is a repost of my 29 Oct 2003 message, which didn't seem to make it all
the way in. It restores Tcl 8.0 compatibility, which was lost in my patch to
fix corrupt binary data transfer in pg_lo_read and pg_lo_write. Sorry, this
is against PostgreSQL-7.4beta5 which was the latest when I did this up. If it
can't be applied to RC1, I can redo it against RC1 in a few days.

...

I don't think Tcl 8.0.x will have the problem with binary data, as the
trouble started with internationalization at 8.1. So here's my patch
resubmitted with some conditional ugliness:

===================================================================
--- src/interfaces/libpgtcl/pgtclCmds.c.orig 2003-08-03 22:40:16.000000000 -0400
+++ src/interfaces/libpgtcl/pgtclCmds.c 2003-10-29 14:37:48.000000000 -0500
@@ -1215,7 +1215,11 @@
buf = ckalloc(len + 1);

nbytes = lo_read(conn, fd, buf, len);
+#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)
@@ -1307,7 +1311,11 @@
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;
===================================================================

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Gaetano Mendola 2003-11-06 03:29:59 Re: equal() perf tweak
Previous Message Neil Conway 2003-11-06 00:44:37 Re: equal() perf tweak