diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-05-29 15:10:27 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-05-29 15:10:27 -0700 |
commit | dd71e58827f55c797bfc58ec5ce15061165d5ff9 (patch) | |
tree | 4154f771953844556b14c8e6031820fd621d087d /com32/libutil | |
parent | 58254cf2c22aff867dbbe3e7b55ff3082f91870d (diff) | |
download | syslinux-dd71e58827f55c797bfc58ec5ce15061165d5ff9.tar.gz |
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 <hpa@zytor.com>
Diffstat (limited to 'com32/libutil')
-rw-r--r-- | com32/libutil/unbase64.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/com32/libutil/unbase64.c b/com32/libutil/unbase64.c index a1728d10..3cbf3fb4 100644 --- a/com32/libutil/unbase64.c +++ b/com32/libutil/unbase64.c @@ -35,43 +35,42 @@ #include <base64.h> 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; } |