aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers
diff options
context:
space:
mode:
authorArnoldZokas <arnold.zokas@coderoom.net>2010-11-22 22:13:59 +0000
committerArnoldZokas <arnold.zokas@coderoom.net>2010-11-22 22:13:59 +0000
commit64580d092f1d30328416b3836576fd25b82e5318 (patch)
treec08de5e5a1f1d7ecb1fc10b6edc26c6a7dafa243 /src/ProtocolBuffers
parenta695dfaa5a0dd60d818bd70f1798c651661cba43 (diff)
parent57599ef16daeda48381711dae1600cf0c467689d (diff)
downloadprotobuf-64580d092f1d30328416b3836576fd25b82e5318.tar.gz
protobuf-64580d092f1d30328416b3836576fd25b82e5318.tar.bz2
protobuf-64580d092f1d30328416b3836576fd25b82e5318.zip
Fixed merge conflicts
Diffstat (limited to 'src/ProtocolBuffers')
-rw-r--r--src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs186
-rw-r--r--src/ProtocolBuffers/Descriptors/FileDescriptor.cs129
-rw-r--r--src/ProtocolBuffers/DynamicMessage.cs2
-rw-r--r--src/ProtocolBuffers/UnknownField.cs4
4 files changed, 269 insertions, 52 deletions
diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
index 313c855e..ae13b5ac 100644
--- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
+++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
@@ -37,23 +37,26 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
byte[] descriptorData = global::System.Convert.FromBase64String(
"CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds" +
"ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG8i" +
- "6gEKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" +
+ "6wIKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" +
"bWJyZWxsYV9jbGFzc25hbWUYAiABKAkSHAoOcHVibGljX2NsYXNzZXMYAyAB" +
"KAg6BHRydWUSFgoObXVsdGlwbGVfZmlsZXMYBCABKAgSFAoMbmVzdF9jbGFz" +
"c2VzGAUgASgIEhYKDmNvZGVfY29udHJhY3RzGAYgASgIEiQKHGV4cGFuZF9u" +
"YW1lc3BhY2VfZGlyZWN0b3JpZXMYByABKAgSHAoOY2xzX2NvbXBsaWFuY2UY" +
- "CCABKAg6BHRydWUiKwoSQ1NoYXJwRmllbGRPcHRpb25zEhUKDXByb3BlcnR5" +
- "X25hbWUYASABKAk6XgoTY3NoYXJwX2ZpbGVfb3B0aW9ucxIcLmdvb2dsZS5w" +
- "cm90b2J1Zi5GaWxlT3B0aW9ucxjoByABKAsyIi5nb29nbGUucHJvdG9idWYu" +
- "Q1NoYXJwRmlsZU9wdGlvbnM6YQoUY3NoYXJwX2ZpZWxkX29wdGlvbnMSHS5n" +
- "b29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zGOgHIAEoCzIjLmdvb2dsZS5w" +
- "cm90b2J1Zi5DU2hhcnBGaWVsZE9wdGlvbnM=");
+ "CCABKAg6BHRydWUSHAoOZmlsZV9leHRlbnNpb24Y3QEgASgJOgMuY3MSGwoS" +
+ "dW1icmVsbGFfbmFtZXNwYWNlGN4BIAEoCRIcChBvdXRwdXRfZGlyZWN0b3J5" +
+ "GN8BIAEoCToBLhImChZpZ25vcmVfZ29vZ2xlX3Byb3RvYnVmGOABIAEoCDoF" +
+ "ZmFsc2UiKwoSQ1NoYXJwRmllbGRPcHRpb25zEhUKDXByb3BlcnR5X25hbWUY" +
+ "ASABKAk6XgoTY3NoYXJwX2ZpbGVfb3B0aW9ucxIcLmdvb2dsZS5wcm90b2J1" +
+ "Zi5GaWxlT3B0aW9ucxjoByABKAsyIi5nb29nbGUucHJvdG9idWYuQ1NoYXJw" +
+ "RmlsZU9wdGlvbnM6YQoUY3NoYXJwX2ZpZWxkX29wdGlvbnMSHS5nb29nbGUu" +
+ "cHJvdG9idWYuRmllbGRPcHRpb25zGOgHIAEoCzIjLmdvb2dsZS5wcm90b2J1" +
+ "Zi5DU2hhcnBGaWVsZE9wdGlvbnM=");
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
descriptor = root;
internal__static_google_protobuf_CSharpFileOptions__Descriptor = Descriptor.MessageTypes[0];
internal__static_google_protobuf_CSharpFileOptions__FieldAccessorTable =
new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions.Builder>(internal__static_google_protobuf_CSharpFileOptions__Descriptor,
- new string[] { "Namespace", "UmbrellaClassname", "PublicClasses", "MultipleFiles", "NestClasses", "CodeContracts", "ExpandNamespaceDirectories", "ClsCompliance", });
+ new string[] { "Namespace", "UmbrellaClassname", "PublicClasses", "MultipleFiles", "NestClasses", "CodeContracts", "ExpandNamespaceDirectories", "ClsCompliance", "FileExtension", "UmbrellaNamespace", "OutputDirectory", "IgnoreGoogleProtobuf", });
internal__static_google_protobuf_CSharpFieldOptions__Descriptor = Descriptor.MessageTypes[1];
internal__static_google_protobuf_CSharpFieldOptions__FieldAccessorTable =
new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions.Builder>(internal__static_google_protobuf_CSharpFieldOptions__Descriptor,
@@ -173,6 +176,46 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
get { return clsCompliance_; }
}
+ public const int FileExtensionFieldNumber = 221;
+ private bool hasFileExtension;
+ private string fileExtension_ = ".cs";
+ public bool HasFileExtension {
+ get { return hasFileExtension; }
+ }
+ public string FileExtension {
+ get { return fileExtension_; }
+ }
+
+ public const int UmbrellaNamespaceFieldNumber = 222;
+ private bool hasUmbrellaNamespace;
+ private string umbrellaNamespace_ = "";
+ public bool HasUmbrellaNamespace {
+ get { return hasUmbrellaNamespace; }
+ }
+ public string UmbrellaNamespace {
+ get { return umbrellaNamespace_; }
+ }
+
+ public const int OutputDirectoryFieldNumber = 223;
+ private bool hasOutputDirectory;
+ private string outputDirectory_ = ".";
+ public bool HasOutputDirectory {
+ get { return hasOutputDirectory; }
+ }
+ public string OutputDirectory {
+ get { return outputDirectory_; }
+ }
+
+ public const int IgnoreGoogleProtobufFieldNumber = 224;
+ private bool hasIgnoreGoogleProtobuf;
+ private bool ignoreGoogleProtobuf_ = false;
+ public bool HasIgnoreGoogleProtobuf {
+ get { return hasIgnoreGoogleProtobuf; }
+ }
+ public bool IgnoreGoogleProtobuf {
+ get { return ignoreGoogleProtobuf_; }
+ }
+
public override bool IsInitialized {
get {
return true;
@@ -205,6 +248,18 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
if (HasClsCompliance) {
output.WriteBool(8, ClsCompliance);
}
+ if (HasFileExtension) {
+ output.WriteString(221, FileExtension);
+ }
+ if (HasUmbrellaNamespace) {
+ output.WriteString(222, UmbrellaNamespace);
+ }
+ if (HasOutputDirectory) {
+ output.WriteString(223, OutputDirectory);
+ }
+ if (HasIgnoreGoogleProtobuf) {
+ output.WriteBool(224, IgnoreGoogleProtobuf);
+ }
UnknownFields.WriteTo(output);
}
@@ -239,6 +294,18 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
if (HasClsCompliance) {
size += pb::CodedOutputStream.ComputeBoolSize(8, ClsCompliance);
}
+ if (HasFileExtension) {
+ size += pb::CodedOutputStream.ComputeStringSize(221, FileExtension);
+ }
+ if (HasUmbrellaNamespace) {
+ size += pb::CodedOutputStream.ComputeStringSize(222, UmbrellaNamespace);
+ }
+ if (HasOutputDirectory) {
+ size += pb::CodedOutputStream.ComputeStringSize(223, OutputDirectory);
+ }
+ if (HasIgnoreGoogleProtobuf) {
+ size += pb::CodedOutputStream.ComputeBoolSize(224, IgnoreGoogleProtobuf);
+ }
size += UnknownFields.SerializedSize;
memoizedSerializedSize = size;
return size;
@@ -355,6 +422,18 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
if (other.HasClsCompliance) {
ClsCompliance = other.ClsCompliance;
}
+ if (other.HasFileExtension) {
+ FileExtension = other.FileExtension;
+ }
+ if (other.HasUmbrellaNamespace) {
+ UmbrellaNamespace = other.UmbrellaNamespace;
+ }
+ if (other.HasOutputDirectory) {
+ OutputDirectory = other.OutputDirectory;
+ }
+ if (other.HasIgnoreGoogleProtobuf) {
+ IgnoreGoogleProtobuf = other.IgnoreGoogleProtobuf;
+ }
this.MergeUnknownFields(other.UnknownFields);
return this;
}
@@ -419,6 +498,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
ClsCompliance = input.ReadBool();
break;
}
+ case 1770: {
+ FileExtension = input.ReadString();
+ break;
+ }
+ case 1778: {
+ UmbrellaNamespace = input.ReadString();
+ break;
+ }
+ case 1786: {
+ OutputDirectory = input.ReadString();
+ break;
+ }
+ case 1792: {
+ IgnoreGoogleProtobuf = input.ReadBool();
+ break;
+ }
}
}
}
@@ -569,6 +664,81 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
result.clsCompliance_ = true;
return this;
}
+
+ public bool HasFileExtension {
+ get { return result.HasFileExtension; }
+ }
+ public string FileExtension {
+ get { return result.FileExtension; }
+ set { SetFileExtension(value); }
+ }
+ public Builder SetFileExtension(string value) {
+ pb::ThrowHelper.ThrowIfNull(value, "value");
+ result.hasFileExtension = true;
+ result.fileExtension_ = value;
+ return this;
+ }
+ public Builder ClearFileExtension() {
+ result.hasFileExtension = false;
+ result.fileExtension_ = ".cs";
+ return this;
+ }
+
+ public bool HasUmbrellaNamespace {
+ get { return result.HasUmbrellaNamespace; }
+ }
+ public string UmbrellaNamespace {
+ get { return result.UmbrellaNamespace; }
+ set { SetUmbrellaNamespace(value); }
+ }
+ public Builder SetUmbrellaNamespace(string value) {
+ pb::ThrowHelper.ThrowIfNull(value, "value");
+ result.hasUmbrellaNamespace = true;
+ result.umbrellaNamespace_ = value;
+ return this;
+ }
+ public Builder ClearUmbrellaNamespace() {
+ result.hasUmbrellaNamespace = false;
+ result.umbrellaNamespace_ = "";
+ return this;
+ }
+
+ public bool HasOutputDirectory {
+ get { return result.HasOutputDirectory; }
+ }
+ public string OutputDirectory {
+ get { return result.OutputDirectory; }
+ set { SetOutputDirectory(value); }
+ }
+ public Builder SetOutputDirectory(string value) {
+ pb::ThrowHelper.ThrowIfNull(value, "value");
+ result.hasOutputDirectory = true;
+ result.outputDirectory_ = value;
+ return this;
+ }
+ public Builder ClearOutputDirectory() {
+ result.hasOutputDirectory = false;
+ result.outputDirectory_ = ".";
+ return this;
+ }
+
+ public bool HasIgnoreGoogleProtobuf {
+ get { return result.HasIgnoreGoogleProtobuf; }
+ }
+ public bool IgnoreGoogleProtobuf {
+ get { return result.IgnoreGoogleProtobuf; }
+ set { SetIgnoreGoogleProtobuf(value); }
+ }
+ public Builder SetIgnoreGoogleProtobuf(bool value) {
+ result.hasIgnoreGoogleProtobuf = true;
+ result.ignoreGoogleProtobuf_ = value;
+ return this;
+ }
+ public Builder ClearIgnoreGoogleProtobuf() {
+ result.hasIgnoreGoogleProtobuf = false;
+ result.ignoreGoogleProtobuf_ = false;
+ return this;
+ }
}
static CSharpFileOptions() {
object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, null);
diff --git a/src/ProtocolBuffers/Descriptors/FileDescriptor.cs b/src/ProtocolBuffers/Descriptors/FileDescriptor.cs
index 4d7b54e0..f1eba496 100644
--- a/src/ProtocolBuffers/Descriptors/FileDescriptor.cs
+++ b/src/ProtocolBuffers/Descriptors/FileDescriptor.cs
@@ -32,17 +32,17 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.IO;
using Google.ProtocolBuffers.DescriptorProtos;
+using FileOptions = Google.ProtocolBuffers.DescriptorProtos.FileOptions;
namespace Google.ProtocolBuffers.Descriptors {
-
/// <summary>
/// Describes a .proto file, including everything defined within.
/// IDescriptor is implemented such that the File property returns this descriptor,
/// and the FullName is the same as the Name.
/// </summary>
public sealed class FileDescriptor : IDescriptor<FileDescriptorProto> {
-
private FileDescriptorProto proto;
private readonly IList<MessageDescriptor> messageTypes;
private readonly IList<EnumDescriptor> enumTypes;
@@ -52,7 +52,7 @@ namespace Google.ProtocolBuffers.Descriptors {
private readonly DescriptorPool pool;
private CSharpFileOptions csharpFileOptions;
private readonly object optionsLock = new object();
-
+
private FileDescriptor(FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool) {
this.pool = pool;
this.proto = proto;
@@ -60,34 +60,60 @@ namespace Google.ProtocolBuffers.Descriptors {
pool.AddPackage(Package, this);
- messageTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.MessageTypeList,
- (message, index) => new MessageDescriptor(message, this, null, index));
+ messageTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.MessageTypeList,
+ (message, index) =>
+ new MessageDescriptor(message, this, null, index));
enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumTypeList,
- (enumType, index) => new EnumDescriptor(enumType, this, null, index));
+ (enumType, index) =>
+ new EnumDescriptor(enumType, this, null, index));
services = DescriptorUtil.ConvertAndMakeReadOnly(proto.ServiceList,
- (service, index) => new ServiceDescriptor(service, this, index));
+ (service, index) => new ServiceDescriptor(service, this, index));
extensions = DescriptorUtil.ConvertAndMakeReadOnly(proto.ExtensionList,
- (field, index) => new FieldDescriptor(field, this, null, index, true));
+ (field, index) =>
+ new FieldDescriptor(field, this, null, index, true));
}
- private CSharpFileOptions BuildOrFakeCSharpOptions() {
- // TODO(jonskeet): Check if we could use FileDescriptorProto.Descriptor.Name - interesting bootstrap issues
- if (proto.Name == "google/protobuf/descriptor.proto") {
- return new CSharpFileOptions.Builder {
- Namespace = "Google.ProtocolBuffers.DescriptorProtos",
- UmbrellaClassname = "DescriptorProtoFile", NestClasses = false, MultipleFiles = false, PublicClasses = true
- }.Build();
- }
- if (proto.Name == "google/protobuf/csharp_options.proto") {
- return new CSharpFileOptions.Builder {
- Namespace = "Google.ProtocolBuffers.DescriptorProtos",
- UmbrellaClassname = "CSharpOptions", NestClasses = false, MultipleFiles = false, PublicClasses = true
- }.Build();
+
+ /// <summary>
+ /// Allows a file descriptor to be configured with a set of external options, e.g. from the
+ /// command-line arguments to protogen.
+ /// </summary>
+ internal void ConfigureWithDefaultOptions(CSharpFileOptions options) {
+ csharpFileOptions = BuildOrFakeWithDefaultOptions(options);
+ }
+
+ private CSharpFileOptions BuildOrFakeWithDefaultOptions(CSharpFileOptions defaultOptions) {
+ // Fix for being able to relocate these files to any directory structure
+ if (proto.Package == "google.protobuf") {
+ string filename = Path.GetFileName(proto.Name);
+ // TODO(jonskeet): Check if we could use FileDescriptorProto.Descriptor.Name - interesting bootstrap issues)
+ if (filename == "descriptor.proto") {
+ return new CSharpFileOptions.Builder {
+ Namespace = "Google.ProtocolBuffers.DescriptorProtos",
+ UmbrellaClassname = "DescriptorProtoFile",
+ NestClasses = false,
+ MultipleFiles = false,
+ PublicClasses = true,
+ OutputDirectory = defaultOptions.OutputDirectory,
+ IgnoreGoogleProtobuf = defaultOptions.IgnoreGoogleProtobuf
+ }.Build();
+ }
+ if (filename == "csharp_options.proto") {
+ return new CSharpFileOptions.Builder {
+ Namespace = "Google.ProtocolBuffers.DescriptorProtos",
+ UmbrellaClassname = "CSharpOptions",
+ NestClasses = false,
+ MultipleFiles = false,
+ PublicClasses = true,
+ OutputDirectory = defaultOptions.OutputDirectory,
+ IgnoreGoogleProtobuf = defaultOptions.IgnoreGoogleProtobuf
+ }.Build();
+ }
}
- CSharpFileOptions.Builder builder = CSharpFileOptions.CreateBuilder();
+ CSharpFileOptions.Builder builder = defaultOptions.ToBuilder();
if (proto.Options.HasExtension(DescriptorProtos.CSharpOptions.CSharpFileOptions)) {
builder.MergeFrom(proto.Options.GetExtension(DescriptorProtos.CSharpOptions.CSharpFileOptions));
}
@@ -97,8 +123,27 @@ namespace Google.ProtocolBuffers.Descriptors {
if (!builder.HasUmbrellaClassname) {
int lastSlash = Name.LastIndexOf('/');
string baseName = Name.Substring(lastSlash + 1);
- builder.UmbrellaClassname = NameHelpers.UnderscoresToPascalCase(NameHelpers.StripProto(baseName));
+ builder.UmbrellaClassname = NameHelpers.UnderscoresToPascalCase(NameHelpers.StripProto(baseName));
}
+
+ // Auto-fix for name collision by placing umbrella class into a new namespace. This
+ // still won't fix the collisions with nesting enabled; however, you have to turn that on explicitly anyway.
+ if (!builder.NestClasses && !builder.HasUmbrellaNamespace) {
+ bool collision = false;
+ foreach (IDescriptor d in MessageTypes) {
+ collision |= d.Name == builder.UmbrellaClassname;
+ }
+ foreach (IDescriptor d in Services) {
+ collision |= d.Name == builder.UmbrellaClassname;
+ }
+ foreach (IDescriptor d in EnumTypes) {
+ collision |= d.Name == builder.UmbrellaClassname;
+ }
+ if (collision) {
+ builder.UmbrellaNamespace = "Proto";
+ }
+ }
+
return builder.Build();
}
@@ -110,7 +155,7 @@ namespace Google.ProtocolBuffers.Descriptors {
}
/// <value>
- /// The <see cref="FileOptions" /> defined in <c>descriptor.proto</c>.
+ /// The <see cref="DescriptorProtos.FileOptions" /> defined in <c>descriptor.proto</c>.
/// </value>
public FileOptions Options {
get { return proto.Options; }
@@ -124,7 +169,7 @@ namespace Google.ProtocolBuffers.Descriptors {
get {
lock (optionsLock) {
if (csharpFileOptions == null) {
- csharpFileOptions = BuildOrFakeCSharpOptions();
+ csharpFileOptions = BuildOrFakeWithDefaultOptions(CSharpFileOptions.DefaultInstance);
}
}
return csharpFileOptions;
@@ -208,15 +253,15 @@ namespace Google.ProtocolBuffers.Descriptors {
internal DescriptorPool DescriptorPool {
get { return pool; }
}
-
+
/// <summary>
/// Finds a type (message, enum, service or extension) in the file by name. Does not find nested types.
/// </summary>
/// <param name="name">The unqualified type name to look for.</param>
/// <typeparam name="T">The type of descriptor to look for (or ITypeDescriptor for any)</typeparam>
/// <returns>The type's descriptor, or null if not found.</returns>
- public T FindTypeByName<T>(String name)
- where T : class, IDescriptor {
+ public T FindTypeByName<T>(String name)
+ where T : class, IDescriptor {
// Don't allow looking up nested types. This will make optimization
// easier later.
if (name.IndexOf('.') != -1) {
@@ -261,20 +306,20 @@ namespace Google.ProtocolBuffers.Descriptors {
if (dependencies.Length != proto.DependencyCount) {
throw new DescriptorValidationException(result,
- "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
- "those listed in the FileDescriptorProto.");
+ "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
+ "those listed in the FileDescriptorProto.");
}
for (int i = 0; i < proto.DependencyCount; i++) {
if (dependencies[i].Name != proto.DependencyList[i]) {
throw new DescriptorValidationException(result,
- "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
- "those listed in the FileDescriptorProto.");
+ "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
+ "those listed in the FileDescriptorProto.");
}
}
result.CrossLink();
return result;
- }
+ }
private void CrossLink() {
foreach (MessageDescriptor message in messageTypes) {
@@ -293,7 +338,7 @@ namespace Google.ProtocolBuffers.Descriptors {
message.CheckRequiredFields();
}
}
-
+
/// <summary>
/// This method is to be called by generated code only. It is equivalent
/// to BuildFrom except that the FileDescriptorProto is encoded in
@@ -320,19 +365,21 @@ namespace Google.ProtocolBuffers.Descriptors {
public delegate ExtensionRegistry InternalDescriptorAssigner(FileDescriptor descriptor);
public static FileDescriptor InternalBuildGeneratedFileFrom(byte[] descriptorData,
- FileDescriptor[] dependencies,InternalDescriptorAssigner descriptorAssigner) {
-
+ FileDescriptor[] dependencies,
+ InternalDescriptorAssigner descriptorAssigner) {
FileDescriptorProto proto;
try {
proto = FileDescriptorProto.ParseFrom(descriptorData);
- } catch (InvalidProtocolBufferException e) {
+ }
+ catch (InvalidProtocolBufferException e) {
throw new ArgumentException("Failed to parse protocol buffer descriptor for generated code.", e);
}
FileDescriptor result;
try {
result = BuildFrom(proto, dependencies);
- } catch (DescriptorValidationException e) {
+ }
+ catch (DescriptorValidationException e) {
throw new ArgumentException("Invalid embedded descriptor for \"" + proto.Name + "\".", e);
}
@@ -342,7 +389,8 @@ namespace Google.ProtocolBuffers.Descriptors {
// We must re-parse the proto using the registry.
try {
proto = FileDescriptorProto.ParseFrom(descriptorData, registry);
- } catch (InvalidProtocolBufferException e) {
+ }
+ catch (InvalidProtocolBufferException e) {
throw new ArgumentException("Failed to parse protocol buffer descriptor for generated code.", e);
}
@@ -351,7 +399,6 @@ namespace Google.ProtocolBuffers.Descriptors {
return result;
}
-
/// <summary>
/// Replace our FileDescriptorProto with the given one, which is
/// identical except that it might contain extensions that weren't present
@@ -382,4 +429,4 @@ namespace Google.ProtocolBuffers.Descriptors {
}
}
}
-}
+} \ No newline at end of file
diff --git a/src/ProtocolBuffers/DynamicMessage.cs b/src/ProtocolBuffers/DynamicMessage.cs
index 00d7494f..12f2186c 100644
--- a/src/ProtocolBuffers/DynamicMessage.cs
+++ b/src/ProtocolBuffers/DynamicMessage.cs
@@ -335,7 +335,7 @@ namespace Google.ProtocolBuffers {
}
public override bool IsInitialized {
- get { return fields.IsInitializedWithRespectTo(type); }
+ get { return fields.IsInitializedWithRespectTo(type); }
}
public override Builder MergeFrom(CodedInputStream input, ExtensionRegistry extensionRegistry) {
diff --git a/src/ProtocolBuffers/UnknownField.cs b/src/ProtocolBuffers/UnknownField.cs
index dc0b1b6a..fdc00650 100644
--- a/src/ProtocolBuffers/UnknownField.cs
+++ b/src/ProtocolBuffers/UnknownField.cs
@@ -273,7 +273,7 @@ namespace Google.ProtocolBuffers {
if (extras.Count == 0) {
return current;
}
- if (current == null) {
+ if (current == null) {
current = new List<T>(extras);
} else {
current.AddRange(extras);
@@ -359,7 +359,7 @@ namespace Google.ProtocolBuffers {
/// <returns></returns>
private static ReadOnlyCollection<T> MakeReadOnly<T>(ref List<T> list) {
ReadOnlyCollection<T> ret = list == null ? Lists<T>.Empty : new ReadOnlyCollection<T>(list);
- list = null;
+ list = null;
return ret;
}
}