Skip to content

Commit 4ca28eb

Browse files
committed
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
1 parent 3eabc44 commit 4ca28eb

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.99 2002/11/08 05:03:11 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.100 2002/11/10 00:14:22 momjian Exp $
33
-->
44

55
<chapter id="libpq">
@@ -926,7 +926,7 @@ strings overlap.
926926
<function>PQescapeBytea</function>
927927
Escapes a binary string (<type>bytea</type> type) for use within an SQL query.
928928
<synopsis>
929-
unsigned char *PQescapeBytea(unsigned char *from,
929+
unsigned char *PQescapeBytea(const unsigned char *from,
930930
size_t from_length,
931931
size_t *to_length);
932932
</synopsis>
@@ -970,7 +970,7 @@ strings overlap.
970970
Converts an escaped string representation of binary data into binary
971971
data - the reverse of <function>PQescapeBytea</function>.
972972
<synopsis>
973-
unsigned char *PQunescapeBytea(unsigned char *from, size_t *to_length);
973+
unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length);
974974
</synopsis>
975975

976976
The <parameter>from</parameter> parameter points to an escaped string

src/interfaces/libpq/fe-exec.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.122 2002/09/04 20:31:47 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.123 2002/11/10 00:14:22 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -118,9 +118,9 @@ PQescapeString(char *to, const char *from, size_t length)
118118
* anything >= 0x80 ---> \\ooo (where ooo is an octal expression)
119119
*/
120120
unsigned char *
121-
PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen)
121+
PQescapeBytea(const unsigned char *bintext, size_t binlen, size_t *bytealen)
122122
{
123-
unsigned char *vp;
123+
const unsigned char *vp;
124124
unsigned char *rp;
125125
unsigned char *result;
126126
size_t i;
@@ -202,12 +202,12 @@ PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen)
202202
* 6 \\
203203
*/
204204
unsigned char *
205-
PQunescapeBytea(unsigned char *strtext, size_t *retbuflen)
205+
PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
206206
{
207207
size_t buflen;
208208
unsigned char *buffer,
209-
*sp,
210209
*bp;
210+
const unsigned char *sp;
211211
unsigned int state = 0;
212212

213213
if (strtext == NULL)

src/interfaces/libpq/libpq-fe.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: libpq-fe.h,v 1.86 2002/09/04 20:31:47 momjian Exp $
10+
* $Id: libpq-fe.h,v 1.87 2002/11/10 00:14:22 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -249,9 +249,9 @@ extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
249249

250250
/* Quoting strings before inclusion in queries. */
251251
extern size_t PQescapeString(char *to, const char *from, size_t length);
252-
extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen,
252+
extern unsigned char *PQescapeBytea(const unsigned char *bintext, size_t binlen,
253253
size_t *bytealen);
254-
extern unsigned char *PQunescapeBytea(unsigned char *strtext,
254+
extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
255255
size_t *retbuflen);
256256

257257

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy