MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / PrintBytesInObjectToImpl

Function PrintBytesInObjectToImpl

tests/gtest/gtest-all.cc:11186–11206  ·  view source on GitHub ↗

Prints the bytes in the given value to the given ostream.

Source from the content-addressed store, hash-verified

11184
11185// Prints the bytes in the given value to the given ostream.
11186void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,
11187 ostream* os) {
11188 // Tells the user how big the object is.
11189 *os << count << "-byte object <";
11190
11191 const size_t kThreshold = 132;
11192 const size_t kChunkSize = 64;
11193 // If the object size is bigger than kThreshold, we'll have to omit
11194 // some details by printing only the first and the last kChunkSize
11195 // bytes.
11196 if (count < kThreshold) {
11197 PrintByteSegmentInObjectTo(obj_bytes, 0, count, os);
11198 } else {
11199 PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os);
11200 *os << " ... ";
11201 // Rounds up to 2-byte boundary.
11202 const size_t resume_pos = (count - kChunkSize + 1)/2*2;
11203 PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os);
11204 }
11205 *os << ">";
11206}
11207
11208} // namespace
11209

Callers 1

PrintBytesInObjectToFunction · 0.85

Calls 1

Tested by

no test coverage detected