Applied for 7.1.X and 7.2.
> On Mon, May 14, 2001 at 01:15:59PM -0700, Ian Lance Taylor wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > Applied to 7.1.X and 7.2.
> >
> > But, but...
>
> ;)
>
> > > > - return srclen + (srclen / 3) + (srclen / (76 / 2));
> > > > + return srclen + (srclen + 2 / 3) + (srclen / (76 / 2)) + 2;
> >
> > (srclen + 2 / 3) is always the same as (srclen).
> >
> > Perhaps this was meant to be ((srclen + 2) / 3)?
>
> I guess too... Its no good to create patches half-asleep...
>
> > The current code is safe, but weird.
>
> But I got very good response time :)
>
> Well, the correct code - that corresponds to current
> encode - is below. I even got the linefeed stuff wrong.
>
> --
> marko
>
>
>
> Index: contrib/pgcrypto/encode.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/encode.c,v
> retrieving revision 1.5
> diff -u -r1.5 encode.c
> --- contrib/pgcrypto/encode.c 2001/05/13 02:17:09 1.5
> +++ contrib/pgcrypto/encode.c 2001/05/14 21:29:43
> @@ -349,7 +349,8 @@
> uint
> b64_enc_len(uint srclen)
> {
> - return srclen + (srclen + 2 / 3) + (srclen / (76 / 2)) + 2;
> + /* 3 bytes will be converted to 4, linefeed after 76 chars */
> + return (srclen + 2) * 4 / 3 + srclen / (76 * 3 / 4);
> }
>
> uint
>
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026