@@ -42,7 +42,7 @@ static const unsigned char _base64[] =
42
42
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ;
43
43
44
44
static int
45
- b64_encode (const uint8 * src ,unsigned len ,uint8 * dst )
45
+ pg_base64_encode (const uint8 * src ,unsigned len ,uint8 * dst )
46
46
{
47
47
uint8 * p ,
48
48
* lend = dst + 76 ;
@@ -92,7 +92,7 @@ b64_encode(const uint8 *src, unsigned len, uint8 *dst)
92
92
93
93
/* probably should use lookup table */
94
94
static int
95
- b64_decode (const uint8 * src ,unsigned len ,uint8 * dst )
95
+ pg_base64_decode (const uint8 * src ,unsigned len ,uint8 * dst )
96
96
{
97
97
const uint8 * srcend = src + len ,
98
98
* s = src ;
@@ -160,7 +160,7 @@ b64_decode(const uint8 *src, unsigned len, uint8 *dst)
160
160
}
161
161
162
162
static unsigned
163
- b64_enc_len (unsigned srclen )
163
+ pg_base64_enc_len (unsigned srclen )
164
164
{
165
165
/*
166
166
* 3 bytes will be converted to 4, linefeed after 76 chars
@@ -169,7 +169,7 @@ b64_enc_len(unsigned srclen)
169
169
}
170
170
171
171
static unsigned
172
- b64_dec_len (unsigned srclen )
172
+ pg_base64_dec_len (unsigned srclen )
173
173
{
174
174
return (srclen * 3 ) >>2 ;
175
175
}
@@ -218,11 +218,11 @@ pgp_armor_encode(const uint8 *src, unsigned len, StringInfo dst,
218
218
appendStringInfo (dst ,"%s: %s\n" ,keys [n ],values [n ]);
219
219
appendStringInfoChar (dst ,'\n' );
220
220
221
- /* make sure we have enough room tob64_encode () */
222
- b64len = b64_enc_len (len );
221
+ /* make sure we have enough room topg_base64_encode () */
222
+ b64len = pg_base64_enc_len (len );
223
223
enlargeStringInfo (dst , (int )b64len );
224
224
225
- res = b64_encode (src ,len , (uint8 * )dst -> data + dst -> len );
225
+ res = pg_base64_encode (src ,len , (uint8 * )dst -> data + dst -> len );
226
226
if (res > b64len )
227
227
elog (FATAL ,"overflow - encode estimate too small" );
228
228
dst -> len += res ;
@@ -358,14 +358,14 @@ pgp_armor_decode(const uint8 *src, int len, StringInfo dst)
358
358
gotoout ;
359
359
360
360
/* decode crc */
361
- if (b64_decode (p + 1 ,4 ,buf )!= 3 )
361
+ if (pg_base64_decode (p + 1 ,4 ,buf )!= 3 )
362
362
gotoout ;
363
363
crc = (((long )buf [0 ]) <<16 )+ (((long )buf [1 ]) <<8 )+ (long )buf [2 ];
364
364
365
365
/* decode data */
366
- blen = (int )b64_dec_len (len );
366
+ blen = (int )pg_base64_dec_len (len );
367
367
enlargeStringInfo (dst ,blen );
368
- res = b64_decode (base64_start ,base64_end - base64_start , (uint8 * )dst -> data );
368
+ res = pg_base64_decode (base64_start ,base64_end - base64_start , (uint8 * )dst -> data );
369
369
if (res > blen )
370
370
elog (FATAL ,"overflow - decode estimate too small" );
371
371
if (res >=0 )