aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers/CodedOutputStream.cs
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2009-06-05 22:00:05 +0100
committerJon Skeet <skeet@pobox.com>2009-06-05 22:00:05 +0100
commitd6dd0a45608ffc34d53a60cc3db33cb38e6c2a18 (patch)
treed3aa02f1cbea4437b404bc7aa77cbc02f7e398dd /src/ProtocolBuffers/CodedOutputStream.cs
parent0864d30b977e0ae90a111004f597d777ce3082ed (diff)
downloadprotobuf-d6dd0a45608ffc34d53a60cc3db33cb38e6c2a18.tar.gz
protobuf-d6dd0a45608ffc34d53a60cc3db33cb38e6c2a18.tar.bz2
protobuf-d6dd0a45608ffc34d53a60cc3db33cb38e6c2a18.zip
Add CLSCompliance.
Diffstat (limited to 'src/ProtocolBuffers/CodedOutputStream.cs')
-rw-r--r--src/ProtocolBuffers/CodedOutputStream.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs
index 7cc5ff46..e5f890f9 100644
--- a/src/ProtocolBuffers/CodedOutputStream.cs
+++ b/src/ProtocolBuffers/CodedOutputStream.cs
@@ -133,6 +133,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a uint64 field value, including tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteUInt64(int fieldNumber, ulong value) {
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint64(value);
@@ -162,6 +163,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a fixed64 field value, including tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteFixed64(int fieldNumber, ulong value) {
WriteTag(fieldNumber, WireFormat.WireType.Fixed64);
WriteRawLittleEndian64(value);
@@ -170,6 +172,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a fixed32 field value, including tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteFixed32(int fieldNumber, uint value) {
WriteTag(fieldNumber, WireFormat.WireType.Fixed32);
WriteRawLittleEndian32(value);
@@ -230,6 +233,7 @@ namespace Google.ProtocolBuffers {
WriteRawBytes(bytes);
}
+ [CLSCompliant(false)]
public void WriteUInt32(int fieldNumber, uint value) {
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint32(value);
@@ -344,6 +348,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a uint64 field value, without a tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteUInt64NoTag(ulong value) {
WriteRawVarint64(value);
}
@@ -370,6 +375,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a fixed64 field value, without a tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteFixed64NoTag(ulong value) {
WriteRawLittleEndian64(value);
}
@@ -377,6 +383,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a fixed32 field value, without a tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteFixed32NoTag(uint value) {
WriteRawLittleEndian32(value);
}
@@ -424,6 +431,7 @@ namespace Google.ProtocolBuffers {
WriteRawBytes(bytes);
}
+ [CLSCompliant(false)]
public void WriteUInt32NoTag(uint value) {
WriteRawVarint32(value);
}
@@ -454,6 +462,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Encodes and writes a tag.
/// </summary>
+ [CLSCompliant(false)]
public void WriteTag(int fieldNumber, WireFormat.WireType type) {
WriteRawVarint32(WireFormat.MakeTag(fieldNumber, type));
}
@@ -475,6 +484,7 @@ namespace Google.ProtocolBuffers {
/// there's enough buffer space left to whizz through without checking
/// for each byte; otherwise, we resort to calling WriteRawByte each time.
/// </summary>
+ [CLSCompliant(false)]
public void WriteRawVarint32(uint value) {
if (position + 5 > limit) {
SlowWriteRawVarint32(value);
@@ -492,6 +502,7 @@ namespace Google.ProtocolBuffers {
}
}
+ [CLSCompliant(false)]
public void WriteRawVarint64(ulong value) {
while (true) {
if ((value & ~0x7FUL) == 0) {
@@ -504,6 +515,7 @@ namespace Google.ProtocolBuffers {
}
}
+ [CLSCompliant(false)]
public void WriteRawLittleEndian32(uint value) {
WriteRawByte((byte)value);
WriteRawByte((byte)(value >> 8));
@@ -511,6 +523,7 @@ namespace Google.ProtocolBuffers {
WriteRawByte((byte)(value >> 24));
}
+ [CLSCompliant(false)]
public void WriteRawLittleEndian64(ulong value) {
WriteRawByte((byte)value);
WriteRawByte((byte)(value >> 8));
@@ -530,6 +543,7 @@ namespace Google.ProtocolBuffers {
buffer[position++] = value;
}
+ [CLSCompliant(false)]
public void WriteRawByte(uint value) {
WriteRawByte((byte)value);
}
@@ -599,6 +613,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// uint64 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeUInt64Size(int fieldNumber, ulong value) {
return ComputeTagSize(fieldNumber) + ComputeRawVarint64Size(value);
}
@@ -628,6 +643,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// fixed64 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeFixed64Size(int fieldNumber, ulong value) {
return ComputeTagSize(fieldNumber) + LittleEndian64Size;
}
@@ -636,6 +652,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// fixed32 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeFixed32Size(int fieldNumber, uint value) {
return ComputeTagSize(fieldNumber) + LittleEndian32Size;
}
@@ -699,6 +716,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// uint32 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeUInt32Size(int fieldNumber, uint value) {
return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size(value);
}
@@ -764,6 +782,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// uint64 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeUInt64SizeNoTag(ulong value) {
return ComputeRawVarint64Size(value);
}
@@ -793,6 +812,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// fixed64 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeFixed64SizeNoTag(ulong value) {
return LittleEndian64Size;
}
@@ -801,6 +821,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// fixed32 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeFixed32SizeNoTag(uint value) {
return LittleEndian32Size;
}
@@ -861,6 +882,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// uint32 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeUInt32SizeNoTag(uint value) {
return ComputeRawVarint32Size(value);
}
@@ -936,6 +958,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Compute the number of bytes that would be needed to encode a varint.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeRawVarint32Size(uint value) {
if ((value & (0xffffffff << 7)) == 0) return 1;
if ((value & (0xffffffff << 14)) == 0) return 2;
@@ -947,6 +970,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Compute the number of bytes that would be needed to encode a varint.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeRawVarint64Size(ulong value) {
if ((value & (0xffffffffffffffffL << 7)) == 0) return 1;
if ((value & (0xffffffffffffffffL << 14)) == 0) return 2;
@@ -1035,6 +1059,7 @@ namespace Google.ProtocolBuffers {
/// sign-extended to 64 bits to be varint encoded, thus always taking
/// 10 bytes on the wire.)
/// </remarks>
+ [CLSCompliant(false)]
public static uint EncodeZigZag32(int n) {
// Note: the right-shift must be arithmetic
return (uint)((n << 1) ^ (n >> 31));
@@ -1049,6 +1074,7 @@ namespace Google.ProtocolBuffers {
/// sign-extended to 64 bits to be varint encoded, thus always taking
/// 10 bytes on the wire.)
/// </remarks>
+ [CLSCompliant(false)]
public static ulong EncodeZigZag64(long n) {
return (ulong)((n << 1) ^ (n >> 63));
}