[Cmake-commits] [cmake-commits] king committed cmCTest.cxx 1.355 1.356 cmCTest.h 1.114 1.115

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 24 15:43:09 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv6423/Source

Modified Files:
	cmCTest.cxx cmCTest.h 
Log Message:
ENH: Add cmCTest::DecodeURL method

This new method decodes the "percent-encoding" used in URL syntax.


Index: cmCTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.h,v
retrieving revision 1.114
retrieving revision 1.115
diff -C 2 -d -r1.114 -r1.115
*** cmCTest.h	13 Feb 2009 16:49:26 -0000	1.114
--- cmCTest.h	24 Feb 2009 20:43:06 -0000	1.115
***************
*** 311,314 ****
--- 311,317 ----
    static std::string MakeURLSafe(const std::string&);
  
+   /** Decode a URL to the original string.  */
+   static std::string DecodeURL(const std::string&);
+ 
    //! Should ctect configuration be updated. When using new style ctest
    // script, this should be true.

Index: cmCTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.cxx,v
retrieving revision 1.355
retrieving revision 1.356
diff -C 2 -d -r1.355 -r1.356
*** cmCTest.cxx	10 Feb 2009 21:08:40 -0000	1.355
--- cmCTest.cxx	24 Feb 2009 20:43:06 -0000	1.356
***************
*** 48,51 ****
--- 48,52 ----
  #include <math.h>
  #include <float.h>
+ #include <ctype.h>
  
  #include <memory> // auto_ptr
***************
*** 181,184 ****
--- 182,205 ----
  }
  
+ //----------------------------------------------------------------------------
+ std::string cmCTest::DecodeURL(const std::string& in)
+ {
+   std::string out;
+   for(const char* c = in.c_str(); *c; ++c)
+     {
+     if(*c == '%' && isxdigit(*(c+1)) && isxdigit(*(c+2)))
+       {
+       char buf[3] = {*(c+1), *(c+2), 0};
+       out.append(1, char(strtoul(buf, 0, 16)));
+       c += 2;
+       }
+     else
+       {
+       out.append(1, *c);
+       }
+     }
+   return out;
+ }
+ 
  //----------------------------------------------------------------------
  cmCTest::cmCTest()



More information about the Cmake-commits mailing list