From owner-p4-projects@FreeBSD.ORG Fri Jul 13 06:09:29 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9BA4316A406; Fri, 13 Jul 2007 06:09:29 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 45F0A16A401; Fri, 13 Jul 2007 06:09:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id CF1E113C494; Fri, 13 Jul 2007 06:09:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [89.162.146.170] (helo=skuns.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1I9C55-000Eif-Vn; Fri, 13 Jul 2007 06:44:37 +0300 Received: from deviant.kiev.zoral.com.ua (root@[10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l6D3iQWm014833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jul 2007 06:44:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l6D3iQQ9036815; Fri, 13 Jul 2007 06:44:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l6D3iPr7036814; Fri, 13 Jul 2007 06:44:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 Jul 2007 06:44:25 +0300 From: Kostik Belousov To: Alexey Tarasov Message-ID: <20070713034425.GH2200@deviant.kiev.zoral.com.ua> References: <200707121428.l6CESBSj045007@repoman.freebsd.org> <46965433.6050207@FreeBSD.org> <200707121831.22913.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZgsjCHEQV+PhxuqO" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.90.3, clamav-milter version 0.90.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.2.1 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on skuns.kiev.zoral.com.ua X-Scanner-Signature: 6dc4245230f22f3abb357b69a6da667e X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1217 [July 12 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: Shteryana Shopova , "Constantine A. Murenin" , Perforce Change Reviews , Hans Petter Selasky Subject: Re: PERFORCE change 123376 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2007 06:09:30 -0000 --ZgsjCHEQV+PhxuqO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 13, 2007 at 12:40:38PM +1100, Alexey Tarasov wrote: > >http://perforce.freebsd.org/chv.cgi?CH=3D123376 > > > >Change 123376 by taleks@taleks_th on 2007/07/12 14:27:18 > > > >@@ -104,11 +107,11 @@ > > } > > > > if ( (from =3D=3D 0) && (size =3D=3D 0) ) { > >- sprintf(http_data, "GET /%s HTTP/1.1\r\nHost: > %s\r\nConnection: Close\r\n\r\n", > >+ sprintf(http_data, "GET /%s HTTP/1.1\r\nHost: > %s\r\nConnection: Close\r\nUser-Agent: pxe_http/0\r\n\r\n", > > filename, server_name > > ); > > } else { > >- sprintf(http_data, "GET /%s HTTP/1.1\r\nHost: %s\r\nRange: > %d-%d\r\nConnection: Close\r\n\r\n", > >+ sprintf(http_data, "GET /%s HTTP/1.1\r\nHost: %s\r\nRange: > bytes=3D%d-%d\r\nConnection: Close\r\nUser-Agent: pxe_http/0\r\n\r\n", > > filename, server_name, from, from + size > > ); > > } >=20 > >You might want to change long lines like these to something as follows: > Ok, I'll make lines shorter. > I've not found strict rule in style(9) for ");" at the end of multiple li= nes > of parameters in function call, and thought my variant is more simple for > reading. Same intention is in using curly brackets in complex single > statement in if-else block. Well, it's not big problem, I may correct this > on next submits. >=20 > >And, don't use "sprintf". Use "snprintf" instead. > As for snprintf(), I'm also wanted to make it safer, but according to man > and header file - libstand have no such function. Same for strnstr(). > I'm thinking about skipping sprintf() with many parameters while generati= ng > header and writing directly to socket, in such case will be more function > calls and checks, but only one of them (Range field, that always has > predictable size smaller then default buffer size) will use sprintf(). Nobody will object if you add the functions to libstand. --ZgsjCHEQV+PhxuqO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGlvUYC3+MBN1Mb4gRAmpKAKCGMCAZowDUEfz7K+vZ9PxdSjZXeACgtJww W4gO0rvjnCo3yh1W0HIg0yw= =x41T -----END PGP SIGNATURE----- --ZgsjCHEQV+PhxuqO--