Skip to content

Commit

Permalink
Strict compatibility with OCaml 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed May 5, 2022
1 parent bf7c7e1 commit 659c773
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ssl_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,13 @@ CAMLprim value ocaml_ssl_digest(value vevp, value vcert)

CAMLprim value ocaml_ssl_get_client_verify_callback_ptr(value unit)
{
#ifdef NO_NAKED_POINTERS
value v = caml_alloc_small(1, Abstract_tag);
*((int(**) (int, X509_STORE_CTX*))Data_abstract_val(v)) = client_verify_callback;
return v;
#else
return (value)client_verify_callback;
#endif
}

static int client_verify_callback_verbose = 1;
Expand Down Expand Up @@ -613,10 +617,14 @@ CAMLprim value ocaml_ssl_ctx_set_verify(value context, value vmode, value vcallb

if (Is_block(vcallback))
{
#ifdef NO_NAKED_POINTERS
vcallback = Field(vcallback, 0);
if (!Is_block(vcallback) || Wosize_val(vcallback) != 1)
caml_invalid_argument("callback");
callback = *((int(**) (int, X509_STORE_CTX*))Data_abstract_val(vcallback));
#else
callback = (int(*) (int, X509_STORE_CTX*))Field(vcallback, 0);
#endif
}

caml_enter_blocking_section();
Expand Down

0 comments on commit 659c773

Please sign in to comment.