From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12310 invoked by alias); 28 Apr 2017 12:13:04 -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 12230 invoked by uid 89); 28 Apr 2017 12:13:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 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= X-HELO: rgout01.bt.lon5.cpcloud.co.uk Received: from rgout0104.bt.lon5.cpcloud.co.uk (HELO rgout01.bt.lon5.cpcloud.co.uk) (65.20.0.124) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Apr 2017 12:13:02 +0000 X-OWM-Source-IP: 31.51.207.210 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-Junkmail-Premium-Raw: score=8/50,refid=2.7.2:2017.4.26.2416:17:8.707,ip=,rules=NO_URI_FOUND, NO_CTA_URI_FOUND, NO_MESSAGE_ID, NO_URI_HTTPS, TO_MALFORMED Received: from localhost.localdomain (31.51.207.210) by rgout01.bt.lon5.cpcloud.co.uk (9.0.019.13-1) (authenticated as jonturney@btinternet.com) id 58F62BE3012F555D; Fri, 28 Apr 2017 13:13:04 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 04/11] Make packageversion::source(|s) const Date: Fri, 28 Apr 2017 12:13:00 -0000 Message-Id: <20170428121205.12240-5-jon.turney@dronecode.org.uk> In-Reply-To: <20170428121205.12240-1-jon.turney@dronecode.org.uk> References: <20170428121205.12240-1-jon.turney@dronecode.org.uk> X-SW-Source: 2017-04/txt/msg00090.txt.bz2 Make packageversion::source() and sources() const Remove a temporary used to dererence an packageversion iterator to avoid problems with const-correctness --- PickView.cc | 4 ++-- package_version.cc | 4 ++-- package_version.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PickView.cc b/PickView.cc index 3de49f7..1ba55e8 100644 --- a/PickView.cc +++ b/PickView.cc @@ -442,9 +442,9 @@ PickView::init_headers (HDC dc) if (*i != pkg.installed) note_width (headers, dc, i->Canonical_version (), HMARGIN + SPIN_WIDTH, new_col); - std::string z = format_1000s(packageversion(*i).source ()->size); + std::string z = format_1000s(i->source ()->size); note_width (headers, dc, z, HMARGIN, size_col); - z = format_1000s(packageversion(i->sourcePackage ()).source ()->size); + z = format_1000s(i->sourcePackage ().source ()->size); note_width (headers, dc, z, HMARGIN, size_col); } std::string s = pkg.name; diff --git a/package_version.cc b/package_version.cc index 1a4d041..695641f 100644 --- a/package_version.cc +++ b/package_version.cc @@ -262,7 +262,7 @@ packageversion::uninstall () } packagesource * -packageversion::source () +packageversion::source () const { if (!data->sources.size()) data->sources.push_back (packagesource()); @@ -270,7 +270,7 @@ packageversion::source () } vector * -packageversion::sources () +packageversion::sources () const { return &data->sources; } diff --git a/package_version.h b/package_version.h index c271f73..6f6fcde 100644 --- a/package_version.h +++ b/package_version.h @@ -118,9 +118,9 @@ public: void uninstall (); /* invariant: never null */ - packagesource *source(); /* where can we source the file from */ + packagesource *source() const; /* where can we source the file from */ /* invariant: never null */ - std::vector *sources(); /* expose the list of files. + std::vector *sources() const; /* expose the list of files. source() returns the 'default' file sources() allows managing multiple files in a single package -- 2.12.2