|
a/src/utils/base64.cpp |
|
b/src/utils/base64.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: base64.cpp,v 1.5 2006-01-23 13:32:28 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: base64.cpp,v 1.6 2006-02-01 07:14:45 dockes Exp $ (C) 2005 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
36 |
static const char Base64[] =
|
36 |
static const char Base64[] =
|
37 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
37 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
38 |
static const char Pad64 = '=';
|
38 |
static const char Pad64 = '=';
|
39 |
bool base64_decode(const string& in, string& out)
|
39 |
bool base64_decode(const string& in, string& out)
|
40 |
{
|
40 |
{
|
41 |
int io = 0, state = 0, ch;
|
41 |
int io = 0, state = 0, ch = 0;
|
42 |
char *pos;
|
42 |
char *pos;
|
43 |
unsigned int ii = 0;
|
43 |
unsigned int ii = 0;
|
44 |
out.erase();
|
44 |
out.erase();
|
45 |
out.reserve(in.length());
|
45 |
out.reserve(in.length());
|
46 |
|
46 |
|