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 | |
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')
-rw-r--r-- | sys/gnu/i386/isa/sound/awe_wave.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/sound/gus_wave.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/sound/midi_synth.c | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/sys/gnu/i386/isa/sound/awe_wave.c b/sys/gnu/i386/isa/sound/awe_wave.c index 1f3269e..c4f3cbf 100644 --- a/sys/gnu/i386/isa/sound/awe_wave.c +++ b/sys/gnu/i386/isa/sound/awe_wave.c @@ -21,6 +21,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <stddef.h> + #ifdef __FreeBSD__ # include <gnu/i386/isa/sound/awe_config.h> #else @@ -3296,7 +3298,7 @@ awe_load_guspatch(const char *addr, int offs, int size, int pmgr_flag) int note, free_sample, free_info; int rc; - sizeof_patch = (int)((long)&patch.data[0] - (long)&patch); /* header size */ + sizeof_patch = offsetof(struct patch_info, data); /* header size */ if (size < sizeof_patch) { printk("AWE32 Error: Patch header too short\n"); return RET_ERROR(EINVAL); 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); |