Skip to content

Commit

Permalink
Fix C warning with OCaml 4.10
Browse files Browse the repository at this point in the history
OCaml 4.10 comes by default with -force-safe-string enabled which means String_val changes from char* to const char*. Bytes_val should be used instead.
  • Loading branch information
kit-ty-kate committed Dec 13, 2019
1 parent 24cab63 commit 11b485e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/unix/unix_c/unix_read_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static value result_read(struct job_read *job)
lwt_unix_free_job(&job->job);
unix_error(error_code, "read", Nothing);
} else {
memcpy(String_val(job->string) + job->offset, job->buffer, result);
memcpy(Bytes_val(job->string) + job->offset, job->buffer, result);
caml_remove_generational_global_root(&(job->string));
lwt_unix_free_job(&job->job);
return Val_long(result);
Expand Down
2 changes: 1 addition & 1 deletion src/unix/windows_c/windows_read_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static value result_read(struct job_read *job)
win32_maperr(error);
uerror("read", Nothing);
}
memcpy(String_val(job->string) + job->offset, job->buffer, job->result);
memcpy(Bytes_val(job->string) + job->offset, job->buffer, job->result);
result = Val_long(job->result);
caml_remove_generational_global_root(&job->string);
lwt_unix_free_job(&job->job);
Expand Down

0 comments on commit 11b485e

Please sign in to comment.