From dd71e58827f55c797bfc58ec5ce15061165d5ff9 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 29 May 2009 15:10:27 -0700 Subject: [PATCH] Run Nindent on com32/libutil/unbase64.c Automatically reformat com32/libutil/unbase64.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin --- com32/libutil/unbase64.c | 59 ++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/com32/libutil/unbase64.c b/com32/libutil/unbase64.c index a1728d1..3cbf3fb 100644 --- a/com32/libutil/unbase64.c +++ b/com32/libutil/unbase64.c @@ -35,43 +35,42 @@ #include static const unsigned char _base64chars[] = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; size_t unbase64(unsigned char *buffer, size_t bufsiz, const char *txt) { - unsigned int bits = 0; - int nbits = 0; - char base64tbl[256]; - int i; - char v; - size_t nbytes = 0; + unsigned int bits = 0; + int nbits = 0; + char base64tbl[256]; + int i; + char v; + size_t nbytes = 0; + memset(base64tbl, -1, sizeof base64tbl); - memset(base64tbl, -1, sizeof base64tbl); - - for ( i = 0 ; _base64chars[i] ; i++ ) { - base64tbl[_base64chars[i]] = i; - } + for (i = 0; _base64chars[i]; i++) { + base64tbl[_base64chars[i]] = i; + } - /* Also support filesystem safe alternate base64 encoding */ - base64tbl['.'] = 62; - base64tbl['-'] = 62; - base64tbl['_'] = 63; + /* Also support filesystem safe alternate base64 encoding */ + base64tbl['.'] = 62; + base64tbl['-'] = 62; + base64tbl['_'] = 63; - while ( *txt ) { - if ( (v = base64tbl[(unsigned char) *txt]) >= 0 ) { - bits <<= 6; - bits += v; - nbits += 6; - if ( nbits >= 8 ) { - if ( nbytes < bufsiz ) - *buffer++ = (bits >> (nbits-8)); - nbytes++; - nbits -= 8; - } + while (*txt) { + if ((v = base64tbl[(unsigned char)*txt]) >= 0) { + bits <<= 6; + bits += v; + nbits += 6; + if (nbits >= 8) { + if (nbytes < bufsiz) + *buffer++ = (bits >> (nbits - 8)); + nbytes++; + nbits -= 8; + } + } + txt++; } - txt++; - } - return nbytes; + return nbytes; } -- 2.7.4