From owner-svn-src-all@FreeBSD.ORG Tue Jul 22 23:29:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA2A2FB1; Tue, 22 Jul 2014 23:29:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9753523D8; Tue, 22 Jul 2014 23:29:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6MNTt1K069645; Tue, 22 Jul 2014 23:29:55 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6MNTtLI069643; Tue, 22 Jul 2014 23:29:55 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407222329.s6MNTtLI069643@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 22 Jul 2014 23:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269001 - head/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 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: Tue, 22 Jul 2014 23:29:55 -0000 Author: pfg Date: Tue Jul 22 23:29:54 2014 New Revision: 269001 URL: http://svnweb.freebsd.org/changeset/base/269001 Log: Avoid possible cast degradation. For consistency with r268985 for fputs.c, assign iov_len first, avoiding the cast to uio_resid (int in stdio) from degrading the value. We currently don't support lengths higher than INT_MAX so this change is little more than cosmetic. MFC after: 3 days Modified: head/lib/libc/stdio/fputws.c head/lib/libc/stdio/putw.c Modified: head/lib/libc/stdio/fputws.c ============================================================================== --- head/lib/libc/stdio/fputws.c Tue Jul 22 23:16:28 2014 (r269000) +++ head/lib/libc/stdio/fputws.c Tue Jul 22 23:29:54 2014 (r269001) @@ -67,7 +67,7 @@ fputws_l(const wchar_t * __restrict ws, &fp->_mbstate); if (nbytes == (size_t)-1) goto error; - iov.iov_len = uio.uio_resid = nbytes; + uio.uio_resid = iov.iov_len = nbytes; if (__sfvwrite(fp, &uio) != 0) goto error; } while (wsp != NULL); Modified: head/lib/libc/stdio/putw.c ============================================================================== --- head/lib/libc/stdio/putw.c Tue Jul 22 23:16:28 2014 (r269000) +++ head/lib/libc/stdio/putw.c Tue Jul 22 23:29:54 2014 (r269001) @@ -50,7 +50,7 @@ putw(int w, FILE *fp) struct __siov iov; iov.iov_base = &w; - iov.iov_len = uio.uio_resid = sizeof(w); + uio.uio_resid = iov.iov_len = sizeof(w); uio.uio_iov = &iov; uio.uio_iovcnt = 1; FLOCKFILE(fp);