aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.mllib1
-rw-r--r--lib/safe_marshal.ml11
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/lib.mllib b/lib/lib.mllib
index 86d29c4be6..b5db04d213 100644
--- a/lib/lib.mllib
+++ b/lib/lib.mllib
@@ -25,3 +25,4 @@ Heap
Option
Dnet
Store
+Safe_marshal
diff --git a/lib/safe_marshal.ml b/lib/safe_marshal.ml
index e9ba81b499..0ae5245d7f 100644
--- a/lib/safe_marshal.ml
+++ b/lib/safe_marshal.ml
@@ -5,6 +5,15 @@
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
+(*
+let uuencode s =
+ let norm_s = s ^ (String.make (String.length s mod 3) '\000') in
+ let rec y f x = f (y f) x in
+ let chop rem = function
+ | "" -> []
+ | s -> String.sub s 0 3 :: (rem (String.sub s 3 (String.length (s - 3)))) in
+ let chunks = y chop norm_s in
+ *)
let hobcnv = Array.init 256 (fun i -> Printf.sprintf "%.2x" i)
let bohcnv = Array.init 256 (fun i -> i -
@@ -13,7 +22,7 @@ let bohcnv = Array.init 256 (fun i -> i -
(if 0x61 <= i then 0x20 else 0))
let hex_of_bin ch = hobcnv.(int_of_char ch)
-let bin_of_hex s = bohcnv.(char_of_int s[0]) * 16 + bohcnv.(char_of_int s[1])
+let bin_of_hex s = char_of_int (bohcnv.(int_of_char s.[0]) * 16 + bohcnv.(int_of_char s.[1]))
let send cout expr =
let mshl_expr = Marshal.to_string expr [] in