diff options
author | csharptest <roger@csharptest.net> | 2015-02-07 15:34:25 -0600 |
---|---|---|
committer | rogerk <devnull@localhost> | 2015-02-07 15:34:25 -0600 |
commit | 53727a0ac7428bc50bc309758d47a66d38e28e85 (patch) | |
tree | d69d09e6541b497745b426b3027fede47ea8a69a /src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs | |
parent | b4bd2e0384609a18751a3584e18cbe52ed1542a4 (diff) | |
download | protobuf-53727a0ac7428bc50bc309758d47a66d38e28e85.tar.gz protobuf-53727a0ac7428bc50bc309758d47a66d38e28e85.tar.bz2 protobuf-53727a0ac7428bc50bc309758d47a66d38e28e85.zip |
Rebuild source for Issue 84 change to code generator
Diffstat (limited to 'src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs')
-rw-r--r-- | src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs index f7ecaa44..5737582d 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -120,7 +120,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override void WriteTo(pb::ICodedOutputStream output) {
- int size = SerializedSize;
+ CalcSerializedSize();
string[] field_names = _testEmbedOptimizedForSizeFieldNames;
if (hasOptionalMessage) {
output.WriteMessage(1, field_names[0], OptionalMessage);
@@ -136,20 +136,25 @@ namespace Google.ProtocolBuffers.TestProtos { get {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
- size = 0;
- if (hasOptionalMessage) {
- size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalMessage);
- }
- foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) {
- size += pb::CodedOutputStream.ComputeMessageSize(2, element);
- }
- size += UnknownFields.SerializedSize;
- memoizedSerializedSize = size;
- return size;
+ return CalcSerializedSize();
}
}
+ private int CalcSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (hasOptionalMessage) {
+ size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalMessage);
+ }
+ foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) {
+ size += pb::CodedOutputStream.ComputeMessageSize(2, element);
+ }
+ size += UnknownFields.SerializedSize;
+ memoizedSerializedSize = size;
+ return size;
+ }
public static TestEmbedOptimizedForSize ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
|