diff --git a/src/fastpb/generator.py b/src/fastpb/generator.py index 4b8f1b6..71d83fe 100755 --- a/src/fastpb/generator.py +++ b/src/fastpb/generator.py @@ -43,6 +43,7 @@ 'BYTES': descriptor_pb2.FieldDescriptorProto.TYPE_BYTES, 'BOOL': descriptor_pb2.FieldDescriptorProto.TYPE_BOOL, 'ENUM': descriptor_pb2.FieldDescriptorProto.TYPE_ENUM, + 'FIXED32': descriptor_pb2.FieldDescriptorProto.TYPE_FIXED32, # TODO(robbyw): More types. } diff --git a/src/fastpb/template/module.jinjacc b/src/fastpb/template/module.jinjacc index d54a482..eb51fbe 100644 --- a/src/fastpb/template/module.jinjacc +++ b/src/fastpb/template/module.jinjacc @@ -43,6 +43,12 @@ fastpb_convert{{ TYPE.UINT32 }}(::google::protobuf::uint32 value) return PyLong_FromUnsignedLong(value); } +static PyObject * +fastpb_convert{{ TYPE.FIXED32 }}(::google::protobuf::int32 value) +{ + return PyLong_FromLong(value); +} + static PyObject * fastpb_convert{{ TYPE.UINT64 }}(::google::protobuf::uint64 value) { @@ -413,7 +419,7 @@ namespace { return -1; } - {% elif member.type == TYPE.INT32 or member.type == TYPE.SINT32 %} + {% elif member.type == TYPE.INT32 or member.type == TYPE.SINT32 or member.type == TYPE.FIXED32%} ::google::protobuf::int32 protoValue; // int32