MCPcopy Create free account
hub / github.com/apache/qpid-proton / pn_buffer_get

Function pn_buffer_get

c/src/core/buffer.c:169–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169size_t pn_buffer_get(pn_buffer_t *buf, size_t offset, size_t size, char *dst)
170{
171 size = pn_min(size, buf->size);
172 size_t start = pni_buffer_index(buf, offset);
173 size_t stop = pni_buffer_index(buf, offset + size);
174
175 if (size == 0) return 0;
176
177 size_t sz1;
178 size_t sz2;
179
180 if (start >= stop) {
181 sz1 = buf->capacity - start;
182 sz2 = stop;
183 } else {
184 sz1 = stop - start;
185 sz2 = 0;
186 }
187
188 memcpy(dst, buf->bytes + start, sz1);
189 memcpy(dst + sz1, buf->bytes, sz2);
190
191 return sz1 + sz2;
192}
193
194int pn_buffer_trim(pn_buffer_t *buf, size_t left, size_t right)
195{

Callers 3

pn_link_recvFunction · 0.85
pn_dispatcher_outputFunction · 0.85

Calls 1

pni_buffer_indexFunction · 0.85

Tested by

no test coverage detected