Browse Source

Changes following review

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 12 years ago
parent
commit
bd1187922b
3 changed files with 14 additions and 16 deletions
  1. 6 8
      dali/base/dadfs.cpp
  2. 6 6
      dali/base/dafdesc.cpp
  3. 2 2
      esp/services/ws_dfu/ws_dfuService.cpp

+ 6 - 8
dali/base/dadfs.cpp

@@ -2162,7 +2162,8 @@ class CFileChangeWriteLock
     Owned<IPropertyTree> &root;
     unsigned timeoutMs, prevMode;
 public:
-    CFileChangeWriteLock(Owned<IRemoteConnection> &_conn, unsigned _timeoutMs, Owned<IPropertyTree> &_root) : conn(_conn), timeoutMs(_timeoutMs), root(_root)
+    CFileChangeWriteLock(Owned<IRemoteConnection> &_conn, unsigned _timeoutMs, Owned<IPropertyTree> &_root)
+        : conn(_conn), timeoutMs(_timeoutMs), root(_root)
     {
         prevMode = conn->queryMode();
         unsigned newMode = (prevMode & ~RTM_LOCKBASIC_MASK) | RTM_LOCK_WRITE;
@@ -2773,9 +2774,6 @@ protected:
                 Owned<IFileDescriptor> fdesc = getFileDescriptor(clusterName);
                 fdesc->serialize(mb);
                 fileDescCopy.setown(deserializeFileDescriptor(mb));
-
-                const char *dir = fileDescCopy->queryDefaultDir();
-
             }
 
             bool removeFile=true;
@@ -2875,7 +2873,7 @@ protected:
                 }
             }
         } afor(fileDesc, mexcept);
-        afor.islazy = 0 != fileDesc->queryProperties().getPropInt("@lazy");
+        afor.islazy = fileDesc->queryProperties().getPropBool("@lazy");
         afor.For(fileDesc->numParts(),10,false,true);
         return afor.ok;
     }
@@ -5583,14 +5581,14 @@ public:
 
     virtual bool removeCluster(const char *clustername)
     {
-        bool tf=false;
+        bool clusterRemoved=false;
         CriticalBlock block (sect);
         clusterscache.clear();
         ForEachItemIn(i,subfiles) {
             IDistributedFile &f=subfiles.item(i);
-            tf |= f.removeCluster(clustername);
+            clusterRemoved |= f.removeCluster(clustername);
         }       
-        return tf;
+        return clusterRemoved;
     }
 
     void setPreferredClusters(const char *clusters)

+ 6 - 6
dali/base/dafdesc.cpp

@@ -1919,25 +1919,25 @@ public:
         {
             if (!done)
                 done = 1;
-            bool resetDefaultDir=false;
+            StringAttr oldDefaultDir;
             StringBuffer baseDir1;
             while (clusters.ordinality()>done)
             {
                 clusters.item(clusters.ordinality()-1).getBaseDir(baseDir1.clear(),SepCharBaseOs(getPathSepChar(directory)));
 
                 // if baseDir is leading component this file's default directory..
-                if (directory.length()>=baseDir1.length() && 0==strncmp(directory, baseDir1, baseDir1.length()) &&
+                if (!oldDefaultDir.length() && directory.length()>=baseDir1.length() && 0==strncmp(directory, baseDir1, baseDir1.length()) &&
                     (directory.length()==baseDir1.length() || isPathSepChar(directory[baseDir1.length()])))
-                    resetDefaultDir = true;
+                    oldDefaultDir.set(baseDir1.str());
                 clusters.remove(clusters.ordinality()-1);
             }
-            if (resetDefaultDir && clusters.ordinality())
+            if (oldDefaultDir.length() && clusters.ordinality())
             {
                 StringBuffer baseDir2;
                 clusters.item(0).getBaseDir(baseDir2.clear(), SepCharBaseOs(getPathSepChar(directory)));
                 StringBuffer newDir(baseDir2.str());
-                if (directory.length()>baseDir1.length())
-                    newDir.append(directory.get()+baseDir1.length());
+                if (directory.length()>oldDefaultDir.length())
+                    newDir.append(directory.get()+oldDefaultDir.length());
                 directory.set(newDir.str());
             }
         }

+ 2 - 2
esp/services/ws_dfu/ws_dfuService.cpp

@@ -1159,10 +1159,10 @@ bool CWsDfuEx::DFUDeleteFiles(IEspContext &context, IEspDFUArrayActionRequest &r
             if (j>0)
             { // 2nd pass, now we want to skip superfiles and the files which cannot do the lookup.
 
-                if (NotFound != superFileNames.find(filename))
+                if (superFileNames.contains(filename))
                     continue;
 
-                if (NotFound != filesCannotBeDeleted.find(filename))
+                if (filesCannotBeDeleted.contains(filename))
                     continue;
             }