aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers
diff options
context:
space:
mode:
Diffstat (limited to 'src/ProtocolBuffers')
-rw-r--r--src/ProtocolBuffers/CodedInputStream.cs4
-rw-r--r--src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs4
-rw-r--r--src/ProtocolBuffers/CodedOutputStream.cs4
-rw-r--r--src/ProtocolBuffers/Descriptors/FileDescriptor.cs4
-rw-r--r--src/ProtocolBuffers/ICodedInputStream.cs4
-rw-r--r--src/ProtocolBuffers/ICodedOutputStream.cs4
-rw-r--r--src/ProtocolBuffers/MessageStreamIterator.cs2
-rw-r--r--src/ProtocolBuffers/TextFormat.cs2
-rw-r--r--src/ProtocolBuffers/TextTokenizer.cs2
9 files changed, 17 insertions, 13 deletions
diff --git a/src/ProtocolBuffers/CodedInputStream.cs b/src/ProtocolBuffers/CodedInputStream.cs
index e4d690b5..ab18f9d7 100644
--- a/src/ProtocolBuffers/CodedInputStream.cs
+++ b/src/ProtocolBuffers/CodedInputStream.cs
@@ -449,7 +449,7 @@ namespace Google.ProtocolBuffers
/// </summary>
[CLSCompliant(false)]
public bool ReadEnum<T>(ref T value, out object unknown)
- where T : struct, IComparable, IFormattable, IConvertible
+ where T : struct, IComparable, IFormattable
{
int number = (int) ReadRawVarint32();
if (Enum.IsDefined(typeof(T), number))
@@ -882,7 +882,7 @@ namespace Google.ProtocolBuffers
[CLSCompliant(false)]
public void ReadEnumArray<T>(uint fieldTag, string fieldName, ICollection<T> list,
out ICollection<object> unknown)
- where T : struct, IComparable, IFormattable, IConvertible
+ where T : struct, IComparable, IFormattable
{
unknown = null;
object unkval;
diff --git a/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs b/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs
index 4f4e13d8..ca6662a4 100644
--- a/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs
+++ b/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs
@@ -575,7 +575,7 @@ namespace Google.ProtocolBuffers
case FieldType.Enum:
if (value is Enum)
{
- return ComputeEnumSize(fieldNumber, ((IConvertible)value).ToInt32(FrameworkPortability.InvariantCulture));
+ return ComputeEnumSize(fieldNumber, Convert.ToInt32(value));
}
else
{
@@ -631,7 +631,7 @@ namespace Google.ProtocolBuffers
case FieldType.Enum:
if (value is Enum)
{
- return ComputeEnumSizeNoTag(((IConvertible)value).ToInt32(FrameworkPortability.InvariantCulture));
+ return ComputeEnumSizeNoTag(Convert.ToInt32(value));
}
else
{
diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs
index b6a501c4..b767f705 100644
--- a/src/ProtocolBuffers/CodedOutputStream.cs
+++ b/src/ProtocolBuffers/CodedOutputStream.cs
@@ -806,7 +806,7 @@ namespace Google.ProtocolBuffers
[CLSCompliant(false)]
public void WriteEnumArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
- where T : struct, IComparable, IFormattable, IConvertible
+ where T : struct, IComparable, IFormattable
{
if (list is ICastArray)
{
@@ -1028,7 +1028,7 @@ namespace Google.ProtocolBuffers
[CLSCompliant(false)]
public void WritePackedEnumArray<T>(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<T> list)
- where T : struct, IComparable, IFormattable, IConvertible
+ where T : struct, IComparable, IFormattable
{
WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited);
WriteRawVarint32((uint) calculatedSize);
diff --git a/src/ProtocolBuffers/Descriptors/FileDescriptor.cs b/src/ProtocolBuffers/Descriptors/FileDescriptor.cs
index 392db9a7..d7075e35 100644
--- a/src/ProtocolBuffers/Descriptors/FileDescriptor.cs
+++ b/src/ProtocolBuffers/Descriptors/FileDescriptor.cs
@@ -90,12 +90,14 @@ namespace Google.ProtocolBuffers.Descriptors
csharpFileOptions = BuildOrFakeWithDefaultOptions(options);
}
+ static readonly char[] PathSeperators = new char[] { '/', '\\' };
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);
+ int ixslash = proto.Name.LastIndexOfAny(PathSeperators);
+ string filename = ixslash < 0 ? proto.Name : proto.Name.Substring(ixslash + 1);
// TODO(jonskeet): Check if we could use FileDescriptorProto.Descriptor.Name - interesting bootstrap issues)
if (filename == "descriptor.proto")
{
diff --git a/src/ProtocolBuffers/ICodedInputStream.cs b/src/ProtocolBuffers/ICodedInputStream.cs
index a3c0f30b..b39b602d 100644
--- a/src/ProtocolBuffers/ICodedInputStream.cs
+++ b/src/ProtocolBuffers/ICodedInputStream.cs
@@ -171,7 +171,7 @@ namespace Google.ProtocolBuffers
/// </summary>
[CLSCompliant(false)]
bool ReadEnum<T>(ref T value, out object unknown)
- where T : struct, IComparable, IFormattable, IConvertible;
+ where T : struct, IComparable, IFormattable;
/// <summary>
/// Reads an sfixed32 field value from the stream.
@@ -214,7 +214,7 @@ namespace Google.ProtocolBuffers
/// </summary>
[CLSCompliant(false)]
void ReadEnumArray<T>(uint fieldTag, string fieldName, ICollection<T> list, out ICollection<object> unknown)
- where T : struct, IComparable, IFormattable, IConvertible;
+ where T : struct, IComparable, IFormattable;
/// <summary>
/// Reads a set of messages using the <paramref name="messageType"/> as a template. T is not guaranteed to be
diff --git a/src/ProtocolBuffers/ICodedOutputStream.cs b/src/ProtocolBuffers/ICodedOutputStream.cs
index 8619508a..64c80653 100644
--- a/src/ProtocolBuffers/ICodedOutputStream.cs
+++ b/src/ProtocolBuffers/ICodedOutputStream.cs
@@ -292,7 +292,7 @@ namespace Google.ProtocolBuffers
/// </summary>
[CLSCompliant(false)]
void WriteEnumArray<T>(int fieldNumber, string fieldName, IEnumerable<T> list)
- where T : struct, IComparable, IFormattable, IConvertible;
+ where T : struct, IComparable, IFormattable;
/// <summary>
/// Writes a packed repeated primitive, including tag and length, to the stream.
@@ -369,6 +369,6 @@ namespace Google.ProtocolBuffers
/// </summary>
[CLSCompliant(false)]
void WritePackedEnumArray<T>(int fieldNumber, string fieldName, int calculatedSize, IEnumerable<T> list)
- where T : struct, IComparable, IFormattable, IConvertible;
+ where T : struct, IComparable, IFormattable;
}
} \ No newline at end of file
diff --git a/src/ProtocolBuffers/MessageStreamIterator.cs b/src/ProtocolBuffers/MessageStreamIterator.cs
index 89fda91f..32d697ca 100644
--- a/src/ProtocolBuffers/MessageStreamIterator.cs
+++ b/src/ProtocolBuffers/MessageStreamIterator.cs
@@ -124,10 +124,12 @@ namespace Google.ProtocolBuffers
return new MessageStreamIterator<TMessage>(streamProvider, extensionRegistry, newSizeLimit);
}
+#if CLIENTPROFILE
public static MessageStreamIterator<TMessage> FromFile(string file)
{
return new MessageStreamIterator<TMessage>(() => File.OpenRead(file), ExtensionRegistry.Empty);
}
+#endif
public static MessageStreamIterator<TMessage> FromStreamProvider(StreamProvider streamProvider)
{
diff --git a/src/ProtocolBuffers/TextFormat.cs b/src/ProtocolBuffers/TextFormat.cs
index c0f4a5f6..7e2eff04 100644
--- a/src/ProtocolBuffers/TextFormat.cs
+++ b/src/ProtocolBuffers/TextFormat.cs
@@ -708,7 +708,7 @@ namespace Google.ProtocolBuffers
{
// Explicitly specify the invariant culture so that this code does not break when
// executing in Turkey.
- String lowerName = name.ToLower(FrameworkPortability.InvariantCulture);
+ String lowerName = name.ToLowerInvariant();
field = type.FindDescriptor<FieldDescriptor>(lowerName);
// If the case-insensitive match worked but the field is NOT a group,
// TODO(jonskeet): What? Java comment ends here!
diff --git a/src/ProtocolBuffers/TextTokenizer.cs b/src/ProtocolBuffers/TextTokenizer.cs
index 90774bc2..5bb27fd0 100644
--- a/src/ProtocolBuffers/TextTokenizer.cs
+++ b/src/ProtocolBuffers/TextTokenizer.cs
@@ -338,7 +338,7 @@ namespace Google.ProtocolBuffers
NextToken();
return negative ? double.NegativeInfinity : double.PositiveInfinity;
}
- if (currentToken.Equals("nan", StringComparison.InvariantCultureIgnoreCase))
+ if (currentToken.Equals("nan", StringComparison.OrdinalIgnoreCase))
{
NextToken();
return Double.NaN;