From a397922e8d53c6f7ff469d38e5139fd003c705b5 Mon Sep 17 00:00:00 2001 From: Zaba999 Date: Tue, 18 Sep 2012 00:01:00 +0200 Subject: warnings fight in progress. --- src/CBot/CBotString.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/CBot') 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(m_pData); - delete[] (unsigned char *)m_pData; + delete[] reinterpret_cast(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 (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 (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(m_pData); m_pData = pNewData; m_nSize = nNewSize; m_nMaxSize = nNewMax; -- cgit v1.2.3-1-g7c22