ohgreat Posted October 5, 2005 Share Posted October 5, 2005 expandcollapse popupvoid Variant::Concat(Variant &vOp2) { char *szTempString; const char *szOp2; int nOldLen; //ADDED // This must be a string type ChangeToString(); // Ensure that the other variant has a valid string value and // the m_nStrLen m_nStrAlloc variables - VERY IMPORTANT szOp2 = vOp2.szValue(); nOldLen = m_nStrLen; //ADDED // Get new total string length m_nStrLen += vOp2.m_nStrLen; // Do we have enough space for the concat? if ( (m_nStrLen+1) > m_nStrAlloc) // +1 for \0 { // Create DOUBLE the space we need (room to grow) m_nStrAlloc = (m_nStrLen << 1) + 1; szTempString = new char[m_nStrAlloc]; strcpy(szTempString, m_szValue); // strcat(szTempString, szOp2); //REMOVED strcpy(szTempString + nOldLen, szOp2); //ADDED delete [] m_szValue; m_szValue = szTempString; } else // strcat(szTempString, szOp2); //REMOVED strcpy(szTempString + nOldLen, szOp2); //ADDED } // Concat() Link to comment Share on other sites More sharing options...
jpm Posted October 5, 2005 Share Posted October 5, 2005 The beta is running with such code already, even using memcpy instead of strcpy. Thanks for trying to improve AutoIt internals Link to comment Share on other sites More sharing options...
ohgreat Posted October 5, 2005 Author Share Posted October 5, 2005 The beta is running with such code already, even using memcpy instead of strcpy.Thanks for trying to improve AutoIt internals Great stuff! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now