libs 232 B

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