Skip to content

Commit 0aa6817

Browse files
committed
name clash with gnutls on on base64_encode
1 parent 5ea5a7f commit 0aa6817

File tree

7 files changed

+50
-50
lines changed

7 files changed

+50
-50
lines changed

include/base64.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,34 @@ extern "C" {
2222
#endif
2323

2424
/*
25-
Calculate how much memory needed for dst of base64_encode()
25+
Calculate how much memory needed for dst of my_base64_encode()
2626
*/
27-
int base64_needed_encoded_length(int length_of_data);
27+
int my_base64_needed_encoded_length(int length_of_data);
2828

2929
/*
30-
Maximum length base64_encode_needed_length() can accept with no overflow.
30+
Maximum length my_base64_encode_needed_length() can accept with no overflow.
3131
*/
32-
int base64_encode_max_arg_length(void);
32+
int my_base64_encode_max_arg_length(void);
3333

3434
/*
35-
Calculate how much memory needed for dst of base64_decode()
35+
Calculate how much memory needed for dst of my_base64_decode()
3636
*/
37-
int base64_needed_decoded_length(int length_of_encoded_data);
37+
int my_base64_needed_decoded_length(int length_of_encoded_data);
3838

3939
/*
40-
Maximum length base64_decode_needed_length() can accept with no overflow.
40+
Maximum length my_base64_decode_needed_length() can accept with no overflow.
4141
*/
42-
int base64_decode_max_arg_length();
42+
int my_base64_decode_max_arg_length();
4343

4444
/*
4545
Encode data as a base64 string
4646
*/
47-
int base64_encode(const void *src, size_t src_len, char *dst);
47+
int my_base64_encode(const void *src, size_t src_len, char *dst);
4848

4949
/*
5050
Decode a base64 string into data
5151
*/
52-
int base64_decode(const char *src, size_t src_len,
52+
int my_base64_decode(const char *src, size_t src_len,
5353
void *dst, const char **end_ptr, int flags);
5454

5555
/* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */

mysys/base64.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2626
"0123456789+/";
2727

2828
/**
29-
* Maximum length base64_needed_encoded_length()
29+
* Maximum length my_base64_needed_encoded_length()
3030
* can handle without signed integer overflow.
3131
*/
3232
int
33-
base64_encode_max_arg_length()
33+
my_base64_encode_max_arg_length()
3434
{
3535
/*
36-
base64_needed_encoded_length(1589695686) -> 2147483646 (7FFFFFFE)
37-
base64_needed_encoded_length(1589695687) -> -2147483645
36+
my_base64_needed_encoded_length(1589695686) -> 2147483646 (7FFFFFFE)
37+
my_base64_needed_encoded_length(1589695687) -> -2147483645
3838
*/
3939
return 0x5EC0D4C6; /* 1589695686 */
4040
}
4141

4242

4343
int
44-
base64_needed_encoded_length(int length_of_data)
44+
my_base64_needed_encoded_length(int length_of_data)
4545
{
4646
int nb_base64_chars;
4747
nb_base64_chars= (length_of_data + 2) / 3 * 4;
@@ -54,17 +54,17 @@ base64_needed_encoded_length(int length_of_data)
5454

5555

5656
/**
57-
* Maximum length supported by base64_decode().
57+
* Maximum length supported by my_base64_decode().
5858
*/
5959
int
60-
base64_decode_max_arg_length()
60+
my_base64_decode_max_arg_length()
6161
{
6262
return 0x7FFFFFFF;
6363
}
6464

6565

6666
int
67-
base64_needed_decoded_length(int length_of_encoded_data)
67+
my_base64_needed_decoded_length(int length_of_encoded_data)
6868
{
6969
return (int) ((longlong) length_of_encoded_data + 3) / 4 * 3;
7070
}
@@ -74,7 +74,7 @@ base64_needed_decoded_length(int length_of_encoded_data)
7474
Encode a data as base64.
7575
7676
Note: We require that dst is pre-allocated to correct size.
77-
See base64_needed_encoded_length().
77+
See my_base64_needed_encoded_length().
7878
7979
Note: We add line separators every 76 characters.
8080
@@ -83,7 +83,7 @@ base64_needed_decoded_length(int length_of_encoded_data)
8383
*/
8484

8585
int
86-
base64_encode(const void *src, size_t src_len, char *dst)
86+
my_base64_encode(const void *src, size_t src_len, char *dst)
8787
{
8888
const unsigned char *s= (const unsigned char*)src;
8989
size_t i= 0;
@@ -299,7 +299,7 @@ my_base64_decoder_getch(MY_BASE64_DECODER *decoder)
299299
* the last read character, even in the presence of error.
300300
*
301301
* Note: 'dst' must have sufficient space to store the decoded data.
302-
* Use base64_needed_decoded_length() to calculate the correct space size.
302+
* Use my_base64_needed_decoded_length() to calculate the correct space size.
303303
*
304304
* Note: we allow spaces and line separators at any position.
305305
*
@@ -313,7 +313,7 @@ my_base64_decoder_getch(MY_BASE64_DECODER *decoder)
313313
* @return Number of bytes written at 'dst', or -1 in case of failure
314314
*/
315315
int
316-
base64_decode(const char *src_base, size_t len,
316+
my_base64_decode(const char *src_base, size_t len,
317317
void *dst, const char **end_ptr, int flags)
318318
{
319319
char *d= (char*) dst;
@@ -397,18 +397,18 @@ main(void)
397397
}
398398

399399
/* Encode */
400-
needed_length= base64_needed_encoded_length(src_len);
400+
needed_length= my_base64_needed_encoded_length(src_len);
401401
str= (char *) malloc(needed_length);
402402
require(str);
403403
for (k= 0; k < needed_length; k++)
404404
str[k]= 0xff; /* Fill memory to check correct NUL termination */
405-
require(base64_encode(src, src_len, str) == 0);
405+
require(my_base64_encode(src, src_len, str) == 0);
406406
require(needed_length == strlen(str) + 1);
407407

408408
/* Decode */
409-
dst= (char *) malloc(base64_needed_decoded_length(strlen(str)));
409+
dst= (char *) malloc(my_base64_needed_decoded_length(strlen(str)));
410410
require(dst);
411-
dst_len= base64_decode(str, strlen(str), dst, NULL);
411+
dst_len= my_base64_decode(str, strlen(str), dst, NULL);
412412
require(dst_len == src_len);
413413

414414
if (memcmp(src, dst, src_len) != 0)

plugin/feedback/utils.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ int calculate_server_uid(char *dest)
422422

423423
compute_sha1_hash((uint8*) shabuf, (char*) rawbuf, sizeof(rawbuf));
424424

425-
assert(base64_needed_encoded_length(sizeof(shabuf)) <= SERVER_UID_SIZE);
426-
base64_encode(shabuf, sizeof(shabuf), dest);
425+
assert(my_base64_needed_encoded_length(sizeof(shabuf)) <= SERVER_UID_SIZE);
426+
my_base64_encode(shabuf, sizeof(shabuf), dest);
427427

428428
return 0;
429429
}

sql/item_strfunc.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -427,14 +427,14 @@ void Item_func_to_base64::fix_length_and_dec()
427427
{
428428
maybe_null= args[0]->maybe_null;
429429
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
430-
if (args[0]->max_length > (uint) base64_encode_max_arg_length())
430+
if (args[0]->max_length > (uint) my_base64_encode_max_arg_length())
431431
{
432432
maybe_null= 1;
433-
fix_char_length_ulonglong((ulonglong) base64_encode_max_arg_length());
433+
fix_char_length_ulonglong((ulonglong) my_base64_encode_max_arg_length());
434434
}
435435
else
436436
{
437-
int length= base64_needed_encoded_length((int) args[0]->max_length);
437+
int length= my_base64_needed_encoded_length((int) args[0]->max_length);
438438
DBUG_ASSERT(length > 0);
439439
fix_char_length_ulonglong((ulonglong) length - 1);
440440
}
@@ -447,9 +447,9 @@ String *Item_func_to_base64::val_str_ascii(String *str)
447447
bool too_long= false;
448448
int length;
449449
if (!res ||
450-
res->length() > (uint) base64_encode_max_arg_length() ||
450+
res->length() > (uint) my_base64_encode_max_arg_length() ||
451451
(too_long=
452-
((uint) (length= base64_needed_encoded_length((int) res->length())) >
452+
((uint) (length= my_base64_needed_encoded_length((int) res->length())) >
453453
current_thd->variables.max_allowed_packet)) ||
454454
tmp_value.alloc((uint) length))
455455
{
@@ -465,7 +465,7 @@ String *Item_func_to_base64::val_str_ascii(String *str)
465465
}
466466
return 0;
467467
}
468-
base64_encode(res->ptr(), (int) res->length(), (char*) tmp_value.ptr());
468+
my_base64_encode(res->ptr(), (int) res->length(), (char*) tmp_value.ptr());
469469
DBUG_ASSERT(length > 0);
470470
tmp_value.length((uint) length - 1); // Without trailing '\0'
471471
null_value= 0;
@@ -475,13 +475,13 @@ String *Item_func_to_base64::val_str_ascii(String *str)
475475

476476
void Item_func_from_base64::fix_length_and_dec()
477477
{
478-
if (args[0]->max_length > (uint) base64_decode_max_arg_length())
478+
if (args[0]->max_length > (uint) my_base64_decode_max_arg_length())
479479
{
480-
fix_char_length_ulonglong((ulonglong) base64_decode_max_arg_length());
480+
fix_char_length_ulonglong((ulonglong) my_base64_decode_max_arg_length());
481481
}
482482
else
483483
{
484-
int length= base64_needed_decoded_length((int) args[0]->max_length);
484+
int length= my_base64_needed_decoded_length((int) args[0]->max_length);
485485
fix_char_length_ulonglong((ulonglong) length);
486486
}
487487
maybe_null= 1; // Can be NULL, e.g. in case of badly formed input string
@@ -497,8 +497,8 @@ String *Item_func_from_base64::val_str(String *str)
497497
if (!res)
498498
goto err;
499499

500-
if (res->length() > (uint) base64_decode_max_arg_length() ||
501-
((uint) (length= base64_needed_decoded_length((int) res->length())) >
500+
if (res->length() > (uint) my_base64_decode_max_arg_length() ||
501+
((uint) (length= my_base64_needed_decoded_length((int) res->length())) >
502502
current_thd->variables.max_allowed_packet))
503503
{
504504
THD *thd= current_thd;
@@ -513,7 +513,7 @@ String *Item_func_from_base64::val_str(String *str)
513513
if (tmp_value.alloc((uint) length))
514514
goto err;
515515

516-
if ((length= base64_decode(res->ptr(), (int) res->length(),
516+
if ((length= my_base64_decode(res->ptr(), (int) res->length(),
517517
(char *) tmp_value.ptr(), &end_ptr, 0)) < 0 ||
518518
end_ptr < res->ptr() + res->length())
519519
{

sql/log_event.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2771,15 +2771,15 @@ void Log_event::print_base64(IO_CACHE* file,
27712771
uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
27722772
DBUG_ENTER("Log_event::print_base64");
27732773

2774-
size_t const tmp_str_sz= base64_needed_encoded_length((int) size);
2774+
size_t const tmp_str_sz= my_base64_needed_encoded_length((int) size);
27752775
char *const tmp_str= (char *) my_malloc(tmp_str_sz, MYF(MY_WME));
27762776
if (!tmp_str) {
27772777
fprintf(stderr, "\nError: Out of memory. "
27782778
"Could not print correct binlog event.\n");
27792779
DBUG_VOID_RETURN;
27802780
}
27812781

2782-
if (base64_encode(ptr, (size_t) size, tmp_str))
2782+
if (my_base64_encode(ptr, (size_t) size, tmp_str))
27832783
{
27842784
DBUG_ASSERT(0);
27852785
}

sql/sql_binlog.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void mysql_client_binlog_statement(THD* thd)
6060
my_error(ER_SYNTAX_ERROR, MYF(0));
6161
DBUG_VOID_RETURN;
6262
}
63-
size_t decoded_len= base64_needed_decoded_length(coded_len);
63+
size_t decoded_len= my_base64_needed_decoded_length(coded_len);
6464

6565
/*
6666
option_bits will be changed when applying the event. But we don't expect
@@ -124,7 +124,7 @@ void mysql_client_binlog_statement(THD* thd)
124124
strptr < thd->lex->comment.str + thd->lex->comment.length ; )
125125
{
126126
char const *endptr= 0;
127-
int bytes_decoded= base64_decode(strptr, coded_len, buf, &endptr,
127+
int bytes_decoded= my_base64_decode(strptr, coded_len, buf, &endptr,
128128
MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS);
129129

130130
#ifndef HAVE_valgrind

unittest/mysys/base64-t.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ main(int argc __attribute__((unused)),char *argv[])
4949
}
5050

5151
/* Encode */
52-
needed_length= base64_needed_encoded_length(src_len);
52+
needed_length= my_base64_needed_encoded_length(src_len);
5353
str= (char *) malloc(needed_length);
5454
for (k= 0; k < needed_length; k++)
5555
str[k]= 0xff; /* Fill memory to check correct NUL termination */
56-
ok(base64_encode(src, src_len, str) == 0,
57-
"base64_encode: size %d", i);
56+
ok(my_base64_encode(src, src_len, str) == 0,
57+
"my_base64_encode: size %d", i);
5858
ok(needed_length == strlen(str) + 1,
59-
"base64_needed_encoded_length: size %d", i);
59+
"my_base64_needed_encoded_length: size %d", i);
6060

6161
/* Decode */
62-
dst= (char *) malloc(base64_needed_decoded_length(strlen(str)));
63-
dst_len= base64_decode(str, strlen(str), dst, NULL, 0);
62+
dst= (char *) malloc(my_base64_needed_decoded_length(strlen(str)));
63+
dst_len= my_base64_decode(str, strlen(str), dst, NULL, 0);
6464
ok(dst_len == src_len, "Comparing lengths");
6565

6666
cmp= memcmp(src, dst, src_len);

0 commit comments

Comments
 (0)