| 147 | m_read_off += len; |
| 148 | } |
| 149 | void 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 |
no outgoing calls
no test coverage detected