From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 15:35:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A996910656AA; Thu, 12 Aug 2010 15:35:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 789A88FC1C; Thu, 12 Aug 2010 15:35:06 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 2095D46B37; Thu, 12 Aug 2010 11:35:06 -0400 (EDT) Received: from John-Baldwins-Macbook-Pro.local (75-48-78-116.lightspeed.cncrca.sbcglobal.net [75.48.78.116]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id BF5AC8A03C; Thu, 12 Aug 2010 11:35:04 -0400 (EDT) Message-ID: <4C6414A7.6020306@FreeBSD.org> Date: Thu, 12 Aug 2010 11:35:03 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= References: <201008121358.o7CDwk0d098768@svn.freebsd.org> <86pqxn50vr.fsf@ds4.des.no> In-Reply-To: <86pqxn50vr.fsf@ds4.des.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 12 Aug 2010 11:35:05 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, Takanori Watanabe , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211221 - head/usr.sbin/acpi/acpidump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 15:35:06 -0000 Dag-Erling Smørgrav wrote: > Takanori Watanabe writes: >> - printf("\tClass %d Base Address 0x%jx Length %llu\n\n", >> + printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", >> tcpa->platform_class, paddr, len); > > This is just as wrong as the previous attempt. > > 1) platform_class is not an int. > 2) paddr is not a uintmax_t. > 3) so far, we've avoided using the PRI macros. > > Slightly better: > > printf("\tClass %u Base Address 0x%jx Length %ju\n\n", > (unsigned int)tcpa->platform_class, (uintmax_t)paddr, (uintmax_t)len); > > but it would probably be easier to define paddr and len as unsigned long > long instead of the misspelled u_int64_t, and use %llx and %llu. Depends. If the table defines a field to be a 64-bit integer, it is better to use an explicitly-64-bit integer type such as uint64_t rather than assuming that 'long long' is 64-bit. Other ACPI table definitions all use fixed-size types like uint32_t and uint64_t since the tables are defined as fixed-size fields, not as 'long' and 'int'. Using %j with uintmax_t casts is the solution used for other 64-bit fields in ACPI tables. -- John Baldwin