MCPcopy Create free account
hub / github.com/apache/impala / CEscape

Function CEscape

be/src/gutil/strings/escaping.cc:584–591  ·  view source on GitHub ↗

---------------------------------------------------------------------- CEscape() CHexEscape() Utf8SafeCEscape() Utf8SafeCHexEscape() Copies 'src' to result, escaping dangerous characters using C-style escape sequences. This is very useful for preparing query flags. 'src' and 'dest' should not overlap. The 'Hex' version hexadecimal rather than octal sequences. The 'Utf8Safe' version doesn't touch U

Source from the content-addressed store, hash-verified

582// Currently only \n, \r, \t, ", ', \ and !ascii_isprint() chars are escaped.
583// ----------------------------------------------------------------------
584string CEscape(const StringPiece& src) {
585 const int dest_length = src.size() * 4 + 1; // Maximum possible expansion
586 unique_ptr<char[]> dest(new char[dest_length]);
587 const int len = CEscapeInternal(src.data(), src.size(),
588 dest.get(), dest_length, false, false);
589 DCHECK_GE(len, 0);
590 return string(dest.get(), len);
591}
592
593string CHexEscape(const StringPiece& src) {
594 const int dest_length = src.size() * 4 + 1; // Maximum possible expansion

Callers 1

SubstitutedSizeFunction · 0.85

Calls 4

CEscapeInternalFunction · 0.85
getMethod · 0.65
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected