mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
More VARHDRSZ additions.
This commit is contained in:
parent
bec35da8bf
commit
53026db75e
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.19 1997/12/06 22:56:20 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.20 1997/12/08 04:42:43 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -265,7 +265,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
|
||||
/* variable length, assume a varlena structure */
|
||||
len = VARSIZE(attr) - VARHDRSZ;
|
||||
|
||||
pq_putint(len, sizeof(int32));
|
||||
pq_putint(len, VARHDRSZ);
|
||||
pq_putnchar(VARDATA(attr), len);
|
||||
#ifdef IPORTAL_DEBUG
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.16 1997/10/25 01:09:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.17 1997/12/08 04:42:45 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This should be moved to a more appropriate place. It is here
|
||||
@ -227,9 +227,9 @@ loread(int fd, int len)
|
||||
struct varlena *retval;
|
||||
int totalread = 0;
|
||||
|
||||
retval = (struct varlena *) palloc(sizeof(int32) + len);
|
||||
retval = (struct varlena *) palloc(VARHDRSZ + len);
|
||||
totalread = lo_read(fd, VARDATA(retval), len);
|
||||
VARSIZE(retval) = totalread + sizeof(int32);
|
||||
VARSIZE(retval) = totalread + VARHDRSZ;
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -240,7 +240,7 @@ lowrite(int fd, struct varlena * wbuf)
|
||||
int totalwritten;
|
||||
int bytestowrite;
|
||||
|
||||
bytestowrite = VARSIZE(wbuf) - sizeof(int32);
|
||||
bytestowrite = VARSIZE(wbuf) - VARHDRSZ;
|
||||
totalwritten = lo_write(fd, VARDATA(wbuf), bytestowrite);
|
||||
return totalwritten;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.23 1997/12/06 22:57:15 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.24 1997/12/08 04:42:48 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -59,7 +59,7 @@ byteain(char *inputText)
|
||||
elog(WARN, "Bad input string for type bytea");
|
||||
}
|
||||
tp = inputText;
|
||||
byte += sizeof(int32); /* varlena? */
|
||||
byte += VARHDRSZ;
|
||||
result = (struct varlena *) palloc(byte);
|
||||
result->vl_len = byte; /* varlena? */
|
||||
rp = result->vl_dat;
|
||||
@ -88,11 +88,11 @@ shove_bytes(unsigned char *stuff, int len)
|
||||
{
|
||||
struct varlena *result;
|
||||
|
||||
result = (struct varlena *) palloc(len + sizeof(int32));
|
||||
result = (struct varlena *) palloc(len + VARHDRSZ);
|
||||
result->vl_len = len;
|
||||
memmove(result->vl_dat,
|
||||
stuff + sizeof(int32),
|
||||
len - sizeof(int32));
|
||||
stuff + VARHDRSZ,
|
||||
len - VARHDRSZ);
|
||||
return (result);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ byteaout(struct varlena * vlena)
|
||||
}
|
||||
vp = vlena->vl_dat;
|
||||
len = 1; /* empty string has 1 char */
|
||||
for (i = vlena->vl_len - sizeof(int32); i != 0; i--, vp++) /* varlena? */
|
||||
for (i = vlena->vl_len - VARHDRSZ; i != 0; i--, vp++)
|
||||
if (*vp == '\\')
|
||||
len += 2;
|
||||
else if (isascii(*vp) && isprint(*vp))
|
||||
@ -135,7 +135,7 @@ byteaout(struct varlena * vlena)
|
||||
len += VARHDRSZ;
|
||||
rp = result = (char *) palloc(len);
|
||||
vp = vlena->vl_dat;
|
||||
for (i = vlena->vl_len - sizeof(int32); i != 0; i--) /* varlena? */
|
||||
for (i = vlena->vl_len - VARHDRSZ; i != 0; i--)
|
||||
if (*vp == '\\')
|
||||
{
|
||||
vp++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user