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:
obrien 2012-09-12 15:36:44 +00:00
parent 463d9d9745
commit 0128bff91e
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); char *blockcheck(char *name);
int blread(int fd, char *buf, ufs2_daddr_t blk, long size); int blread(int fd, char *buf, ufs2_daddr_t blk, long size);
void bufinit(void); 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 blerase(int fd, ufs2_daddr_t blk, long size);
void cacheino(union dinode *dp, ino_t inumber); void cacheino(union dinode *dp, ino_t inumber);
void catch(int); void catch(int);

View File

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