Re: [PATCH setup 08/15] Fix comments and indentation in check_for_cached

2017-05-23 Thread Achim Gratz
Jon Turney writes:
> +  /* 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();
> +

That part of the patch was a bit premature, but I see you've already
fixed it.  I found that interestingly it only crashed on 64bit, which
seems a bit odd, but maybe that's Windows for you.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds


[PATCH setup 08/15] Fix comments and indentation in check_for_cached

2017-05-16 Thread Jon Turney
---
 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