| 261 | } |
| 262 | |
| 263 | bool InputBuffer::SubBuffer(uint32_t length, InputBuffer* sub_buffer) |
| 264 | { |
| 265 | if (m_Current + length > m_End) |
| 266 | { |
| 267 | return false; |
| 268 | } |
| 269 | #if 0 |
| 270 | const char* c = m_Current; |
| 271 | m_Current += length; |
| 272 | return InputBuffer(c, length); |
| 273 | #else |
| 274 | InputBuffer ret = InputBuffer(m_Start, m_End - m_Start); |
| 275 | // NOTE: Very important to preserve start. Tell() is used to |
| 276 | // uniquely identify repeated fields. See function DDFCalculateRepeated(.) |
| 277 | ret.m_Start = m_Start; |
| 278 | ret.m_Current = m_Current; |
| 279 | ret.m_End = m_Current + length; |
| 280 | m_Current += length; |
| 281 | *sub_buffer = ret; |
| 282 | return true; |
| 283 | #endif |
| 284 | } |
| 285 | } |
no test coverage detected