Date: Thu, 12 Jul 2007 18:31:22 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: "Constantine A. Murenin" <cnst@freebsd.org> Cc: Shteryana Shopova <syrinx@freebsd.org>, Perforce Change Reviews <perforce@freebsd.org>, Alexey Tarasov <taleks@freebsd.org> Subject: Re: PERFORCE change 123376 for review Message-ID: <200707121831.22913.hselasky@c2i.net> In-Reply-To: <46965433.6050207@FreeBSD.org> References: <200707121428.l6CESBSj045007@repoman.freebsd.org> <46965433.6050207@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 12 July 2007 18:17, Constantine A. Murenin wrote: > On 12/07/2007 10:28, 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: > > if ( (from == 0) && (size == 0) ) > sprintf(http_data, "GET /%s HTTP/1.1\r\nHost: %s\r\n" > "Connection: 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\n" > "Range: bytes=%d-%d\r\n" > "Connection: Close\r\nUser-Agent: pxe_http/0\r\n\r\n", > filename, server_name, from, from + size); > > Also note that ");" should not appear on a line by itself, if I'm reading > style(9) correctly. > > Removing curly brackets is optional in this case, because lines are > somewhat long, but personally, I do like them removed, too. :) > And, don't use "sprintf". Use "snprintf" instead. --HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707121831.22913.hselasky>