use intptr_t for file descriptor abstraction so that Win32 HANDLEs can be retained; fix other warnings too
diff --git a/include/picotls.h b/include/picotls.h index fb6567d..2bdd490 100644 --- a/include/picotls.h +++ b/include/picotls.h
@@ -779,7 +779,7 @@ /** * optional callback returning a file descriptor that becomes readable when the job is complete */ - int (*get_fd)(struct st_ptls_async_job_t *self); + intptr_t (*get_fd)(struct st_ptls_async_job_t *self); /** * optional callback for setting a completion callback */
diff --git a/lib/openssl.c b/lib/openssl.c index 19b5cfe..3ed9c15 100644 --- a/lib/openssl.c +++ b/lib/openssl.c
@@ -1088,7 +1088,7 @@ free(self); } -int async_sign_ctx_get_fd(ptls_async_job_t *_self) +intptr_t async_sign_ctx_get_fd(ptls_async_job_t *_self) { struct async_sign_ctx *self = (void *)_self; OSSL_ASYNC_FD fds[1]; @@ -1097,7 +1097,7 @@ ASYNC_WAIT_CTX_get_all_fds(self->waitctx, NULL, &numfds); assert(numfds == 1); ASYNC_WAIT_CTX_get_all_fds(self->waitctx, fds, &numfds); - return (int)fds[0]; + return (intptr_t)fds[0]; } static ptls_async_job_t *async_sign_ctx_new(const ptls_openssl_signature_scheme_t *scheme, EVP_MD_CTX *ctx, size_t siglen)
diff --git a/t/openssl.c b/t/openssl.c index 1380548..638503e 100644 --- a/t/openssl.c +++ b/t/openssl.c
@@ -482,7 +482,7 @@ case PTLS_ERROR_ASYNC_OPERATION: { ptls_async_job_t *job = ptls_get_async_job(qat.conns[offending].tls); assert(job->get_fd != NULL); - qat.conns[offending].wait_fd = job->get_fd(job); + qat.conns[offending].wait_fd = (int)job->get_fd(job); assert(qat.conns[offending].wait_fd != -1); } break; default:
diff --git a/t/picotls.c b/t/picotls.c index 799b803..2200d23 100644 --- a/t/picotls.c +++ b/t/picotls.c
@@ -1220,7 +1220,7 @@ int ret = sign_certificate(self, tls, NULL, selected_algorithm, &fakebuf, input, algorithms, num_algorithms); assert(ret == 0); ptls_buffer_dispose(&fakebuf); - async_ctx.super.destroy_ = (void (*)(ptls_async_job_t *))0xdeadbeef; + async_ctx.super.destroy_ = NULL; async_ctx.selected_algorithm = *selected_algorithm; *async = &async_ctx.super; --server_sc_callcnt;