diff options
Diffstat (limited to 'src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs')
-rw-r--r-- | src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs b/src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs index 57b9e65c..61aca3d9 100644 --- a/src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs @@ -107,7 +107,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override void WriteTo(pb::ICodedOutputStream output) {
- int size = SerializedSize;
+ CalcSerializedSize();
string[] field_names = _importMessageFieldNames;
if (hasD) {
output.WriteInt32(1, field_names[0], D);
@@ -120,17 +120,22 @@ namespace Google.ProtocolBuffers.TestProtos { get {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
- size = 0;
- if (hasD) {
- size += pb::CodedOutputStream.ComputeInt32Size(1, D);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
+ return CalcSerializedSize();
}
}
+ private int CalcSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (hasD) {
+ size += pb::CodedOutputStream.ComputeInt32Size(1, D);
+ }
+ size += UnknownFields.SerializedSize;
+ memoizedSerializedSize = size;
+ return size;
+ }
public static ImportMessage ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
|