| 295 | } |
| 296 | |
| 297 | bool LzwDecoder::copyStack(const LzwDecoder& other) |
| 298 | { |
| 299 | bool isSuccessful = true; |
| 300 | |
| 301 | if (nullptr != m_stack) |
| 302 | { |
| 303 | m_stackAllocator.deallocateArray(m_stack); |
| 304 | m_stack = nullptr; |
| 305 | m_stackPtr = nullptr; |
| 306 | } |
| 307 | |
| 308 | if (nullptr != other.m_stack) |
| 309 | { |
| 310 | m_stack = m_stackAllocator.allocateArray(STACK_SIZE); |
| 311 | |
| 312 | if (nullptr == m_stack) |
| 313 | { |
| 314 | isSuccessful = false; |
| 315 | } |
| 316 | else |
| 317 | { |
| 318 | for (size_t idx = 0U; idx < STACK_SIZE; ++idx) |
| 319 | { |
| 320 | m_stack[idx] = other.m_stack[idx]; |
| 321 | } |
| 322 | m_stackPtr = m_stack + (other.m_stackPtr - other.m_stack); |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | return isSuccessful; |
| 327 | } |
| 328 | |
| 329 | void LzwDecoder::clear() |
| 330 | { |
nothing calls this directly
no test coverage detected