summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2023-02-23 21:53:16 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2023-02-23 21:56:06 +0100
commit86a66ea412a725caa59d9fa41ea333117406768e (patch)
tree27d396eb8fefdd4c9ff5ebc46d52dbd43e07fd5b
parent3dce1d6b1885f326c55aed9e1d401ac79801396a (diff)
downloadgjs-86a66ea412a725caa59d9fa41ea333117406768e.tar.gz
gi/value: Cleanup schar setting code
We still need to use an int32 to hold its result (as that's where a signed char is stored in JS), but if the conversion is fine we need to cast its value to signed char. Do it using C++ style now though.
-rw-r--r--gi/value.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/gi/value.cpp b/gi/value.cpp
index 651c21ad..17db002f 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -458,11 +458,11 @@ gjs_value_to_g_value_internal(JSContext *context,
return throw_expect_type(context, value, "string");
}
} else if (gtype == G_TYPE_CHAR) {
- gint32 i;
+ int32_t i;
if (Gjs::js_value_to_c_checked<signed char>(context, value, &i,
&out_of_range) &&
!out_of_range) {
- g_value_set_schar(gvalue, (signed char)i);
+ g_value_set_schar(gvalue, static_cast<signed char>(i));
} else {
return throw_expect_type(context, value, "char", 0, out_of_range);
}