diff options
author | Zaba999 <zaba.marcin@gmail.com> | 2012-09-18 00:01:00 +0200 |
---|---|---|
committer | Zaba999 <zaba.marcin@gmail.com> | 2012-09-18 00:01:00 +0200 |
commit | a397922e8d53c6f7ff469d38e5139fd003c705b5 (patch) | |
tree | 8f6e92a0ac59d655e5fcc48bd198aa1bae25f0db /src/CBot/CBotString.cpp | |
parent | 844e11db4f394004258cdca8f8fd8bc95c41a985 (diff) | |
download | colobot-a397922e8d53c6f7ff469d38e5139fd003c705b5.tar.gz colobot-a397922e8d53c6f7ff469d38e5139fd003c705b5.tar.bz2 colobot-a397922e8d53c6f7ff469d38e5139fd003c705b5.zip |
warnings fight in progress.
Diffstat (limited to 'src/CBot/CBotString.cpp')
-rw-r--r-- | src/CBot/CBotString.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/CBot/CBotString.cpp b/src/CBot/CBotString.cpp index 7223e6f..84f9ca2 100644 --- a/src/CBot/CBotString.cpp +++ b/src/CBot/CBotString.cpp @@ -597,18 +597,6 @@ static void DestructElements(CBotString* pOldData, int nCount) } } -static void CopyElements(CBotString* pDest, CBotString* pSrc, int nCount) -{ - while (nCount--) - { - *pDest = *pSrc; - ++pDest; - ++pSrc; - } -} - - - // set the array size void CBotStringArray::SetSize(int nNewSize) @@ -618,15 +606,14 @@ void CBotStringArray::SetSize(int nNewSize) // shrink to nothing DestructElements(m_pData, m_nSize); -// delete[] static_cast<unsigned char *>(m_pData); - delete[] (unsigned char *)m_pData; + delete[] reinterpret_cast<unsigned char *>(m_pData); m_pData = NULL; m_nSize = m_nMaxSize = 0; } else if (m_pData == NULL) { // create one with exact size - m_pData = (CBotString*) new unsigned char[nNewSize * sizeof(CBotString)]; + m_pData = reinterpret_cast<CBotString*> (new unsigned char[nNewSize * sizeof(CBotString)]); ConstructElements(m_pData, nNewSize); @@ -663,7 +650,7 @@ void CBotStringArray::SetSize(int nNewSize) else nNewMax = nNewSize; // no slush - CBotString* pNewData = (CBotString*) new unsigned char[nNewMax * sizeof(CBotString)]; + CBotString* pNewData = reinterpret_cast<CBotString*> (new unsigned char[nNewMax * sizeof(CBotString)]); // copy new data from old memcpy(pNewData, m_pData, m_nSize * sizeof(CBotString)); @@ -673,7 +660,7 @@ void CBotStringArray::SetSize(int nNewSize) // Get rid of old stuff (note: no destructors called) - delete[] (unsigned char *)m_pData; + delete[] reinterpret_cast<unsigned char *>(m_pData); m_pData = pNewData; m_nSize = nNewSize; m_nMaxSize = nNewMax; |