mirror of
https://github.com/curl/curl.git
synced 2026-05-30 15:17:27 +03:00
tidy-up: miscellaneous
- INSTALL-CMAKE.md: add missing periods, text fixes. - md4, md5: sync variables names. - curl_trc: sync an argument type. - docs/examples: sync debug/trace function copies, constify, tidy-ups. - replace commented code with `#if 0`. - drop redundant parenthesis (macro values, `return`, around single variables, function calls). - fix indentation, apply clang-format in places. Closes #20481
This commit is contained in:
parent
ca5efd02b6
commit
3003c32cb2
62 changed files with 291 additions and 281 deletions
|
|
@ -33,7 +33,7 @@ struct data {
|
|||
char trace_ascii; /* 1 or 0 */
|
||||
};
|
||||
|
||||
static void dump(const char *text, FILE *stream, unsigned char *ptr,
|
||||
static void dump(const char *text, const unsigned char *ptr,
|
||||
size_t size, char nohex)
|
||||
{
|
||||
size_t i;
|
||||
|
|
@ -45,20 +45,20 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
|
|||
/* without the hex output, we can fit more on screen */
|
||||
width = 0x40;
|
||||
|
||||
fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
|
||||
fprintf(stderr, "%s, %10.10lu bytes (0x%8.8lx)\n",
|
||||
text, (unsigned long)size, (unsigned long)size);
|
||||
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stream, "%4.4lx: ", (unsigned long)i);
|
||||
fprintf(stderr, "%4.4lx: ", (unsigned long)i);
|
||||
|
||||
if(!nohex) {
|
||||
/* hex not disabled, show it */
|
||||
for(c = 0; c < width; c++)
|
||||
if(i + c < size)
|
||||
fprintf(stream, "%02x ", ptr[i + c]);
|
||||
fprintf(stderr, "%02x ", ptr[i + c]);
|
||||
else
|
||||
fputs(" ", stream);
|
||||
fputs(" ", stderr);
|
||||
}
|
||||
|
||||
for(c = 0; (c < width) && (i + c < size); c++) {
|
||||
|
|
@ -68,7 +68,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
|
|||
i += (c + 2 - width);
|
||||
break;
|
||||
}
|
||||
fprintf(stream, "%c",
|
||||
fprintf(stderr, "%c",
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
|
||||
/* check again for 0D0A, to avoid an extra \n if it is at width */
|
||||
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
|
||||
|
|
@ -77,9 +77,8 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
|
|||
break;
|
||||
}
|
||||
}
|
||||
fputc('\n', stream); /* newline */
|
||||
fputc('\n', stderr); /* newline */
|
||||
}
|
||||
fflush(stream);
|
||||
}
|
||||
|
||||
static int my_trace(CURL *curl, curl_infotype type,
|
||||
|
|
@ -115,7 +114,7 @@ static int my_trace(CURL *curl, curl_infotype type,
|
|||
return 0;
|
||||
}
|
||||
|
||||
dump(text, stderr, (unsigned char *)data, size, config->trace_ascii);
|
||||
dump(text, (const unsigned char *)data, size, config->trace_ascii);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue