Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 3943)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 3944)
@@ -19,4 +19,13 @@
                                                  -*-*- END OF LINE -*-*-
 
+ 2004/05/03: Thomas Bretz
+
+   * mbase/MRunIter.cc:
+     - AddRuns(char*) added some const-qualifiers
+     - replaced deprecated if-else-if by continue- and return-
+       constructions
+
+
+
  2004/05/03: Javier Lopez
  
@@ -26,4 +35,5 @@
 
 
+
  2004/05/03: Markus Gaug
 
@@ -36,5 +46,4 @@
    * msignal/MExtractTimeHighestIntegral.h
      - changed name of base class to MExtractTime
-
 
    * mcalib/MCalibrationCam.[h,cc]
@@ -62,4 +71,6 @@
        bootcampstandardanalysis.C
      - take out pixvstime.C which does not exist
+
+
 
  2004/05/01: Thomas Bretz
Index: /trunk/MagicSoft/Mars/mbase/MRunIter.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MRunIter.cc	(revision 3943)
+++ /trunk/MagicSoft/Mars/mbase/MRunIter.cc	(revision 3944)
@@ -72,52 +72,58 @@
 Int_t MRunIter::AddRuns(const char* runrange, const char* path)
 { 
-  TString chcopy = runrange;
-  Ssiz_t  last=0;
-  Int_t   lowrun=-1;
-  Int_t   upprun;
-  UInt_t  totdir=0;
-
-
-  // loop over the elements of the character chain 
-  for(Int_t i=0;i<chcopy.Length();i++)
+    const TString chcopy(runrange);
+  
+    Ssiz_t last=0;
+    Int_t  lowrun=-1;
+    UInt_t totdir=0;
+  
+    // loop over the elements of the character chain 
+    for (Int_t i=0;i<chcopy.Length();i++)
     {
-      // look for a digit, a '-' or a ',' 
-      char c=chcopy[i];
-      if(! ((c>='0' && c<='9') || c=='-' || c==','))
-	return totdir;
-      
-      // if '-' is found, save the previous number as initial run
-      else if(c=='-' && lowrun<0 && i>last)
-	{
-	  TSubString chrun = chcopy(last,i-last);
-	  lowrun=atoi(chrun.Data());	  	  
-	  last=i+1;
-	}
-      // if ',' or the end of the string are found, save the previous run or run range
-      else if(c==',' && i>last)
-	{
-	  TSubString chrun = chcopy(last,i-last);
-	  upprun=atoi(chrun.Data());	  	  
-	  if(lowrun>=0 && lowrun<=upprun)
-	    totdir+=AddRuns(lowrun,upprun,path);
-	  else if(lowrun<0)
-	    totdir+=AddRun(upprun,path);	  
-	  
-	  lowrun=-1;
-	  last=i+1;
-	}
-      // if find two contiguous separators exit
-      else if((c=='-' && i==last) || (c==',' && i==last))
-	return totdir;
+        // look for a digit, a '-' or a ',' 
+        const char c=chcopy[i];
+        if (! ((c>='0' && c<='9') || c=='-' || c==','))
+            return totdir;
+        
+        // if '-' is found, save the previous number as initial run
+        if (c=='-' && lowrun<0 && i>last)
+        {
+            const TSubString chrun = chcopy(last,i-last);
+            lowrun=atoi(chrun.Data());	  	  
+            last=i+1;
+            continue;
+        }
+        // if ',' or the end of the string are found, save the previous run or run range
+        if (c==',' && i>last)
+        {
+            const TSubString chrun = chcopy(last,i-last);
+            const Int_t up=atoi(chrun.Data());
+            if(lowrun>=0 && lowrun<=up)
+                totdir+=AddRuns(lowrun,up,path);
+            else if(lowrun<0)
+                totdir+=AddRun(up,path);
+            
+            lowrun=-1;
+            last=i+1;
+            continue;
+        }
+  
+        // if find two continous separators exit
+        if ((c=='-' && i==last) || (c==',' && i==last))
+            return totdir;
     }
-
-  // save last run range
-  TSubString chrun = chcopy(last,chcopy.Length()-last);
-  upprun=atoi(chrun.Data());	  	  
-  if(lowrun>=0 && lowrun<=upprun)
-    totdir+=AddRuns(lowrun,upprun,path);
-  else if(lowrun<0)
-    totdir+=AddRun(upprun,path);	  
-
-  return totdir;
+  
+    // save last run range
+    const TSubString chrun = chcopy(last,chcopy.Length()-last);
+    const Int_t upprun=atoi(chrun.Data());
+    if(lowrun>=0 && lowrun<=upprun)
+    {
+        totdir+=AddRuns(lowrun,upprun,path);
+        return totdir;
+    }
+  
+    if(lowrun<0)
+        totdir+=AddRun(upprun,path);
+  
+    return totdir;
 }
