~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/base64.c

  • Committer: Monty Taylor
  • Date: 2008-10-04 22:26:22 UTC
  • Revision ID: monty@inaugust.com-20081004222622-89vkm3px5b1jujc2
Made sql_state and stacktrace compile as C++. drizzled/ is pure c++ now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include <drizzled/global.h>
17
16
#include <mystrings/m_string.h>  /* strchr() */
18
17
#include <mystrings/m_ctype.h>  /* my_isspace() */
19
18
#include <mysys/base64.h>
20
 
#include <cstdio>
21
 
#include <cmath>
22
 
 
23
 
using namespace std;
24
19
 
25
20
#ifndef MAIN
26
21
 
45
40
int
46
41
base64_needed_decoded_length(int length_of_encoded_data)
47
42
{
48
 
  return (int) ceil((double)(length_of_encoded_data * 3 / 4));
 
43
  return (int) ceil(length_of_encoded_data * 3 / 4);
49
44
}
50
45
 
51
46
 
107
102
static inline uint
108
103
pos(unsigned char c)
109
104
{
110
 
  return (uint32_t) (strchr(base64_table, c) - base64_table);
 
105
  return (uint) (strchr(base64_table, c) - base64_table);
111
106
}
112
107
 
113
108
 
287
282
      printf("       --------- src ---------   --------- dst ---------\n");
288
283
      for (k= 0; k<src_len; k+=8)
289
284
      {
290
 
        printf("%.4x   ", (uint32_t) k);
 
285
        printf("%.4x   ", (uint) k);
291
286
        for (l=0; l<8 && k+l<src_len; l++)
292
287
        {
293
288
          unsigned char c= src[k+l];
304
299
        printf("\n");
305
300
      }
306
301
      printf("src length: %.8x, dst length: %.8x\n",
307
 
             (uint32_t) src_len, (uint32_t) dst_len);
 
302
             (uint) src_len, (uint) dst_len);
308
303
      require(0);
309
304
    }
310
305
  }