From owner-svn-src-all@freebsd.org Wed Dec 16 13:56:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D33BA49B21; Wed, 16 Dec 2015 13:56:22 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 157901792; Wed, 16 Dec 2015 13:56:21 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBG9KkGC051644; Wed, 16 Dec 2015 09:20:46 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBG9KkBw051643; Wed, 16 Dec 2015 09:20:46 GMT (envelope-from des@FreeBSD.org) Message-Id: <201512160920.tBG9KkBw051643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Wed, 16 Dec 2015 09:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292332 - head/lib/libfetch 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.20 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: Wed, 16 Dec 2015 13:56:22 -0000 Author: des Date: Wed Dec 16 09:20:45 2015 New Revision: 292332 URL: https://svnweb.freebsd.org/changeset/base/292332 Log: As a followup to r292330, standardize on size_t and add a few comments. Modified: head/lib/libfetch/http.c Modified: head/lib/libfetch/http.c ============================================================================== --- head/lib/libfetch/http.c Wed Dec 16 09:18:20 2015 (r292331) +++ head/lib/libfetch/http.c Wed Dec 16 09:20:45 2015 (r292332) @@ -130,8 +130,8 @@ struct httpio int chunked; /* chunked mode */ char *buf; /* chunk buffer */ size_t bufsize; /* size of chunk buffer */ - ssize_t buflen; /* amount of data currently in buffer */ - int bufpos; /* current read offset in buffer */ + size_t buflen; /* amount of data currently in buffer */ + size_t bufpos; /* current read offset in buffer */ int eof; /* end-of-file flag */ int error; /* error flag */ size_t chunksize; /* remaining size of current chunk */ @@ -215,6 +215,7 @@ http_fillbuf(struct httpio *io, size_t l if (io->eof) return (0); + /* not chunked: just fetch the requested amount */ if (io->chunked == 0) { if (http_growbuf(io, len) == -1) return (-1); @@ -227,6 +228,7 @@ http_fillbuf(struct httpio *io, size_t l return (io->buflen); } + /* chunked, but we ran out: get the next chunk header */ if (io->chunksize == 0) { switch (http_new_chunk(io)) { case -1: @@ -238,6 +240,7 @@ http_fillbuf(struct httpio *io, size_t l } } + /* fetch the requested amount, but no more than the current chunk */ if (len > io->chunksize) len = io->chunksize; if (http_growbuf(io, len) == -1)