| 877 | } |
| 878 | |
| 879 | google::protobuf::Message* UInt32FromValue(const google::protobuf::Message* prototype, |
| 880 | const CelValue& value, google::protobuf::Arena* arena) { |
| 881 | uint64_t val; |
| 882 | if (!value.GetValue(&val)) { |
| 883 | return nullptr; |
| 884 | } |
| 885 | if (!cel::internal::CheckedUint64ToUint32(val).ok()) { |
| 886 | return nullptr; |
| 887 | } |
| 888 | uint32_t ival = static_cast<uint32_t>(val); |
| 889 | auto* message = prototype->New(arena); |
| 890 | CEL_ASSIGN_OR_RETURN( |
| 891 | auto reflection, |
| 892 | cel::well_known_types::GetUInt32ValueReflection(message->GetDescriptor()), |
| 893 | _.With(IgnoreErrorAndReturnNullptr())); |
| 894 | reflection.SetValue(message, ival); |
| 895 | return message; |
| 896 | } |
| 897 | |
| 898 | google::protobuf::Message* UInt64FromValue(const google::protobuf::Message* prototype, |
| 899 | const CelValue& value, google::protobuf::Arena* arena) { |
no test coverage detected