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<packagesource> * -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 <packagesource> *sources(); /* expose the list of files. + std::vector <packagesource> *sources() const; /* expose the list of files. source() returns the 'default' file sources() allows managing multiple files in a single package -- 2.12.2