Skip to content

Commit df102c4

Browse files
authored
Update ReadAny to skip over lists and maps (#372)
* Normalize line endings * Skip over List and Map encountered by ReadAny
1 parent f2904b0 commit df102c4

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

.gitattributes

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
*.sln text eol=crlf
7+
*.csproj text eol=crlf
8+
*.vbproj text eol=crlf
9+
*.vcxproj text eol=crlf
10+
*.vcproj text eol=crlf
11+
*.dbproj text eol=crlf
12+
*.fsproj text eol=crlf
13+
*.lsproj text eol=crlf
14+
*.wixproj text eol=crlf
15+
*.modelproj text eol=crlf
16+
*.sqlproj text eol=crlf
17+
*.wmaproj text eol=crlf
18+
19+
*.xproj text eol=crlf
20+
*.props text eol=crlf
21+
*.filters text eol=crlf
22+
*.vcxitems text eol=crlf
23+
*.dgml text eol=crlf
24+
25+
*.bat text eol=crlf
26+
*.cmd text eol=crlf
27+
*.sh text eol=lf
28+
29+
*.DotSettings text eol=lf
30+
*.svg text eol=lf
31+
*.kts text eol=lf
32+
33+
*.cs diff=csharp
34+
*.doc diff=astextplain
35+
*.DOC diff=astextplain
36+
*.docx diff=astextplain
37+
*.DOCX diff=astextplain
38+
*.dot diff=astextplain
39+
*.DOT diff=astextplain
40+
*.pdf diff=astextplain
41+
*.PDF diff=astextplain
42+
*.rtf diff=astextplain
43+
*.RTF diff=astextplain
44+
45+
*.exe binary
46+
*.pdf binary
47+
*.bmp binary
48+
*.cur binary
49+
*.dll binary
50+
*.doc binary
51+
*.docx binary
52+
*.ico binary
53+
*.jpg binary
54+
*.ocx binary
55+
*.xls binary
56+
*.xlsx binary
57+
*.png binary
58+
*.gif binary

RabbitMQ.Stream.Client/AMQP/AmqpWireFormattingRead.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,35 @@ internal static int ReadAny(ref SequenceReader<byte> reader, out object value)
148148
value = null;
149149
reader.Advance(1);
150150
return 1;
151+
152+
case FormatCode.List0:
153+
case FormatCode.List8:
154+
case FormatCode.List32:
155+
{
156+
offset = ReadListHeader(ref reader, out var fields);
157+
for (long i = 0; i < fields; i++)
158+
{
159+
offset += ReadAny(ref reader, out _);
160+
}
161+
162+
value = null;
163+
return offset;
164+
}
165+
166+
case FormatCode.Map8:
167+
case FormatCode.Map32:
168+
{
169+
offset = ReadMapHeader(ref reader, out var count);
170+
var values = count / 2;
171+
for (uint i = 0; i < values; i++)
172+
{
173+
offset += ReadAny(ref reader, out _);
174+
offset += ReadAny(ref reader, out _);
175+
}
176+
177+
value = null;
178+
return offset;
179+
}
151180
}
152181

153182
throw new AmqpParseException($"Read Any: Invalid type: {type}");

0 commit comments

Comments
 (0)