Hi,
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
*** postgresql-7.3b3/src/interfaces/libpq/fe-exec.c 2002-09-04 22:31:47.000000000 +0200
--- postgresql-7.3b3tm1/src/interfaces/libpq/fe-exec.c 2002-11-02 22:28:34.000000000 +0100
***************
*** 118,126 ****
* anything >= 0x80 ---> \\ooo (where ooo is an octal expression)
*/
unsigned char *
! PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen)
{
! unsigned char *vp;
unsigned char *rp;
unsigned char *result;
size_t i;
--- 118,126 ----
* anything >= 0x80 ---> \\ooo (where ooo is an octal expression)
*/
unsigned char *
! PQescapeBytea(const unsigned char *bintext, size_t binlen, size_t *bytealen)
{
! const unsigned char *vp;
unsigned char *rp;
unsigned char *result;
size_t i;
***************
*** 202,213 ****
* 6 \\
*/
unsigned char *
! PQunescapeBytea(unsigned char *strtext, size_t *retbuflen)
{
size_t buflen;
unsigned char *buffer,
- *sp,
*bp;
unsigned int state = 0;
if (strtext == NULL)
--- 202,213 ----
* 6 \\
*/
unsigned char *
! PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
{
size_t buflen;
unsigned char *buffer,
*bp;
+ const unsigned char *sp;
unsigned int state = 0;
if (strtext == NULL)
*** postgresql-7.3b3/src/interfaces/libpq/libpq-fe.h 2002-09-04 22:31:47.000000000 +0200
--- postgresql-7.3b3tm1/src/interfaces/libpq/libpq-fe.h 2002-11-02 22:27:24.000000000 +0100
***************
*** 249,257 ****
/* 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,
size_t *bytealen);
! extern unsigned char *PQunescapeBytea(unsigned char *strtext,
size_t *retbuflen);
--- 249,257 ----
/* Quoting strings before inclusion in queries. */
extern size_t PQescapeString(char *to, const char *from, size_t length);
! extern unsigned char *PQescapeBytea(const unsigned char *bintext, size_t binlen,
size_t *bytealen);
! extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
size_t *retbuflen);
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster