NetBSD Problem Report #21894
Received: (qmail 10320 invoked by uid 605); 15 Jun 2003 17:47:54 -0000
Message-Id: <E19RbaL-0000FH-Qw@d33-110.ropnet.ru>
Date: Sun, 15 Jun 2003 21:46:33 +0400
From: "Sergey Svishchev" <svs+pr@grep.ru>
Sender: gnats-bugs-owner@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: cdplay(1) de-lintification
X-Send-Pr-Version: 3.95
>Number: 21894
>Category: bin
>Synopsis: cdplay(1) de-lintification
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: dholland
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Jun 15 17:48:00 +0000 2003
>Closed-Date: Mon Oct 07 00:21:07 +0000 2013
>Last-Modified: Mon Oct 07 00:21:07 +0000 2013
>Originator: "Sergey Svishchev" <svs+pr@grep.ru>
>Release: NetBSD 1.6T
>Organization:
>Environment:
>Description:
>How-To-Repeat:
Run `make lint' in usr.bin/cdplay.
>Fix:
Fixes 48 warnings.
--- usr.bin/cdplay/cdplay.c.nolint Fri Jun 6 01:39:21 2003
+++ usr.bin/cdplay/cdplay.c.lint Sun Jun 15 16:32:43 2003
@@ -81,7 +81,7 @@
CMD_SKIP,
CMD_STATUS,
CMD_STOP,
- CMD_VOLUME,
+ CMD_VOLUME
};
struct cmdtab {
@@ -131,20 +131,20 @@
int get_vol(int *, int *);
int get_status(int *, int *, int *, int *, int *);
void help(void);
-int info(const char *);
-void lba2msf(u_long, u_int *, u_int *, u_int *);
+int info(void);
+void lba2msf(u_int32_t, u_int *, u_int *, u_int *);
int main(int, char **);
-u_int msf2lba(u_int, u_int, u_int);
+u_int msf2lba(u_char, u_char, u_char);
int opencd(void);
const char *parse(char *, int *);
int play(const char *, int);
int play_blocks(int, int);
-int play_msf(int, int, int, int, int, int);
+int play_msf(u_int, u_int, u_int, u_int, u_int, u_int);
int play_track(int, int, int, int);
-int print_status(const char *);
+int print_status(void);
void print_track(struct cd_toc_entry *);
const char *prompt(void);
-int read_toc_entrys(int);
+int read_toc_entries(u_int);
int run(int, const char *);
int setvol(int, int);
void sig_timer(int, int, struct sigcontext *);
@@ -165,7 +165,7 @@
int cmd, len, c;
char *line;
const char *elline;
- int scratch, rv;
+ int scratch;
struct sigaction sa_timer;
cdname = getenv("MUSIC_CD");
@@ -197,8 +197,8 @@
cdname = defdev;
}
- opencd();
- srandom(time(NULL));
+ (void) opencd();
+ srandom((u_long)time(NULL));
if (argc > 0) {
interactive = 0;
@@ -231,7 +231,7 @@
sigemptyset(&sa_timer.sa_mask);
sa_timer.sa_handler = (void (*)(int))sig_timer;
sa_timer.sa_flags = SA_RESTART;
- if ((rv = sigaction(SIGALRM, &sa_timer, NULL)) < 0)
+ if (sigaction(SIGALRM, &sa_timer, NULL) < 0)
err(EXIT_FAILURE, "sigaction()");
for (;;) {
@@ -260,10 +260,10 @@
free(line);
}
+ /* NOTREACHED */
el_end(elptr);
history_end(hist);
exit(EXIT_SUCCESS);
- /* NOTREACHED */
}
void
@@ -313,11 +313,11 @@
switch (cmd) {
case CMD_INFO:
- rv = info(arg);
+ rv = info();
break;
case CMD_STATUS:
- rv = print_status(arg);
+ rv = print_status();
break;
case CMD_PAUSE:
@@ -347,7 +347,7 @@
case CMD_EJECT:
if (shuffle)
- run(CMD_SHUFFLE, NULL);
+ rv = run(CMD_SHUFFLE, NULL);
if (ioctl(fd, CDIOCALLOW) < 0)
warn("ioctl(CDIOCALLOW)");
if ((rv = ioctl(fd, CDIOCEJECT)) < 0)
@@ -355,7 +355,7 @@
break;
case CMD_CLOSE:
- ioctl(fd, CDIOCALLOW);
+ (void) ioctl(fd, CDIOCALLOW);
if ((rv = ioctl(fd, CDIOCCLOSE)) >= 0) {
close(fd);
fd = -1;
@@ -388,7 +388,7 @@
itv_timer.it_value.tv_usec = 0;
if (setitimer(ITIMER_REAL, &itv_timer, NULL) == 0) {
shuffle = 1;
- skip(0, 1);
+ rv = skip(0, 1);
}
} else {
itv_timer.it_interval.tv_sec = 0;
@@ -409,7 +409,7 @@
if (!shuffle)
warnx("`skip' valid only in shuffle mode");
else
- skip(0, 1);
+ rv = skip(0, 1);
break;
case CMD_SET:
@@ -459,8 +459,8 @@
int
play(const char *arg, int fromuser)
{
- int rv, n, start, end, istart, iend, blk, len, relend;
- u_int tr1, tr2, m1, m2, s1, s2, f1, f2, tm, ts, tf;
+ int rv, start, end, istart, iend, blk, len, relend;
+ u_int n, tr1, tr2, m1, m2, s1, s2, f1, f2, tm, ts, tf;
struct ioc_toc_header h;
if (shuffle && fromuser) {
@@ -476,7 +476,7 @@
end = 0;
istart = iend = 1;
n = h.ending_track - h.starting_track + 1;
- rv = read_toc_entrys((n + 1) * sizeof(struct cd_toc_entry));
+ rv = read_toc_entries((n + 1) * sizeof(struct cd_toc_entry));
if (rv < 0)
return (rv);
@@ -685,12 +685,17 @@
{
sigset_t anymore;
+#ifdef lint
+ sig = sig;
+ code = code;
+ scp = scp;
+#endif
sigpending(&anymore);
if (sigismember(&anymore, SIGALRM))
return;
- setitimer(ITIMER_REAL, &itv_timer, NULL);
+ (void) setitimer(ITIMER_REAL, &itv_timer, NULL);
if (fd != -1)
- skip(0, 0);
+ (void) skip(0, 0);
}
int
@@ -763,7 +768,7 @@
}
int
-print_status(const char *arg)
+print_status(void)
{
struct cd_sub_channel_info data;
struct ioc_read_subchannel ss;
@@ -809,10 +814,11 @@
}
int
-info(const char *arg)
+info(void)
{
struct ioc_toc_header h;
- int rc, i, n;
+ int rc, i;
+ u_int n;
if ((rc = ioctl(fd, CDIOREADTOCHEADER, &h)) < 0) {
warn("ioctl(CDIOREADTOCHEADER)");
@@ -820,7 +826,7 @@
}
n = h.ending_track - h.starting_track + 1;
- rc = read_toc_entrys((n + 1) * sizeof(struct cd_toc_entry));
+ rc = read_toc_entries((n + 1) * sizeof(struct cd_toc_entry));
if (rc < 0)
return (rc);
@@ -837,7 +843,7 @@
}
void
-lba2msf(u_long lba, u_int *m, u_int *s, u_int *f)
+lba2msf(u_int32_t lba, u_int *m, u_int *s, u_int *f)
{
lba += 150; /* block start offset */
@@ -849,7 +855,7 @@
}
u_int
-msf2lba(u_int m, u_int s, u_int f)
+msf2lba(u_char m, u_char s, u_char f)
{
return (((m * 60) + s) * 75 + f) - 150;
@@ -858,7 +864,7 @@
void
print_track(struct cd_toc_entry *e)
{
- int block, next, len;
+ u_int32_t block, next, len;
u_int m, s, f;
if (msf) {
@@ -939,7 +945,7 @@
}
int
-read_toc_entrys(int len)
+read_toc_entries(u_int len)
{
struct ioc_read_toc_entry t;
int rv;
@@ -955,8 +961,8 @@
}
int
-play_msf(int start_m, int start_s, int start_f, int end_m, int end_s,
- int end_f)
+play_msf(u_int start_m, u_int start_s, u_int start_f, u_int end_m, u_int end_s,
+ u_int end_f)
{
struct ioc_play_msf a;
int rv;
@@ -1021,7 +1027,7 @@
{
const struct cmdtab *c, *mc;
char *p, *q;
- int len;
+ u_int len;
for (p = buf; isspace(*p); p++)
continue;
@@ -1103,7 +1109,6 @@
{
struct cd_toc_entry *ctep;
- assert(i >= 0);
assert(i <= CD_MAX_TRACK);
ctep = &toc_buffer[i];
>Release-Note:
>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: "Sergey Svishchev" <svs+pr@grep.ru>
Cc: gnats-bugs@gnats.netbsd.org
Subject: re: bin/21894: cdplay(1) de-lintification
Date: Mon, 16 Jun 2003 12:43:54 +1000
- CMD_VOLUME,
+ CMD_VOLUME
};
why does lint complain about these? sigh.
.mrg.
State-Changed-From-To: open->closed
State-Changed-By: shattered@NetBSD.org
State-Changed-When: Sun, 14 Apr 2013 19:53:13 +0000
State-Changed-Why:
I don't care about this bug enough.
Responsible-Changed-From-To: bin-bug-people->dholland
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Mon, 07 Oct 2013 00:03:05 +0000
Responsible-Changed-Why:
I'll merge some of this - someone may as well.
State-Changed-From-To: closed->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Oct 2013 00:03:05 +0000
State-Changed-Why:
.
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/21894 CVS commit: src/usr.bin/cdplay
Date: Mon, 7 Oct 2013 00:16:19 +0000
Module Name: src
Committed By: dholland
Date: Mon Oct 7 00:16:19 UTC 2013
Modified Files:
src/usr.bin/cdplay: cdplay.c
Log Message:
Merge some of the cleanup from PR 21894. Do a bit more of my own.
lint still squawks quite a bit, and it woudl probably be worthwhile
for someone to go through and make all the signedness consistent, but
I think I've got the valuable bits.
To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/cdplay/cdplay.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Oct 2013 00:21:07 +0000
State-Changed-Why:
I committed the more significant bits. There's no point trying to pacify
lint completely; it's too stupid.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.