[CBOR] Implement indefinite length writer and reader support (#33831)
authorEirik Tsarpalis <eirik.tsarpalis@gmail.com>
Tue, 24 Mar 2020 22:01:27 +0000 (22:01 +0000)
committerGitHub <noreply@github.com>
Tue, 24 Mar 2020 22:01:27 +0000 (22:01 +0000)
commit5c8cad2b40fbe311da121060790461771091c844
tree6563e56d086ff88ea99e8bec089e3eb315a58307
parentdcfce2e0af6614ee124590b75a7027d0efdb2e31
[CBOR] Implement indefinite length writer and reader support (#33831)

* Implement indefinite length writes

* add indefinite-length cbor reader support

* Use CborReaderState.FormatError in Peek() instead of throwing exceptions.

* use verbose naming for indefinite-length write methods

* address feedback

* implement concatenation logic for indefinite-length string readers

* add tests for nested indefinite-length strings

* fix naming issues

* check that TryReadString() methods are idempotent on failed reads.

* use string.Create instead of char buffer; share single range list allocation

* only clear List if it is guaranteed to be reused

* move field to top of main CborReader source file.
20 files changed:
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Array.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Helpers.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Integer.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Map.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.String.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Array.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Helpers.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Map.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.String.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborInitialByte.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Array.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Integer.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Map.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.String.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Array.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Integer.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Map.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.String.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.cs