~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/base64.cc

  • Committer: Brian Aker
  • Date: 2009-04-17 01:45:33 UTC
  • Revision ID: brian@gaz-20090417014533-exdrtriab9zecqs2
Refactor get_variable to session

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>
16
17
#include <mystrings/m_string.h>  /* strchr() */
17
18
#include <mystrings/m_ctype.h>  /* my_isspace() */
18
19
#include <mysys/base64.h>
 
20
#include <cstdio>
 
21
#include <cmath>
 
22
 
 
23
using namespace std;
19
24
 
20
25
#ifndef MAIN
21
26
 
40
45
int
41
46
base64_needed_decoded_length(int length_of_encoded_data)
42
47
{
43
 
  return (int) ceil(length_of_encoded_data * 3 / 4);
 
48
  return (int) ceil((double)(length_of_encoded_data * 3 / 4));
44
49
}
45
50
 
46
51
 
102
107
static inline uint
103
108
pos(unsigned char c)
104
109
{
105
 
  return (uint) (strchr(base64_table, c) - base64_table);
 
110
  return (uint32_t) (strchr(base64_table, c) - base64_table);
106
111
}
107
112
 
108
113
 
109
114
#define SKIP_SPACE(src, i, size)                                \
110
115
{                                                               \
111
 
  while (i < size && my_isspace(&my_charset_latin1, * src))     \
 
116
  while (i < size && my_isspace(&my_charset_utf8_general_ci, * src))     \
112
117
  {                                                             \
113
118
    i++;                                                        \
114
119
    src++;                                                      \
282
287
      printf("       --------- src ---------   --------- dst ---------\n");
283
288
      for (k= 0; k<src_len; k+=8)
284
289
      {
285
 
        printf("%.4x   ", (uint) k);
 
290
        printf("%.4x   ", (uint32_t) k);
286
291
        for (l=0; l<8 && k+l<src_len; l++)
287
292
        {
288
293
          unsigned char c= src[k+l];
299
304
        printf("\n");
300
305
      }
301
306
      printf("src length: %.8x, dst length: %.8x\n",
302
 
             (uint) src_len, (uint) dst_len);
 
307
             (uint32_t) src_len, (uint32_t) dst_len);
303
308
      require(0);
304
309
    }
305
310
  }