Date: Mon, 11 Dec 2006 23:56:04 -0600 From: "Scot Hetzel" <swhetzel@gmail.com> To: FreeBSD-CURRENT <freebsd-current@freebsd.org>, "Bill Paul" <wpaul@windriver.com> Subject: Re: Latest Broadcom NDIS driver requires 4 additional functions Message-ID: <790a9fff0612112156s359f1cc3w68c3d4b39661832c@mail.gmail.com> In-Reply-To: <790a9fff0611251051md2ef50cja84440ba3cc7942f@mail.gmail.com> References: <790a9fff0611251051md2ef50cja84440ba3cc7942f@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 11/25/06, Scot Hetzel <swhetzel@gmail.com> wrote: > Unimplemented Functions: > memchr - implemented but causes "cast discards qualifiers from pointer target type" : > > Any ideas as to how to fix memchr, ... ? > I was able to fix memchr with the help of one of my college professors, he provided me with two different solutions to get rid of the cast problem. #ifdef BROKEN_MEMCHR static void *ntoskrnl_memchr(const void *, int, size_t); /* * /usr/src/sys/modules/ndis/../../compat/ndis/subr_ntoskrnl.c: In function `ntoskrnl_memchr': * /usr/src/sys/modules/ndis/../../compat/ndis/subr_ntoskrnl.c:465: warning: cast discards qualifiers from pointer target type * *** Error code 1 */ static void * ntoskrnl_memchr(buf, ch, len) const void *buf; unsigned char ch; size_t len; { if (len != 0) { const unsigned char *p = buf; do { if (*p++ == ch) { return ((void *)(p - 1)); /* error occurs here */ } } while (--len != 0); } return (NULL); } #endif #ifdef FIX1_MEMCHR static void *ntoskrnl_memchr(void *, int, size_t); static void * ntoskrnl_memchr(buf, ch, len) void *buf; unsigned char ch; size_t len; { if (len != 0) { unsigned char *p = buf; do { if (*p++ == ch) { return ((void *)(p - 1)); } } while (--len != 0); } return (NULL); } #endif #ifdef FIX2_MEMCHR static const void *ntoskrnl_memchr(const void *, int, size_t); static const void * ntoskrnl_memchr(buf, ch, len) const void *buf; unsigned char ch; size_t len; { if (len != 0) { const unsigned char *p = buf; do { if (*p++ == ch) { return ((const void *)(p - 1)); } } while (--len != 0); } return (NULL); } #endif Which version should I use as a follow up to PR 106131. http://www.freebsd.org/cgi/query-pr.cgi?pr=106131 Scot -- DISCLAIMER: No electrons were mamed while sending this message. Only slightly bruised.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?790a9fff0612112156s359f1cc3w68c3d4b39661832c>