search for: to_int

Displaying 20 results from an estimated 57 matches for "to_int".

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 May 26
2
[PATCH] customize: random_seed: avoid one file checking for existing files
...t = !created -and make_random_seed_file g file = - let file_exists = g#is_file file in +and make_random_seed_file ?exists g file = + let file_exists = + match exists with + | None -> g#is_file file + | Some b -> b in let n = if file_exists then ( let n = Int64.to_int (g#filesize file) in -- 2.5.5
2008 Aug 01
1
bug in readRAST6 function in package spgrass6
...import a raster layer which consists only of NULL values from grass by using the readRAST6, I get an error message: > readRAST6("HSericea_seedsDisperse_2007") ERROR: Invalid value for null (integers only) Error in readBinGrid(rtmpfl11, colname = vname[i], proj4string = p4, integer = to_int) : no such file: /home/rkrug/Documents/Projects/AlienSpread/R/../grass/simulation/.tmp/ecolmod/HSericea_seedsDisperse_2007 Thanks Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Facul...
2019 Apr 23
0
[PATCH nbdkit v2 1/2] ocaml: Change pread method to avoid leaking heap memory.
...lugin.ml index 842f10e..f27c099 100644 --- a/tests/test_ocaml_plugin.ml +++ b/tests/test_ocaml_plugin.ml @@ -28,9 +28,11 @@ let test_close h = let test_get_size h = Int64.of_int (Bytes.length h.disk) -let test_pread h buf offset _ = - let len = Bytes.length buf in - Bytes.blit h.disk (Int64.to_int offset) buf 0 len +let test_pread h count offset _ = + let count = Int32.to_int count in + let buf = Bytes.create count in + Bytes.blit h.disk (Int64.to_int offset) buf 0 count; + Bytes.unsafe_to_string buf let test_pwrite h buf offset _ = let len = String.length buf in -- 2.20.1
2014 Jan 14
0
[PATCH] builder, edit, fish: use copy-attributes
...py over other extended - * attributes too? - *) - let selinux_context = - if has_linuxxattrs then ( - try Some (g#getxattr src "security.selinux") with _ -> None - ) else None in - - (* Set the permissions (inc. sticky and set*id bits), UID, GID. *) - let mode = Int64.to_int stat.G.mode - and uid = Int64.to_int stat.G.uid and gid = Int64.to_int stat.G.gid in - g#chmod (mode land 0o7777) dest; - g#chown uid gid dest; - - (* Set the SELinux context. *) - match selinux_context with - | None -> () - | Some selinux_context -> - g#setxattr "security.seli...
2019 Aug 13
1
Re: [PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
...echanical conversion. > +++ b/ocaml/examples/asynch_copy.ml > @@ -48,7 +48,7 @@ let asynch_copy src dst = > if !soff < size && NBD.aio_in_flight src < max_reads_in_flight then ( > let bs = min bs (size -^ !soff) in > let buf = NBD.Buffer.alloc (Int64.to_int bs) in > - ignore (NBD.aio_pread_callback src buf !soff > + ignore (NBD.aio_pread src buf !soff > ~completion:(read_completed buf !soff)); Pre-existing; but is the indentation off here? (I would have guessed two fewer spaces, so that ~completion starts just afte...
2016 Jun 13
1
[PATCH] v2v: Fix get_firmware_bootable_device.
I'm going to push this because it's a test blocker, but FYI. Rich.
2009 Apr 24
0
[PATCH 2/2] Preserve MBR id in isohybrid
When running isohybrid again it's nice to preserve the MBR id There was some partial code to support setting the id using non existing to_int, but no way to use it. Signed-off-by: Pascal Terjan <pterjan at mandriva.com> --- utils/isohybrid.in | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/utils/isohybrid.in b/utils/isohybrid.in index e98c59f..b6c2b6f 100644 --- a/utils/isohybrid.in +++ b/uti...
2017 Jul 19
2
Re: [PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...; > + device func arg (error_message err); > + false > + > +let proc_unmangle_path path = > + let n = String.length path in > + let b = Buffer.create n in > + let rec loop i = > + if i < n-3 && path.[i] = '\\' then ( > + let to_int c = Char.code c - Char.code '0' in > + let v = > + (to_int path.[i+1] lsl 6) lor > + (to_int path.[i+2] lsl 3) lor > + to_int path.[i+3] in > + Buffer.add_char b (Char.chr v); > + loop (i+4) > + ) > + else if i < n then (...
2016 Jun 10
0
Re: [PATCH 1/2] v2v: fill the list of the EFI system partitions
...stfs. root=%s fmt=%s") root fmt > > -and has_uefi_bootable_device g = > +and get_uefi_bootable_device g = > let rec uefi_ESP_guid = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" > and is_uefi_ESP dev { G.part_num = partnum } = > g#part_get_gpt_type dev (Int32.to_int partnum) = uefi_ESP_guid > + and part_dev_name dev { G.part_num = partnum } = > + sprintf "%s%d" dev (Int32.to_int partnum) > and parttype_is_gpt dev = > try g#part_get_parttype dev = "gpt" > with G.Error msg as exn -> > @@ -164,14 +166,25 @...
2019 Aug 13
0
[PATCH libnbd 6/6] lib: Make all completion callbacks into OClosures.
...--git a/ocaml/examples/asynch_copy.ml b/ocaml/examples/asynch_copy.ml index 7dbe976..5aa6e60 100644 --- a/ocaml/examples/asynch_copy.ml +++ b/ocaml/examples/asynch_copy.ml @@ -49,7 +49,7 @@ let asynch_copy src dst = let bs = min bs (size -^ !soff) in let buf = NBD.Buffer.alloc (Int64.to_int bs) in ignore (NBD.aio_pread_callback src buf !soff - (read_completed buf !soff)); + ~completion:(read_completed buf !soff)); soff := !soff +^ bs ); @@ -59,7 +59,8 @@ let asynch_copy src dst = List.iter ( fun (buf, offset) ->...
2019 Aug 13
0
[PATCH libnbd v2 2/3] lib: Make all completion callbacks into OClosures.
...--git a/ocaml/examples/asynch_copy.ml b/ocaml/examples/asynch_copy.ml index 7dbe976..5aa6e60 100644 --- a/ocaml/examples/asynch_copy.ml +++ b/ocaml/examples/asynch_copy.ml @@ -49,7 +49,7 @@ let asynch_copy src dst = let bs = min bs (size -^ !soff) in let buf = NBD.Buffer.alloc (Int64.to_int bs) in ignore (NBD.aio_pread_callback src buf !soff - (read_completed buf !soff)); + ~completion:(read_completed buf !soff)); soff := !soff +^ bs ); @@ -59,7 +59,8 @@ let asynch_copy src dst = List.iter ( fun (buf, offset) ->...
2019 Apr 23
4
[PATCH nbdkit v2 0/2] Be careful not to leak server heap memory to the client.
Version 1 was here: https://www.redhat.com/archives/libguestfs/2019-April/msg00144.html Version 2 makes a couple of much larger changes: The OCaml patch changes the API of the pread method so it matches what other language bindings are already doing, ie. get the language plugin to return a newly allocated buffer, check it is long enough, copy out the data. The server patch implements a
2009 Sep 07
1
Usage of OCaml/R binding.
..._value : sexp -> unit = "r_print_value" > external exec : string -> arg array -> unit = "r_exec" > external current_test : unit -> unit = "r_current_test" > external to_bool : sexp -> bool = "bool_of_sexp" > external to_int : sexp -> int = "int_of_sexp" > external to_float : sexp -> float = "float_of_sexp" > external to_string : sexp -> string = "string_of_sexp" > external of_bool : bool -> sexp = "sexp_of_bool" > external of_int : int -&g...
2009 Sep 07
1
Usage of OCaml/R binding.
..._value : sexp -> unit = "r_print_value" > external exec : string -> arg array -> unit = "r_exec" > external current_test : unit -> unit = "r_current_test" > external to_bool : sexp -> bool = "bool_of_sexp" > external to_int : sexp -> int = "int_of_sexp" > external to_float : sexp -> float = "float_of_sexp" > external to_string : sexp -> string = "string_of_sexp" > external of_bool : bool -> sexp = "sexp_of_bool" > external of_int : int -&g...
2005 Mar 10
8
Login controller additions
I have added roles and roles_users table and updated the model so that my users can have multiple roles. ("Admin" role does always have id = 1). I have added these methods to my application controller. <code> helper_method :is_admin? helper_method :is_user? def is_admin? if @session[''user''] @session[''user''].roles.find(1)
2016 May 26
0
Re: [PATCH] customize: random_seed: avoid one file checking for existing files
...e g file = > - let file_exists = g#is_file file in > +and make_random_seed_file ?exists g file = > + let file_exists = > + match exists with > + | None -> g#is_file file > + | Some b -> b in > let n = > if file_exists then ( > let n = Int64.to_int (g#filesize file) in Seems to be quite a detailed optimization, but sure, ACK. What was the problem this was trying to address? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df...
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.
2014 Jan 07
8
RFC: copy-attributes command
Hi, attached there is a prototype of patch for adding a new copy-attributes command. Such command would allow copy the attributes of a "file" to another, so for example in guestfish: copy-attributes foo bar permissions:true xattributes:false would only copy the permissions of foo to bar, not copying its extended attributes too. Just few notes: - my first daemon command, so
2017 Jul 14
0
[PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...f "is_root_device: %s: %s: %s: %s\n" + device func arg (error_message err); + false + +let proc_unmangle_path path = + let n = String.length path in + let b = Buffer.create n in + let rec loop i = + if i < n-3 && path.[i] = '\\' then ( + let to_int c = Char.code c - Char.code '0' in + let v = + (to_int path.[i+1] lsl 6) lor + (to_int path.[i+2] lsl 3) lor + to_int path.[i+3] in + Buffer.add_char b (Char.chr v); + loop (i+4) + ) + else if i < n then ( + Buffer.add_char b path.[i]; +...