MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / resize

Function resize

include/internal/CL/cl.hpp:547–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545 }
546
547 void resize( ::size_t n )
548 {
549 if( size_ == n ) {
550 return;
551 }
552 if (n == 0) {
553 if( str_ ) {
554 delete [] str_;
555 }
556 str_ = NULL;
557 size_ = 0;
558 }
559 else {
560 char *newString = new char[n + 1];
561 ::size_t copySize = n;
562 if( size_ < n ) {
563 copySize = size_;
564 }
565 size_ = n;
566
567 if(str_) {
568 memcpy(newString, str_, (copySize + 1) * sizeof(char));
569 }
570 if( copySize < size_ ) {
571 memset(newString + copySize, 0, size_ - copySize);
572 }
573 newString[size_] = '\0';
574
575 delete [] str_;
576 str_ = newString;
577 }
578 }
579
580 const char& operator[] ( ::size_t pos ) const
581 {

Callers

nothing calls this directly

Calls 1

errHandlerFunction · 0.85

Tested by

no test coverage detected