Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit c4c427e

Browse files
edwintorokKonstantina Chremmou
authored andcommitted
CA-333712: handle wrapped strings the same as strings
The difference between these only matter for XAPI's implementation, not the clients. Signed-off-by: Edwin Török <[email protected]>
1 parent 01b005a commit c4c427e

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

c/gen_c_binding.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ and abstract_param_conv name = function
437437
| _ -> paramname name
438438

439439
and abstract_member = function
440-
String
440+
| SecretString | String
441441
| Ref _ -> "string"
442442
| Enum _ -> "enum"
443443
| Int -> "int"
@@ -532,7 +532,7 @@ and abstract_result_type typ =
532532

533533

534534
and abstract_type record = function
535-
| String -> "abstract_type_string"
535+
| SecretString | String -> "abstract_type_string"
536536
| Enum(n, _) ->
537537
sprintf "%s_abstract_type_" (typename n)
538538
| Ref _ ->
@@ -1206,7 +1206,7 @@ and find_needed' needed message =
12061206

12071207

12081208
and find_needed'' needed = function
1209-
| String
1209+
| SecretString | String
12101210
| Int
12111211
| Float
12121212
| Bool
@@ -1238,7 +1238,7 @@ and record_free_impl prefix = function
12381238

12391239

12401240
and free_impl val_name record = function
1241-
| String -> sprintf "free(%s);" val_name
1241+
| SecretString | String -> sprintf "free(%s);" val_name
12421242
| Int
12431243
| Float
12441244
| Bool
@@ -1274,7 +1274,7 @@ and add_enum_map_internal needed l r =
12741274

12751275

12761276
and c_type_of_ty needed record = function
1277-
| String -> "char *"
1277+
| SecretString|String -> "char *"
12781278
| Int -> "int64_t "
12791279
| Float -> "double "
12801280
| Bool -> "bool "
@@ -1341,7 +1341,7 @@ and c_type_of_enum name =
13411341

13421342

13431343
and initialiser_of_ty = function
1344-
| String
1344+
| SecretString | String
13451345
| Ref _
13461346
| Set _
13471347
| Map _
@@ -1354,7 +1354,7 @@ and mapname l r =
13541354

13551355

13561356
and name_of_ty = function
1357-
| String -> "string"
1357+
| SecretString | String -> "string"
13581358
| Int -> "int"
13591359
| Float -> "float"
13601360
| Bool -> "bool"

csharp/gen_csharp_binding.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ and proxy_type_opt = function
10651065

10661066

10671067
and proxy_type = function
1068-
| String -> "string"
1068+
| SecretString|String -> "string"
10691069
| Int -> "string"
10701070
| Float -> "double"
10711071
| Bool -> "bool"
@@ -1086,7 +1086,7 @@ and exposed_type_opt = function
10861086
| None -> "void"
10871087

10881088
and exposed_type = function
1089-
| String -> "string"
1089+
| SecretString | String -> "string"
10901090
| Int -> "long"
10911091
| Float -> "double"
10921092
| Bool -> "bool"
@@ -1128,7 +1128,7 @@ and convert_from_proxy_opt thing = function
11281128
and convert_from_proxy_hashtable_value thing ty =
11291129
match ty with
11301130
| Int -> sprintf "%s == null ? 0 : long.Parse((string)%s)" thing thing
1131-
| String -> sprintf "%s == null ? null : (string)%s" thing thing
1131+
| SecretString|String -> sprintf "%s == null ? null : (string)%s" thing thing
11321132
| Set(String) -> sprintf "%s == null ? new string[] {} : Array.ConvertAll<object, string>((object[])%s, Convert.ToString)" thing thing
11331133
| _ -> convert_from_proxy thing ty
11341134

