From 982112b953c9f27161849fa1204c28fc0233e42f Mon Sep 17 00:00:00 2001 From: Johann Tuffe Date: Tue, 14 Feb 2017 11:48:47 +0800 Subject: [PATCH] fix wrong size from sint fields --- codegen/src/types.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codegen/src/types.rs b/codegen/src/types.rs index e1d5b2854..58d63483a 100644 --- a/codegen/src/types.rs +++ b/codegen/src/types.rs @@ -290,9 +290,10 @@ impl FieldType { fn get_size(&self, s: &str) -> String { match *self { - FieldType::Int32 | FieldType::Sint32 | FieldType::Int64 | - FieldType::Sint64 | FieldType::Uint32 | FieldType::Uint64 | + FieldType::Int32 | FieldType::Int64 | FieldType::Uint32 | FieldType::Uint64 | FieldType::Bool | FieldType::Enum(_) => format!("sizeof_varint(*({}) as u64)", s), + FieldType::Sint32 => format!("sizeof_sint32(*({}))", s), + FieldType::Sint64 => format!("sizeof_sint64(*({}))", s), FieldType::Fixed64 | FieldType::Sfixed64 | FieldType::Double => "8".to_string(), FieldType::Fixed32 | FieldType::Sfixed32 | FieldType::Float => "4".to_string(),