diff options
Diffstat (limited to 'unicode_utils')
-rw-r--r-- | unicode_utils/unicode.ml | 8 | ||||
-rw-r--r-- | unicode_utils/unicode_build.ml | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/unicode_utils/unicode.ml b/unicode_utils/unicode.ml index 49b8978..c09ea4c 100644 --- a/unicode_utils/unicode.ml +++ b/unicode_utils/unicode.ml @@ -111,7 +111,7 @@ let rec norm s i l s' j = let normalize s = let l = String.length s in - let s' = String.create (3 * l) in + let s' = Bytes.create (3 * l) in try norm s 0 l s' 0 with Invalid -> s (****) @@ -774,7 +774,7 @@ and cont s' j s i l v = let to_utf_16 s = let l = String.length s in - let s' = String.create (2 * l) in + let s' = Bytes.create (2 * l) in scan s' 0 s 0 l (****) @@ -804,7 +804,7 @@ let rec scan s' i' l' s i l = let from_utf_16 s = let l = String.length s in let l' = 3 * l / 2 in - let s' = String.create l' in + let s' = Bytes.create l' in scan s' 0 l' s 0 l (* @@ -812,4 +812,4 @@ from_utf16 2 bytes -> 3 bytes 4 bytes -> 4 bytes -*)
\ No newline at end of file +*) diff --git a/unicode_utils/unicode_build.ml b/unicode_utils/unicode_build.ml index 3bcbfc9..7997125 100644 --- a/unicode_utils/unicode_build.ml +++ b/unicode_utils/unicode_build.ml @@ -5,18 +5,18 @@ let encode_utf8 c = if c < 0x80 then String.make 1 (Char.chr c) else if c < 0x800 then - let s = String.create 2 in + let s = Bytes.create 2 in s.[0] <- Char.chr (c lsr 6 + 0xC0); s.[1] <- Char.chr (c land 0x3f + 0x80); s else if c < 0x10000 then - let s = String.create 3 in + let s = Bytes.create 3 in s.[0] <- Char.chr (c lsr 12 + 0xE0); s.[1] <- Char.chr ((c lsr 6) land 0x3f + 0x80); s.[2] <- Char.chr (c land 0x3f + 0x80); s else - let s = String.create 4 in + let s = Bytes.create 4 in s.[0] <- Char.chr (c lsr 18 + 0xF0); s.[1] <- Char.chr ((c lsr 12) land 0x3f + 0x80); s.[2] <- Char.chr ((c lsr 6) land 0x3f + 0x80); @@ -1660,7 +1660,7 @@ let _ = let read_file nm l = let ch = open_in ("codepages/" ^ nm) in - let s = String.create l in + let s = Bytes.create l in really_input ch s 0 l; s |