search for: caml_invalid_argu

Displaying 20 results from an estimated 69 matches for "caml_invalid_argu".

2015 May 05
2
[PATCH 0/2] v2v: -o libvirt: Check if the domain exists on the target (RHBZ#889082).
https://bugzilla.redhat.com/show_bug.cgi?id=889082
2017 Sep 08
2
[PATCH] RFC: v2v: add and use libvirt connection objects
...VIR_CONNECT_RO); - if (conn == NULL) { - if (conn_uri) - snprintf (errmsg, sizeof errmsg, - _("cannot open libvirt connection ‘%s’"), conn_uri); - else - snprintf (errmsg, sizeof errmsg, _("cannot open libvirt connection")); - caml_invalid_argument (errmsg); - } - - /* Suppress default behaviour of printing errors to stderr. Note - * you can't set this to NULL to ignore errors; setting it to NULL - * restores the default error handler ... - */ - virConnSetErrorFunc (conn, NULL, ignore_errors); - /* Look up the pool. */ +...
2019 Apr 08
0
[PATCH v4 3/7] v2v: switch to ocaml-libvirt
...VIR_CONNECT_RO); - if (conn == NULL) { - if (conn_uri) - snprintf (errmsg, sizeof errmsg, - _("cannot open libvirt connection ‘%s’"), conn_uri); - else - snprintf (errmsg, sizeof errmsg, _("cannot open libvirt connection")); - caml_invalid_argument (errmsg); - } - - /* Suppress default behaviour of printing errors to stderr. Note - * you can't set this to NULL to ignore errors; setting it to NULL - * restores the default error handler ... - */ - virConnSetErrorFunc (conn, NULL, ignore_errors); - - /* Look up the pool. */ -...
2015 Jul 02
0
[PATCH] Fix various -Wformat problems.
.../* Does the stream footer look reasonable? */ r = lzma_stream_footer_decode (&footer_flags, footer); if (r != LZMA_OK) { - fprintf (stderr, "invalid stream footer - error %d\n", r); + fprintf (stderr, "invalid stream footer - error %u\n", r); caml_invalid_argument ("invalid stream footer"); } @@ -317,7 +317,7 @@ parse_indexes (value filenamev, int fd) /* Decode the index. */ r = lzma_index_decoder (&strm, &this_index, UINT64_MAX); if (r != LZMA_OK) { - fprintf (stderr, "invalid stream index - error %d\n&q...
2015 Jul 02
0
[PATCH v2] Fix various -Wformat problems.
.../* Does the stream footer look reasonable? */ r = lzma_stream_footer_decode (&footer_flags, footer); if (r != LZMA_OK) { - fprintf (stderr, "invalid stream footer - error %d\n", r); + fprintf (stderr, "invalid stream footer - error %u\n", r); caml_invalid_argument ("invalid stream footer"); } @@ -317,7 +317,7 @@ parse_indexes (value filenamev, int fd) /* Decode the index. */ r = lzma_index_decoder (&strm, &this_index, UINT64_MAX); if (r != LZMA_OK) { - fprintf (stderr, "invalid stream index - error %d\n&q...
2015 Jun 25
0
[PATCH v2] v2v: Free XML objects in the correct order.
...59,7 +162,7 @@ v2v_xml_to_string (value docv, value formatv) } value -v2v_xml_xpath_new_context (value docv) +v2v_xml_xpath_new_context_ptr (value docv) { CAMLparam1 (docv); CAMLlocal1 (xpathctxv); @@ -171,21 +174,21 @@ v2v_xml_xpath_new_context (value docv) if (xpathctx == NULL) caml_invalid_argument ("xpath_new_context: unable to create xmlXPathNewContext"); - xpathctxv = caml_alloc_custom (&xpathctx_custom_operations, + xpathctxv = caml_alloc_custom (&xpathctx_ptr_custom_operations, sizeof (xmlXPathContextPtr), 0, 1); - Xpathctx_val...
2015 Jun 25
0
[PATCH] v2v: Free XML objects in the correct order.
...59,7 +162,7 @@ v2v_xml_to_string (value docv, value formatv) } value -v2v_xml_xpath_new_context (value docv) +v2v_xml_xpath_new_context_ptr (value docv) { CAMLparam1 (docv); CAMLlocal1 (xpathctxv); @@ -171,21 +174,21 @@ v2v_xml_xpath_new_context (value docv) if (xpathctx == NULL) caml_invalid_argument ("xpath_new_context: unable to create xmlXPathNewContext"); - xpathctxv = caml_alloc_custom (&xpathctx_custom_operations, + xpathctxv = caml_alloc_custom (&xpathctx_ptr_custom_operations, sizeof (xmlXPathContextPtr), 0, 1); - Xpathctx_val...
2015 Aug 12
0
[PATCH 2/2] builder: support Simple Streams v1.0 as index metadata
...l_none (Val_int (0)) + +extern value virt_builder_yajl_is_available (value unit); +extern value virt_builder_yajl_tree_parse (value stringv); + +#if HAVE_YAJL +static value +convert_yajl_value (yajl_val val, int level) +{ + CAMLparam0 (); + CAMLlocal4 (rv, lv, v, sv); + + if (level > 20) + caml_invalid_argument ("too many levels of object/array nesting"); + + if (YAJL_IS_OBJECT (val)) { + size_t len = YAJL_GET_OBJECT(val)->len; + size_t i; + rv = caml_alloc (1, 3); + lv = caml_alloc_tuple (len); + for (i = 0; i < len; ++i) { + v = caml_alloc_tuple (2); + sv =...
2015 Jun 25
2
[PATCH v2] v2v: Free XML objects in the correct order.
In version 2: - No substantial change, I just tidied up the code a bit. - Removed one case where whitespace changes had crept in. Rich.
2017 Sep 22
0
[PATCH v3 01/22] common/mlpcre: Raise Invalid_argument if PCRE.sub n parameter is negative.
...,10 @@ guestfs_int_pcre_sub (value nv) if (m == NULL) raise_pcre_error ("PCRE.sub called without calling PCRE.matches", 0); - len = pcre_get_substring (m->subject, m->vec, m->r, Int_val (nv), - (const char **) &str); + if (n < 0) + caml_invalid_argument ("PCRE.sub: n must be >= 0"); + + len = pcre_get_substring (m->subject, m->vec, m->r, n, (const char **) &str); if (len == PCRE_ERROR_NOSUBSTRING) caml_raise_not_found (); diff --git a/common/mlpcre/pcre_tests.ml b/common/mlpcre/pcre_tests.ml index e5214eab8...
2018 Feb 15
0
[PATCH] Introduce a wrapper around xmlParseURI.
...0,11 @@ mllib_xml_doc_get_root_element (value docv) } } -value -mllib_xml_parse_uri (value strv) +static value +Val_uri (xmlURIPtr uri) { - CAMLparam1 (strv); + CAMLparam0 (); CAMLlocal3 (rv, sv, ov); - xmlURIPtr uri; - - uri = xmlParseURI (String_val (strv)); - if (uri == NULL) - caml_invalid_argument ("parse_uri: unable to parse URI"); rv = caml_alloc_tuple (9); @@ -514,7 +513,37 @@ mllib_xml_parse_uri (value strv) else ov = Val_int (0); Store_field (rv, 8, ov); + CAMLreturn (rv); +} + +value +mllib_xml_parse_uri (value strv) +{ + CAMLparam1 (strv); + CAMLlocal1...
2018 Nov 02
0
[PATCH REPOST] Introduce a wrapper around xmlParseURI.
...0,11 @@ mllib_xml_doc_get_root_element (value docv) } } -value -mllib_xml_parse_uri (value strv) +static value +Val_uri (xmlURIPtr uri) { - CAMLparam1 (strv); + CAMLparam0 (); CAMLlocal3 (rv, sv, ov); - xmlURIPtr uri; - - uri = xmlParseURI (String_val (strv)); - if (uri == NULL) - caml_invalid_argument ("parse_uri: unable to parse URI"); rv = caml_alloc_tuple (9); @@ -514,7 +513,37 @@ mllib_xml_parse_uri (value strv) else ov = Val_int (0); Store_field (rv, 8, ov); + CAMLreturn (rv); +} + +value +mllib_xml_parse_uri (value strv) +{ + CAMLparam1 (strv); + CAMLlocal1...
2017 Dec 12
1
[PATCH] Introduce a wrapper around xmlParseURI.
An alternate solution to: https://www.redhat.com/archives/libguestfs/2017-December/msg00035.html "[PATCH] v2v: -i vmx: Allow ssh URLs to use spaces." is to classify all URLs processed by libguestfs as either ordinary URLs or the special non-standard URLs that we use for things like ‘virt-v2v -i vmx’ and ‘guestfish --add’. For the non-standard URLs, provide a wrapper around
2017 Sep 20
4
[PATCH 0/4] Replace some uses of the Str module with PCRE.
Str is a pretty ugly regexp module. Let's try to replace it with PCRE. This series of commits goes some small way towards that eventual goal. - - - I wonder if there was a deep reason why we had this? let unix2dos s = String.concat "\r\n" (Str.split_delim (Str.regexp_string "\n") s) I replaced it with what I think should be (nearly) equivalent: let unix2dos s =
2019 Apr 08
0
[PATCH v4 1/7] v2v: require libvirt
...ine NO_LIBVIRT(proto) \ - proto __attribute__((noreturn)); \ - proto \ - { \ - caml_invalid_argument ("virt-v2v was compiled without libvirt support"); \ - } - -NO_LIBVIRT (value v2v_dumpxml (value connv, value domv)) -NO_LIBVIRT (value v2v_pool_dumpxml (value connv, value poolv)) -NO_LIBVIRT (value v2v_vol_dumpxml (value connv, value poolnamev, value volnamev)) -NO_LIBVIRT (value v...
2017 Sep 22
0
[PATCH v3 02/22] common/mlpcre: Add PCRE.subi to return indexes instead of the substring.
...rv); } + +value +guestfs_int_pcre_subi (value nv) +{ + CAMLparam1 (nv); + int n = Int_val (nv); + CAMLlocal1 (rv); + struct last_match *m = gl_tls_get (last_match); + + if (m == NULL) + raise_pcre_error ("PCRE.subi called without calling PCRE.matches", 0); + + if (n < 0) + caml_invalid_argument ("PCRE.subi: n must be >= 0"); + + /* eg if there are 2 captures, m->r == 3, and valid values of n are + * 0, 1 or 2. + */ + if (n >= m->r) + caml_raise_not_found (); + + rv = caml_alloc (2, 0); + Store_field (rv, 0, Val_int (m->vec[n*2])); + Store_field (rv...
2018 Aug 23
2
[PATCH 1/2] mltools: JSON: add json_parser_tree_parse_file
...) { + char buf[1024 + JSON_ERROR_TEXT_LENGTH]; + if (strlen (err.text) > 0) + snprintf (buf, sizeof buf, "%s: JSON parse error: %s", String_val (filev), err.text); + else + snprintf (buf, sizeof buf, "%s: unknown JSON parse error", String_val (filev)); + caml_invalid_argument (buf); + } + + rv = convert_json_t (tree, 1); + json_decref (tree); + + CAMLreturn (rv); +} diff --git a/common/mltools/JSON_parser.ml b/common/mltools/JSON_parser.ml index 642e24d65..7c01ddf04 100644 --- a/common/mltools/JSON_parser.ml +++ b/common/mltools/JSON_parser.ml @@ -21,6 +21,7 @@...
2018 Nov 02
2
[PATCH REPOST] Introduce a wrapper around xmlParseURI.
Previously posted: https://www.redhat.com/archives/libguestfs/2017-December/msg00046.html Rich.
2015 Aug 12
4
[PATCH 0/2 v2] RFC: builder: support for Simple Streams metadata
Hi, this series adds a basic support for Simple Streams v1.0 metadata files. This makes it possible to create a repository .conf files with [cirros] uri=http://download.cirros-cloud.net format=simplestreams to read the latest version of each CirrOS image. TODO items: - check the pasted metadata: listing and creating images works, so most of the current metadata is correct - possibly wait
2016 Jul 06
0
[PATCH] ext2: Don't load whole files into memory when copying to the appliance (RHBZ#1113065).
...r *p = buf; - - while (n < size) { - ssize_t r = read (fd, p, size - n); - if (r == -1) - unix_error (errno, (char *) "read", caml_copy_string (filename)); - if (r == 0) { - fprintf (stderr, "supermin: end of file reading '%s'\n", filename); - caml_invalid_argument ("ext2fs: file has changed size unexpectedly"); - } - n += r; - p += r; - } - - if (close (fd) == -1) - unix_error (errno, (char *) "close", caml_copy_string (filename)); - - return buf; -} - /* Copy a file (or directory etc) from the host. */ static void e...