aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers
diff options
context:
space:
mode:
Diffstat (limited to 'src/ProtocolBuffers')
-rw-r--r--src/ProtocolBuffers/CodedInputStream.cs2
-rw-r--r--src/ProtocolBuffers/Descriptors/FieldDescriptor.cs4
-rw-r--r--src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs4
-rw-r--r--src/ProtocolBuffers/EnumLite.cs6
-rw-r--r--src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs22
-rw-r--r--src/ProtocolBuffers/GeneratedExtensionBase.cs2
-rw-r--r--src/ProtocolBuffers/GeneratedRepeatExtension.cs2
-rw-r--r--src/ProtocolBuffers/GeneratedSingleExtension.cs2
-rw-r--r--src/ProtocolBuffers/MessageStreamIterator.cs28
-rw-r--r--src/ProtocolBuffers/MessageUtil.cs2
10 files changed, 37 insertions, 37 deletions
diff --git a/src/ProtocolBuffers/CodedInputStream.cs b/src/ProtocolBuffers/CodedInputStream.cs
index 9dadf306..be88d154 100644
--- a/src/ProtocolBuffers/CodedInputStream.cs
+++ b/src/ProtocolBuffers/CodedInputStream.cs
@@ -467,7 +467,7 @@ namespace Google.ProtocolBuffers
where T : struct, IComparable, IFormattable, IConvertible
{
int number = (int) ReadRawVarint32();
- if (Enum.IsDefined(typeof (T), number))
+ if (Enum.IsDefined(typeof(T), number))
{
unknown = null;
value = (T) (object) number;
diff --git a/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs b/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs
index 6d9de74f..6d17ae2a 100644
--- a/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs
+++ b/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs
@@ -441,11 +441,11 @@ namespace Google.ProtocolBuffers.Descriptors
private static IDictionary<FieldType, MappedType> MapFieldTypes()
{
var map = new Dictionary<FieldType, MappedType>();
- foreach (FieldInfo field in typeof (FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
+ foreach (FieldInfo field in typeof(FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
{
FieldType fieldType = (FieldType) field.GetValue(null);
FieldMappingAttribute mapping =
- (FieldMappingAttribute) field.GetCustomAttributes(typeof (FieldMappingAttribute), false)[0];
+ (FieldMappingAttribute) field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0];
map[fieldType] = mapping.MappedType;
}
return Dictionaries.AsReadOnly(map);
diff --git a/src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs b/src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs
index 55b7fc54..fc58d046 100644
--- a/src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs
+++ b/src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs
@@ -63,11 +63,11 @@ namespace Google.ProtocolBuffers.Descriptors
private static IDictionary<FieldType, FieldMappingAttribute> MapFieldTypes()
{
var map = new Dictionary<FieldType, FieldMappingAttribute>();
- foreach (FieldInfo field in typeof (FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
+ foreach (FieldInfo field in typeof(FieldType).GetFields(BindingFlags.Static | BindingFlags.Public))
{
FieldType fieldType = (FieldType) field.GetValue(null);
FieldMappingAttribute mapping =
- (FieldMappingAttribute) field.GetCustomAttributes(typeof (FieldMappingAttribute), false)[0];
+ (FieldMappingAttribute) field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0];
map[fieldType] = mapping;
}
return Dictionaries.AsReadOnly(map);
diff --git a/src/ProtocolBuffers/EnumLite.cs b/src/ProtocolBuffers/EnumLite.cs
index 18800ad4..a6a25f4e 100644
--- a/src/ProtocolBuffers/EnumLite.cs
+++ b/src/ProtocolBuffers/EnumLite.cs
@@ -107,7 +107,7 @@ namespace Google.ProtocolBuffers
items.Add(Convert.ToInt32(evalue), new EnumValue(evalue));
}
#else
- foreach (TEnum evalue in Enum.GetValues(typeof (TEnum)))
+ foreach (TEnum evalue in Enum.GetValues(typeof(TEnum)))
{
items.Add(Convert.ToInt32(evalue), new EnumValue(evalue));
}
@@ -128,9 +128,9 @@ namespace Google.ProtocolBuffers
public IEnumLite FindValueByName(string name)
{
IEnumLite val;
- if (Enum.IsDefined(typeof (TEnum), name))
+ if (Enum.IsDefined(typeof(TEnum), name))
{
- return items.TryGetValue((int) Enum.Parse(typeof (TEnum), name, false), out val) ? val : null;
+ return items.TryGetValue((int) Enum.Parse(typeof(TEnum), name, false), out val) ? val : null;
}
return null;
}
diff --git a/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs b/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs
index e876d9ce..84c53e26 100644
--- a/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs
+++ b/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs
@@ -56,8 +56,8 @@ namespace Google.ProtocolBuffers.FieldAccess
public static Func<T, object> CreateUpcastDelegate<T>(MethodInfo method)
{
// The tricky bit is invoking CreateCreateUpcastDelegateImpl with the right type parameters
- MethodInfo openImpl = typeof (ReflectionUtil).GetMethod("CreateUpcastDelegateImpl");
- MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof (T), method.ReturnType);
+ MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateUpcastDelegateImpl");
+ MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.ReturnType);
return (Func<T, object>) closedImpl.Invoke(null, new object[] {method});
}
@@ -71,7 +71,7 @@ namespace Google.ProtocolBuffers.FieldAccess
// Convert the reflection call into an open delegate, i.e. instead of calling x.Method()
// we'll call getter(x).
Func<TSource, TResult> getter =
- (Func<TSource, TResult>) Delegate.CreateDelegate(typeof (Func<TSource, TResult>), null, method);
+ (Func<TSource, TResult>) Delegate.CreateDelegate(typeof(Func<TSource, TResult>), null, method);
// Implicit upcast to object (within the delegate)
return delegate(TSource source) { return getter(source); };
@@ -83,8 +83,8 @@ namespace Google.ProtocolBuffers.FieldAccess
/// </summary>
public static Action<T, object> CreateDowncastDelegate<T>(MethodInfo method)
{
- MethodInfo openImpl = typeof (ReflectionUtil).GetMethod("CreateDowncastDelegateImpl");
- MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof (T), method.GetParameters()[0].ParameterType);
+ MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateDowncastDelegateImpl");
+ MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.GetParameters()[0].ParameterType);
return (Action<T, object>) closedImpl.Invoke(null, new object[] {method});
}
@@ -93,7 +93,7 @@ namespace Google.ProtocolBuffers.FieldAccess
// Convert the reflection call into an open delegate, i.e. instead of calling x.Method(y) we'll
// call Method(x, y)
Action<TSource, TParam> call =
- (Action<TSource, TParam>) Delegate.CreateDelegate(typeof (Action<TSource, TParam>), null, method);
+ (Action<TSource, TParam>) Delegate.CreateDelegate(typeof(Action<TSource, TParam>), null, method);
return delegate(TSource source, object parameter) { call(source, (TParam) parameter); };
}
@@ -104,8 +104,8 @@ namespace Google.ProtocolBuffers.FieldAccess
/// </summary>
public static Action<T, object> CreateDowncastDelegateIgnoringReturn<T>(MethodInfo method)
{
- MethodInfo openImpl = typeof (ReflectionUtil).GetMethod("CreateDowncastDelegateIgnoringReturnImpl");
- MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof (T), method.GetParameters()[0].ParameterType,
+ MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateDowncastDelegateIgnoringReturnImpl");
+ MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.GetParameters()[0].ParameterType,
method.ReturnType);
return (Action<T, object>) closedImpl.Invoke(null, new object[] {method});
}
@@ -116,7 +116,7 @@ namespace Google.ProtocolBuffers.FieldAccess
// Convert the reflection call into an open delegate, i.e. instead of calling x.Method(y) we'll
// call Method(x, y)
Func<TSource, TParam, TReturn> call = (Func<TSource, TParam, TReturn>)
- Delegate.CreateDelegate(typeof (Func<TSource, TParam, TReturn>), null,
+ Delegate.CreateDelegate(typeof(Func<TSource, TParam, TReturn>), null,
method);
return delegate(TSource source, object parameter) { call(source, (TParam) parameter); };
@@ -127,14 +127,14 @@ namespace Google.ProtocolBuffers.FieldAccess
/// </summary>
public static Func<IBuilder> CreateStaticUpcastDelegate(MethodInfo method)
{
- MethodInfo openImpl = typeof (ReflectionUtil).GetMethod("CreateStaticUpcastDelegateImpl");
+ MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateStaticUpcastDelegateImpl");
MethodInfo closedImpl = openImpl.MakeGenericMethod(method.ReturnType);
return (Func<IBuilder>) closedImpl.Invoke(null, new object[] {method});
}
public static Func<IBuilder> CreateStaticUpcastDelegateImpl<T>(MethodInfo method)
{
- Func<T> call = (Func<T>) Delegate.CreateDelegate(typeof (Func<T>), null, method);
+ Func<T> call = (Func<T>) Delegate.CreateDelegate(typeof(Func<T>), null, method);
return delegate { return (IBuilder) call(); };
}
}
diff --git a/src/ProtocolBuffers/GeneratedExtensionBase.cs b/src/ProtocolBuffers/GeneratedExtensionBase.cs
index 53a43de0..424b981a 100644
--- a/src/ProtocolBuffers/GeneratedExtensionBase.cs
+++ b/src/ProtocolBuffers/GeneratedExtensionBase.cs
@@ -85,7 +85,7 @@ namespace Google.ProtocolBuffers
if (defaultInstanceProperty == null)
{
throw new ArgumentException("No public static DefaultInstance property for type " +
- typeof (TExtension).Name);
+ typeof(TExtension).Name);
}
messageDefaultInstance = (IMessageLite) defaultInstanceProperty.GetValue(null, null);
diff --git a/src/ProtocolBuffers/GeneratedRepeatExtension.cs b/src/ProtocolBuffers/GeneratedRepeatExtension.cs
index a044bf2e..7e7b088c 100644
--- a/src/ProtocolBuffers/GeneratedRepeatExtension.cs
+++ b/src/ProtocolBuffers/GeneratedRepeatExtension.cs
@@ -46,7 +46,7 @@ namespace Google.ProtocolBuffers
/// </summary>
public sealed class GeneratedRepeatExtension<TExtensionElement> : GeneratedExtensionBase<IList<TExtensionElement>>
{
- private GeneratedRepeatExtension(FieldDescriptor field) : base(field, typeof (TExtensionElement))
+ private GeneratedRepeatExtension(FieldDescriptor field) : base(field, typeof(TExtensionElement))
{
}
diff --git a/src/ProtocolBuffers/GeneratedSingleExtension.cs b/src/ProtocolBuffers/GeneratedSingleExtension.cs
index de9fd29f..f0f1979b 100644
--- a/src/ProtocolBuffers/GeneratedSingleExtension.cs
+++ b/src/ProtocolBuffers/GeneratedSingleExtension.cs
@@ -44,7 +44,7 @@ namespace Google.ProtocolBuffers
/// </remarks>
public sealed class GeneratedSingleExtension<TExtension> : GeneratedExtensionBase<TExtension>
{
- internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor, typeof (TExtension))
+ internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor, typeof(TExtension))
{
}
diff --git a/src/ProtocolBuffers/MessageStreamIterator.cs b/src/ProtocolBuffers/MessageStreamIterator.cs
index 3c46537d..f5d9bcbe 100644
--- a/src/ProtocolBuffers/MessageStreamIterator.cs
+++ b/src/ProtocolBuffers/MessageStreamIterator.cs
@@ -84,16 +84,16 @@ namespace Google.ProtocolBuffers
Type builderType = FindBuilderType();
// Yes, it's redundant to find this again, but it's only the once...
- MethodInfo createBuilderMethod = typeof (TMessage).GetMethod("CreateBuilder", EmptyTypes);
+ MethodInfo createBuilderMethod = typeof(TMessage).GetMethod("CreateBuilder", EmptyTypes);
Delegate builderBuilder = Delegate.CreateDelegate(
- typeof (Func<>).MakeGenericType(builderType), null, createBuilderMethod);
+ typeof(Func<>).MakeGenericType(builderType), null, createBuilderMethod);
- MethodInfo buildMethod = typeof (MessageStreamIterator<TMessage>)
+ MethodInfo buildMethod = typeof(MessageStreamIterator<TMessage>)
.GetMethod("BuildImpl", BindingFlags.Static | BindingFlags.NonPublic)
- .MakeGenericMethod(typeof (TMessage), builderType);
+ .MakeGenericMethod(typeof(TMessage), builderType);
return (Func<CodedInputStream, ExtensionRegistry, TMessage>) Delegate.CreateDelegate(
- typeof (Func<CodedInputStream, ExtensionRegistry, TMessage>), builderBuilder, buildMethod);
+ typeof(Func<CodedInputStream, ExtensionRegistry, TMessage>), builderBuilder, buildMethod);
}
catch (ArgumentException e)
{
@@ -116,28 +116,28 @@ namespace Google.ProtocolBuffers
/// </summary>
private static Type FindBuilderType()
{
- MethodInfo createBuilderMethod = typeof (TMessage).GetMethod("CreateBuilder", EmptyTypes);
+ MethodInfo createBuilderMethod = typeof(TMessage).GetMethod("CreateBuilder", EmptyTypes);
if (createBuilderMethod == null)
{
- throw new ArgumentException("Message type " + typeof (TMessage).FullName +
+ throw new ArgumentException("Message type " + typeof(TMessage).FullName +
" has no CreateBuilder method.");
}
- if (createBuilderMethod.ReturnType == typeof (void))
+ if (createBuilderMethod.ReturnType == typeof(void))
{
- throw new ArgumentException("CreateBuilder method in " + typeof (TMessage).FullName +
+ throw new ArgumentException("CreateBuilder method in " + typeof(TMessage).FullName +
" has void return type");
}
Type builderType = createBuilderMethod.ReturnType;
- Type messageInterface = typeof (IMessage<,>).MakeGenericType(typeof (TMessage), builderType);
- Type builderInterface = typeof (IBuilder<,>).MakeGenericType(typeof (TMessage), builderType);
- if (Array.IndexOf(typeof (TMessage).GetInterfaces(), messageInterface) == -1)
+ Type messageInterface = typeof(IMessage<,>).MakeGenericType(typeof(TMessage), builderType);
+ Type builderInterface = typeof(IBuilder<,>).MakeGenericType(typeof(TMessage), builderType);
+ if (Array.IndexOf(typeof(TMessage).GetInterfaces(), messageInterface) == -1)
{
- throw new ArgumentException("Message type " + typeof (TMessage) + " doesn't implement " +
+ throw new ArgumentException("Message type " + typeof(TMessage) + " doesn't implement " +
messageInterface.FullName);
}
if (Array.IndexOf(builderType.GetInterfaces(), builderInterface) == -1)
{
- throw new ArgumentException("Builder type " + typeof (TMessage) + " doesn't implement " +
+ throw new ArgumentException("Builder type " + typeof(TMessage) + " doesn't implement " +
builderInterface.FullName);
}
return builderType;
diff --git a/src/ProtocolBuffers/MessageUtil.cs b/src/ProtocolBuffers/MessageUtil.cs
index a32bda88..d120d209 100644
--- a/src/ProtocolBuffers/MessageUtil.cs
+++ b/src/ProtocolBuffers/MessageUtil.cs
@@ -65,7 +65,7 @@ namespace Google.ProtocolBuffers
throw new ArgumentException("Unable to get a default message for an abstract or generic type (" +
type.FullName + ")");
}
- if (!typeof (IMessage).IsAssignableFrom(type))
+ if (!typeof(IMessage).IsAssignableFrom(type))
{
throw new ArgumentException("Unable to get a default message for non-message type (" + type.FullName +
")");