diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2014-05-01 21:54:15 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2014-05-01 21:54:15 +0000 |
commit | 9baf42b72da71213f483e3cc3b9ed9088cdf76ff (patch) | |
tree | 65c6cbb610ddce5c345e6afc60fe33fdc8830385 /stdlib/digest.ml | |
parent | 05100e597e4296a2e79e6c2d9cd75b7e1cc595c9 (diff) |
safe-string: documentation fixes and add a couple of functions in Pervasives and Digest
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14721 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/digest.ml')
-rw-r--r-- | stdlib/digest.ml | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/stdlib/digest.ml b/stdlib/digest.ml index e6b6b3589..14cb4ebd9 100644 --- a/stdlib/digest.ml +++ b/stdlib/digest.ml @@ -23,11 +23,15 @@ external channel: in_channel -> int -> t = "caml_md5_chan" let string str = unsafe_string str 0 (String.length str) +let bytes b = string (Bytes.unsafe_to_string b) + let substring str ofs len = if ofs < 0 || len < 0 || ofs > String.length str - len then invalid_arg "Digest.substring" else unsafe_string str ofs len +let subbytes b ofs len = substring (Bytes.unsafe_to_string b) ofs len + let file filename = let ic = open_in_bin filename in let d = channel ic (-1) in |