search for: unsafe_get

Displaying 20 results from an estimated 35 matches for "unsafe_get".

2016 Jun 15
3
[PATCH 2/3] Convert source so it can be compiled with OCaml '-safe-string' option.
OCaml 4.02 introduced the 'bytes' type, a mutable string intended to replace the existing 'string' type for those cases where the byte array can be mutated. In future the 'string' type will become immutable. This is not the default now, but it can be forced using the '-safe-string' compile option. I tested this on Fedora 24 (OCaml 4.02) & RHEL 7 (OCaml 4.01).
2016 Dec 09
0
Re: [PATCH] generator: Share Common_utils code.
...ly in generator, so I'd leave it here for now (reduces the changes in this patch, and it can always be moved later on when needed). > -let replace_char s c1 c2 = > - let b2 = Bytes.of_string s in > - let r = ref false in > - for i = 0 to Bytes.length b2 - 1 do > - if Bytes.unsafe_get b2 i = c1 then ( > - Bytes.unsafe_set b2 i c2; > - r := true > - ) > - done; > - if not !r then s else Bytes.to_string b2 Ditto. > -let isspace c = > - c = ' ' > - (* || c = '\f' *) || c = '\n' || c = '\r' || c = '\t'...
2016 Aug 25
1
[PATCH] mllib: Add String.map function for OCaml < 4.00.0.
...10cf8..4e36d50 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -38,6 +38,14 @@ end module String = struct include String + let map f s = + let len = String.length s in + let b = Bytes.create len in + for i = 0 to len-1 do + Bytes.unsafe_set b i (f (unsafe_get s i)) + done; + Bytes.to_string b + let lowercase_ascii s = map Char.lowercase_ascii s let uppercase_ascii s = map Char.uppercase_ascii s diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 4959de6..de95f9d 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_...
2016 Aug 25
1
[PATCH 1.32] mllib: Add String.map function for OCaml < 4.00.0.
Same patch as just posted, but this is the modified version required for the stable-1.32 branch. Rich.
2017 Nov 21
3
[PATCH 0/3] Small improvements and fixes to urandom.
Small improvements and fixes to urandom.
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...e' | 'E' -> 14 + | 'f' | 'F' -> 15 + | _ -> -1 +end + +module String = struct + include String + + let map f s = + let len = String.length s in + let b = Bytes.create len in + for i = 0 to len-1 do + Bytes.unsafe_set b i (f (unsafe_get s i)) + done; + Bytes.to_string b + + let lowercase_ascii s = map Char.lowercase_ascii s + let uppercase_ascii s = map Char.uppercase_ascii s + + let capitalize_ascii s = + let b = Bytes.of_string s in + Bytes.unsafe_set b 0 (Char.uppercase_ascii (Bytes.unsafe_get b 0))...
2017 Jun 19
16
[PATCH v7 00/13] Refactor utilities
This is just the utilities part of the patch series from: https://www.redhat.com/archives/libguestfs/2017-June/msg00103.html I believe this addresses everything raised in comments on that patch series. Rich.
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...ntf @@ -119,85 +121,6 @@ let rstructs_used_by functions = let failwithf fs = ksprintf failwith fs -let unique = let i = ref 0 in fun () -> incr i; !i - -let replace_char s c1 c2 = - let b2 = Bytes.of_string s in - let r = ref false in - for i = 0 to Bytes.length b2 - 1 do - if Bytes.unsafe_get b2 i = c1 then ( - Bytes.unsafe_set b2 i c2; - r := true - ) - done; - if not !r then s else Bytes.to_string b2 - -let isspace c = - c = ' ' - (* || c = '\f' *) || c = '\n' || c = '\r' || c = '\t' (* || c = '\v' *) - -let triml ?(test...
2015 Oct 06
0
[PATCH 3/5] mllib: Add (Char|String).(lower|upper)case_ascii functions.
...val lowercase : char -> char val unsafe_chr : int -> char val uppercase : char -> char + + val lowercase_ascii : char -> char + val uppercase_ascii : char -> char end (** Override the Char module from stdlib. *) @@ -58,6 +61,9 @@ module String : sig val unsafe_get : string -> int -> char val unsafe_set : string -> int -> char -> unit val uppercase : string -> string + + val lowercase_ascii : string -> string + val uppercase_ascii : string -> string end (** Override the String module from stdlib. *) diff --git a/v2v...
2015 Oct 07
1
Re: [PATCH 3/5] mllib: Add (Char|String).(lower|upper)case_ascii functions.
...l unsafe_chr : int -> char > val uppercase : char -> char > + > + val lowercase_ascii : char -> char > + val uppercase_ascii : char -> char > end > (** Override the Char module from stdlib. *) > > @@ -58,6 +61,9 @@ module String : sig > val unsafe_get : string -> int -> char > val unsafe_set : string -> int -> char -> unit > val uppercase : string -> string > + > + val lowercase_ascii : string -> string > + val uppercase_ascii : string -> string > end > (** Override the String module...
2017 Feb 18
11
[PATCH 0/8] Miscellaneous cleanups to Windows registry code.
A very miscellaneous set of cleanups to how we handle the Windows registry in virt-v2v, firstboot, and inspection code. This should all be straightforward non-controversial refactoring. Some highlights: - Add a new mllib Registry module containing various utility functions that are currently scattered all around. - Only compute the software/system hive paths once during inspection, and
2017 Jun 09
12
[PATCH 00/12] Refactor utility functions.
This turned out to be rather more involved than I thought. We have lots of utility functions, spread all over the repository, with not a lot of structure. This moves many of them under common/ and structures them so there are clear dependencies. This doesn't complete the job by any means. Other items I had on my to-do list for this change were: - Split up mllib/common_utils into: -
2016 Dec 02
1
[PATCH NOT TO BE APPLIED] builder: make-template: Add --encrypted
I was attempting one way to solve: https://bugzilla.redhat.com/show_bug.cgi?id=1400332 "RFE: virt-builder should support templates with encrypted filesystems" However this approach doesn't really work because templates containing encrypted partitions cannot be compressed, and therefore the guest template would be a multi-gigabyte download. I better approach will likely be to use
2017 Jun 15
45
[PATCH v6 00/41] Refactor utilities, reimplement inspection in the daemon.
v5: https://www.redhat.com/archives/libguestfs/2017-June/msg00065.html Since v5, this now implements inspection almost completely for Linux and Windows guests. Rich.
2015 Oct 06
10
[PATCH 0/5] mllib: Hide bad String functions and miscellaneous refactoring.
Hide/prevent the use of bad string functions like String.lowercase. These are replaced by safe functions that won't break UTF-8 strings. Other miscellaneous refactoring. Rich.
2017 Jun 21
45
[PATCH v8 00/42] Refactor utilities and reimplement inspection.
v7 was: https://www.redhat.com/archives/libguestfs/2017-June/msg00169.html https://www.redhat.com/archives/libguestfs/2017-June/msg00184.html I believe this addresses all comments received so far. Also it now passes a test where I compared about 100 disk images processed with old and new virt-inspector binaries. The output is identical in all cases except one which is caused by a bug in blkid
2018 Apr 09
5
[PATCH 0/3] daemon: generate almost all the API OCaml interfaces
Hi, as a followup for the signature fix for mount_vfs [1], here it is a patch series to generate automatically most of the OCaml interfaces of daemon actions. Only the Lvm and Mount modules are left with hand-written interfaces. [1] https://www.redhat.com/archives/libguestfs/2018-April/msg00059.html Thanks, Pino Toscano (3): daemon: directly use Optgroups daemon: use the structs from the
2017 Jun 12
32
[PATCH v5 00/32] Refactor utilities, implement some APIs in OCaml.
This is a combination of: https://www.redhat.com/archives/libguestfs/2017-June/msg00046.html [PATCH 00/12] Refactor utility functions. plus: https://www.redhat.com/archives/libguestfs/2017-June/msg00023.html [PATCH v3 00/19] Allow APIs to be implemented in OCaml. with the second patches rebased on top of the utility refactoring, and some other adjustments and extensions. This passes
2018 Apr 09
0
[PATCH 3/3] daemon: autogenerate most of OCaml interfaces
...ain.ml +++ b/generator/main.ml @@ -46,6 +46,11 @@ let output_to_subset fs f = for i = 0 to nr_actions_files-1 do ksprintf (fun filename -> output_to filename (f actions_subsets.(i))) fs i done +let output_to_ocaml_daemon modname = + let fn = Char.escaped (Char.lowercase_ascii (String.unsafe_get modname 0)) ^ + String.sub modname 1 (String.length modname - 1) in + output_to (sprintf "daemon/%s.mli" fn) + (Daemon.generate_daemon_caml_interface modname) (* Main program. *) let () = @@ -155,6 +160,11 @@ Run it from the top source directory using the command...
2012 Aug 16
5
[PATCH 0/4] Add customization capabilities to virt-sysprep
In the TODO file there's a discussion of perhaps writing a new 'virt-customize' tool. I think it's probably better (or at any rate, easier) to just add this functionality into virt-sysprep. That is what this small series of patches aims to achieve. Note these are not very well tested at the moment. The first patch adds a generic and useful '--firstboot' flag. The