MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / EncodeChar

Function EncodeChar

src/tripwire/mailmessage.cpp:281–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281static std::string EncodeChar(char ch)
282{
283 std::ostringstream ss;
284
285 ss.imbue(std::locale::classic());
286 ss.fill('0');
287 ss.setf(std::ios_base::hex, std::ios_base::basefield);
288 ss.width(2);
289
290 ss << (unsigned int)(unsigned char)ch;
291
292 ASSERT(ss.str().length() == 2);
293
294 // Make sure the hex is uppercase
295 std::string s = ss.str();
296 std::transform(s.begin(), s.end(), s.begin(), toupper);
297
298 return s;
299}
300
301
302/* static */

Callers 1

EncodeMethod · 0.85

Calls 3

beginMethod · 0.80
endMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected