aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:27 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:27 -0700
commite57c7678375f86463d231bd43a236144ab92e0ef (patch)
tree7f9354aed737a344e4e6dee314d516fd481c024f
parent5d3abcf64d586bb6d9aa586bb41ba6397d3efdc0 (diff)
downloadsyslinux-e57c7678375f86463d231bd43a236144ab92e0ef.tar.gz
syslinux-e57c7678375f86463d231bd43a236144ab92e0ef.tar.xz
syslinux-e57c7678375f86463d231bd43a236144ab92e0ef.zip
Run Nindent on com32/libutil/base64.c
Automatically reformat com32/libutil/base64.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>
-rw-r--r--com32/libutil/base64.c131
1 files changed, 66 insertions, 65 deletions
diff --git a/com32/libutil/base64.c b/com32/libutil/base64.c
index 7ad21599..74b101ce 100644
--- a/com32/libutil/base64.c
+++ b/com32/libutil/base64.c
@@ -11,60 +11,61 @@
size_t genbase64(char *output, const void *input, size_t size, int flags)
{
- static char charz[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_";
- uint8_t buf[3];
- int j;
- const uint8_t *p;
- char *q;
- uint32_t bv;
- int left = size;
-
- charz[62] = (char)flags;
- charz[63] = (char)(flags >> 8);
-
- p = input; q = output;
-
- while (left > 0) {
- if (left < 3) {
- buf[0] = p[0];
- buf[1] = (left > 1) ? p[1] : 0;
- buf[2] = 0;
- p = buf;
+ static char charz[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_";
+ uint8_t buf[3];
+ int j;
+ const uint8_t *p;
+ char *q;
+ uint32_t bv;
+ int left = size;
+
+ charz[62] = (char)flags;
+ charz[63] = (char)(flags >> 8);
+
+ p = input;
+ q = output;
+
+ while (left > 0) {
+ if (left < 3) {
+ buf[0] = p[0];
+ buf[1] = (left > 1) ? p[1] : 0;
+ buf[2] = 0;
+ p = buf;
+ }
+
+ bv = (p[0] << 16) | (p[1] << 8) | p[2];
+ p += 3;
+ left -= 3;
+
+ for (j = 0; j < 4; j++) {
+ *q++ = charz[(bv >> 18) & 0x3f];
+ bv <<= 6;
+ }
}
- bv = (p[0] << 16) | (p[1] << 8) | p[2];
- p += 3;
- left -= 3;
-
- for ( j = 0 ; j < 4 ; j++ ) {
- *q++ = charz[(bv >> 18) & 0x3f];
- bv <<= 6;
+ switch (left) {
+ case -1:
+ if (flags & BASE64_PAD)
+ q[-1] = '=';
+ else
+ q--;
+ break;
+
+ case -2:
+ if (flags & BASE64_PAD)
+ q[-2] = q[-1] = '=';
+ else
+ q -= 2;
+ break;
+
+ default:
+ break;
}
- }
-
- switch (left) {
- case -1:
- if (flags & BASE64_PAD)
- q[-1] = '=';
- else
- q--;
- break;
-
- case -2:
- if (flags & BASE64_PAD)
- q[-2] = q[-1] = '=';
- else
- q -= 2;
- break;
-
- default:
- break;
- }
-
- *q = '\0';
-
- return q-output;
+
+ *q = '\0';
+
+ return q - output;
}
#ifdef TEST
@@ -74,21 +75,21 @@ size_t genbase64(char *output, const void *input, size_t size, int flags)
int main(int argc, char *argv[])
{
- int i;
- char buf[4096];
- int len, bytes;
-
- for (i = 1; i < argc; i++) {
- printf("Original: \"%s\"\n", argv[i]);
-
- len = strlen(argv[i]);
- bytes = genbase64(buf, argv[i], len, BASE64_MIME|BASE64_PAD);
- printf(" MIME: \"%s\" (%d)\n", buf, bytes);
- bytes = genbase64(buf, argv[i], len, BASE64_SAFE);
- printf(" Safe: \"%s\" (%d)\n", buf, bytes);
- }
+ int i;
+ char buf[4096];
+ int len, bytes;
+
+ for (i = 1; i < argc; i++) {
+ printf("Original: \"%s\"\n", argv[i]);
+
+ len = strlen(argv[i]);
+ bytes = genbase64(buf, argv[i], len, BASE64_MIME | BASE64_PAD);
+ printf(" MIME: \"%s\" (%d)\n", buf, bytes);
+ bytes = genbase64(buf, argv[i], len, BASE64_SAFE);
+ printf(" Safe: \"%s\" (%d)\n", buf, bytes);
+ }
- return 0;
+ return 0;
}
#endif