Skip to content

Commit fa760b1

Browse files
authored
Merge pull request ged#667 from larskanis/fix-heimdal-segfault
Use "rbpg_" prefix for base64_* functions
2 parents 124e4fc + c6e49b5 commit fa760b1

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

ext/pg_binary_decoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pg_bin_dec_to_base64(t_pg_coder *conv, const char *val, int len, int tuple, int
117117
/* create a buffer of the encoded length */
118118
VALUE out_value = rb_str_new(NULL, encoded_len);
119119

120-
base64_encode( RSTRING_PTR(out_value), val, len );
120+
rbpg_base64_encode( RSTRING_PTR(out_value), val, len );
121121

122122
/* Is it a pure String conversion? Then we can directly send out_value to the user. */
123123
if( this->comp.format == 0 && dec_func == pg_text_dec_string ){

ext/pg_binary_encoder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ pg_bin_enc_from_base64(t_pg_coder *conv, VALUE value, char *out, VALUE *intermed
524524
if(out){
525525
/* Second encoder pass, if required */
526526
strlen = enc_func(this->elem, value, out, intermediate, enc_idx);
527-
strlen = base64_decode( out, out, strlen );
527+
strlen = rbpg_base64_decode( out, out, strlen );
528528

529529
return strlen;
530530
} else {
@@ -538,7 +538,7 @@ pg_bin_enc_from_base64(t_pg_coder *conv, VALUE value, char *out, VALUE *intermed
538538
strlen = RSTRING_LENINT(subint);
539539
out_str = rb_str_new(NULL, BASE64_DECODED_SIZE(strlen));
540540

541-
strlen = base64_decode( RSTRING_PTR(out_str), RSTRING_PTR(subint), strlen);
541+
strlen = rbpg_base64_decode( RSTRING_PTR(out_str), RSTRING_PTR(subint), strlen);
542542
rb_str_set_len( out_str, strlen );
543543
*intermediate = out_str;
544544

ext/pg_text_decoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ pg_text_dec_from_base64(t_pg_coder *conv, const char *val, int len, int tuple, i
579579
/* create a buffer of the expected decoded length */
580580
VALUE out_value = rb_str_new(NULL, BASE64_DECODED_SIZE(len));
581581

582-
decoded_len = base64_decode( RSTRING_PTR(out_value), val, len );
582+
decoded_len = rbpg_base64_decode( RSTRING_PTR(out_value), val, len );
583583
rb_str_set_len(out_value, decoded_len);
584584

585585
/* Is it a pure String conversion? Then we can directly send out_value to the user. */

ext/pg_text_encoder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ pg_text_enc_to_base64(t_pg_coder *conv, VALUE value, char *out, VALUE *intermedi
784784
if(out){
785785
/* Second encoder pass, if required */
786786
strlen = enc_func(this->elem, value, out, intermediate, enc_idx);
787-
base64_encode( out, out, strlen );
787+
rbpg_base64_encode( out, out, strlen );
788788

789789
return BASE64_ENCODED_SIZE(strlen);
790790
} else {
@@ -799,7 +799,7 @@ pg_text_enc_to_base64(t_pg_coder *conv, VALUE value, char *out, VALUE *intermedi
799799
out_str = rb_str_new(NULL, BASE64_ENCODED_SIZE(strlen));
800800
PG_ENCODING_SET_NOCHECK(out_str, enc_idx);
801801

802-
base64_encode( RSTRING_PTR(out_str), RSTRING_PTR(subint), strlen);
802+
rbpg_base64_encode( RSTRING_PTR(out_str), RSTRING_PTR(subint), strlen);
803803
*intermediate = out_str;
804804

805805
return -1;

ext/pg_util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static const char base64_encode_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk
1515
* in-place (with _out_ == _in_).
1616
*/
1717
void
18-
base64_encode( char *out, const char *in, int len)
18+
rbpg_base64_encode( char *out, const char *in, int len)
1919
{
2020
const unsigned char *in_ptr = (const unsigned char *)in + len;
2121
char *out_ptr = out + BASE64_ENCODED_SIZE(len);
@@ -72,7 +72,7 @@ static const unsigned char base64_decode_table[] =
7272
* It is possible to decode a string in-place (with _out_ == _in_).
7373
*/
7474
int
75-
base64_decode( char *out, const char *in, unsigned int len)
75+
rbpg_base64_decode( char *out, const char *in, unsigned int len)
7676
{
7777
unsigned char a, b, c, d;
7878
const unsigned char *in_ptr = (const unsigned char *)in;

ext/pg_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
#define BASE64_ENCODED_SIZE(strlen) (((strlen) + 2) / 3 * 4)
5858
#define BASE64_DECODED_SIZE(base64len) (((base64len) + 3) / 4 * 3)
5959

60-
void base64_encode( char *out, const char *in, int len);
61-
int base64_decode( char *out, const char *in, unsigned int len);
60+
void rbpg_base64_encode( char *out, const char *in, int len);
61+
int rbpg_base64_decode( char *out, const char *in, unsigned int len);
6262

6363
int rbpg_strncasecmp(const char *s1, const char *s2, size_t n);
6464

0 commit comments

Comments
 (0)