+ # Fix field data types where enums have negative values.
+ for enum in enums:
+ if not enum.has_negative():
+ for message in messages:
+ for field in message.fields:
+ if field.pbtype == 'ENUM' and field.ctype == enum.names:
+ field.pbtype = 'UENUM'
+