MCPcopy Create free account
hub / github.com/apache/brpc / AppendChunkHead

Function AppendChunkHead

src/brpc/progressive_attachment.cpp:75–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73inline char ToHex(uint32_t size/*0-15*/) { return s_hex_map[size]; }
74
75inline void AppendChunkHead(butil::IOBuf* buf, uint32_t size) {
76 char tmp[32];
77 int i = (int)sizeof(tmp);
78 tmp[--i] = '\n';
79 tmp[--i] = '\r';
80 if (size == 0) {
81 tmp[--i] = '0';
82 } else {
83 for (--i; i >= 0; --i) {
84 const uint32_t new_size = (size >> 4);
85 tmp[i] = ToHex(size - (new_size << 4));
86 size = new_size;
87 if (size == 0) {
88 --i;
89 break;
90 }
91 }
92 }
93 buf->append(tmp + i + 1, sizeof(tmp) - i - 1);
94}
95
96inline void AppendAsChunk(butil::IOBuf* chunk_buf, const butil::IOBuf& data,
97 bool before_http_1_1) {

Callers 1

AppendAsChunkFunction · 0.85

Calls 2

ToHexFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected