Pārlūkot izejas kodu

KWSys: Do not mangle UNC paths in ConvertToUnixOutputPath (#10206)

This method replaces '//' with '/' to make the paths look nicer.
Originally it correctly skipped a leading '//' in a UNC path as the
comment says.  However, commit "Removed extra variable initializations"
(2005-04-15) accidentally removed the "pos=1" initializer.  It was then
incorrectly restored by commit "Added missing variable initialization"
(2005-04-15) as just "pos=0".  Restore the proper initializer.

The test for this added by commit "better coverage" (2006-07-31)
included incorrect output for a sample UNC-like path.  Fix it.
Brad King 15 gadi atpakaļ
vecāks
revīzija
3a14b6e556
2 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 1 1
      Source/kwsys/SystemTools.cxx
  2. 1 1
      Source/kwsys/testSystemTools.cxx

+ 1 - 1
Source/kwsys/SystemTools.cxx

@@ -1640,7 +1640,7 @@ kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path)
   kwsys_stl::string ret = path;
   
   // remove // except at the beginning might be a cygwin drive
-  kwsys_stl::string::size_type pos=0;
+  kwsys_stl::string::size_type pos=1;
   while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
     {
     ret.erase(pos, 1);

+ 1 - 1
Source/kwsys/testSystemTools.cxx

@@ -297,7 +297,7 @@ bool CheckStringOperations()
 
   if (kwsys::SystemTools::ConvertToUnixOutputPath
       ("//Local Mojo/Hex Power Pack/Iffy Voodoo") != 
-      "/Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo")
+      "//Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo")
     {
     kwsys_ios::cerr
       << "Problem with ConvertToUnixOutputPath "