MCPcopy Create free account
hub / github.com/OpenPrinting/cups / http_debug_hex

Function http_debug_hex

cups/http.c:4104–4152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4102 */
4103
4104static void
4105http_debug_hex(const char *prefix, /* I - Prefix for line */
4106 const char *buffer, /* I - Buffer to dump */
4107 int bytes) /* I - Bytes to dump */
4108{
4109 int i, j, /* Looping vars */
4110 ch; /* Current character */
4111 char line[255], /* Line buffer */
4112 *start, /* Start of line after prefix */
4113 *ptr; /* Pointer into line */
4114
4115
4116 if (_cups_debug_fd < 0 || _cups_debug_level < 6)
4117 return;
4118
4119 DEBUG_printf(("9%s: %d bytes:", prefix, bytes));
4120
4121 snprintf(line, sizeof(line), "9%s: ", prefix);
4122 start = line + strlen(line);
4123
4124 for (i = 0; i < bytes; i += 16)
4125 {
4126 for (j = 0, ptr = start; j < 16 && (i + j) < bytes; j ++, ptr += 2)
4127 snprintf(ptr, 3, "%02X", buffer[i + j] & 255);
4128
4129 while (j < 16)
4130 {
4131 memcpy(ptr, " ", 3);
4132 ptr += 2;
4133 j ++;
4134 }
4135
4136 memcpy(ptr, " ", 3);
4137 ptr += 2;
4138
4139 for (j = 0; j < 16 && (i + j) < bytes; j ++)
4140 {
4141 ch = buffer[i + j] & 255;
4142
4143 if (ch < ' ' || ch >= 127)
4144 ch = '.';
4145
4146 *ptr++ = (char)ch;
4147 }
4148
4149 *ptr = '\0';
4150 DEBUG_puts(line);
4151 }
4152}
4153#endif /* DEBUG */
4154
4155

Callers 4

httpPeekFunction · 0.85
httpRead2Function · 0.85
http_readFunction · 0.85
http_writeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected