MCPcopy Create free account
hub / github.com/acl-dev/acl / push_pop

Method push_pop

lib_acl_cpp/src/mime/mime_code.cpp:310–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310int mime_code::push_pop(const char* in, size_t len,
311 string* out, size_t max /* = 0 */)
312{
313 if (m_pBuf == NULL) {
314 m_pBuf = NEW string(1024);
315 }
316
317 if (in && len > 0) {
318 if (m_encoding) {
319 encode_update(in, (int) len, m_pBuf);
320 } else {
321 decode_update(in, (int) len, m_pBuf);
322 }
323 }
324
325 if (out == NULL) {
326 return 0;
327 }
328
329 len = m_pBuf->length();
330 if (len == 0) {
331 return 0;
332 }
333
334 size_t n;
335 if (max > 0) {
336 n = max > len ? len : max;
337 } else {
338 n = len;
339 }
340
341 out->append(m_pBuf->c_str(), n);
342
343 if (len > n) {
344 m_pBuf->memmove(m_pBuf->c_str() + n, len - n);
345 } else {
346 m_pBuf->clear();
347 }
348
349 return (int) (n);
350}
351
352int mime_code::pop_end(string* out, size_t max /* = 0 */)
353{

Callers

nothing calls this directly

Calls 5

stringClass · 0.50
lengthMethod · 0.45
appendMethod · 0.45
c_strMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected