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

Method push_pop

lib_acl_cpp/src/stdlib/charset_conv.cpp:513–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511}
512
513int charset_conv::push_pop(const char* in, size_t len,
514 acl::string* out, size_t max /* = 0 */)
515{
516 if (m_pBuf == NULL) {
517 m_pBuf = NEW acl::string(1024);
518 }
519
520 if (in && len > 0 && !update(in, len, m_pBuf)) {
521 return -1;
522 }
523
524 len = m_pBuf->length();
525 if (len == 0) {
526 return 0;
527 }
528
529 size_t n;
530 if (max > 0) {
531 n = max > len ? len : max;
532 } else {
533 n = len;
534 }
535
536 out->append(m_pBuf->c_str(), n);
537
538 if (len > n) {
539 m_pBuf->memmove(m_pBuf->c_str() + n, len - n);
540 } else {
541 m_pBuf->clear();
542 }
543
544 return (int) n;
545}
546
547int charset_conv::pop_end(acl::string* out, size_t max /* = 0 */)
548{

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected