Adding fix for uninitialized char *

This commit is contained in:
Ian Roddis
2022-02-24 10:46:52 -04:00
parent 4e5ca633d8
commit 93ab2f38c9

View File

@@ -8,34 +8,36 @@ using namespace std::chrono_literals;
static int http_trace(CURL *handle, curl_infotype type, char *data, size_t size, static int http_trace(CURL *handle, curl_infotype type, char *data, size_t size,
void *userp) void *userp)
{ {
const char *text; const char *text = "";
(void)handle; /* prevent compiler warning */ (void)handle; /* prevent compiler warning */
(void)userp; (void)userp;
// from curl.h
switch (type) { switch (type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", data); text = "== Info";
default: /* in case a new one is introduced to shock us */
return 0;
case CURLINFO_HEADER_OUT:
text = "=> Send header";
break;
case CURLINFO_DATA_OUT:
text = "=> Send data";
break;
case CURLINFO_SSL_DATA_OUT:
text = "=> Send SSL data";
break; break;
case CURLINFO_HEADER_IN: case CURLINFO_HEADER_IN:
text = "<= Recv header"; text = "<= Recv header";
break; break;
case CURLINFO_HEADER_OUT:
text = "=> Send header";
break;
case CURLINFO_DATA_IN: case CURLINFO_DATA_IN:
text = "<= Recv data"; text = "<= Recv data";
break; break;
case CURLINFO_DATA_OUT:
text = "=> Send data";
break;
case CURLINFO_SSL_DATA_IN: case CURLINFO_SSL_DATA_IN:
text = "<= Recv SSL data"; text = "<= Recv SSL data";
break; break;
case CURLINFO_SSL_DATA_OUT:
text = "=> Send SSL data";
break;
default: /* in case a new one is introduced to shock us */
text = "?? Unknown curl_infotype";
break;
} }
std::cerr << "\n================== " << text std::cerr << "\n================== " << text