Skip to content

Commit d5be7be

Browse files
committed
rm unused string decodes
1 parent 8352b9c commit d5be7be

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

src/CborDecode.sol

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -155,52 +155,6 @@ library CBORDecoder {
155155
return byteIdx + len;
156156
}
157157

158-
/// @notice attempt to read an arbitrary length string value
159-
/// @param cborData cbor encoded bytes to parse from
160-
/// @param byteIdx current position to read on the cbor encoded bytes
161-
/// @return arbitrary length string decoded from input bytes and the byte index after moving past the value
162-
function readStringBytes8(bytes memory cborData, uint byteIdx) internal pure returns (bytes8, uint) {
163-
uint8 maj;
164-
uint len;
165-
166-
(maj, len, byteIdx) = parseCborHeader(cborData, byteIdx);
167-
require(maj == MajTextString, "invalid maj (expected MajTextString)");
168-
require(len <= 8, "expected string length of 8 or less");
169-
170-
uint max_len = byteIdx + len;
171-
bytes memory slice = new bytes(len);
172-
uint slice_index = 0;
173-
for (uint256 i = byteIdx; i < max_len; i++) {
174-
slice[slice_index] = cborData[i];
175-
slice_index++;
176-
}
177-
178-
return (bytes8(slice), byteIdx + len);
179-
}
180-
181-
/// @notice attempt to read an arbitrary length string value
182-
/// @param cborData cbor encoded bytes to parse from
183-
/// @param byteIdx current position to read on the cbor encoded bytes
184-
/// @return arbitrary length string decoded from input bytes and the byte index after moving past the value
185-
function readStringBytes10(bytes memory cborData, uint byteIdx) internal pure returns (bytes10, uint) {
186-
uint8 maj;
187-
uint len;
188-
189-
(maj, len, byteIdx) = parseCborHeader(cborData, byteIdx);
190-
require(maj == MajTextString, "invalid maj (expected MajTextString)");
191-
require(len <= 10, "expected string length of 10 or less");
192-
193-
uint max_len = byteIdx + len;
194-
bytes memory slice = new bytes(len);
195-
uint slice_index = 0;
196-
for (uint256 i = byteIdx; i < max_len; i++) {
197-
slice[slice_index] = cborData[i];
198-
slice_index++;
199-
}
200-
201-
return (bytes10(slice), byteIdx + len);
202-
}
203-
204158
/// @notice attempt to read an arbitrary byte string value
205159
/// @param cborData cbor encoded bytes to parse from
206160
/// @param byteIdx current position to read on the cbor encoded bytes

0 commit comments

Comments
 (0)