From 332d7c138f73485d266e36d2fcc6fda36a78f6b9 Mon Sep 17 00:00:00 2001 From: augustss Date: Fri, 8 Jan 1999 18:10:35 +0000 Subject: [PATCH] Avoid arithmetic on `void *' since that's not ANSI C. --- sys/arch/i386/isa/isa_machdep.c | 15 +++++++------- sys/ddb/db_elf.c | 20 +++++++++--------- sys/dev/ata/ata_wdc.c | 22 ++++++++++---------- sys/dev/isa/sbdsp.c | 8 +++++--- sys/dev/scsipi/atapi_wdc.c | 36 +++++++++++++++++++++------------ 5 files changed, 58 insertions(+), 43 deletions(-) diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c index 2b98d5ffdf6d..fa238e9dd7fe 100644 --- a/sys/arch/i386/isa/isa_machdep.c +++ b/sys/arch/i386/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: isa_machdep.c,v 1.40 1998/10/03 21:53:04 thorpej Exp $ */ +/* $NetBSD: isa_machdep.c,v 1.41 1999/01/08 18:10:35 augustss Exp $ */ #define ISA_DMA_STATS @@ -961,16 +961,16 @@ _isa_bus_dmamap_sync(t, map, offset, len, ops) /* * Copy the caller's buffer to the bounce buffer. */ - memcpy(cookie->id_bouncebuf + offset, - cookie->id_origbuf + offset, len); + memcpy((char *)cookie->id_bouncebuf + offset, + (char *)cookie->id_origbuf + offset, len); } if (ops & BUS_DMASYNC_POSTREAD) { /* * Copy the bounce buffer to the caller's buffer. */ - memcpy(cookie->id_origbuf + offset, - cookie->id_bouncebuf + offset, len); + memcpy((char *)cookie->id_origbuf + offset, + (char *)cookie->id_bouncebuf + offset, len); } /* @@ -992,7 +992,7 @@ _isa_bus_dmamap_sync(t, map, offset, len, ops) * Copy the caller's buffer to the bounce buffer. */ m_copydata(m0, offset, len, - cookie->id_bouncebuf + offset); + (char *)cookie->id_bouncebuf + offset); } if (ops & BUS_DMASYNC_POSTREAD) { @@ -1016,7 +1016,8 @@ _isa_bus_dmamap_sync(t, map, offset, len, ops) len : m->m_len - moff; memcpy(mtod(m, caddr_t) + moff, - cookie->id_bouncebuf + offset, minlen); + (char *)cookie->id_bouncebuf + offset, + minlen); moff = 0; len -= minlen; diff --git a/sys/ddb/db_elf.c b/sys/ddb/db_elf.c index ca1b9324d479..d8d6bdebf3e8 100644 --- a/sys/ddb/db_elf.c +++ b/sys/ddb/db_elf.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_elf.c,v 1.7 1998/12/04 20:18:05 thorpej Exp $ */ +/* $NetBSD: db_elf.c,v 1.8 1999/01/08 18:10:35 augustss Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -157,7 +157,7 @@ db_elf_sym_init(symsize, symtab, esymtab, name) * its section type Elf_sht_null so that it will be ignored * later. */ - shp = (Elf_Shdr *)(symtab + elf->e_shoff); + shp = (Elf_Shdr *)((char *)symtab + elf->e_shoff); for (i = 0; i < elf->e_shnum; i++) { switch (shp[i].sh_type) { case Elf_sht_strtab: @@ -167,17 +167,18 @@ db_elf_sym_init(symsize, symtab, esymtab, name) } if (strtab_start != NULL) goto multiple_strtab; - strtab_start = (char *)(symtab + shp[i].sh_offset); - strtab_end = (char *)(symtab + shp[i].sh_offset + - shp[i].sh_size); + strtab_start = (char *)symtab + shp[i].sh_offset; + strtab_end = (char *)symtab + shp[i].sh_offset + + shp[i].sh_size; break; case Elf_sht_symtab: if (symtab_start != NULL) goto multiple_symtab; - symtab_start = (Elf_Sym *)(symtab + shp[i].sh_offset); - symtab_end = (Elf_Sym *)(symtab + shp[i].sh_offset + - shp[i].sh_size); + symtab_start = (Elf_Sym *)((char *)symtab + + shp[i].sh_offset); + symtab_end = (Elf_Sym *)((char *)symtab + + shp[i].sh_offset + shp[i].sh_size); break; default: @@ -203,7 +204,8 @@ db_elf_sym_init(symsize, symtab, esymtab, name) if (db_add_symbol_table((char *)symtab_start, (char *)symtab_end, name, (char *)symtab) != -1) { printf("[ preserving %lu bytes of %s ELF symbol table ]\n", - (u_long)roundup((esymtab - symtab), sizeof(u_long)), name); + (u_long)roundup(((char *)esymtab - (char *)symtab), + sizeof(u_long)), name); return (TRUE); } diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c index d01bc9e42957..48a7dcf68a08 100644 --- a/sys/dev/ata/ata_wdc.c +++ b/sys/dev/ata/ata_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata_wdc.c,v 1.10 1998/12/16 13:02:03 bouyer Exp $ */ +/* $NetBSD: ata_wdc.c,v 1.11 1999/01/08 18:10:35 augustss Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -264,8 +264,8 @@ again: /* Init the DMA channel. */ if ((*chp->wdc->dma_init)(chp->wdc->dma_arg, chp->channel, xfer->drive, - xfer->databuf + xfer->c_skip, ata_bio->nbytes, - dma_flags) != 0) { + (char *)xfer->databuf + xfer->c_skip, + ata_bio->nbytes, dma_flags) != 0) { ata_bio->error = ERR_DMA; ata_bio->r_error = 0; wdc_ata_bio_done(chp, xfer); @@ -330,24 +330,24 @@ again: if (drvp->drive_flags & DRIVE_CAP32) { bus_space_write_multi_4(chp->data32iot, chp->data32ioh, 0, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, ata_bio->nbytes >> 2); } else { bus_space_write_multi_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, ata_bio->nbytes >> 1); } } else { if (drvp->drive_flags & DRIVE_CAP32) { bus_space_write_multi_stream_4(chp->data32iot, chp->data32ioh, 0, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, ata_bio->nbytes >> 2); } else { bus_space_write_multi_stream_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, ata_bio->nbytes >> 1); } } @@ -481,24 +481,24 @@ wdc_ata_bio_intr(chp, xfer) if (drvp->drive_flags & DRIVE_CAP32) { bus_space_read_multi_4(chp->data32iot, chp->data32ioh, 0, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, ata_bio->nbytes >> 2); } else { bus_space_read_multi_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, ata_bio->nbytes >> 1); } } else { if (drvp->drive_flags & DRIVE_CAP32) { bus_space_read_multi_stream_4(chp->data32iot, chp->data32ioh, 0, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, ata_bio->nbytes >> 2); } else { bus_space_read_multi_stream_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, ata_bio->nbytes >> 1); } } diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c index 81b71ce2851b..692d5c799c25 100644 --- a/sys/dev/isa/sbdsp.c +++ b/sys/dev/isa/sbdsp.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.88 1998/08/17 21:16:15 augustss Exp $ */ +/* $NetBSD: sbdsp.c,v 1.89 1999/01/08 18:10:35 augustss Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -1238,7 +1238,8 @@ sbdsp_trigger_input(addr, start, end, blksize, intr, arg, param) DPRINTF(("sbdsp: dma start loop input start=%p end=%p chan=%d\n", start, end, sc->sc_i.dmachan)); - isa_dmastart(sc->sc_ic, sc->sc_i.dmachan, start, end - start, NULL, + isa_dmastart(sc->sc_ic, sc->sc_i.dmachan, start, + (char *)end - (char *)start, NULL, DMAMODE_READ | DMAMODE_LOOP, BUS_DMA_NOWAIT); return sbdsp_block_input(addr); @@ -1373,7 +1374,8 @@ sbdsp_trigger_output(addr, start, end, blksize, intr, arg, param) DPRINTF(("sbdsp: dma start loop output start=%p end=%p chan=%d\n", start, end, sc->sc_o.dmachan)); - isa_dmastart(sc->sc_ic, sc->sc_o.dmachan, start, end - start, NULL, + isa_dmastart(sc->sc_ic, sc->sc_o.dmachan, start, + (char *)end - (char *)start, NULL, DMAMODE_WRITE | DMAMODE_LOOP, BUS_DMA_NOWAIT); return sbdsp_block_output(addr); diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index acdae0a9f5bb..502c7979d17d 100644 --- a/sys/dev/scsipi/atapi_wdc.c +++ b/sys/dev/scsipi/atapi_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: atapi_wdc.c,v 1.12 1998/12/17 13:05:05 bouyer Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.13 1999/01/08 18:10:36 augustss Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -446,12 +446,12 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) { bus_space_write_multi_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, xfer->c_bcount >> 1); } else { bus_space_write_multi_stream_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, + (char *)xfer->databuf + xfer->c_skip, xfer->c_bcount >> 1); } for (i = xfer->c_bcount; i < len; i += 2) @@ -464,11 +464,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) bus_space_write_multi_4(chp->data32iot, chp->data32ioh, 0, - xfer->databuf + xfer->c_skip, len >> 2); + (char *)xfer->databuf + xfer->c_skip, + len >> 2); else bus_space_write_multi_stream_4(chp->data32iot, chp->data32ioh, wd_data, - xfer->databuf + xfer->c_skip, len >> 2); + (char *)xfer->databuf + xfer->c_skip, + len >> 2); xfer->c_skip += len & 0xfffffffc; xfer->c_bcount -= len & 0xfffffffc; @@ -478,11 +480,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) bus_space_write_multi_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, len >> 1); + (char *)xfer->databuf + xfer->c_skip, + len >> 1); else bus_space_write_multi_stream_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, len >> 1); + (char *)xfer->databuf + xfer->c_skip, + len >> 1); xfer->c_skip += len; xfer->c_bcount -= len; } @@ -515,11 +519,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) { bus_space_read_multi_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, xfer->c_bcount >> 1); + (char *)xfer->databuf + xfer->c_skip, + xfer->c_bcount >> 1); } else { bus_space_read_multi_stream_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, xfer->c_bcount >> 1); + (char *)xfer->databuf + xfer->c_skip, + xfer->c_bcount >> 1); } wdcbit_bucket(chp, len - xfer->c_bcount); xfer->c_skip += xfer->c_bcount; @@ -529,11 +535,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) bus_space_read_multi_4(chp->data32iot, chp->data32ioh, 0, - xfer->databuf + xfer->c_skip, len >> 2); + (char *)xfer->databuf + xfer->c_skip, + len >> 2); else bus_space_read_multi_stream_4(chp->data32iot, chp->data32ioh, wd_data, - xfer->databuf + xfer->c_skip, len >> 2); + (char *)xfer->databuf + xfer->c_skip, + len >> 2); xfer->c_skip += len & 0xfffffffc; xfer->c_bcount -= len & 0xfffffffc; @@ -543,11 +551,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) bus_space_read_multi_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, len >> 1); + (char *)xfer->databuf + xfer->c_skip, + len >> 1); else bus_space_read_multi_stream_2(chp->cmd_iot, chp->cmd_ioh, wd_data, - xfer->databuf + xfer->c_skip, len >> 1); + (char *)xfer->databuf + xfer->c_skip, + len >> 1); xfer->c_skip += len; xfer->c_bcount -=len; }