| 809 | } |
| 810 | |
| 811 | google::protobuf::Message* Int32FromValue(const google::protobuf::Message* prototype, |
| 812 | const CelValue& value, google::protobuf::Arena* arena) { |
| 813 | int64_t val; |
| 814 | if (!value.GetValue(&val)) { |
| 815 | return nullptr; |
| 816 | } |
| 817 | if (!cel::internal::CheckedInt64ToInt32(val).ok()) { |
| 818 | return nullptr; |
| 819 | } |
| 820 | int32_t ival = static_cast<int32_t>(val); |
| 821 | auto* message = prototype->New(arena); |
| 822 | CEL_ASSIGN_OR_RETURN( |
| 823 | auto reflection, |
| 824 | cel::well_known_types::GetInt32ValueReflection(message->GetDescriptor()), |
| 825 | _.With(IgnoreErrorAndReturnNullptr())); |
| 826 | reflection.SetValue(message, ival); |
| 827 | return message; |
| 828 | } |
| 829 | |
| 830 | google::protobuf::Message* Int64FromValue(const google::protobuf::Message* prototype, |
| 831 | const CelValue& value, google::protobuf::Arena* arena) { |
no test coverage detected