From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 17 08:47:23 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CBA737B401 for ; Tue, 17 Jun 2003 08:47:23 -0700 (PDT) Received: from mgr1.xmission.com (mgr1.xmission.com [198.60.22.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 83E3243F75 for ; Tue, 17 Jun 2003 08:47:22 -0700 (PDT) (envelope-from glewis@eyesbeyond.com) Received: from mail by mgr1.xmission.com with spam-scanned (Exim 3.35 #1) id 19SIg1-0000dF-01 for freebsd-hackers@freebsd.org; Tue, 17 Jun 2003 09:47:21 -0600 Received: from [207.135.128.145] (helo=misty.eyesbeyond.com) by mgr1.xmission.com with esmtp (Exim 3.35 #1) id 19SIfz-0000cH-01; Tue, 17 Jun 2003 09:47:16 -0600 Received: from misty.eyesbeyond.com (localhost.eyesbeyond.com [127.0.0.1]) by misty.eyesbeyond.com (8.12.9/8.12.9) with ESMTP id h5HFrKBM086949; Tue, 17 Jun 2003 09:53:21 -0600 (MDT) (envelope-from glewis@eyesbeyond.com) Received: (from glewis@localhost) by misty.eyesbeyond.com (8.12.9/8.12.9/Submit) id h5HFrHrO086948; Tue, 17 Jun 2003 09:53:17 -0600 (MDT) X-Authentication-Warning: misty.eyesbeyond.com: glewis set sender to glewis@eyesbeyond.com using -f Date: Tue, 17 Jun 2003 09:53:17 -0600 From: Greg Lewis To: freebsd-hackers@freebsd.org Message-ID: <20030617155317.GA86754@misty.eyesbeyond.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Qxx1br4bt0+wmkIi" Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Spam-Status: No, hits=-8.4 required=8.0 tests=BAYES_10,PATCH_UNIFIED_DIFF,USER_AGENT_MUTT,X_AUTH_WARNING autolearn=ham version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: Munehiro Matsuda Subject: Broken in 5.1R and -current X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2003 15:47:23 -0000 --Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi all, While moving from its own internal endian defines to using the JDK 1.3.1 code has become broken on both 5.1R and -current. The problem is that C++ code that includes (whether wrapped in extern "C" { } or not) fails during compilation with errors such as: In file included from ../../../src/share/native/sun/awt/font/FontWrapper.cpp:21: /usr/include/sys/endian.h: In function `uint16_t be16dec(const void*)': /usr/include/sys/endian.h:97: invalid conversion from `const void*' to `const unsigned char*' /usr/include/sys/endian.h: In function `uint32_t be32dec(const void*)': /usr/include/sys/endian.h:105: invalid conversion from `const void*' to `const unsigned char*' /usr/include/sys/endian.h: In function `uint64_t be64dec(const void*)': /usr/include/sys/endian.h:113: invalid conversion from `const void*' to `const unsigned char*' [...] gmake[3]: *** [../../../build/bsd-i386/tmp/sun/sun.awt.font/fontmanager/obj/FontWrapper.o] Error 1 The developer who noticed this problem (Munehiro Matsuda - cc'ed) submitted the attached patch which simply casts the function arguments to the appropriate type. Can someone please commit this, approve me to commit it (my commit bit is docs and ports :) or suggest an alternative? Thanks. A bump of __FreeBSD_version would be great too, since then we could detect this and work around it, however I'm not sure this meets the criteria for such a bump. -- Greg Lewis Email : glewis@eyesbeyond.com Eyes Beyond Web : http://www.eyesbeyond.com Information Technology FreeBSD : glewis@FreeBSD.org --Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-sys-endian.h" --- src/sys/sys/endian.h.ctm Fri Apr 4 00:48:59 2003 +++ src/sys/sys/endian.h Sun Jun 15 02:20:24 2003 @@ -94,7 +94,7 @@ static __inline uint16_t be16dec(const void *pp) { - unsigned char const *p = pp; + unsigned char const *p = (unsigned char const *)pp; return ((p[0] << 8) | p[1]); } @@ -102,7 +102,7 @@ static __inline uint32_t be32dec(const void *pp) { - unsigned char const *p = pp; + unsigned char const *p = (unsigned char const *)pp; return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); } @@ -110,7 +110,7 @@ static __inline uint64_t be64dec(const void *pp) { - unsigned char const *p = pp; + unsigned char const *p = (unsigned char const *)pp; return (((uint64_t)be32dec(p) << 32) | be32dec(p + 4)); } @@ -118,7 +118,7 @@ static __inline uint16_t le16dec(const void *pp) { - unsigned char const *p = pp; + unsigned char const *p = (unsigned char const *)pp; return ((p[1] << 8) | p[0]); } @@ -126,7 +126,7 @@ static __inline uint32_t le32dec(const void *pp) { - unsigned char const *p = pp; + unsigned char const *p = (unsigned char const *)pp; return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]); } @@ -134,7 +134,7 @@ static __inline uint64_t le64dec(const void *pp) { - unsigned char const *p = pp; + unsigned char const *p = (unsigned char const *)pp; return (((uint64_t)le32dec(p + 4) << 32) | le32dec(p)); } @@ -142,7 +142,7 @@ static __inline void be16enc(void *pp, uint16_t u) { - unsigned char *p = pp; + unsigned char *p = (unsigned char *)pp; p[0] = (u >> 8) & 0xff; p[1] = u & 0xff; @@ -151,7 +151,7 @@ static __inline void be32enc(void *pp, uint32_t u) { - unsigned char *p = pp; + unsigned char *p = (unsigned char *)pp; p[0] = (u >> 24) & 0xff; p[1] = (u >> 16) & 0xff; @@ -162,7 +162,7 @@ static __inline void be64enc(void *pp, uint64_t u) { - unsigned char *p = pp; + unsigned char *p = (unsigned char *)pp; be32enc(p, u >> 32); be32enc(p + 4, u & 0xffffffff); @@ -171,7 +171,7 @@ static __inline void le16enc(void *pp, uint16_t u) { - unsigned char *p = pp; + unsigned char *p = (unsigned char *)pp; p[0] = u & 0xff; p[1] = (u >> 8) & 0xff; @@ -180,7 +180,7 @@ static __inline void le32enc(void *pp, uint32_t u) { - unsigned char *p = pp; + unsigned char *p = (unsigned char *)pp; p[0] = u & 0xff; p[1] = (u >> 8) & 0xff; @@ -191,7 +191,7 @@ static __inline void le64enc(void *pp, uint64_t u) { - unsigned char *p = pp; + unsigned char *p = (unsigned char *)pp; le32enc(p, u & 0xffffffff); le32enc(p + 4, u >> 32); --Qxx1br4bt0+wmkIi--