From owner-p4-projects@FreeBSD.ORG Fri Jul 13 07:24:39 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 32F9116A404; Fri, 13 Jul 2007 07:24:39 +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 E7F0716A402 for ; Fri, 13 Jul 2007 07:24:38 +0000 (UTC) (envelope-from shteryana@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.178]) by mx1.freebsd.org (Postfix) with ESMTP id BAAED13C48E for ; Fri, 13 Jul 2007 07:24:38 +0000 (UTC) (envelope-from shteryana@gmail.com) Received: by wa-out-1112.google.com with SMTP id j37so503981waf for ; Fri, 13 Jul 2007 00:24:38 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=Ys5sHv0ZWfo/kUf3i4Z0AYoqOhj46r9qfrP/zRKeNcY+0pqW+YxhGXdpv/eRdFgUX7AGAJZ9xY+bA7k0aPdxhyzW4pqbs6NcsgQKty9RKuGbIQgftUX8F4SV2seyfrKtCCfJT/uwG18yahcpTNNn8c8/aNqbuq01pfoVCpsmuCk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=lfBLd7azgjbU+CbwJNnofD9F2/XXbsQfnPtPzo9vExs1oTOBdrPHld/iRCSti4L69ZZU+y3jrUBtEcWqlhQFNsjAqhb/cSIsjEWTDnfcqCuI3TrnofKZsilCbvopvcNWjhc5pmducK+f4PmBGcTfva3wz7vL/nz49dqKVILvm3E= Received: by 10.115.111.1 with SMTP id o1mr1347384wam.1184309950305; Thu, 12 Jul 2007 23:59:10 -0700 (PDT) Received: by 10.114.60.6 with HTTP; Thu, 12 Jul 2007 23:59:10 -0700 (PDT) Message-ID: <61b573980707122359y43bb9ec4gf76892e619cc8599@mail.gmail.com> Date: Fri, 13 Jul 2007 09:59:10 +0300 From: "Shteryana Shopova" Sender: shteryana@gmail.com To: "Alexey Tarasov" In-Reply-To: <20070713034425.GH2200@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200707121428.l6CESBSj045007@repoman.freebsd.org> <46965433.6050207@FreeBSD.org> <200707121831.22913.hselasky@c2i.net> <20070713034425.GH2200@deviant.kiev.zoral.com.ua> X-Google-Sender-Auth: 4e57a8c3e9890798 Cc: Kostik Belousov , "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 Reply-To: syrinx@FreeBSD.org List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2007 07:24:39 -0000 style(9) says: Many of the style rules are implicit in the examples. ;) IMO it is a good idea to try to keep to the rules while coding. Also all code lines should (must ;)) contain 80 characters max. cheers, Shteryana On 7/13/07, Kostik Belousov wrote: > On Fri, Jul 13, 2007 at 12:40:38PM +1100, Alexey Tarasov wrote: > > >http://perforce.freebsd.org/chv.cgi?CH=123376 > > > > > >Change 123376 by taleks@taleks_th on 2007/07/12 14:27:18 > > > > > >@@ -104,11 +107,11 @@ > > > } > > > > > > if ( (from == 0) && (size == 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=%d-%d\r\nConnection: Close\r\nUser-Agent: pxe_http/0\r\n\r\n", > > > filename, server_name, from, from + size > > > ); > > > } > > > > >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 lines > > 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. > > > > >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 generating > > 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. > >