summaryrefslogtreecommitdiff
path: root/src/base64.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-02-18 00:49:08 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-02-18 00:49:08 +0000
commit8aacf43b3b4f21247a63b8301c952c6a8c98585e (patch)
treed2dc275b7d2672390ab9eeb1adffaf5953a4981d /src/base64.c
parentbfff941cb7fdb428de57971831e39e3cf660112b (diff)
adding trackers now seems to work. change all tabs to whitespace.
Diffstat (limited to 'src/base64.c')
-rw-r--r--src/base64.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/base64.c b/src/base64.c
index 2504a68..8e0562b 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -30,9 +30,9 @@ void encodeblock(unsigned char in[3], unsigned char out[4], int len)
out[0] = cb64[in[0] >> 2];
out[1] = cb64[((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4)];
out[2] =
- (unsigned char) (len >
- 1 ? cb64[((in[1] & 0x0f) << 2) |
- ((in[2] & 0xc0) >> 6)] : '=');
+ (unsigned char) (len >
+ 1 ? cb64[((in[1] & 0x0f) << 2) |
+ ((in[2] & 0xc0) >> 6)] : '=');
out[3] = (unsigned char) (len > 2 ? cb64[in[2] & 0x3f] : '=');
}
@@ -43,22 +43,22 @@ char *base64encode(char *filename)
int i, len, j = 0;
char *output = NULL;
while (!feof(infile)) {
- len = 0;
- for (i = 0; i < 3; i++) {
- in[i] = (unsigned char) getc(infile);
- if (!feof(infile)) {
- len++;
- } else {
- in[i] = 0;
- }
- }
- if (len) {
- output = (char *) realloc(output, j + 5);
- encodeblock(in, out, len);
- for (i = 0; i < 4; i++) {
- output[j++] = out[i];
- }
- }
+ len = 0;
+ for (i = 0; i < 3; i++) {
+ in[i] = (unsigned char) getc(infile);
+ if (!feof(infile)) {
+ len++;
+ } else {
+ in[i] = 0;
+ }
+ }
+ if (len) {
+ output = (char *) realloc(output, j + 5);
+ encodeblock(in, out, len);
+ for (i = 0; i < 4; i++) {
+ output[j++] = out[i];
+ }
+ }
}
output[j] = '\0';
fclose(infile);