diff options
author | Paul Phillips <paulp@improving.org> | 2016-03-01 08:08:37 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2016-03-01 08:38:40 -0800 |
commit | 04886a8e9d25c2a28e63645c1cc3feff0625a747 (patch) | |
tree | b4cdbee1d75719fb180df4ecf330f5a889760157 | |
parent | 644299b54ab3162b444d907b068accab08000a38 (diff) | |
download | unison-04886a8e9d25c2a28e63645c1cc3feff0625a747.zip unison-04886a8e9d25c2a28e63645c1cc3feff0625a747.tar.gz unison-04886a8e9d25c2a28e63645c1cc3feff0625a747.tar.bz2 |
Eliminating deprecation warnings.
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | src/bytearray.ml | 4 | ||||
-rw-r--r-- | src/case.ml | 2 | ||||
-rw-r--r-- | src/fileutil.ml | 6 | ||||
-rw-r--r-- | src/fingerprint.ml | 2 | ||||
-rw-r--r-- | src/fpcache.ml | 6 | ||||
-rw-r--r-- | src/fsmonitor/watchercommon.ml | 6 | ||||
-rw-r--r-- | src/fspath.ml | 4 | ||||
-rw-r--r-- | src/fswatch.ml | 6 | ||||
-rw-r--r-- | src/lwt/example/relay.ml | 2 | ||||
-rw-r--r-- | src/lwt/generic/lwt_unix_impl.ml | 6 | ||||
-rw-r--r-- | src/lwt/win/lwt_unix_impl.ml | 6 | ||||
-rw-r--r-- | src/osx.ml | 6 | ||||
-rw-r--r-- | src/path.ml | 4 | ||||
-rw-r--r-- | src/remote.ml | 2 | ||||
-rw-r--r-- | src/terminal.ml | 4 | ||||
-rw-r--r-- | src/test.ml | 2 | ||||
-rw-r--r-- | src/transfer.ml | 8 | ||||
-rw-r--r-- | src/uicommon.ml | 2 | ||||
-rw-r--r-- | src/uitext.ml | 2 | ||||
-rw-r--r-- | src/unicode.ml | 8 | ||||
-rw-r--r-- | src/uutil.ml | 2 | ||||
-rw-r--r-- | unicode_utils/unicode.ml | 8 | ||||
-rw-r--r-- | unicode_utils/unicode_build.ml | 8 |
24 files changed, 56 insertions, 53 deletions
@@ -17,3 +17,6 @@ # Simulated Subversion default ignores end here # The contents of the svn:ignore property on the branch root. /logmsg +src/u-b.o.startup.s +src/uimac14/ExternalSettings.xcconfig +src/uimac14/build/ diff --git a/src/bytearray.ml b/src/bytearray.ml index 44df2d9..60f5dcf 100644 --- a/src/bytearray.ml +++ b/src/bytearray.ml @@ -44,7 +44,7 @@ external unsafe_blit_to_string : t -> int -> string -> int -> int -> unit let to_string a = let l = length a in if l > Sys.max_string_length then invalid_arg "Bytearray.to_string" else - let s = String.create l in + let s = Bytes.create l in unsafe_blit_to_string a 0 s 0 l; s @@ -60,7 +60,7 @@ let sub a ofs len = then invalid_arg "Bytearray.sub" else begin - let s = String.create len in + let s = Bytes.create len in unsafe_blit_to_string a ofs s 0 len; s end diff --git a/src/case.ml b/src/case.ml index c366d06..3ba41e9 100644 --- a/src/case.ml +++ b/src/case.ml @@ -95,7 +95,7 @@ let hasTrailingDots s = let removeTrailingDots s = let len = String.length s in - let s' = String.create len in + let s' = Bytes.create len in let pos = ref (len - 1) in let pos' = ref (len - 1) in while !pos >= 0 do diff --git a/src/fileutil.ml b/src/fileutil.ml index 79390aa..ddff30b 100644 --- a/src/fileutil.ml +++ b/src/fileutil.ml @@ -21,12 +21,12 @@ let backslashes2forwardslashes s0 = try ignore(String.index s0 '\\'); (* avoid alloc if possible *) let n = String.length s0 in - let s = String.create n in + let s = Bytes.create n in for i = 0 to n-1 do let c = String.get s0 i in if c = '\\' - then String.set s i '/' - else String.set s i c + then Bytes.set s i '/' + else Bytes.set s i c done; s with Not_found -> s0 diff --git a/src/fingerprint.ml b/src/fingerprint.ml index 21a9099..cb03c44 100644 --- a/src/fingerprint.ml +++ b/src/fingerprint.ml @@ -75,7 +75,7 @@ let hexaCode theChar = let toString md5 = if ispseudo md5 then md5 else begin let length = String.length md5 in - let string = String.create (length * 2) in + let string = Bytes.create (length * 2) in for i=0 to (length - 1) do let c1, c2 = hexaCode (md5.[i]) in string.[2*i] <- c1; diff --git a/src/fpcache.ml b/src/fpcache.ml index 7492802..d3fce4f 100644 --- a/src/fpcache.ml +++ b/src/fpcache.ml @@ -50,7 +50,7 @@ let state = ref None let decompress st i path = let l = String.length path in - let s = String.create (l + i) in + let s = Bytes.create (l + i) in String.blit !st 0 s 0 i; String.blit path 0 s i l; st := s; @@ -74,14 +74,14 @@ let read st ic = let fp1 = Digest.input ic in let fp2 = Digest.input ic in let headerSize = Marshal.header_size in - let header = String.create headerSize in + let header = Bytes.create headerSize in really_input ic header 0 headerSize; if fp1 <> Digest.string header then begin debug (fun () -> Util.msg "bad header checksum\n"); raise End_of_file end; let dataSize = Marshal.data_size header 0 in - let s = String.create (headerSize + dataSize) in + let s = Bytes.create (headerSize + dataSize) in String.blit header 0 s 0 headerSize; really_input ic s headerSize dataSize; if fp2 <> Digest.string s then begin diff --git a/src/fsmonitor/watchercommon.ml b/src/fsmonitor/watchercommon.ml index b274a64..c6b9ebf 100644 --- a/src/fsmonitor/watchercommon.ml +++ b/src/fsmonitor/watchercommon.ml @@ -46,7 +46,7 @@ let quote s = let n = ref 0 in for i = 0 to l - 1 do if disallowed_char s.[i] then incr n done; if !n = 0 then s else begin - let q = String.create (l + 2 * !n) in + let q = Bytes.create (l + 2 * !n) in let j = ref 0 in let hex = "0123456789ABCDEF" in for i = 0 to l - 1 do @@ -76,7 +76,7 @@ let unquote s = | 'A'..'F' -> Char.code c - Char.code 'A' + 10 | _ -> invalid_arg "unquote" in - let u = String.create (l - 2 * !n) in + let u = Bytes.create (l - 2 * !n) in let j = ref 0 in for i = 0 to l - 2 * !n - 1 do let c = s.[!j] in @@ -130,7 +130,7 @@ let printf fmt = let read_line = let b = Buffer.create 160 in - let buf = String.create 160 in + let buf = Bytes.create 160 in let start = ref 0 in let last = ref 0 in let rec read_line () = diff --git a/src/fspath.ml b/src/fspath.ml index 92ee31c..fc06877 100644 --- a/src/fspath.ml +++ b/src/fspath.ml @@ -92,7 +92,7 @@ let appleDouble (Fspath f) = let len = String.length f in try let i = 1 + String.rindex f '/' in - let res = String.create (len + 2) in + let res = Bytes.create (len + 2) in String.blit f 0 res 0 i; res.[i] <- '.'; res.[i + 1] <- '_'; @@ -192,7 +192,7 @@ let concat fspath path = let p = Path.toString path in let l = String.length fspath in let l' = String.length p in - let s = String.create (l + l' + 1) in + let s = Bytes.create (l + l' + 1) in String.blit fspath 0 s 0 l; s.[l] <- '/'; String.blit p 0 s (l + 1) l'; diff --git a/src/fswatch.ml b/src/fswatch.ml index dd8169e..9d46a6f 100644 --- a/src/fswatch.ml +++ b/src/fswatch.ml @@ -110,7 +110,7 @@ let quote s = let n = ref 0 in for i = 0 to l - 1 do if disallowed_char s.[i] then incr n done; if !n = 0 then s else begin - let q = String.create (l + 2 * !n) in + let q = Bytes.create (l + 2 * !n) in let j = ref 0 in let hex = "0123456789ABCDEF" in for i = 0 to l - 1 do @@ -140,7 +140,7 @@ let unquote s = | 'A'..'F' -> Char.code c - Char.code 'A' + 10 | _ -> invalid_arg "unquote" in - let u = String.create (l - 2 * !n) in + let u = Bytes.create (l - 2 * !n) in let j = ref 0 in for i = 0 to l - 2 * !n - 1 do let c = s.[!j] in @@ -189,7 +189,7 @@ let printf o fmt = let read_line i = let b = Buffer.create 160 in - let buf = String.create 160 in + let buf = Bytes.create 160 in let start = ref 0 in let last = ref 0 in let rec read () = diff --git a/src/lwt/example/relay.ml b/src/lwt/example/relay.ml index 77be87c..9cdd337 100644 --- a/src/lwt/example/relay.ml +++ b/src/lwt/example/relay.ml @@ -18,7 +18,7 @@ let rec really_write out_ch buffer pos len = let relay in_ch out_ch = let rec relay_rec previous_write = - let buffer = String.create 8192 in + let buffer = Bytes.create 8192 in (* Read some data from the input socket *) Lwt_unix.read in_ch buffer 0 8192 >>= (fun len -> (* If we read nothing, this means that the connection has been diff --git a/src/lwt/generic/lwt_unix_impl.ml b/src/lwt/generic/lwt_unix_impl.ml index 09f007a..1c16cf3 100644 --- a/src/lwt/generic/lwt_unix_impl.ml +++ b/src/lwt/generic/lwt_unix_impl.ml @@ -369,11 +369,11 @@ let really_input ic s ofs len = else unsafe_really_input ic s ofs len let input_line ic = - let buf = ref (String.create 128) in + let buf = ref (Bytes.create 128) in let pos = ref 0 in let rec loop () = if !pos = String.length !buf then begin - let newbuf = String.create (2 * !pos) in + let newbuf = Bytes.create (2 * !pos) in String.blit !buf 0 newbuf 0 !pos; buf := newbuf end; @@ -395,7 +395,7 @@ let input_line ic = | _ -> Lwt.fail e)) (fun () -> - let res = String.create !pos in + let res = Bytes.create !pos in String.blit !buf 0 res 0 !pos; Lwt.return res) diff --git a/src/lwt/win/lwt_unix_impl.ml b/src/lwt/win/lwt_unix_impl.ml index 63f9b3c..7ee9082 100644 --- a/src/lwt/win/lwt_unix_impl.ml +++ b/src/lwt/win/lwt_unix_impl.ml @@ -500,11 +500,11 @@ let really_input ic s ofs len = else unsafe_really_input ic s ofs len let input_line ic = - let buf = ref (String.create 128) in + let buf = ref (Bytes.create 128) in let pos = ref 0 in let rec loop () = if !pos = String.length !buf then begin - let newbuf = String.create (2 * !pos) in + let newbuf = Bytes.create (2 * !pos) in String.blit !buf 0 newbuf 0 !pos; buf := newbuf end; @@ -526,7 +526,7 @@ let input_line ic = | _ -> Lwt.fail e)) (fun () -> - let res = String.create !pos in + let res = Bytes.create !pos in String.blit !buf 0 res 0 !pos; Lwt.return res) *) @@ -108,7 +108,7 @@ let getID buf ofs = | _ -> `UNKNOWN let setInt4 v = - let s = String.create 4 in + let s = Bytes.create 4 in let set i = s.[i] <- Char.chr (Int64.to_int (Int64.logand 255L @@ -126,7 +126,7 @@ let fail dataFspath dataPath doubleFspath msg = (Fspath.toPrintString (Fspath.concat dataFspath dataPath)) msg)) let readDouble dataFspath dataPath doubleFspath inch len = - let buf = String.create len in + let buf = Bytes.create len in begin try really_input inch buf 0 len with End_of_file -> @@ -267,7 +267,7 @@ let getFileInfos dataFspath dataPath typ = protect (fun () -> LargeFile.seek_in inch (Int64.add offset 16L); let len = String.length resource_fork_empty_tag in - let buf = String.create len in + let buf = Bytes.create len in really_input inch buf 0 len; buf = resource_fork_empty_tag) (fun () -> close_in_noerr inch) diff --git a/src/path.ml b/src/path.ml index 827fd40..96657f2 100644 --- a/src/path.ml +++ b/src/path.ml @@ -30,7 +30,7 @@ let concat p p' = if l = 0 then p' else let l' = String.length p' in if l' = 0 then p else - let p'' = String.create (l + l' + 1) in + let p'' = Bytes.create (l + l' + 1) in String.blit p 0 p'' 0 l; p''.[l] <- pathSeparatorChar; String.blit p' 0 p'' (l + 1) l'; @@ -201,7 +201,7 @@ let addPrefixToFinalName path prefix = let i = String.rindex path pathSeparatorChar + 1 in let l = String.length path in let l' = String.length prefix in - let p = String.create (l + l') in + let p = Bytes.create (l + l') in String.blit path 0 p 0 i; String.blit prefix 0 p i l'; String.blit path i p (i + l') (l - i); diff --git a/src/remote.ml b/src/remote.ml index 37efd0d..1c70add 100644 --- a/src/remote.ml +++ b/src/remote.ml @@ -125,7 +125,7 @@ let bufferSize = 16384 buffer of this size *) let makeBuffer ch = - { channel = ch; buffer = String.create bufferSize; + { channel = ch; buffer = Bytes.create bufferSize; length = 0; opened = true } (****) diff --git a/src/terminal.ml b/src/terminal.ml index 2e3fe6b..ea8f849 100644 --- a/src/terminal.ml +++ b/src/terminal.ml @@ -222,7 +222,7 @@ let (>>=) = Lwt.bind (* Wait until there is input. If there is terminal input s, return Some s. Otherwise, return None. *) let rec termInput fdTerm fdInput = - let buf = String.create 10000 in + let buf = Bytes.create 10000 in let rec readPrompt () = Lwt_unix.read fdTerm buf 0 10000 >>= fun len -> if len = 0 then @@ -244,7 +244,7 @@ let rec termInput fdTerm fdInput = (* Read messages from the terminal and use the callback to get an answer *) let handlePasswordRequests fdTerm callback = - let buf = String.create 10000 in + let buf = Bytes.create 10000 in let rec loop () = Lwt_unix.read fdTerm buf 0 10000 >>= (fun len -> if len = 0 then diff --git a/src/test.ml b/src/test.ml index 03dd5cb..b9c926d 100644 --- a/src/test.ml +++ b/src/test.ml @@ -48,7 +48,7 @@ let rec remove_file_or_dir d = let read_chan chan = let nbytes = in_channel_length chan in - let string = String.create nbytes in + let string = Bytes.create nbytes in really_input chan string 0 nbytes; string diff --git a/src/transfer.ml b/src/transfer.ml index 4af0243..a0305bf 100644 --- a/src/transfer.ml +++ b/src/transfer.ml @@ -261,7 +261,7 @@ let send infd length showProgress transmit = let timer = Trace.startTimer "Sending file using generic transmission" in let bufSz = 8192 in let bufSzFS = Uutil.Filesize.ofInt 8192 in - let buf = String.create bufSz in + let buf = Bytes.create bufSz in let q = makeQueue 0 in let rec sendSlice length = if length > Uutil.Filesize.zero then begin @@ -373,7 +373,7 @@ struct and eventually handles the buffer update. *) let blockIter infd f blockSize maxCount = let bufferSize = 8192 + blockSize in - let buffer = String.create bufferSize in + let buffer = Bytes.create bufferSize in let rec iter count offset length = if count = maxCount then count @@ -454,7 +454,7 @@ struct (* For each transfer instruction, either output a string or copy one or several blocks from the old file. *) let rsyncDecompress blockSize infd outfd showProgress (data, pos, len) = - let decomprBuf = String.create decomprBufSize in + let decomprBuf = Bytes.create decomprBufSize in let progress = ref 0 in let rec copy length = if length > decomprBufSize then begin @@ -712,7 +712,7 @@ struct in (* Create the compression buffer *) - let comprBuf = String.create comprBufSize in + let comprBuf = Bytes.create comprBufSize in (* If there is data waiting to be sent, transmit it as a STRING token *) let transmitString toBeSent offset = diff --git a/src/uicommon.ml b/src/uicommon.ml index f0cbf40..5204605 100644 --- a/src/uicommon.ml +++ b/src/uicommon.ml @@ -359,7 +359,7 @@ let dangerousPathMsg dangerousPaths = let quote s = let len = String.length s in - let buf = String.create (2 * len) in + let buf = Bytes.create (2 * len) in let pos = ref 0 in for i = 0 to len - 1 do match s.[i] with diff --git a/src/uitext.ml b/src/uitext.ml index 250c36f..a53d300 100644 --- a/src/uitext.ml +++ b/src/uitext.ml @@ -110,7 +110,7 @@ let getInput () = (* We cannot used buffered I/Os under Windows, as character '\r' is not passed through (probably due to the code that turns \r\n into \n) *) - let s = String.create 1 in + let s = Bytes.create 1 in let n = Unix.read Unix.stdin s 0 1 in if n = 0 then raise End_of_file; if s.[0] = '\003' then raise Sys.Break; diff --git a/src/unicode.ml b/src/unicode.ml index c0ef8fe..cfa4d58 100644 --- a/src/unicode.ml +++ b/src/unicode.ml @@ -930,7 +930,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 let s' = norm s 0 l s' 0 in order s'; s' with Invalid -> @@ -1027,7 +1027,7 @@ let rec decomp s i l s' j = let decompose s = let l = String.length s in - let s' = String.create (3 * l) in + let s' = Bytes.create (3 * l) in try let s' = decomp s 0 l s' 0 in order s'; s' with Invalid -> @@ -1753,7 +1753,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 (****) @@ -1813,7 +1813,7 @@ let rec scan s' i' l' s i l = let from_utf_16_filename 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 (****) diff --git a/src/uutil.ml b/src/uutil.ml index 09d1fdc..b0c7c70 100644 --- a/src/uutil.ml +++ b/src/uutil.ml @@ -113,7 +113,7 @@ let showUpdateStatus path = let bufsize = 16384 let bufsizeFS = Filesize.ofInt bufsize -let buf = String.create bufsize +let buf = Bytes.create bufsize let readWrite source target notify = let len = ref 0 in 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 |