mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-27 15:25:30 +03:00
Use a variable for input string length in logic_substring
This commit is contained in:
parent
41cde5ccf7
commit
99a8bdcb37
@ -66,13 +66,14 @@ void CLogicSubstring::InputInValue( inputdata_t &inputData )
|
|||||||
{
|
{
|
||||||
if( !m_bEnabled ) return;
|
if( !m_bEnabled ) return;
|
||||||
|
|
||||||
int startPosCheck = m_nStartPos < 0 ? Q_strlen(inputData.value.String()) + m_nStartPos : m_nStartPos;
|
int inputLength = Q_strlen(inputData.value.String());
|
||||||
|
int startPosCheck = m_nStartPos < 0 ? inputLength + m_nStartPos : m_nStartPos;
|
||||||
if( startPosCheck < 0 )
|
if( startPosCheck < 0 )
|
||||||
{
|
{
|
||||||
startPosCheck = 0;
|
startPosCheck = 0;
|
||||||
}
|
}
|
||||||
int lengthCheck = (m_nLength < 0 || m_nLength > Q_strlen(inputData.value.String()) - startPosCheck ? Q_strlen(inputData.value.String()) - startPosCheck : m_nLength) + 1;
|
int lengthCheck = (m_nLength < 0 || m_nLength > inputLength - startPosCheck ? inputLength - startPosCheck : m_nLength) + 1;
|
||||||
if( lengthCheck < 1 || startPosCheck > Q_strlen(inputData.value.String()) )
|
if( lengthCheck < 1 || startPosCheck > inputLength )
|
||||||
{
|
{
|
||||||
m_OutValue.Set( MAKE_STRING(""), inputData.pActivator, this );
|
m_OutValue.Set( MAKE_STRING(""), inputData.pActivator, this );
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user