@@ -1151,7 +1151,7 @@ and convert_from_hashtable fname ty =
11511151
| Float -> sprintf "Marshalling.ParseDouble(table, %s)" field
11521152
| Int -> sprintf "Marshalling.ParseLong(table, %s)" field
11531153
| Ref name -> sprintf "Marshalling.ParseRef<%s>(table, %s)" (exposed_class_name name) field
1154-
| String -> sprintf "Marshalling.ParseString(table, %s)" field
1154+
| SecretString|String -> sprintf "Marshalling.ParseString(table, %s)" field
11551155
| Set(String) -> sprintf "Marshalling.ParseStringArray(table, %s)" field
11561156
| Set(Ref name) -> sprintf "Marshalling.ParseSetRef<%s>(table, %s)" (exposed_class_name name) field
11571157
| Set(Enum(name, _)) -> sprintf "Helper.StringArrayToEnumList<%s>(Marshalling.ParseStringArray(table, %s))" name field
@@ -1182,7 +1182,7 @@ and simple_convert_from_proxy thing ty =
11821182
| Bool -> sprintf "(bool)%s" thing
11831183
| Float -> sprintf "Convert.ToDouble(%s)" thing
11841184
| Ref name -> sprintf "XenRef<%s>.Create(%s)" (exposed_class_name name) thing
1185-
| String -> thing
1185+
| SecretString|String -> thing
11861186
| Set(String) -> sprintf "(string [])%s" thing
11871187
| Set(Ref name) -> sprintf "XenRef<%s>.Create(%s)" (exposed_class_name name) thing
11881188
| Set(Enum(name, _)) -> sprintf "Helper.StringArrayToEnumList<%s>(%s)" name thing
@@ -1210,7 +1210,7 @@ and convert_to_proxy thing ty =
12101210
| Float
12111211
| DateTime -> thing
12121212
| Ref _ -> sprintf "%s ?? \"\"" thing
1213-
| String -> sprintf "%s ?? \"\"" thing
1213+
| SecretString | String -> sprintf "%s ?? \"\"" thing
12141214
| Enum (name,_) -> sprintf "%s_helper.ToString(%s)" name thing
12151215
| Set (Ref _) -> sprintf "%s == null ? new string[] {} : Helper.RefListToStringArray(%s)" thing thing
12161216
| Set(String) -> thing
@@ -1261,7 +1261,7 @@ and json_param p =
12611261
| Float
12621262
| Bool
12631263
| DateTime -> sprintf "_%s" thing
1264-
| String
1264+
| SecretString | String
12651265
| Ref _ -> sprintf "_%s ?? \"\"" thing
12661266
| Enum _ -> sprintf "_%s.StringOf()" thing
12671267
| Set (Ref _) -> sprintf "_%s == null ? new JArray() : JArray.FromObject(_%s, serializer)" thing thing
@@ -1340,7 +1340,7 @@ and get_default_value_per_type ty thing =
13401340
| Bool
13411341
| Float -> if thing = [] then "" else sprintf " = %s" (String.concat ", " thing)
13421342
| Ref _ -> sprintf " = new %s(%s)" (exposed_type ty) (if thing = [] then "Helper.NullOpaqueRef" else (String.concat ", " thing))
1343-
| String -> sprintf " = %s" (if thing = [] then "\"\"" else (String.concat ", " thing))
1343+
| SecretString | String -> sprintf " = %s" (if thing = [] then "\"\"" else (String.concat ", " thing))
13441344
| Enum (name,_) -> if thing = [] then "" else sprintf " = %s.%s" name (String.concat ", " thing)
13451345
| Set(Int)
13461346
| Set(String) -> sprintf " = {%s}" (String.concat ", " thing)

java/main.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ let types = ref TypeSet.empty
146146
let rec get_java_type ty =
147147
types := TypeSet.add ty !types;
148148
match ty with
149-
| String -> "String"
149+
| SecretString | String -> "String"
150150
| Int -> "Long"
151151
| Float -> "Double"
152152
| Bool -> "Boolean"
@@ -166,7 +166,7 @@ let _ = (get_java_type switch_enum);;
166166

167167
(*Helper function for get_marshall_function*)
168168
let rec get_marshall_function_rec = function
169-
| String -> "String"
169+
| SecretString | String -> "String"
170170
| Int -> "Long"
171171
| Float -> "Double"
172172
| Bool -> "Boolean"
@@ -388,7 +388,7 @@ and gen_record_tostring_contents file prefix = function
388388

389389

390390
let field_default = function
391-
| String -> "\"\""
391+
| SecretString | String -> "\"\""
392392
| Int -> "0"
393393
| Float -> "0.0"
394394
| Bool -> "false"
@@ -611,7 +611,7 @@ let gen_task_result_func file = function
611611
;;
612612

613613
let rec gen_marshall_body file = function
614-
| String -> fprintf file " return (String) object;\n"
614+
| SecretString | String -> fprintf file " return (String) object;\n"
615615
| Int -> fprintf file " return Long.valueOf((String) object);\n"
616616
| Float -> fprintf file " return (Double) object;\n"
617617
| Bool -> fprintf file " return (Boolean) object;\n"

powershell/common_functions.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ and qualified_class_name classname =
9999
and type_default ty =
100100
match ty with
101101
| Int -> ""
102-
| String -> ""
102+
| SecretString | String -> ""
103103
| Float -> ""
104104
| Bool -> ""
105105
| Enum _ -> ""
@@ -121,7 +121,7 @@ and exposed_type_opt = function
121121
| None -> "void"
122122

123123
and exposed_type = function
124-
| String -> "string"
124+
| SecretString | String -> "string"
125125
| Int -> "long"
126126
| Float -> "double"
127127
| Bool -> "bool"

powershell/gen_powershell_binding.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ and convert_from_hashtable fname ty =
649649
| Int -> sprintf "Marshalling.ParseLong(HashTable, %s)" field
650650
| Ref name -> sprintf "Marshalling.ParseRef<%s>(HashTable, %s)"
651651
(exposed_class_name name) field
652-
| String -> sprintf "Marshalling.ParseString(HashTable, %s)" field
652+
| SecretString|String -> sprintf "Marshalling.ParseString(HashTable, %s)" field
653653
| Set(String) -> sprintf "Marshalling.ParseStringArray(HashTable, %s)" field
654654
| Set(Ref x) -> sprintf "Marshalling.ParseSetRef<%s>(HashTable, %s)"
655655
(exposed_class_name x) field

0 commit comments

Comments
 (0)