[Cmake-commits] [cmake-commits] zach.mullen committed SystemInformation.cxx 1.48 1.49
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Oct 8 10:56:59 EDT 2009
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv17644
Modified Files:
SystemInformation.cxx
Log Message:
Trimmed off the newline from sw_vers output on mac, it could cause xml parsing errors if left in
Index: SystemInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemInformation.cxx,v
retrieving revision 1.48
retrieving revision 1.49
diff -C 2 -d -r1.48 -r1.49
*** SystemInformation.cxx 6 Oct 2009 18:55:48 -0000 1.48
--- SystemInformation.cxx 8 Oct 2009 14:56:55 -0000 1.49
***************
*** 244,247 ****
--- 244,248 ----
bool ParseSysCtl();
void CallSwVers();
+ void TrimNewline(kwsys_stl::string&);
kwsys_stl::string ExtractValueFromSysCtl(const char* word);
kwsys_stl::string SysCtlBuffer;
***************
*** 3391,3394 ****
--- 3392,3396 ----
args.push_back(0);
output = this->RunProcess(args);
+ this->TrimNewline(output);
this->OSName = output;
args.clear();
***************
*** 3398,3401 ****
--- 3400,3404 ----
args.push_back(0);
output = this->RunProcess(args);
+ this->TrimNewline(output);
this->OSRelease = output;
args.clear();
***************
*** 3405,3412 ****
--- 3408,3433 ----
args.push_back(0);
output = this->RunProcess(args);
+ this->TrimNewline(output);
this->OSVersion = output;
#endif
}
+ void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output)
+ {
+ // remove \r
+ kwsys_stl::string::size_type pos=0;
+ while((pos = output.find("\r", pos)) != kwsys_stl::string::npos)
+ {
+ output.erase(pos);
+ }
+
+ // remove \n
+ pos = 0;
+ while((pos = output.find("\n", pos)) != kwsys_stl::string::npos)
+ {
+ output.erase(pos);
+ }
+ }
+
/** Return true if the machine is 64 bits */
bool SystemInformationImplementation::Is64Bits()
More information about the Cmake-commits
mailing list