Merge pull request #361

Conversion fixes for util.h
diff --git a/t/util.h b/t/util.h
index 0dbbed7..a77b02d 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) {
@@ -124,7 +124,7 @@
     }
 }
 
-static inline X509_STORE* init_cert_store(char const *crt_file)
+static inline X509_STORE *init_cert_store(char const *crt_file)
 {
     int ret = 0;
     X509_STORE *store = X509_STORE_new();
@@ -133,8 +133,7 @@
         X509_LOOKUP *lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
         ret = X509_LOOKUP_load_file(lookup, crt_file, X509_FILETYPE_PEM);
         if (ret != 1) {
-            fprintf(stderr, "Cannot load store (%s), ret = %d\n",
-                crt_file, ret);
+            fprintf(stderr, "Cannot load store (%s), ret = %d\n", crt_file, ret);
             X509_STORE_free(store);
             exit(1);
         }
@@ -180,7 +179,8 @@
         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));
@@ -337,7 +337,8 @@
     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);