| 1234567891011121314151617181920212223242526272829303132333435 |
- commit 5396ed3306f5a10be138d309d3f9dbf90b8ee07f
- Author: Simon Krajewski <[email protected]>
- Date: Wed May 10 18:13:12 2017 +0200
- expose zlib's crc32
- diff --git a/extc/extc.ml b/extc/extc.ml
- index 45e13875ff..2e98e29bf2 100644
- --- a/extc/extc.ml
- +++ b/extc/extc.ml
- @@ -47,6 +47,8 @@ external get_real_path : string -> string = "get_real_path"
-
- external zlib_deflate_bound : zstream -> int -> int = "zlib_deflate_bound"
-
- +external zlib_crc32 : bytes -> int -> int = "zlib_crc32"
- +
- external time : unit -> float = "sys_time"
-
- type library
- diff --git a/extc/extc_stubs.c b/extc/extc_stubs.c
- index 6442883715..4f98de160e 100644
- --- a/extc/extc_stubs.c
- +++ b/extc/extc_stubs.c
- @@ -352,6 +352,11 @@ CAMLprim value zlib_deflate_bound(value zv,value len) {
- return Val_int(deflateBound(ZStreamP_val(zv),Int_val(len)));
- }
-
- +CAMLprim value zlib_crc32( value src, value len ) {
- + uLong crc = crc32(0L, (Bytef*)(String_val(src)), Int_val(len));
- + return Val_int(crc);
- +}
- +
- CAMLprim value executable_path(value u) {
- #ifdef _WIN32
- char path[MAX_PATH];
|