[Cmake-commits] [cmake-commits] alex committed cmIncludeDirectoryCommand.cxx 1.30 1.31
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Mar 12 19:24:29 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv28907
Modified Files:
cmIncludeDirectoryCommand.cxx
Log Message:
BUG: fix #8704, sometimes crash if include_directories() is called with a whitespace string
Alex
Index: cmIncludeDirectoryCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIncludeDirectoryCommand.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -C 2 -d -r1.30 -r1.31
*** cmIncludeDirectoryCommand.cxx 8 Mar 2008 14:50:56 -0000 1.30
--- cmIncludeDirectoryCommand.cxx 12 Mar 2009 23:24:27 -0000 1.31
***************
*** 95,114 ****
// remove any leading or trailing spaces and \r
! pos = ret.size()-1;
! while(ret[pos] == ' ' || ret[pos] == '\r')
! {
! ret.erase(pos);
! pos--;
! }
! pos = 0;
! while(ret.size() && ret[pos] == ' ' || ret[pos] == '\r')
{
! ret.erase(pos,1);
}
! if (!ret.size())
{
! return;
}
!
if (!cmSystemTools::IsOff(ret.c_str()))
{
--- 95,109 ----
// remove any leading or trailing spaces and \r
! std::string::size_type b = ret.find_first_not_of(" \r");
! std::string::size_type e = ret.find_last_not_of(" \r");
! if ((b!=ret.npos) && (e!=ret.npos))
{
! ret.assign(ret, b, 1+e-b); // copy the remaining substring
}
! else
{
! return; // if we get here, we had only whitespace in the string
}
!
if (!cmSystemTools::IsOff(ret.c_str()))
{
More information about the Cmake-commits
mailing list