X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/1e5cdbdd102555b43fc3ffa9a45ba9e7a833c190..1ed08ad2184ac38d0a80e9a8146f378fb297c6a9:/sbr/base64.c diff --git a/sbr/base64.c b/sbr/base64.c index cbd225de..75e82301 100644 --- a/sbr/base64.c +++ b/sbr/base64.c @@ -29,8 +29,8 @@ writeBase64aux (FILE *in, FILE *out, int crlf) { unsigned int cc, n; unsigned char inbuf[3]; - int skipnl = 0; + bool skipnl = false; n = BPERLIN; while ((cc = fread (inbuf, sizeof(*inbuf), sizeof(inbuf), in)) > 0) { unsigned long bits; @@ -69,7 +69,7 @@ writeBase64aux (FILE *in, FILE *out, int crlf) inbuf[cc++] = '\n'; else ungetc('\n', in); - skipnl = 1; + skipnl = true; } else { /* This only works as long as sizeof(inbuf) == 3 */ ungetc(inbuf[cc - 1], in); @@ -78,7 +78,7 @@ writeBase64aux (FILE *in, FILE *out, int crlf) inbuf[++i] = '\n'; } } else { - skipnl = 0; + skipnl = false; } } } @@ -248,9 +248,9 @@ static const unsigned char b642nib[0x80] = { */ int decodeBase64 (const char *encoded, unsigned char **decoded, size_t *len, - int skip_crs, unsigned char *digest) { + int skip_crs, unsigned char *digest) +{ const char *cp = encoded; - int self_delimiting = 0; int bitno, skip; uint32_t bits; /* Size the decoded string very conservatively. */ @@ -264,6 +264,7 @@ decodeBase64 (const char *encoded, unsigned char **decoded, size_t *len, bits = 0L; skip = 0; + bool self_delimiting = false; for (; *cp; ++cp) { switch (*cp) { unsigned char value; @@ -318,7 +319,7 @@ test_end: case '=': if (++skip <= 3) goto test_end; - self_delimiting = 1; + self_delimiting = true; break; } } @@ -351,7 +352,8 @@ test_end: * is allocated by the function and must be freed by the caller. */ void -hexify (const unsigned char *input, size_t len, char **output) { +hexify (const unsigned char *input, size_t len, char **output) +{ /* Start with a charstring capacity that's arbitrarily larger than len. */ const charstring_t tmp = charstring_create (2 * len); const unsigned char *cp = input;