MCPcopy Create free account
hub / github.com/Segs/Segs / PopFront

Method PopFront

Components/Buffer.cpp:149–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147 m_read_off += len;
148}
149void GrowingBuffer::PopFront(uint32_t pop_count)
150{
151 if(pop_count>m_size)
152 {
153 m_write_off=0;
154 m_read_off=0;
155 return;
156 }
157 if(m_write_off < pop_count) // if there is any reason to memmove
158 {
159 m_write_off = m_read_off = 0;
160 return;
161 }
162 memmove(m_buf,&m_buf[pop_count],m_write_off-pop_count); // shift buffer contents to the left
163 m_write_off-=pop_count;
164 if(m_read_off<pop_count)
165 m_read_off=0;
166 else
167 m_read_off-=pop_count;
168
169}
170
171/** this method will try to resize GrowingBuffer to accommodate_size elements (in reality it preallocates a 'few' more )
172 if the new size is 0, then internal buffer object is deleted, freeing all memory

Callers 2

bytes_to_eventFunction · 0.80
send_bufferFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected