| 170 | //************************************************************************************************* |
| 171 | template <typename T> |
| 172 | void XBuffer<T>::Initialize(const T* p, size_t count, size_t index) |
| 173 | { |
| 174 | if ( p!=NULL && count>0 ) |
| 175 | { |
| 176 | m_allocatedSize = count; |
| 177 | _WData = (unsigned char*)malloc(m_allocatedSize); |
| 178 | if ( !_WData ) { |
| 179 | panic("XBuffer<T>::Initialize(%zu) : malloc returned NULL. System halted\n", count); |
| 180 | } |
| 181 | memcpy(_WData, p, count); |
| 182 | XRBuffer<T>::_RData = _WData; |
| 183 | XRBuffer<T>::m_size = count; |
| 184 | XRBuffer<T>::_Index = index; |
| 185 | } |
| 186 | else{ |
| 187 | m_allocatedSize = 0; |
| 188 | _WData = NULL; |
| 189 | XRBuffer<T>::_RData = NULL; |
| 190 | XRBuffer<T>::m_size = 0; |
| 191 | XRBuffer<T>::_Index = 0; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | //------------------------------------------------------------------------------------------------- |
| 196 | // CheckSize |
no test coverage detected