/[svn]/linuxsampler/trunk/src/common/Path.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/Path.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1337 by schoenebeck, Sun Sep 9 12:22:34 2007 UTC revision 1338 by schoenebeck, Sun Sep 9 23:30:34 2007 UTC
# Line 35  std::string Path::toPosix() { Line 35  std::string Path::toPosix() {
35      // and http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_266 )      // and http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_266 )
36      std::string result;      std::string result;
37      for (int iElement = 0; iElement < elements.size(); iElement++) {      for (int iElement = 0; iElement < elements.size(); iElement++) {
38          // encode forward slashes          // encode percent characters
39          std::string e = elements[iElement];          std::string e = elements[iElement];
40          for (          for (
41                int pos = e.find("%"); pos != std::string::npos;
42                pos = e.find("%", pos+2)
43            ) e.replace(pos/*offset*/, 1/*length*/, "%%"/*by*/);
44            // encode forward slashes
45            for (
46              int pos = e.find("/"); pos != std::string::npos;              int pos = e.find("/"); pos != std::string::npos;
47              pos = e.find("/", pos+1)              pos = e.find("/", pos+3)
48          ) e.replace(pos/*offset*/, 1/*length*/, "%2f"/*by*/);          ) e.replace(pos/*offset*/, 1/*length*/, "%2f"/*by*/);
49          // append encoded node to full encoded path          // append encoded node to full encoded path
50          result += "/" + e;          result += "/" + e;

Legend:
Removed from v.1337  
changed lines
  Added in v.1338

  ViewVC Help
Powered by ViewVC