Module Name: src
Committed By: rillig
Date: Fri Aug 11 02:43:59 UTC 2023
Modified Files:
src/usr.bin/base64: Makefile base64.c
Log Message:
base64: nix trailing whitespace and redundant braces, strict bool mode
No binary change.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/base64/Makefile
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/base64/base64.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/base64/Makefile
diff -u src/usr.bin/base64/Makefile:1.1 src/usr.bin/base64/Makefile:1.2
--- src/usr.bin/base64/Makefile:1.1 Tue Jul 24 15:26:16 2018
+++ src/usr.bin/base64/Makefile Fri Aug 11 02:43:59 2023
@@ -1,9 +1,7 @@
-# $NetBSD: Makefile,v 1.1 2018/07/24 15:26:16 christos Exp $
-
-WARNS?= 6
-
-.include <bsd.own.mk>
+# $NetBSD: Makefile,v 1.2 2023/08/11 02:43:59 rillig Exp $
PROG= base64
+WARNS?= 6 # instead of 5 from usr.bin
+LINTFLAGS+= -T # strict bool mode
.include <bsd.prog.mk>
Index: src/usr.bin/base64/base64.c
diff -u src/usr.bin/base64/base64.c:1.5 src/usr.bin/base64/base64.c:1.6
--- src/usr.bin/base64/base64.c:1.5 Fri Aug 27 17:53:13 2021
+++ src/usr.bin/base64/base64.c Fri Aug 11 02:43:59 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: base64.c,v 1.5 2021/08/27 17:53:13 christos Exp $ */
+/* $NetBSD: base64.c,v 1.6 2023/08/11 02:43:59 rillig Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: base64.c,v 1.5 2021/08/27 17:53:13 christos Exp $");
+__RCSID("$NetBSD: base64.c,v 1.6 2023/08/11 02:43:59 rillig Exp $");
#include <ctype.h>
#include <errno.h>
@@ -65,9 +65,8 @@ putoutput(FILE *fout, uint8_t out[4], si
size_t i;
for (i = 0; i < len + 1; i++) {
- if (out[i] >= 64) {
+ if (out[i] >= 64)
return EINVAL;
- }
if (fputc(B64[out[i]], fout) == -1)
return errno;
if (++(*pos) == wrap) {
@@ -119,13 +118,12 @@ b64_encode(FILE *fout, FILE *fin, size_t
return e;
}
- if (pos && wrap) {
+ if (pos != 0 && wrap != 0) {
if (fputc('\n', fout) == -1)
return errno;
}
return 0;
}
-
static int
b64_decode(FILE *fout, FILE *fin, bool ignore)
@@ -152,7 +150,7 @@ b64_decode(FILE *fout, FILE *fin, bool i
switch (state) {
case 0:
- out = (uint8_t)(b << 2);
+ out = (uint8_t)(b << 2);
break;
case 1:
out |= b >> 4;
@@ -212,7 +210,7 @@ b64_decode(FILE *fout, FILE *fin, bool i
return 0;
}
-static __dead void
+static __dead void
usage(void)
{
fprintf(stderr, "Usage: %s [-di] [-w <wrap>] [<file>]...\n",