From 96302ffc7300305c73ac5d654ad2a4017b0698da Mon Sep 17 00:00:00 2001 From: dogcow Date: Wed, 5 Dec 2007 04:29:10 +0000 Subject: [PATCH] "fix" complaints about type-punned pointers with some icky casts. --- lib/libpuffs/requests.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/libpuffs/requests.c b/lib/libpuffs/requests.c index 4ae0b7cdc4a9..f00050324bbe 100644 --- a/lib/libpuffs/requests.c +++ b/lib/libpuffs/requests.c @@ -1,4 +1,4 @@ -/* $NetBSD: requests.c,v 1.17 2007/12/04 21:24:13 pooka Exp $ */ +/* $NetBSD: requests.c,v 1.18 2007/12/05 04:29:10 dogcow Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -30,7 +30,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: requests.c,v 1.17 2007/12/04 21:24:13 pooka Exp $"); +__RCSID("$NetBSD: requests.c,v 1.18 2007/12/05 04:29:10 dogcow Exp $"); #endif /* !lint */ #include @@ -133,13 +133,14 @@ puffs_fsframe_write(struct puffs_usermount *pu, struct puffs_framebuf *pb, * XXX: this shouldn't be here */ if (puffs_framebuf_telloff(pb) == 0) { - struct puffs_req *preq; + void *preq; winlen = sizeof(struct puffs_req); rv = puffs_framebuf_getwindow(pb, 0, (void **)&preq, &winlen); if (rv == -1) return errno; - preq->preq_pth.pth_framelen = flen = preq->preq_buflen; + flen = ((struct puffs_req *)preq)->preq_buflen; + ((struct puffs_req *)preq)->preq_pth.pth_framelen = flen; } else { struct putter_hdr phdr; @@ -203,13 +204,13 @@ int puffs_fsframe_cmp(struct puffs_usermount *pu, struct puffs_framebuf *pb1, struct puffs_framebuf *pb2, int *notresp) { - struct puffs_req *preq1, *preq2; + void *preq1, *preq2; size_t winlen; int rv; /* map incoming preq */ winlen = sizeof(struct puffs_req); - rv = puffs_framebuf_getwindow(pb1, 0, (void**)&preq1, &winlen); + rv = puffs_framebuf_getwindow(pb1, 0, &preq1, &winlen); assert(rv == 0); /* frames are always at least puffs_req in size */ assert(winlen = sizeof(struct puffs_req)); @@ -217,19 +218,20 @@ puffs_fsframe_cmp(struct puffs_usermount *pu, * Check if this is not a response in this slot. That's the * likely case. */ - if ((preq1->preq_opclass & PUFFSOPFLAG_ISRESPONSE) == 0) { + if ((((struct puffs_req *)preq1)->preq_opclass & PUFFSOPFLAG_ISRESPONSE) == 0) { *notresp = 1; return 0; } /* map second preq */ winlen = sizeof(struct puffs_req); - rv = puffs_framebuf_getwindow(pb2, 0, (void**)&preq2, &winlen); + rv = puffs_framebuf_getwindow(pb2, 0, &preq2, &winlen); assert(rv == 0); /* frames are always at least puffs_req in size */ assert(winlen = sizeof(struct puffs_req)); /* then compare: resid equal? */ - return preq1->preq_id == preq2->preq_id; + return ((struct puffs_req *)preq1)->preq_id == + ((struct puffs_req *)preq2)->preq_id; } void