diff options
Diffstat (limited to 'test/compilationTests/milestonetracker/RLP.sol')
-rw-r--r-- | test/compilationTests/milestonetracker/RLP.sol | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/test/compilationTests/milestonetracker/RLP.sol b/test/compilationTests/milestonetracker/RLP.sol index e96bb332..e261bf23 100644 --- a/test/compilationTests/milestonetracker/RLP.sol +++ b/test/compilationTests/milestonetracker/RLP.sol @@ -39,13 +39,13 @@ library RLP { self._unsafe_nextPtr = ptr + itemLength; } else - throw; + revert(); } function next(Iterator memory self, bool strict) internal view returns (RLPItem memory subItem) { subItem = next(self); if(strict && !_validate(subItem)) - throw; + revert(); return; } @@ -80,11 +80,11 @@ library RLP { if(strict) { uint len = self.length; if(_payloadOffset(item) > len) - throw; + revert(); if(_itemLength(item._unsafe_memPtr) != len) - throw; + revert(); if(!_validate(item)) - throw; + revert(); } return item; } @@ -160,7 +160,7 @@ library RLP { /// @return An 'Iterator' over the item. function iterator(RLPItem memory self) internal view returns (Iterator memory it) { if (!isList(self)) - throw; + revert(); uint ptr = self._unsafe_memPtr + _payloadOffset(self); it._unsafe_item = self; it._unsafe_nextPtr = ptr; @@ -183,7 +183,7 @@ library RLP { /// @return The decoded string. function toData(RLPItem memory self) internal returns (bytes memory bts) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); bts = new bytes(len); _copyToBytes(rStartPos, bts, len); @@ -195,7 +195,7 @@ library RLP { /// @return Array of RLPItems. function toList(RLPItem memory self) internal view returns (RLPItem[] memory list) { if(!isList(self)) - throw; + revert(); uint numItems = items(self); list = new RLPItem[](numItems); Iterator memory it = iterator(self); @@ -212,7 +212,7 @@ library RLP { /// @return The decoded string. function toAscii(RLPItem memory self) internal returns (string memory str) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); bytes memory bts = new bytes(len); _copyToBytes(rStartPos, bts, len); @@ -225,10 +225,10 @@ library RLP { /// @return The decoded string. function toUint(RLPItem memory self) internal view returns (uint data) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); if (len > 32 || len == 0) - throw; + revert(); assembly { data := div(mload(rStartPos), exp(256, sub(32, len))) } @@ -240,16 +240,16 @@ library RLP { /// @return The decoded string. function toBool(RLPItem memory self) internal view returns (bool data) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); if (len != 1) - throw; + revert(); uint temp; assembly { temp := byte(0, mload(rStartPos)) } if (temp > 1) - throw; + revert(); return temp == 1 ? true : false; } @@ -259,10 +259,10 @@ library RLP { /// @return The decoded string. function toByte(RLPItem memory self) internal view returns (byte data) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); if (len != 1) - throw; + revert(); uint8 temp; assembly { temp := byte(0, mload(rStartPos)) @@ -292,10 +292,10 @@ library RLP { /// @return The decoded string. function toAddress(RLPItem memory self) internal view returns (address data) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); if (len != 20) - throw; + revert(); assembly { data := div(mload(rStartPos), exp(256, 12)) } @@ -350,7 +350,7 @@ library RLP { // Get start position and length of the data. function _decode(RLPItem memory self) private view returns (uint memPtr, uint len) { if(!isData(self)) - throw; + revert(); uint b0; uint start = self._unsafe_memPtr; assembly { |