Skip to content

Commit 4dd2eae

Browse files
authored
Merge branch 'rabbitmq:main' into newpipeline
2 parents cab159f + f9d5952 commit 4dd2eae

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

projects/RabbitMQ.Client/client/impl/WireFormatting.Read.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ static object ReadFieldValueSlow(ReadOnlySpan<byte> span, out int bytesRead)
130130
case 's':
131131
bytesRead = 3;
132132
return NetworkOrderDeserializer.ReadInt16(slice);
133+
case 'u':
134+
bytesRead = 3;
135+
return NetworkOrderDeserializer.ReadUInt16(slice);
133136
case 'T':
134137
bytesRead = 1 + ReadTimestamp(slice, out var timestamp);
135138
return timestamp;

projects/RabbitMQ.Client/client/impl/WireFormatting.Write.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ static int WriteFieldValueSlow(ref byte destination, ref byte fieldValue, object
200200
case BinaryTableValue val:
201201
destination = (byte)'x';
202202
return 1 + WriteLongstr(ref fieldValue, val.Bytes);
203+
case ushort val:
204+
destination = (byte)'u';
205+
NetworkOrderSerializer.WriteUInt16(ref fieldValue, val);
206+
return 3;
203207
default:
204208
return ThrowInvalidTableValue(value);
205209
}
@@ -235,6 +239,8 @@ public static int GetFieldValueByteCount(object value)
235239
return 2;
236240
case short _:
237241
return 3;
242+
case ushort _:
243+
return 3;
238244
case uint _:
239245
return 5;
240246
case decimal _:

projects/Unit/TestFieldTableFormatting.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ public void TestQpidJmsTypes()
143143
["f"] = (float)123, // 2+5
144144
["l"] = (long)123, // 2+9
145145
["s"] = (short)123, // 2+2
146+
["u"] = (ushort)123,
146147
["t"] = true // 2+2
147148
};
148149
byte[] xbytes = { 0xaa, 0x55 };
@@ -159,6 +160,7 @@ public void TestQpidJmsTypes()
159160
Assert.Equal(typeof(float), nt["f"].GetType()); Assert.Equal((float)123, nt["f"]);
160161
Assert.Equal(typeof(long), nt["l"].GetType()); Assert.Equal((long)123, nt["l"]);
161162
Assert.Equal(typeof(short), nt["s"].GetType()); Assert.Equal((short)123, nt["s"]);
163+
Assert.Equal(typeof(ushort), nt["u"].GetType()); Assert.Equal((ushort)123, nt["u"]);
162164
Assert.Equal(true, nt["t"]);
163165
Assert.Equal(xbytes, ((BinaryTableValue)nt["x"]).Bytes);
164166
Assert.Null(nt["V"]);

projects/Unit/TestFieldTableFormattingGeneric.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public void TestQpidJmsTypes()
131131
["f"] = (float)123,
132132
["l"] = (long)123,
133133
["s"] = (short)123,
134+
["u"] = (ushort)123,
134135
["t"] = true
135136
};
136137
byte[] xbytes = new byte[] { 0xaa, 0x55 };
@@ -147,6 +148,7 @@ public void TestQpidJmsTypes()
147148
Assert.Equal(typeof(float), nt["f"].GetType()); Assert.Equal((float)123, nt["f"]);
148149
Assert.Equal(typeof(long), nt["l"].GetType()); Assert.Equal((long)123, nt["l"]);
149150
Assert.Equal(typeof(short), nt["s"].GetType()); Assert.Equal((short)123, nt["s"]);
151+
Assert.Equal(typeof(ushort), nt["u"].GetType()); Assert.Equal((ushort)123, nt["u"]);
150152
Assert.Equal(true, nt["t"]);
151153
Assert.Equal(xbytes, ((BinaryTableValue)nt["x"]).Bytes);
152154
Assert.Null(nt["V"]);

0 commit comments

Comments
 (0)