Cast to char* to be able to do pointer arithmetic.

This commit is contained in:
he 2007-03-08 21:50:25 +00:00
parent 1aecca529f
commit 9ebf1fa4d2

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.24 2006/11/25 11:59:57 scw Exp $ */
/* $NetBSD: disksubr.c,v 1.25 2007/03/08 21:50:25 he Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.24 2006/11/25 11:59:57 scw Exp $");
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.25 2007/03/08 21:50:25 he Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -87,7 +87,8 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
if (biowait(bp))
msg = "I/O error";
else for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)(bp->b_data + DEV_BSIZE - sizeof(*dlp));
dlp <= (struct disklabel *)((char *)bp->b_data + DEV_BSIZE -
sizeof(*dlp));
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
if (msg == NULL)
@ -172,7 +173,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
goto done;
for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)
(bp->b_data + lp->d_secsize - sizeof(*dlp));
((char *)bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
dkcksum(dlp) == 0) {