diff options
author | bde <bde@FreeBSD.org> | 1998-08-15 21:36:16 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-08-15 21:36:16 +0000 |
commit | a879550a11a56ab8b528f2cfd88152ac91c174c2 (patch) | |
tree | 754920f3d6afbb781f016f73f4dfd83e9fcafba4 /sys/i386/isa/sound | |
parent | 3fd8693dfa3292e759a052911eeab29f6b133b8f (diff) | |
download | FreeBSD-src-a879550a11a56ab8b528f2cfd88152ac91c174c2.zip FreeBSD-src-a879550a11a56ab8b528f2cfd88152ac91c174c2.tar.gz |
Use offsetof() to avoid some casts from pointers to integers (of a
possibly different size).
Diffstat (limited to 'sys/i386/isa/sound')
-rw-r--r-- | sys/i386/isa/sound/gus_wave.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/sound/midi_synth.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/i386/isa/sound/gus_wave.c b/sys/i386/isa/sound/gus_wave.c index 55463c9..9b3ab0b 100644 --- a/sys/i386/isa/sound/gus_wave.c +++ b/sys/i386/isa/sound/gus_wave.c @@ -27,6 +27,8 @@ * */ +#include <stddef.h> + #include <i386/isa/sound/sound_config.h> #include <i386/isa/sound/ultrasound.h> #include <i386/isa/sound/gus_hw.h> @@ -1569,7 +1571,7 @@ guswave_load_patch(int dev, int format, snd_rw_buf * addr, u_long blk_size, blk_end, left, src_offs, target; - sizeof_patch = (long) &patch.data[0] - (long) &patch; /* Header size */ + sizeof_patch = offsetof(struct patch_info, data); /* Header size */ if (format != GUS_PATCH) { printf("GUS Error: Invalid patch format (key) 0x%x\n", format); diff --git a/sys/i386/isa/sound/midi_synth.c b/sys/i386/isa/sound/midi_synth.c index 86032e3..e63b24a 100644 --- a/sys/i386/isa/sound/midi_synth.c +++ b/sys/i386/isa/sound/midi_synth.c @@ -30,6 +30,8 @@ #define USE_SEQ_MACROS #define USE_SIMPLE_MACROS +#include <stddef.h> + #include <i386/isa/sound/sound_config.h> #if defined(CONFIGURE_SOUNDCARD) /* && defined(CONFIG_MIDI) */ @@ -448,7 +450,7 @@ midi_synth_load_patch(int dev, int format, snd_rw_buf * addr, int i; unsigned long left, src_offs, eox_seen = 0; int first_byte = 1; - int hdr_size = (unsigned long) &sysex.data[0] - (unsigned long) &sysex; + int hdr_size = offsetof(struct sysex_info, data); leave_sysex(dev); |