diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-04-05 10:49:38 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-04-05 10:49:38 +0200 |
commit | d4b30a7a84742ae03774fe25af2cbad144ba2d5d (patch) | |
tree | d65a66f9f2f9378a1f4ca014e18952ae514f4cb1 /extra/yassl/taocrypt/src/coding.cpp | |
parent | d993ce1bbf8413a0aaf5a524a11334359234c5f4 (diff) | |
parent | cea2c5d28ead6ae4191aea164df9b80b41a743ad (diff) | |
download | mariadb-git-mariadb-5.1.62.tar.gz |
mysql-5.1.62 mergemariadb-5.1.62
Diffstat (limited to 'extra/yassl/taocrypt/src/coding.cpp')
-rw-r--r-- | extra/yassl/taocrypt/src/coding.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp index a211d8cbf18..97c62ea12a7 100644 --- a/extra/yassl/taocrypt/src/coding.cpp +++ b/extra/yassl/taocrypt/src/coding.cpp @@ -11,8 +11,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. */ /* coding.cpp implements hex and base64 encoding/decoing @@ -94,7 +95,6 @@ void HexEncoder::Encode() void HexDecoder::Decode() { word32 bytes = coded_.size(); - assert((bytes % 2) == 0); decoded_.New(bytes / 2); word32 i(0); @@ -103,15 +103,9 @@ void HexDecoder::Decode() byte b = coded_.next() - 0x30; // 0 starts at 0x30 byte b2 = coded_.next() - 0x30; - // sanity checks - assert( b < sizeof(hexDecode)/sizeof(hexDecode[0]) ); - assert( b2 < sizeof(hexDecode)/sizeof(hexDecode[0]) ); - b = hexDecode[b]; b2 = hexDecode[b2]; - - assert( b != bad && b2 != bad ); - + decoded_[i++] = (b << 4) | b2; bytes -= 2; } @@ -173,9 +167,9 @@ void Base64Encoder::Encode() } encoded_[i++] = '\n'; - assert(i == outSz); - - plain_.reset(encoded_); + + if (i == outSz) + plain_.reset(encoded_); } @@ -196,7 +190,6 @@ void Base64Decoder::Decode() byte e3 = coded_.next(); byte e4 = coded_.next(); - // do asserts first if (e1 == 0) // end file 0's break; |