diff --git a/elisp/proto/BUILD b/elisp/proto/BUILD index 3678f02c..ce709e6a 100644 --- a/elisp/proto/BUILD +++ b/elisp/proto/BUILD @@ -168,6 +168,7 @@ cc_binary( "@com_google_absl//absl/base:config", "@com_google_absl//absl/base:core_headers", "@upb", + "@upb//:base", "@upb//:collections", "@upb//:descriptor_upb_proto", "@upb//:json", diff --git a/elisp/proto/module.c b/elisp/proto/module.c index 63ac806e..090eeb28 100644 --- a/elisp/proto/module.c +++ b/elisp/proto/module.c @@ -149,6 +149,7 @@ #include "google/protobuf/duration.upbdefs.h" #include "google/protobuf/timestamp.upb.h" #include "google/protobuf/timestamp.upbdefs.h" +#include "upb/base/upcast.h" #include "upb/collections.h" #include "upb/decode.h" #include "upb/def.h" @@ -3528,8 +3529,10 @@ static emacs_value Timestamp(emacs_env* env, kTimestampP, args[0]); if (msg.type == NULL) return NULL; struct timespec time; - time.tv_sec = google_protobuf_Timestamp_seconds(msg.value); - time.tv_nsec = google_protobuf_Timestamp_nanos(msg.value); + time.tv_sec = google_protobuf_Timestamp_seconds( + (google_protobuf_Timestamp*)msg.value); + time.tv_nsec = google_protobuf_Timestamp_nanos( + (google_protobuf_Timestamp*)msg.value); return MakeTime(ctx, time); } @@ -3542,8 +3545,10 @@ static emacs_value Duration(emacs_env* env, kDurationP, args[0]); if (msg.type == NULL) return NULL; struct timespec time; - time.tv_sec = google_protobuf_Duration_seconds(msg.value); - time.tv_nsec = google_protobuf_Duration_nanos(msg.value); + time.tv_sec = google_protobuf_Duration_seconds( + (google_protobuf_Duration*)msg.value); + time.tv_nsec = google_protobuf_Duration_nanos( + (google_protobuf_Duration*)msg.value); return MakeTime(ctx, time); } @@ -3556,7 +3561,7 @@ static emacs_value SetTimestamp(emacs_env* env, ctx, kUpb_WellKnown_Timestamp, kTimestampP, args[0]); if (msg.type == NULL) return NULL; emacs_value time = args[1]; - SetTimestampProto(ctx, msg.value, time); + SetTimestampProto(ctx, (google_protobuf_Timestamp*)msg.value, time); return time; } @@ -3569,7 +3574,7 @@ static emacs_value SetDuration(emacs_env* env, ctx, kUpb_WellKnown_Duration, kDurationP, args[0]); if (msg.type == NULL) return NULL; emacs_value time = args[1]; - SetDurationProto(ctx, msg.value, time); + SetDurationProto(ctx, (google_protobuf_Duration*)msg.value, time); return time; } @@ -3589,7 +3594,7 @@ static emacs_value MakeTimestamp(emacs_env* env, } if (!SetTimestampProto(ctx, msg, args[0])) return NULL; return MakeMessageStruct(ctx, arena, GlobalSymbol(ctx, kTimestampNew), def, - msg, true); + UPB_UPCAST(msg), true); } static emacs_value MakeDuration(emacs_env* env, @@ -3608,7 +3613,7 @@ static emacs_value MakeDuration(emacs_env* env, } if (!SetDurationProto(ctx, msg, args[0])) return NULL; return MakeMessageStruct(ctx, arena, GlobalSymbol(ctx, kDurationNew), def, - msg, true); + UPB_UPCAST(msg), true); } static emacs_value PackAny(emacs_env* env, @@ -3635,7 +3640,7 @@ static emacs_value PackAny(emacs_env* env, if (type_url.data == NULL || serialized.data == NULL) return NULL; google_protobuf_Any_set_type_url(any, View(type_url)); google_protobuf_Any_set_value(any, View(serialized)); - return MakeMutableMessage(ctx, arena, any_def, any); + return MakeMutableMessage(ctx, arena, any_def, UPB_UPCAST(any)); } static emacs_value UnpackAny(emacs_env* env, @@ -3647,8 +3652,10 @@ static emacs_value UnpackAny(emacs_env* env, struct MessageArg any = ExtractWellKnownMessage(ctx, kUpb_WellKnown_Any, kAnyP, arg); if (any.type == NULL) return NULL; - upb_StringView type_url = google_protobuf_Any_type_url(any.value); - upb_StringView serialized = google_protobuf_Any_value(any.value); + upb_StringView type_url = google_protobuf_Any_type_url( + (google_protobuf_Any *)any.value); + upb_StringView serialized = google_protobuf_Any_value( + (google_protobuf_Any *)any.value); if (type_url.data == NULL || serialized.data == NULL) { UninitializedAny(ctx, arg); return NULL; @@ -3670,7 +3677,8 @@ static emacs_value AnyTypeName(emacs_env* env, struct MessageArg any = ExtractWellKnownMessage(ctx, kUpb_WellKnown_Any, kAnyP, arg); if (any.type == NULL) return NULL; - upb_StringView type_url = google_protobuf_Any_type_url(any.value); + upb_StringView type_url = google_protobuf_Any_type_url( + (google_protobuf_Any *)any.value); if (type_url.data == NULL) { UninitializedAny(ctx, arg); return NULL;