List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:March 25 2009 12:05am
Subject:bzr commit into mysql-6.0 branch (jimw:2835) Bug#26818
View as plain text  
#At file:///Users/jimw/my/mysql-6.0--bug26818/ based on revid:alik@stripped

 2835 Jim Winstead	2009-03-24
      Added 'my_' prefix to base64 functions to avoid conflicts with
      other libraries. (Bug #26818)
      modified:
        include/base64.h
        mysys/base64.c
        sql/log_event.cc
        sql/sql_binlog.cc
        storage/ndb/src/mgmapi/mgmapi.cpp
        unittest/mysys/base64-t.c

=== modified file 'include/base64.h'
--- a/include/base64.h	2006-12-23 19:20:40 +0000
+++ b/include/base64.h	2009-03-25 00:04:41 +0000
@@ -23,23 +23,24 @@ extern "C" {
 /*
   Calculate how much memory needed for dst of base64_encode()
 */
-int base64_needed_encoded_length(int length_of_data);
+int my_base64_needed_encoded_length(int length_of_data);
 
 /*
   Calculate how much memory needed for dst of base64_decode()
 */
-int base64_needed_decoded_length(int length_of_encoded_data);
+int my_base64_needed_decoded_length(int length_of_encoded_data);
+
 
 /*
   Encode data as a base64 string
 */
-int base64_encode(const void *src, size_t src_len, char *dst);
+int my_base64_encode(const void *src, size_t src_len, char *dst);
 
 /*
   Decode a base64 string into data
 */
-int base64_decode(const char *src, size_t src_len,
-                  void *dst, const char **end_ptr);
+int my_base64_decode(const char *src, size_t src_len,
+                     void *dst, const char **end_ptr);
 
 
 #ifdef __cplusplus

=== modified file 'mysys/base64.c'
--- a/mysys/base64.c	2008-01-15 12:23:14 +0000
+++ b/mysys/base64.c	2009-03-25 00:04:41 +0000
@@ -26,7 +26,7 @@ static char base64_table[] = "ABCDEFGHIJ
 
 
 int
-base64_needed_encoded_length(int length_of_data)
+my_base64_needed_encoded_length(int length_of_data)
 {
   int nb_base64_chars;
   nb_base64_chars= (length_of_data + 2) / 3 * 4;
@@ -39,7 +39,7 @@ base64_needed_encoded_length(int length_
 
 
 int
-base64_needed_decoded_length(int length_of_encoded_data)
+my_base64_needed_decoded_length(int length_of_encoded_data)
 {
   return (int) ceil(length_of_encoded_data * 3 / 4);
 }
@@ -49,11 +49,11 @@ base64_needed_decoded_length(int length_
   Encode a data as base64.
 
   Note: We require that dst is pre-allocated to correct size.
-        See base64_needed_encoded_length().
+        See my_base64_needed_encoded_length().
 */
 
 int
-base64_encode(const void *src, size_t src_len, char *dst)
+my_base64_encode(const void *src, size_t src_len, char *dst)
 {
   const unsigned char *s= (const unsigned char*)src;
   size_t i= 0;
@@ -146,14 +146,14 @@ pos(unsigned char c)
     We require that 'dst' is pre-allocated to correct size.
 
   SEE ALSO
-    base64_needed_decoded_length().
+    my_base64_needed_decoded_length().
 
   RETURN VALUE
     Number of bytes written at 'dst' or -1 in case of failure
 */
 int
-base64_decode(const char *src_base, size_t len,
-              void *dst, const char **end_ptr)
+my_base64_decode(const char *src_base, size_t len,
+                 void *dst, const char **end_ptr)
 {
   char b[3];
   size_t i= 0;
@@ -264,18 +264,18 @@ main(void)
     }
 
     /* Encode */
-    needed_length= base64_needed_encoded_length(src_len);
+    needed_length= my_base64_needed_encoded_length(src_len);
     str= (char *) malloc(needed_length);
     require(str);
     for (k= 0; k < needed_length; k++)
       str[k]= 0xff; /* Fill memory to check correct NUL termination */
-    require(base64_encode(src, src_len, str) == 0);
+    require(my_base64_encode(src, src_len, str) == 0);
     require(needed_length == strlen(str) + 1);
 
     /* Decode */
-    dst= (char *) malloc(base64_needed_decoded_length(strlen(str)));
+    dst= (char *) malloc(my_base64_needed_decoded_length(strlen(str)));
     require(dst);
-    dst_len= base64_decode(str, strlen(str), dst, NULL);
+    dst_len= my_base64_decode(str, strlen(str), dst, NULL);
     require(dst_len == src_len);
 
     if (memcmp(src, dst, src_len) != 0)

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-03-09 12:17:41 +0000
+++ b/sql/log_event.cc	2009-03-25 00:04:41 +0000
@@ -1903,7 +1903,7 @@ void Log_event::print_base64(IO_CACHE* f
   uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
   DBUG_ENTER("Log_event::print_base64");
 
-  size_t const tmp_str_sz= base64_needed_encoded_length((int) size);
+  size_t const tmp_str_sz= my_base64_needed_encoded_length((int) size);
   char *const tmp_str= (char *) my_malloc(tmp_str_sz, MYF(MY_WME));
   if (!tmp_str) {
     fprintf(stderr, "\nError: Out of memory. "
@@ -1911,7 +1911,7 @@ void Log_event::print_base64(IO_CACHE* f
     DBUG_VOID_RETURN;
   }
 
-  if (base64_encode(ptr, (size_t) size, tmp_str))
+  if (my_base64_encode(ptr, (size_t) size, tmp_str))
   {
     DBUG_ASSERT(0);
   }

=== modified file 'sql/sql_binlog.cc'
--- a/sql/sql_binlog.cc	2009-02-17 23:06:00 +0000
+++ b/sql/sql_binlog.cc	2009-03-25 00:04:41 +0000
@@ -43,7 +43,7 @@ void mysql_client_binlog_statement(THD* 
     DBUG_VOID_RETURN;
 
   size_t coded_len= thd->lex->comment.length + 1;
-  size_t decoded_len= base64_needed_decoded_length(coded_len);
+  size_t decoded_len= my_base64_needed_decoded_length(coded_len);
   DBUG_ASSERT(coded_len > 0);
 
   /*
@@ -93,7 +93,7 @@ void mysql_client_binlog_statement(THD* 
        strptr < thd->lex->comment.str + thd->lex->comment.length ; )
   {
     char const *endptr= 0;
-    int bytes_decoded= base64_decode(strptr, coded_len, buf, &endptr);
+    int bytes_decoded= my_base64_decode(strptr, coded_len, buf, &endptr);
 
 #ifndef HAVE_purify
       /*

=== modified file 'storage/ndb/src/mgmapi/mgmapi.cpp'
--- a/storage/ndb/src/mgmapi/mgmapi.cpp	2009-01-08 11:57:59 +0000
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp	2009-03-25 00:04:41 +0000
@@ -2229,8 +2229,8 @@ ndb_mgm_get_configuration(NdbMgmHandle h
     if(buf64 == 0)
       break;
 
-    void *tmp_data = malloc(base64_needed_decoded_length((size_t) (len - 1)));
-    const int res = base64_decode(buf64, len-1, tmp_data, NULL);
+    void *tmp_data = malloc(my_base64_needed_decoded_length((size_t)(len - 1)));
+    const int res = my_base64_decode(buf64, len-1, tmp_data, NULL);
     delete[] buf64;
     UtilBuffer tmp;
     tmp.append((void *) tmp_data, res);

=== modified file 'unittest/mysys/base64-t.c'
--- a/unittest/mysys/base64-t.c	2007-08-01 19:59:05 +0000
+++ b/unittest/mysys/base64-t.c	2009-03-25 00:04:41 +0000
@@ -48,18 +48,18 @@ main(void)
     }
 
     /* Encode */
-    needed_length= base64_needed_encoded_length(src_len);
+    needed_length= my_base64_needed_encoded_length(src_len);
     str= (char *) malloc(needed_length);
     for (k= 0; k < needed_length; k++)
       str[k]= 0xff; /* Fill memory to check correct NUL termination */
-    ok(base64_encode(src, src_len, str) == 0,
-       "base64_encode: size %d", i);
+    ok(my_base64_encode(src, src_len, str) == 0,
+       "my_base64_encode: size %d", i);
     ok(needed_length == strlen(str) + 1,
-       "base64_needed_encoded_length: size %d", i);
+       "my_base64_needed_encoded_length: size %d", i);
 
     /* Decode */
-    dst= (char *) malloc(base64_needed_decoded_length(strlen(str)));
-    dst_len= base64_decode(str, strlen(str), dst, NULL);
+    dst= (char *) malloc(my_base64_needed_decoded_length(strlen(str)));
+    dst_len= my_base64_decode(str, strlen(str), dst, NULL);
     ok(dst_len == src_len, "Comparing lengths");
 
     cmp= memcmp(src, dst, src_len);

Thread
bzr commit into mysql-6.0 branch (jimw:2835) Bug#26818Jim Winstead25 Mar