Conversion fixes for utils.h
diff --git a/t/util.h b/t/util.h
index 0dbbed7..e889bcc 100644
--- a/t/util.h
+++ b/t/util.h
@@ -88,7 +88,7 @@
static int util_save_ticket_cb(ptls_save_ticket_t *_self, ptls_t *tls, ptls_iovec_t src)
{
- struct st_util_save_ticket_t *self = (void *)_self;
+ struct st_util_save_ticket_t *self = (struct st_util_save_ticket_t*)_self;
FILE *fp;
if ((fp = fopen(self->fn, "wb")) == NULL) {
@@ -180,7 +180,7 @@
fclose(fp);
}
- if ((ctx->esni = malloc(sizeof(*ctx->esni) * 2)) == NULL || (*ctx->esni = malloc(sizeof(**ctx->esni))) == NULL) {
+ if ((ctx->esni = (ptls_esni_context_t**) malloc(sizeof(*ctx->esni) * 2)) == NULL || (*ctx->esni = (ptls_esni_context_t*) malloc(sizeof(**ctx->esni))) == NULL) {
fprintf(stderr, "no memory\n");
exit(1);
}
@@ -198,7 +198,7 @@
static void log_event_cb(ptls_log_event_t *_self, ptls_t *tls, const char *type, const char *fmt, ...)
{
- struct st_util_log_event_t *self = (void *)_self;
+ struct st_util_log_event_t *self = (struct st_util_log_event_t*)_self;
char randomhex[PTLS_HELLO_RANDOM_SIZE * 2 + 1];
va_list args;
@@ -234,14 +234,14 @@
static int encrypt_ticket_cb(ptls_encrypt_ticket_t *_self, ptls_t *tls, int is_encrypt, ptls_buffer_t *dst, ptls_iovec_t src)
{
- struct st_util_session_cache_t *self = (void *)_self;
+ struct st_util_session_cache_t *self = (struct st_util_session_cache_t*)_self;
int ret;
if (is_encrypt) {
/* replace the cached entry along with a newly generated session id */
free(self->data.base);
- if ((self->data.base = malloc(src.len)) == NULL)
+ if ((self->data.base = (uint8_t *) malloc(src.len)) == NULL)
return PTLS_ERROR_NO_MEMORY;
ptls_get_context(tls)->random_bytes(self->id, sizeof(self->id));
@@ -336,8 +336,9 @@
ptls_buffer_t decode_buf;
ptls_base64_decode_state_t ds;
int answer_len;
-
- ptls_buffer_init(&decode_buf, "", 0);
+
+ char* buf = "";
+ ptls_buffer_init(&decode_buf, buf, 0);
if (snprintf(esni_name, sizeof(esni_name), "_esni.%s", server_name) > sizeof(esni_name) - 1)
goto Error;
@@ -349,8 +350,8 @@
goto Error;
if (ns_parserr(&msg, ns_s_an, 0, &rr) != 0)
goto Error;
- base64 = (void *)ns_rr_rdata(rr);
- if (!normalize_txt((void *)base64, ns_rr_rdlen(rr)))
+ base64 = (char *)ns_rr_rdata(rr);
+ if (!normalize_txt((uint8_t *)base64, ns_rr_rdlen(rr)))
goto Error;
ptls_base64_decode_init(&ds);