summaryrefslogtreecommitdiff
path: root/sbin/restore
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2011-06-27 23:40:58 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2011-06-27 23:40:58 +0000
commit1427060e974d41019de36be78aadb4e4cf180f90 (patch)
tree65f4f209dff6b5143030a07fb819ad0b3a73463d /sbin/restore
parent49bb20fc76bbb4b3b4d0c05c540c4c53079a7fab (diff)
remove some useless casts. ok krw
Diffstat (limited to 'sbin/restore')
-rw-r--r--sbin/restore/dirs.c6
-rw-r--r--sbin/restore/interactive.c4
-rw-r--r--sbin/restore/symtab.c23
-rw-r--r--sbin/restore/tape.c16
4 files changed, 24 insertions, 25 deletions
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index 26c178fb0a1..e67498af1b8 100644
--- a/sbin/restore/dirs.c
+++ b/sbin/restore/dirs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dirs.c,v 1.32 2009/10/27 23:59:34 deraadt Exp $ */
+/* $OpenBSD: dirs.c,v 1.33 2011/06/27 23:40:57 tedu Exp $ */
/* $NetBSD: dirs.c,v 1.26 1997/07/01 05:37:49 lukem Exp $ */
/*
@@ -407,7 +407,7 @@ putent(struct direct *dp)
(void)fwrite(dirbuf, 1, DIRBLKSIZ, df);
dirloc = 0;
}
- memcpy(dirbuf + dirloc, dp, (long)dp->d_reclen);
+ memcpy(dirbuf + dirloc, dp, dp->d_reclen);
prev = dirloc;
dirloc += dp->d_reclen;
}
@@ -428,7 +428,7 @@ static void
dcvt(struct odirect *odp, struct direct *ndp)
{
- memset(ndp, 0, (size_t)(sizeof *ndp));
+ memset(ndp, 0, sizeof *ndp);
if (Bcvt)
ndp->d_ino = swap16(odp->d_ino);
else
diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c
index c9af88d9a90..376a4996b20 100644
--- a/sbin/restore/interactive.c
+++ b/sbin/restore/interactive.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interactive.c,v 1.26 2009/10/27 23:59:34 deraadt Exp $ */
+/* $OpenBSD: interactive.c,v 1.27 2011/06/27 23:40:57 tedu Exp $ */
/* $NetBSD: interactive.c,v 1.10 1997/03/19 08:42:52 lukem Exp $ */
/*
@@ -527,7 +527,7 @@ printlist(char *name, char *basename)
while ((dp = rst_readdir(dirp)))
entries++;
rst_closedir(dirp);
- list = (struct afile *)calloc(entries, sizeof(struct afile));
+ list = calloc(entries, sizeof(struct afile));
if (list == NULL) {
fprintf(stderr, "ls: out of memory\n");
return;
diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c
index 51b4f87ba64..e5b6dfdd621 100644
--- a/sbin/restore/symtab.c
+++ b/sbin/restore/symtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: symtab.c,v 1.18 2009/10/27 23:59:34 deraadt Exp $ */
+/* $OpenBSD: symtab.c,v 1.19 2011/06/27 23:40:57 tedu Exp $ */
/* $NetBSD: symtab.c,v 1.10 1997/03/19 08:42:54 lukem Exp $ */
/*
@@ -190,7 +190,7 @@ myname(struct entry *ep)
for (cp = &namebuf[MAXPATHLEN - 2]; cp > &namebuf[ep->e_namlen]; ) {
cp -= ep->e_namlen;
- memcpy(cp, ep->e_name, (long)ep->e_namlen);
+ memcpy(cp, ep->e_name, ep->e_namlen);
if (ep == lookupino(ROOTINO))
return (cp);
*(--cp) = '/';
@@ -217,9 +217,9 @@ addentry(char *name, ino_t inum, int type)
if (freelist != NULL) {
np = freelist;
freelist = np->e_next;
- memset(np, 0, (long)sizeof(struct entry));
+ memset(np, 0, sizeof(struct entry));
} else {
- np = (struct entry *)calloc(1, sizeof(struct entry));
+ np = calloc(1, sizeof(struct entry));
if (np == NULL)
panic("no memory to extend symbol table\n");
}
@@ -388,7 +388,7 @@ savename(char *name)
strtblhdr[len / STRTBLINCR].next = np->next;
cp = (char *)np;
} else {
- cp = malloc((unsigned)allocsize(len));
+ cp = malloc(allocsize(len));
if (cp == NULL)
panic("no space for string table\n");
}
@@ -464,7 +464,7 @@ dumpsymtable(char *filename, long checkpt)
stroff = 0;
for (i = ROOTINO; i <= maxino; i++) {
for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
- memcpy(tep, ep, (long)sizeof(struct entry));
+ memcpy(tep, ep, sizeof(struct entry));
tep->e_name = (char *)stroff;
stroff += allocsize(ep->e_namlen);
tep->e_parent = (struct entry *)ep->e_parent->e_index;
@@ -527,9 +527,8 @@ initsymtable(char *filename)
Vprintf(stdout, "Initialize symbol table.\n");
if (filename == NULL) {
entrytblsize = maxino / HASHFACTOR;
- entry = (struct entry **)
- calloc((unsigned)entrytblsize, sizeof(struct entry *));
- if (entry == (struct entry **)NULL)
+ entry = calloc(entrytblsize, sizeof(struct entry *));
+ if (entry == NULL)
panic("no memory for entry table\n");
ep = addentry(".", ROOTINO, NODE);
ep->e_flags |= NEW;
@@ -544,11 +543,11 @@ initsymtable(char *filename)
panic("cannot stat symbol table file %s\n", filename);
}
tblsize = stbuf.st_size - sizeof(struct symtableheader);
- base = calloc((unsigned)tblsize, sizeof(char));
+ base = calloc(tblsize, sizeof(char));
if (base == NULL)
panic("cannot allocate space for symbol table\n");
- if (read(fd, base, (int)tblsize) < 0 ||
- read(fd, (char *)&hdr, sizeof(struct symtableheader)) < 0) {
+ if (read(fd, base, tblsize) < 0 ||
+ read(fd, &hdr, sizeof(struct symtableheader)) < 0) {
warn("read");
panic("cannot read symbol table file %s\n", filename);
}
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index dddf1eb18a1..6bf713215e8 100644
--- a/sbin/restore/tape.c
+++ b/sbin/restore/tape.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tape.c,v 1.38 2009/10/27 23:59:34 deraadt Exp $ */
+/* $OpenBSD: tape.c,v 1.39 2011/06/27 23:40:57 tedu Exp $ */
/* $NetBSD: tape.c,v 1.26 1997/04/15 07:12:25 lukem Exp $ */
/*
@@ -253,7 +253,7 @@ setup(void)
errx(1, "Cannot find file removal list");
maxino = (spcl.c_count * TP_BSIZE * NBBY) + 1;
Dprintf(stdout, "maxino = %d\n", maxino);
- map = calloc((unsigned)1, (unsigned)howmany(maxino, NBBY));
+ map = calloc(1, howmany(maxino, NBBY));
if (map == NULL)
panic("no memory for active inode map\n");
usedinomap = map;
@@ -261,7 +261,7 @@ setup(void)
getfile(xtrmap, xtrmapskip);
if (spcl.c_type != TS_BITS)
errx(1, "Cannot find file dump list");
- map = calloc((size_t)1, (size_t)howmany(maxino, NBBY));
+ map = calloc(1, howmany(maxino, NBBY));
if (map == NULL)
panic("no memory for file dump list\n");
dumpmap = map;
@@ -819,7 +819,7 @@ readtape(char *buf)
int cnt, seek_failed;
if (blkcnt < numtrec) {
- memcpy(buf, &tapebuf[(blkcnt++ * TP_BSIZE)], (long)TP_BSIZE);
+ memcpy(buf, &tapebuf[(blkcnt++ * TP_BSIZE)], TP_BSIZE);
blksread++;
tpblksread++;
return;
@@ -919,10 +919,10 @@ getmore:
panic("partial block read: %d should be %d\n",
rd, ntrec * TP_BSIZE);
terminateinput();
- memcpy(&tapebuf[rd], &endoftapemark, (long)TP_BSIZE);
+ memcpy(&tapebuf[rd], &endoftapemark, TP_BSIZE);
}
blkcnt = 0;
- memcpy(buf, &tapebuf[(blkcnt++ * TP_BSIZE)], (long)TP_BSIZE);
+ memcpy(buf, &tapebuf[(blkcnt++ * TP_BSIZE)], TP_BSIZE);
blksread++;
tpblksread++;
}
@@ -1011,7 +1011,7 @@ gethead(struct s_spcl *buf)
swap_old_header(&u_ospcl.s_ospcl);
}
- memset(buf, 0, (long)TP_BSIZE);
+ memset(buf, 0, TP_BSIZE);
buf->c_type = u_ospcl.s_ospcl.c_type;
buf->c_date = u_ospcl.s_ospcl.c_date;
buf->c_ddate = u_ospcl.s_ospcl.c_ddate;
@@ -1027,7 +1027,7 @@ gethead(struct s_spcl *buf)
buf->c_atime = u_ospcl.s_ospcl.c_odinode.odi_atime;
buf->c_mtime = u_ospcl.s_ospcl.c_odinode.odi_mtime;
buf->c_count = u_ospcl.s_ospcl.c_count;
- memcpy(buf->c_addr, u_ospcl.s_ospcl.c_addr, (long)256);
+ memcpy(buf->c_addr, u_ospcl.s_ospcl.c_addr, 256);
buf->c_magic = FS_UFS2_MAGIC;
good:
switch (buf->c_type) {