MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / copyStack

Method copyStack

lib/YAWidgets/src/LzwDecoder.cpp:297–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297bool 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
329void LzwDecoder::clear()
330{

Callers

nothing calls this directly

Calls 2

deallocateArrayMethod · 0.80
allocateArrayMethod · 0.80

Tested by

no test coverage detected