From fde300714b06458d6b3f8aea71ec11f41bb6342f Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sun, 13 Jan 2002 13:26:16 +0000 Subject: [PATCH] Change names for internal tables. Organization: Straylight/Edgeware From: mdw --- base64.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/base64.c b/base64.c index 6e5d3bf..2cefb41 100644 --- a/base64.c +++ b/base64.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: base64.c,v 1.4 1999/10/15 21:08:46 mdw Exp $ + * $Id: base64.c,v 1.5 2002/01/13 13:26:16 mdw Exp $ * * Base64 encoding and decoding. * @@ -30,6 +30,9 @@ /*----- 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. * @@ -55,11 +58,11 @@ /*----- Important tables --------------------------------------------------*/ -static const char base64_encodeMap[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/" }; +static const char encodemap[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/" }; -static const signed char base64_decodeMap[] = { +static const signed char decodemap[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 1x */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, /* 2x */ @@ -99,10 +102,10 @@ void base64_encode(base64_ctx *ctx, qsz++; sz--; if (qsz == 3) { - DPUTC(d, base64_encodeMap[(acc >> 18) & 0x3f]); - DPUTC(d, base64_encodeMap[(acc >> 12) & 0x3f]); - DPUTC(d, base64_encodeMap[(acc >> 6) & 0x3f]); - DPUTC(d, base64_encodeMap[(acc >> 0) & 0x3f]); + DPUTC(d, encodemap[(acc >> 18) & 0x3f]); + DPUTC(d, encodemap[(acc >> 12) & 0x3f]); + DPUTC(d, encodemap[(acc >> 6) & 0x3f]); + DPUTC(d, encodemap[(acc >> 0) & 0x3f]); ctx->lnlen += 4; if (ctx->maxline && ctx->lnlen >= ctx->maxline) { dstr_puts(d, ctx->indent); @@ -124,17 +127,17 @@ void base64_encode(base64_ctx *ctx, break; case 1: acc <<= 16; - DPUTC(d, base64_encodeMap[(acc >> 18) & 0x3f]); - DPUTC(d, base64_encodeMap[(acc >> 12) & 0x3f]); + DPUTC(d, encodemap[(acc >> 18) & 0x3f]); + DPUTC(d, encodemap[(acc >> 12) & 0x3f]); DPUTC(d, '='); DPUTC(d, '='); ctx->lnlen += 4; break; case 2: acc <<= 8; - DPUTC(d, base64_encodeMap[(acc >> 18) & 0x3f]); - DPUTC(d, base64_encodeMap[(acc >> 12) & 0x3f]); - DPUTC(d, base64_encodeMap[(acc >> 6) & 0x3f]); + DPUTC(d, encodemap[(acc >> 18) & 0x3f]); + DPUTC(d, encodemap[(acc >> 12) & 0x3f]); + DPUTC(d, encodemap[(acc >> 6) & 0x3f]); DPUTC(d, '='); ctx->lnlen += 4; break; @@ -175,7 +178,7 @@ void base64_decode(base64_ctx *ctx, if (ch >= 128 || ch < 0) ch = -1; else - ch = base64_decodeMap[ch]; + ch = decodemap[ch]; sz--; if (ch == -1) continue; -- [mdw]