]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
Fix comments and indentation in check_for_cached
authorJon Turney <jon.turney@dronecode.org.uk>
Mon, 1 May 2017 10:07:24 +0000 (11:07 +0100)
committerJon Turney <jon.turney@dronecode.org.uk>
Fri, 19 May 2017 18:45:29 +0000 (19:45 +0100)
download.cc

index 5cc5e2bf929191eb6de7b3ab6bba5f859542b51c..59af2d61b9dd22bbefe2d11562fe845aa0a09d2f 100644 (file)
@@ -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)
   {
This page took 0.033135 seconds and 5 git commands to generate.