add back a check for the negative value

thx Christoph_vW notes this mistake.

svn path=/trunk/; revision=33043
This commit is contained in:
Magnus Olsen
2008-04-20 06:25:30 +00:00
parent 73b7a87d10
commit 4dd244dc00
+15 -7
View File
@@ -1164,15 +1164,23 @@ GetEnvVarOrSpecial ( LPCTSTR varName )
if (position)
{
position += 2;
Token = _tcstok(position, _T(","));
while ((Token != NULL) && (i < 2))
if (_tcschr(position, _T(',')) != NULL)
{
StringPart[i] = _ttoi(Token);
i++;
Token = _tcstok (NULL, _T(","));
Token = _tcstok(position, _T(","));
while ((Token != NULL) && (i < 2))
{
StringPart[i] = _ttoi(Token);
i++;
Token = _tcstok (NULL, _T(","));
}
if (i > 0)
{
if (StringPart[1] < 0)
StringPart[1] = _tcslen(ret + StringPart[0]) + StringPart[1];
_tcsncpy(ReturnValue, ret + StringPart[0], StringPart[1]);
_tcscpy(ret, ReturnValue);
}
}
_tcsncpy(ReturnValue, ret + StringPart[0], StringPart[1]);
_tcscpy(ret, ReturnValue);
return ret;
}
else