diff options
author | unknown <peter@linux.local> | 2002-06-14 15:14:30 +0400 |
---|---|---|
committer | unknown <peter@linux.local> | 2002-06-14 15:14:30 +0400 |
commit | 8451d47ac70f5840ec1d5fcfee2982f2a8cedc49 (patch) | |
tree | f47e08fb9e4c935c0c094ada6d7b5861615d6609 /sql/item_strfunc.cc | |
parent | 2325b78d128dc1052f86a3630b35f0b37d809738 (diff) | |
download | mariadb-git-8451d47ac70f5840ec1d5fcfee2982f2a8cedc49.tar.gz |
This is just code style/minor optimizations cleanup changeset
client/mysqldump.c:
Changes adviced by Monty
include/my_aes.h:
Changes adviced by Monty
include/rijndael.h:
Changes adviced by Monty
include/sha1.h:
Changes adviced by Monty
mysys/my_aes.c:
Changes adviced by Monty
mysys/rijndael.c:
Changes adviced by Monty
mysys/sha1.c:
Changes adviced by Monty
sql/item_strfunc.cc:
Changes adviced by Monty
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index adf21ce384f..d791f037cf1 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -108,21 +108,16 @@ String *Item_func_sha::val_str(String *str) if (sptr) /* If we got value different from NULL */ { SHA1_CONTEXT context; /* Context used to generate SHA1 hash */ - /* Temporary buffer to store 160bit digest */ + /* Temporary buffer to store 160bit digest */ uint8_t digest[SHA1_HASH_SIZE]; - null_value=0; sha1_reset(&context); /* We do not have to check for error here */ /* No need to check error as the only case would be too long message */ sha1_input(&context,(const unsigned char *) sptr->ptr(), sptr->length()); - - if (str->alloc(SHA1_HASH_SIZE*2) || (sha1_result(&context,digest)) ) - // Ensure that memory is free + /* Ensure that memory is free and we got result */ + if ( !( str->alloc(SHA1_HASH_SIZE*2) || (sha1_result(&context,digest)) ) ) { - null_value=1; - return 0; - } - sprintf((char *) str->ptr(), - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\ + sprintf((char *) str->ptr(), + "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\ %02x%02x%02x%02x%02x%02x%02x%02x", digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], @@ -130,9 +125,11 @@ String *Item_func_sha::val_str(String *str) digest[12], digest[13], digest[14], digest[15], digest[16], digest[17], digest[18], digest[19]); - str->length((uint) SHA1_HASH_SIZE*2); - return str; - } + str->length((uint) SHA1_HASH_SIZE*2); + null_value=0; + return str; + } + } null_value=1; return 0; } @@ -141,10 +138,10 @@ void Item_func_sha::fix_length_and_dec() { max_length=SHA1_HASH_SIZE*2; // size of hex representation of hash } - - -/* Implementation of AES encryption routines */ - + + +/* Implementation of AES encryption routines */ + String *Item_func_aes_encrypt::val_str(String *str) { String * sptr = args[0]->val_str(str); // String to encrypt @@ -163,7 +160,7 @@ String *Item_func_aes_encrypt::val_str(String *str) key->length()) == aes_length) { // we have to get expected result length - str->length((uint)aes_length); + str->length((uint) aes_length); return str; } } @@ -193,10 +190,10 @@ String *Item_func_aes_decrypt::val_str(String *str) length=my_aes_decrypt(sptr->ptr(),sptr->length(),str->ptr(), key->ptr(),key->length()); if (length>=0) // if we got correct data data - { - str->length((uint)length); - return str; - } + { + str->length((uint) length); + return str; + } } } // Bad parameters. No memory or bad data will all go here @@ -208,8 +205,8 @@ void Item_func_aes_decrypt::fix_length_and_dec() { max_length=args[0]->max_length; } - - + + /* ** Concatinate args with the following premissess ** If only one arg which is ok, return value of arg |