Remove needless (int) casts of write(2)'s 3rd argument.

Also change blwrite() 'size' parameter to a ssize_t to better match
write(2).
This commit is contained in:
David E. O'Brien 2012-09-12 15:36:44 +00:00
parent bd3c72d0d8
commit 4a83537505
2 changed files with 5 additions and 5 deletions

View File

@ -337,7 +337,7 @@ void blkerror(ino_t ino, const char *type, ufs2_daddr_t blk);
char *blockcheck(char *name);
int blread(int fd, char *buf, ufs2_daddr_t blk, long size);
void bufinit(void);
void blwrite(int fd, char *buf, ufs2_daddr_t blk, long size);
void blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size);
void blerase(int fd, ufs2_daddr_t blk, long size);
void cacheino(union dinode *dp, ino_t inumber);
void catch(int);

View File

@ -245,7 +245,7 @@ flush(int fd, struct bufarea *bp)
(bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ",
(long long)bp->b_bno);
bp->b_errs = 0;
blwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size);
blwrite(fd, bp->b_un.b_buf, bp->b_bno, bp->b_size);
if (bp != &sblk)
return;
for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) {
@ -392,7 +392,7 @@ blread(int fd, char *buf, ufs2_daddr_t blk, long size)
}
void
blwrite(int fd, char *buf, ufs2_daddr_t blk, long size)
blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size)
{
int i;
char *cp;
@ -404,7 +404,7 @@ blwrite(int fd, char *buf, ufs2_daddr_t blk, long size)
offset *= dev_bsize;
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK BLK", blk);
else if (write(fd, buf, (int)size) == size) {
else if (write(fd, buf, size) == size) {
fsmodified = 1;
return;
}
@ -414,7 +414,7 @@ blwrite(int fd, char *buf, ufs2_daddr_t blk, long size)
rwerror("SEEK BLK", blk);
printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
if (write(fd, cp, dev_bsize) != dev_bsize) {
(void)lseek(fd, offset + i + dev_bsize, 0);
printf(" %jd,", (intmax_t)blk + i / dev_bsize);
}