소스 검색

BUG: end is not really end, but rather length

Bill Hoffman 20 년 전
부모
커밋
097debb55a
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      Source/cmStringCommand.cxx
  2. 1 1
      Source/cmStringCommand.h

+ 1 - 1
Source/cmStringCommand.cxx

@@ -555,7 +555,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& arg
     return false;
     }
   int leftOverLength = intStringLength - begin;
-  if ( end < 0 || end > intStringLength )
+  if ( end < 0 || end > leftOverLength )
     {
     cmOStringStream ostr;
     ostr << "end index: " << end << " is out of range " << 0 << " - " << leftOverLength;

+ 1 - 1
Source/cmStringCommand.h

@@ -84,7 +84,7 @@ public:
       "  STRING(TOUPPER <string1> <output variable>)\n"
       "  STRING(TOLOWER <string1> <output variable>)\n"
       "  STRING(LENGTH <string> <output variable>)\n"
-      "  STRING(SUBSTRING <string> <begin> <end> <output variable>)\n"
+      "  STRING(SUBSTRING <string> <begin> <length> <output variable>)\n"
       "REGEX MATCH will match the regular expression once and store the "
       "match in the output variable.\n"
       "REGEX MATCHALL will match the regular expression as many times as "