From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57074 invoked by alias); 16 May 2017 11:51:07 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 57058 invoked by uid 89); 16 May 2017 11:51:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=site X-HELO: rgout01.bt.lon5.cpcloud.co.uk Received: from rgout0103.bt.lon5.cpcloud.co.uk (HELO rgout01.bt.lon5.cpcloud.co.uk) (65.20.0.123) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 May 2017 11:51:05 +0000 X-OWM-Source-IP: 86.166.190.52 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-Junkmail-Premium-Raw: score=8/50,refid=2.7.2:2017.5.13.90016:17:8.707,ip=,rules=NO_URI_FOUND, NO_CTA_URI_FOUND, NO_MESSAGE_ID, NO_URI_HTTPS, TO_MALFORMED Received: from localhost.localdomain (86.166.190.52) by rgout01.bt.lon5.cpcloud.co.uk (9.0.019.13-1) (authenticated as jonturney@btinternet.com) id 58F62BE3032B4AD6; Tue, 16 May 2017 12:50:46 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 08/15] Fix comments and indentation in check_for_cached Date: Tue, 16 May 2017 11:51:00 -0000 Message-Id: <20170516114900.168120-9-jon.turney@dronecode.org.uk> In-Reply-To: <20170516114900.168120-1-jon.turney@dronecode.org.uk> References: <20170516114900.168120-1-jon.turney@dronecode.org.uk> X-SW-Source: 2017-05/txt/msg00109.txt.bz2 --- download.cc | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/download.cc b/download.cc index 5cc5e2b..59af2d6 100644 --- a/download.cc +++ b/download.cc @@ -72,41 +72,38 @@ validateCachedPackage (const std::string& fullname, packagesource & pkgsource) int check_for_cached (packagesource & pkgsource, bool mirror_mode) { - /* search algo: - 1) is there a legacy version in the cache dir available. - (Note that the cache dir is represented by a mirror site of - file://local_dir - */ - // Already found one. if (pkgsource.Cached()) return 1; - + + /* Note that the cache dir is represented by a mirror site of file://local_dir */ std::string prefix = "file://" + local_dir + "/"; - /* FIXME: Nullness check can go away once packagesource is properly - * std::string-ified, and doesn't use overcomplex semantics. */ - std::string fullname = prefix + - (pkgsource.Canonical() ? pkgsource.Canonical() : ""); + std::string fullname = prefix + pkgsource.Canonical(); + if (mirror_mode) { /* Just assume correctness of mirror. */ pkgsource.set_cached (fullname); return 1; } + + /* + 1) is there a legacy version in the cache dir available. + */ if (io_stream::exists (fullname)) { if (validateCachedPackage (fullname, pkgsource)) - pkgsource.set_cached (fullname); + pkgsource.set_cached (fullname); else - throw new Exception (TOSTRING(__LINE__) " " __FILE__, - "Package validation failure for " + fullname, - APPERR_CORRUPT_PACKAGE); + throw new Exception (TOSTRING(__LINE__) " " __FILE__, + "Package validation failure for " + fullname, + APPERR_CORRUPT_PACKAGE); return 1; } /* 2) is there a version from one of the selected mirror sites available ? - */ + */ for (packagesource::sitestype::const_iterator n = pkgsource.sites.begin(); n != pkgsource.sites.end(); ++n) { -- 2.12.3