MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / hexdump

Function hexdump

tools/cdb2sql/cdb2sql.cpp:123–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123static void hexdump(FILE *f, uint8_t *p, int len)
124{
125 char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
126 const int sz = 8 * 1024;
127 char buf[sz + 1];
128 buf[sz] = 0;
129 int counter = 0;
130 for (int i = 0; i < len; i++) {
131 uint8_t byte = *p;
132 ++p;
133 buf[counter++] = hex[byte >> 4];
134 buf[counter++] = hex[byte & 0x0f];
135 if (counter == sz) {
136 fprintf(f, "%s", buf);
137 counter = 0;
138 }
139 }
140 if (counter) {
141 buf[counter] = 0;
142 fprintf(f, "%s", buf);
143 }
144}
145
146void dumpstring(FILE *f, char *s, int quotes, int quote_quotes)
147{

Callers 1

print_columnFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected