Re: unknownin/out patch (was [HACKERS] PQescapeBytea is - Mailing list pgsql-patches

From John Gray
Subject Re: unknownin/out patch (was [HACKERS] PQescapeBytea is
Date
Msg-id 1018343465.3587.56.camel@adzuki
Whole thread Raw
In response to Re: unknownin/out patch (was [HACKERS] PQescapeBytea is  (Joe Conway <mail@joeconway.com>)
List pgsql-patches
On Tue, 2002-04-09 at 06:57, Joe Conway wrote:
[snipped]
> > Yes, I was just looking at that also. It doesn't consider the case of n
> > = -1 for MB. See the lines:
> >
> > #ifdef MULTIBYTE
> >    eml = pg_database_encoding_max_length ();
> >
> >    if (eml > 1)
> >    {
> >       sm = 0;
> >       sn = (m + n) * eml + 3;
> >    }
> > #endif
> >
> > When n = -1 this does the wrong thing. And also a few lines later:
> >
> > #ifdef MULTIBYTE
> >    len = pg_mbstrlen_with_len (VARDATA (string), sn - 3);
> >
> > I think both places need to test for n = -1. Do you agree?
> >

Sorry folks! I hadn't thought through the logic of that in the n = -1
and multibyte case. The patch looks OK to me.

John




pgsql-patches by date:

Previous
From: Joe Conway
Date:
Subject: Re: unknownin/out patch (was [HACKERS] PQescapeBytea is
Next
From: Peter Eisentraut
Date:
Subject: Re: unknownin/out patch (was [HACKERS] PQescapeBytea is