16
16
*/
17
17
18
18
// Create an expression using a foreign function call.
19
- inline WasmResult createExpression (StringView expr, uint32_t * token) {
19
+ inline WasmResult createExpression (StringView expr, uint32_t * token) {
20
20
std::string function = " expr_create" ;
21
- char * out = nullptr ;
21
+ char * out = nullptr ;
22
22
size_t out_size = 0 ;
23
23
auto result = proxy_call_foreign_function (function.data (), function.size (), expr.data (),
24
24
expr.size (), &out, &out_size);
25
25
if (result == WasmResult::Ok && out_size == sizeof (uint32_t )) {
26
- *token = *reinterpret_cast <uint32_t *>(out);
26
+ *token = *reinterpret_cast <uint32_t *>(out);
27
27
}
28
28
::free (out);
29
29
return result;
@@ -32,11 +32,11 @@ inline WasmResult createExpression(StringView expr, uint32_t* token) {
32
32
// Evaluate an expression using an expression token.
33
33
inline Optional<WasmDataPtr> exprEvaluate (uint32_t token) {
34
34
std::string function = " expr_evaluate" ;
35
- char * out = nullptr ;
35
+ char * out = nullptr ;
36
36
size_t out_size = 0 ;
37
37
auto result = proxy_call_foreign_function (function.data (), function.size (),
38
- reinterpret_cast <const char *>(&token), sizeof ( uint32_t ),
39
- &out, &out_size);
38
+ reinterpret_cast <const char *>(&token),
39
+ sizeof ( uint32_t ), &out, &out_size);
40
40
if (result != WasmResult::Ok) {
41
41
return {};
42
42
}
@@ -46,25 +46,25 @@ inline Optional<WasmDataPtr> exprEvaluate(uint32_t token) {
46
46
// Delete an expression using an expression token.
47
47
inline WasmResult exprDelete (uint32_t token) {
48
48
std::string function = " expr_delete" ;
49
- char * out = nullptr ;
49
+ char * out = nullptr ;
50
50
size_t out_size = 0 ;
51
51
auto result = proxy_call_foreign_function (function.data (), function.size (),
52
- reinterpret_cast <const char *>(&token), sizeof ( uint32_t ),
53
- &out, &out_size);
52
+ reinterpret_cast <const char *>(&token),
53
+ sizeof ( uint32_t ), &out, &out_size);
54
54
::free (out);
55
55
return result;
56
56
}
57
57
58
- template <typename T> inline bool evaluateExpression (uint32_t token, T* out) {
58
+ template <typename T> inline bool evaluateExpression (uint32_t token, T * out) {
59
59
auto buf = exprEvaluate (token);
60
60
if (!buf.has_value () || buf.value ()->size () != sizeof (T)) {
61
61
return false ;
62
62
}
63
- *out = *reinterpret_cast <const T*>(buf.value ()->data ());
63
+ *out = *reinterpret_cast <const T *>(buf.value ()->data ());
64
64
return true ;
65
65
}
66
66
67
- template <> inline bool evaluateExpression<std::string>(uint32_t token, std::string* out) {
67
+ template <> inline bool evaluateExpression<std::string>(uint32_t token, std::string * out) {
68
68
auto buf = exprEvaluate (token);
69
69
if (!buf.has_value ()) {
70
70
return false ;
@@ -74,7 +74,7 @@ template <> inline bool evaluateExpression<std::string>(uint32_t token, std::str
74
74
}
75
75
76
76
// Specialization for message types (including struct value for lists and maps)
77
- template <typename T> inline bool evaluateMessage (uint32_t token, T* value_ptr) {
77
+ template <typename T> inline bool evaluateMessage (uint32_t token, T * value_ptr) {
78
78
auto buf = exprEvaluate (token);
79
79
if (!buf.has_value ()) {
80
80
return false ;
0 commit comments