aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-05-15 04:45:35 +0000
committerBruce Momjian <bruce@momjian.us>2001-05-15 04:45:35 +0000
commit6099009eae8f4f7f47ebd712f15f7eb936973c7a (patch)
tree240ce396310d08a3b67137c2cec69be0cc970c2f
parenta8bc265bad278a0abe27905d56102184906a18bf (diff)
downloadpostgresql-6099009eae8f4f7f47ebd712f15f7eb936973c7a.tar.gz
postgresql-6099009eae8f4f7f47ebd712f15f7eb936973c7a.zip
Well, the correct code - that corresponds to current
encode - is below. I even got the linefeed stuff wrong. -- marko
-rw-r--r--contrib/pgcrypto/encode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/pgcrypto/encode.c b/contrib/pgcrypto/encode.c
index cd8568d07f0..9b22f08b716 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.4.2.1 2001/05/13 03:27:49 momjian Exp $
+ * $Id: encode.c,v 1.4.2.2 2001/05/15 04:45:35 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