Blob Blame History Raw
diff -ur bin_prot-2.0.9.old/lib/common.ml bin_prot-2.0.9/lib/common.ml
--- bin_prot-2.0.9.old/lib/common.ml	2012-03-15 19:59:16.000000000 +0000
+++ bin_prot-2.0.9/lib/common.ml	2017-11-18 12:44:52.543443638 +0000
@@ -165,7 +165,7 @@
     else unsafe_blit_string_buf ~src_pos str ~dst_pos buf ~len)
 
 external unsafe_blit_buf_string :
-  src_pos : int -> buf -> dst_pos : int -> string -> len : int -> unit
+  src_pos : int -> buf -> dst_pos : int -> bytes -> len : int -> unit
   = "bin_prot_blit_buf_string_stub" "noalloc"
 
 let blit_buf_string ?src_pos buf ?dst_pos str ~len =
@@ -176,12 +176,12 @@
   else if len = 0 then (
     if src_pos > Array1.dim buf then
       invalid_arg "Bin_prot.Common.blit_buf_string: src_pos > buf_len";
-    if dst_pos > String.length str then
+    if dst_pos > Bytes.length str then
       invalid_arg "Bin_prot.Common.blit_buf_string: src_pos > str_len")
   else (
     if src_pos + len > Array1.dim buf then
       invalid_arg "Bin_prot.Common.blit_buf_string: src_pos + len > buf_len"
-    else if dst_pos + len > String.length str then
+    else if dst_pos + len > Bytes.length str then
       invalid_arg "Bin_prot.Common.blit_buf_string: src_pos + len > str_len"
     else unsafe_blit_buf_string ~src_pos buf ~dst_pos str ~len)
 
diff -ur bin_prot-2.0.9.old/lib/common.mli bin_prot-2.0.9/lib/common.mli
--- bin_prot-2.0.9.old/lib/common.mli	2012-03-15 19:59:16.000000000 +0000
+++ bin_prot-2.0.9/lib/common.mli	2017-11-18 12:45:38.015421813 +0000
@@ -63,7 +63,7 @@
 *)
 
 val blit_buf_string :
-  ?src_pos : int -> buf -> ?dst_pos : int -> string -> len : int -> unit
+  ?src_pos : int -> buf -> ?dst_pos : int -> bytes -> len : int -> unit
 (** [blit_buf_string ?src_pos src ?dst_pos dst ~len] blits [len]
     bytes of the source buffer [src] starting at position [src_pos]
     to string [dst] starting at position [dst_pos].
@@ -181,5 +181,5 @@
   = "bin_prot_blit_string_buf_stub" "noalloc"
 
 external unsafe_blit_buf_string :
-  src_pos : int -> buf -> dst_pos : int -> string -> len : int -> unit
+  src_pos : int -> buf -> dst_pos : int -> bytes -> len : int -> unit
   = "bin_prot_blit_buf_string_stub" "noalloc"
diff -ur bin_prot-2.0.9.old/lib/read_ml.ml bin_prot-2.0.9/lib/read_ml.ml
--- bin_prot-2.0.9.old/lib/read_ml.ml	2012-03-15 19:59:16.000000000 +0000
+++ bin_prot-2.0.9/lib/read_ml.ml	2017-11-18 12:47:01.188381893 +0000
@@ -225,9 +225,9 @@
   let next = pos + len in
   check_next buf next;
   pos_ref := next;
-  let str = String.create len in
+  let str = Bytes.create len in
   unsafe_blit_buf_string ~src_pos:pos buf ~dst_pos:0 str ~len;
-  str
+  Bytes.to_string str
 
 let bin_read_char (buf : buf) ~pos_ref =
   let pos = safe_get_pos buf pos_ref in