Changeset 6994 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 05/04/05 16:53:10 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r6858 r6994 856 856 // Replace source by destination 857 857 const TRegexp regexp(src); 858 while (1) 859 { 860 idx = regexp.Index(fname, &len); 858 859 Ssiz_t ichar = 0; 860 while (1) // Replace all occurrences of src by dest 861 { 862 idx = regexp.Index(fname, &len, ichar); 861 863 if (idx<0) 862 864 break; 863 865 864 866 fname.Replace(idx, len, dest); 867 ichar = idx + dest.Length(); 868 869 // In next iteration, we start searching the string fname 870 // right after the last character of the previous substitution 871 // (indicated by ichar). This avoids infinite loops in the case 872 // we want to replace, for instance, "_w" by "_Y_w". Without 873 // the use of ichar, the second string would be replaced by 874 // "_Y_Y_w", and this would never end... 865 875 } 866 876 }
Note:
See TracChangeset
for help on using the changeset viewer.