diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-19 22:53:06 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-19 22:53:06 +0200 |
commit | 7479f486b671acb2a6aea2c84a56b383aaba00ca (patch) | |
tree | 4043545a14234dfaa2d7d08d59c7ee9ee97f0de9 /src/CBot/CBotString.cpp | |
parent | 901f10b2bac18a2063cd21798f22b3917e8519b5 (diff) | |
parent | 57d33d79ea570773d84ad81d4a61f50e079979ef (diff) | |
download | colobot-7479f486b671acb2a6aea2c84a56b383aaba00ca.tar.gz colobot-7479f486b671acb2a6aea2c84a56b383aaba00ca.tar.bz2 colobot-7479f486b671acb2a6aea2c84a56b383aaba00ca.zip |
Forgotten fix in dev-graphics
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; |