Commit 4ca28eb7 authored by Bruce Momjian's avatar Bruce Momjian

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
parent 3eabc449
<!-- <!--
$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"> <chapter id="libpq">
...@@ -926,7 +926,7 @@ strings overlap. ...@@ -926,7 +926,7 @@ strings overlap.
<function>PQescapeBytea</function> <function>PQescapeBytea</function>
Escapes a binary string (<type>bytea</type> type) for use within an SQL query. Escapes a binary string (<type>bytea</type> type) for use within an SQL query.
<synopsis> <synopsis>
unsigned char *PQescapeBytea(unsigned char *from, unsigned char *PQescapeBytea(const unsigned char *from,
size_t from_length, size_t from_length,
size_t *to_length); size_t *to_length);
</synopsis> </synopsis>
...@@ -970,7 +970,7 @@ strings overlap. ...@@ -970,7 +970,7 @@ strings overlap.
Converts an escaped string representation of binary data into binary Converts an escaped string representation of binary data into binary
data - the reverse of <function>PQescapeBytea</function>. data - the reverse of <function>PQescapeBytea</function>.
<synopsis> <synopsis>
unsigned char *PQunescapeBytea(unsigned char *from, size_t *to_length); unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length);
</synopsis> </synopsis>
The <parameter>from</parameter> parameter points to an escaped string The <parameter>from</parameter> parameter points to an escaped string
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -118,9 +118,9 @@ PQescapeString(char *to, const char *from, size_t length)
* anything >= 0x80 ---> \\ooo (where ooo is an octal expression) * anything >= 0x80 ---> \\ooo (where ooo is an octal expression)
*/ */
unsigned char * 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 *rp;
unsigned char *result; unsigned char *result;
size_t i; size_t i;
...@@ -202,12 +202,12 @@ PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen) ...@@ -202,12 +202,12 @@ PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen)
* 6 \\ * 6 \\
*/ */
unsigned char * unsigned char *
PQunescapeBytea(unsigned char *strtext, size_t *retbuflen) PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
{ {
size_t buflen; size_t buflen;
unsigned char *buffer, unsigned char *buffer,
*sp,
*bp; *bp;
const unsigned char *sp;
unsigned int state = 0; unsigned int state = 0;
if (strtext == NULL) if (strtext == NULL)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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, ...@@ -249,9 +249,9 @@ extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
/* Quoting strings before inclusion in queries. */ /* Quoting strings before inclusion in queries. */
extern size_t PQescapeString(char *to, const char *from, size_t length); 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); size_t *bytealen);
extern unsigned char *PQunescapeBytea(unsigned char *strtext, extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
size_t *retbuflen); size_t *retbuflen);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment