MCPcopy Create free account
hub / github.com/devsisters/libquic / EscapeBytesAsInvalidJSONString

Function EscapeBytesAsInvalidJSONString

src/base/json/string_escape.cc:143–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143std::string EscapeBytesAsInvalidJSONString(const StringPiece& str,
144 bool put_in_quotes) {
145 std::string dest;
146
147 if (put_in_quotes)
148 dest.push_back('"');
149
150 for (StringPiece::const_iterator it = str.begin(); it != str.end(); ++it) {
151 unsigned char c = *it;
152 if (EscapeSpecialCodePoint(c, &dest))
153 continue;
154
155 if (c < 32 || c > 126)
156 base::StringAppendF(&dest, kU16EscapeFormat, c);
157 else
158 dest.push_back(*it);
159 }
160
161 if (put_in_quotes)
162 dest.push_back('"');
163
164 return dest;
165}
166
167} // namespace base

Callers

nothing calls this directly

Calls 5

EscapeSpecialCodePointFunction · 0.85
StringAppendFFunction · 0.85
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected