X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/fde300714b06458d6b3f8aea71ec11f41bb6342f..9fcce036ef8b14c12fc4482efc7c8cf75da3b31f:/base64.c diff --git a/base64.c b/base64.c index 2cefb41..8fda2b5 100644 --- a/base64.c +++ b/base64.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: base64.c,v 1.5 2002/01/13 13:26:16 mdw Exp $ + * $Id: base64.c,v 1.7 2004/04/08 01:36:11 mdw Exp $ * * Base64 encoding and decoding. * * (c) 1997 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of the mLib utilities library. * @@ -15,38 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * mLib is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with mLib; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: base64.c,v $ - * Revision 1.5 2002/01/13 13:26:16 mdw - * Change names for internal tables. - * - * Revision 1.4 1999/10/15 21:08:46 mdw - * Change support for erroneous Base64 streams with length 1 mod 4. - * - * Revision 1.3 1999/05/21 22:14:30 mdw - * Take advantage of the new dynamic string macros. - * - * Revision 1.2 1999/05/18 21:45:27 mdw - * Allow Base64 encode and decode of arbitrary rubbish. - * - * Revision 1.1 1999/05/17 20:35:00 mdw - * Base64 encoding and decoding support. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -59,7 +39,7 @@ /*----- Important tables --------------------------------------------------*/ static const char encodemap[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz" "0123456789+/" }; static const signed char decodemap[] = { @@ -71,7 +51,7 @@ static const signed char decodemap[] = { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, /* 5x */ -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 ,37, 38, 39, 40, /* 6x */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 /* 7x */ -}; +}; /*----- Main code ---------------------------------------------------------*/ @@ -272,7 +252,7 @@ int main(int argc, char *argv[]) unsigned char buf[BUFSIZ]; dstr d = DSTR_INIT; base64_ctx ctx; - void (*proc)(base64_ctx *, const unsigned char *, size_t, dstr *); + void (*proc)(base64_ctx *, const void *, size_t, dstr *); size_t sz; base64_init(&ctx);