MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / print_error

Function print_error

libs/qhttpserver/http-parser/test.c:2427–2466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2425}
2426
2427static void
2428print_error (const char *raw, size_t error_location)
2429{
2430 fprintf(stderr, "\n*** %s ***\n\n",
2431 http_errno_description(HTTP_PARSER_ERRNO(parser)));
2432
2433 int this_line = 0, char_len = 0;
2434 size_t i, j, len = strlen(raw), error_location_line = 0;
2435 for (i = 0; i < len; i++) {
2436 if (i == error_location) this_line = 1;
2437 switch (raw[i]) {
2438 case '\r':
2439 char_len = 2;
2440 fprintf(stderr, "\\r");
2441 break;
2442
2443 case '\n':
2444 fprintf(stderr, "\\n\n");
2445
2446 if (this_line) goto print;
2447
2448 error_location_line = 0;
2449 continue;
2450
2451 default:
2452 char_len = 1;
2453 fputc(raw[i], stderr);
2454 break;
2455 }
2456 if (!this_line) error_location_line += char_len;
2457 }
2458
2459 fprintf(stderr, "[eof]\n");
2460
2461 print:
2462 for (j = 0; j < error_location_line; j++) {
2463 fputc(' ', stderr);
2464 }
2465 fprintf(stderr, "^\n\nerror location: %u\n", (unsigned int)error_location);
2466}
2467
2468void
2469test_preserve_data (void)

Callers 4

test_messageFunction · 0.85
test_message_count_bodyFunction · 0.85
test_multiple3Function · 0.85
test_scanFunction · 0.85

Calls 1

http_errno_descriptionFunction · 0.85

Tested by

no test coverage detected