diff options
author | Bruce Momjian <bruce@momjian.us> | 2001-05-15 04:45:15 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2001-05-15 04:45:15 +0000 |
commit | fdbfe1c68e03dc57d956f0b47bf22c39bb30b0b4 (patch) | |
tree | c5e82b0155665513274ff854aa12f2b547bd15d2 /contrib/pgcrypto/encode.c | |
parent | 0eacc60e23600f16400ce09c1606aac32241ca00 (diff) | |
download | postgresql-fdbfe1c68e03dc57d956f0b47bf22c39bb30b0b4.tar.gz postgresql-fdbfe1c68e03dc57d956f0b47bf22c39bb30b0b4.zip |
Well, the correct code - that corresponds to current
encode - is below. I even got the linefeed stuff wrong.
--
marko
Diffstat (limited to 'contrib/pgcrypto/encode.c')
-rw-r--r-- | contrib/pgcrypto/encode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/pgcrypto/encode.c b/contrib/pgcrypto/encode.c index 7a575dacd14..dcd3edea16c 100644 --- a/contrib/pgcrypto/encode.c +++ b/contrib/pgcrypto/encode.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: encode.c,v 1.5 2001/05/13 02:17:09 momjian Exp $ + * $Id: encode.c,v 1.6 2001/05/15 04:45:15 momjian Exp $ */ #include "postgres.h" @@ -349,7 +349,8 @@ hex_dec_len(uint srclen) 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 |