MCPcopy Create free account
hub / github.com/SmingHub/Sming / getBytes

Method getBytes

Sming/Wiring/WString.cpp:666–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666size_t String::getBytes(unsigned char* buf, size_t bufsize, size_t index) const
667{
668 if(!bufsize || !buf) {
669 return 0;
670 }
671 auto len = length();
672 if(index >= len) {
673 buf[0] = '\0';
674 return 0;
675 }
676 size_t n = bufsize - 1;
677 if(n > len - index) {
678 n = len - index;
679 }
680 memmove(buf, cbuffer() + index, n);
681 buf[n] = '\0';
682 return n;
683}
684
685/*********************************************/
686/* Search */

Callers 2

executeMethod · 0.80
configMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected