From 4ca28eb7c72e65e1a4f3a4e6b7d35a56e2b69d5c Mon Sep 17 00:00:00 2001 From: Bruce Momjian <bruce@momjian.us> Date: Sun, 10 Nov 2002 00:14:22 +0000 Subject: [PATCH] I just discovered, that there is missing a const when passing a buffer to PQescapeBytea and PQunescapeBytea. I fixed it and tried to create a usable diff (I'm not so familar to diff). Tommi M?kitalo --- doc/src/sgml/libpq.sgml | 6 +++--- src/interfaces/libpq/fe-exec.c | 10 +++++----- src/interfaces/libpq/libpq-fe.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index d805b31378b..3714f7675a7 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.99 2002/11/08 05:03:11 momjian Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.100 2002/11/10 00:14:22 momjian Exp $ --> <chapter id="libpq"> @@ -926,7 +926,7 @@ strings overlap. <function>PQescapeBytea</function> Escapes a binary string (<type>bytea</type> type) for use within an SQL query. <synopsis> - unsigned char *PQescapeBytea(unsigned char *from, + unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, size_t *to_length); </synopsis> @@ -970,7 +970,7 @@ strings overlap. Converts an escaped string representation of binary data into binary data - the reverse of <function>PQescapeBytea</function>. <synopsis> - unsigned char *PQunescapeBytea(unsigned char *from, size_t *to_length); + unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length); </synopsis> The <parameter>from</parameter> parameter points to an escaped string diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 214f2929fd1..cd48ee38a1c 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.122 2002/09/04 20:31:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.123 2002/11/10 00:14:22 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -118,9 +118,9 @@ PQescapeString(char *to, const char *from, size_t length) * anything >= 0x80 ---> \\ooo (where ooo is an octal expression) */ unsigned char * -PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen) +PQescapeBytea(const unsigned char *bintext, size_t binlen, size_t *bytealen) { - unsigned char *vp; + const unsigned char *vp; unsigned char *rp; unsigned char *result; size_t i; @@ -202,12 +202,12 @@ PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen) * 6 \\ */ unsigned char * -PQunescapeBytea(unsigned char *strtext, size_t *retbuflen) +PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen) { size_t buflen; unsigned char *buffer, - *sp, *bp; + const unsigned char *sp; unsigned int state = 0; if (strtext == NULL) diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index 49045d37b9d..338cf18385a 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: libpq-fe.h,v 1.86 2002/09/04 20:31:47 momjian Exp $ + * $Id: libpq-fe.h,v 1.87 2002/11/10 00:14:22 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -249,9 +249,9 @@ extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, /* Quoting strings before inclusion in queries. */ extern size_t PQescapeString(char *to, const char *from, size_t length); -extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen, +extern unsigned char *PQescapeBytea(const unsigned char *bintext, size_t binlen, size_t *bytealen); -extern unsigned char *PQunescapeBytea(unsigned char *strtext, +extern unsigned char *PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen); -- GitLab