Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add the Int32 type to rpc-light. #122

Merged
merged 1 commit into from

1 participant

@jonludlam
Owner

Note that the autogen code never generates this, it's purely
intended for places where for whatever reason you really need to
marshal an int32 into an xmlrpc tag.

Signed-off-by: Jon Ludlam jonathan.ludlam@eu.citrix.com

@jonludlam jonludlam Add the Int32 type to rpc-light.
Note that the autogen code never generates this, it's purely
intended for places where for whatever reason you really need to
marshal an int32 into an xmlrpc <i4> tag.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
c56c959
@jonludlam jonludlam merged commit 7a0e40e into xapi-project:master

1 check failed

Details default Merged build finished.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 29, 2013
  1. @jonludlam

    Add the Int32 type to rpc-light.

    jonludlam authored
    Note that the autogen code never generates this, it's purely
    intended for places where for whatever reason you really need to
    marshal an int32 into an xmlrpc <i4> tag.
    
    Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
This page is out of date. Refresh to see the latest.
View
1  rpc-light/jsonrpc.ml
@@ -44,6 +44,7 @@ let escape_string s =
let rec to_fct t f =
match t with
| Int i -> f (Printf.sprintf "%Ld" i)
+ | Int32 i -> f (Printf.sprintf "%ld" i)
| Bool b -> f (string_of_bool b)
| Float r -> f (Printf.sprintf "%f" r)
| String s -> f (escape_string s)
View
2  rpc-light/rpc.ml
@@ -19,6 +19,7 @@ let lower = String.lowercase
type t =
| Int of int64
+ | Int32 of int32
| Bool of bool
| Float of float
| String of string
@@ -34,6 +35,7 @@ open Printf
let map_strings sep fn l = String.concat sep (List.map fn l)
let rec to_string t = match t with
| Int i -> sprintf "I(%Li)" i
+ | Int32 i -> sprintf "I32(%li)" i
| Bool b -> sprintf "B(%b)" b
| Float f -> sprintf "F(%g)" f
| String s -> sprintf "S(%s)" s
View
1  rpc-light/rpc.mli
@@ -16,6 +16,7 @@
type t =
Int of int64
+ | Int32 of int32
| Bool of bool
| Float of float
| String of string
View
5 rpc-light/xmlrpc.ml
@@ -65,6 +65,11 @@ let rec add_value f = function
f (Int64.to_string i);
f "</value>"
+ | Int32 i ->
+ f "<value><i4>";
+ f (Int32.to_string i);
+ f "</i4></value>"
+
| Bool b ->
f "<value><boolean>";
f (if b then "1" else "0");
Something went wrong with that request. Please try again.