]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
Make packageversion::source(|s) const
authorJon Turney <jon.turney@dronecode.org.uk>
Wed, 26 Apr 2017 13:59:59 +0000 (14:59 +0100)
committerJon Turney <jon.turney@dronecode.org.uk>
Fri, 28 Apr 2017 12:05:06 +0000 (13:05 +0100)
Make packageversion::source() and sources() const

Remove a temporary used to dererence an packageversion iterator to avoid
problems with const-correctness

PickView.cc
package_version.cc
package_version.h

index 3de49f72ea606037fef5fc4bb9687b8690105557..1ba55e8162c8900be8a1e15cda0690845cb66bad 100644 (file)
@@ -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;
index 1a4d041f247dfea633e5c0fcb30b609aa3ee4420..695641fdbe726e634138ea5aa571709a97873693 100644 (file)
@@ -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;
 }
index c271f7384175012418c3e05c512f85ac4bfaea4e..6f6fcdee1872875c9275cab6492ce329b243094d 100644 (file)
@@ -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
This page took 0.072703 seconds and 5 git commands to generate.