[gjs/msvc.partial.fix] arg-cache.*: Use the type cast macros as needed
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/msvc.partial.fix] arg-cache.*: Use the type cast macros as needed
- Date: Mon, 8 Mar 2021 09:02:40 +0000 (UTC)
commit 6747a4e0f0be283a85807310028161cb423e0575
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Mar 8 17:01:31 2021 +0800
arg-cache.*: Use the type cast macros as needed
Use the macros we added in the previous commit so that we can still
convert between the underlying type of a class enumeration to the class
enumeration itself.
gi/arg-cache.cpp | 12 ++++++------
gi/arg-cache.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gi/arg-cache.cpp b/gi/arg-cache.cpp
index 937f1ade..1110d469 100644
--- a/gi/arg-cache.cpp
+++ b/gi/arg-cache.cpp
@@ -1249,7 +1249,7 @@ static const GjsArgumentMarshallers caller_allocates_out_marshallers = {
static inline void gjs_arg_cache_set_skip_all(GjsArgumentCache* self) {
self->marshallers = &skip_all_marshallers;
- self->flags = (GjsArgumentFlags::SKIP_IN | GjsArgumentFlags::SKIP_OUT);
+ self->flags = CAST_WRAPPED_T(GjsArgumentFlags, (GjsArgumentFlags::SKIP_IN | GjsArgumentFlags::SKIP_OUT));
}
bool gjs_arg_cache_build_return(JSContext*, GjsArgumentCache* self,
@@ -1296,7 +1296,7 @@ bool gjs_arg_cache_build_return(JSContext*, GjsArgumentCache* self,
// marshal_in is ignored for the return value, but skip_in is not (it is
// used in the failure release path)
- self->flags = (self->flags | GjsArgumentFlags::SKIP_IN);
+ self->flags = CAST_WRAPPED_T(GjsArgumentFlags, self->flags | GjsArgumentFlags::SKIP_IN);
self->marshallers = &return_value_marshallers;
return true;
@@ -1326,9 +1326,9 @@ static void gjs_arg_cache_build_enum_bounds(GjsArgumentCache* self,
self->contents.enum_type.enum_max = static_cast<uint32_t>(max);
if (min >= 0 && max > std::numeric_limits<int32_t>::max())
- self->flags = (self->flags | GjsArgumentFlags::UNSIGNED);
+ self->flags = CAST_WRAPPED_T(GjsArgumentFlags, self->flags | GjsArgumentFlags::UNSIGNED);
else
- self->flags = (self->flags & ~GjsArgumentFlags::UNSIGNED);
+ self->flags = CAST_WRAPPED_T(GjsArgumentFlags, self->flags & ~GjsArgumentFlags::UNSIGNED);
}
static void gjs_arg_cache_build_flags_mask(GjsArgumentCache* self,
@@ -1547,7 +1547,7 @@ static bool gjs_arg_cache_build_normal_in_arg(JSContext* cx,
self->marshallers = &string_in_transfer_none_marshallers;
else
self->marshallers = &string_in_marshallers;
- self->flags = (self->flags | GjsArgumentFlags::FILENAME);
+ self->flags = CAST_WRAPPED_T(GjsArgumentFlags, self->flags | GjsArgumentFlags::FILENAME);
break;
case GI_TYPE_TAG_UTF8:
@@ -1555,7 +1555,7 @@ static bool gjs_arg_cache_build_normal_in_arg(JSContext* cx,
self->marshallers = &string_in_transfer_none_marshallers;
else
self->marshallers = &string_in_marshallers;
- self->flags = (self->flags & ~GjsArgumentFlags::FILENAME);
+ self->flags = CAST_WRAPPED_T(GjsArgumentFlags, self->flags & ~GjsArgumentFlags::FILENAME);
break;
case GI_TYPE_TAG_INTERFACE: {
diff --git a/gi/arg-cache.h b/gi/arg-cache.h
index 54159df9..1cc7a604 100644
--- a/gi/arg-cache.h
+++ b/gi/arg-cache.h
@@ -122,7 +122,7 @@ struct GjsArgumentCache {
arg_name = "instance parameter";
// Some calls accept null for the instance, but generally in an object
// oriented language it's wrong to call a method on null
- flags = GjsArgumentFlags::NONE | GjsArgumentFlags::SKIP_OUT;
+ flags = CAST_WRAPPED_T(GjsArgumentFlags, GjsArgumentFlags::NONE | GjsArgumentFlags::SKIP_OUT);
}
void set_return_value() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]