summaryrefslogtreecommitdiff
path: root/sql/password.c
diff options
context:
space:
mode:
authormonty@mysql.com <>2005-10-12 00:58:22 +0300
committermonty@mysql.com <>2005-10-12 00:58:22 +0300
commitf5fdf3e87a5f60fdb6442912ae5741a24b2461c8 (patch)
treece0e98ba05247bbe755ac299d0ceaa8c42d63b7a /sql/password.c
parent17d7ba931d2293f1db89cbd1107a4bc71bc4fcdf (diff)
downloadmariadb-git-f5fdf3e87a5f60fdb6442912ae5741a24b2461c8.tar.gz
Reviewing new pushed code
- CHAR() now returns binary string as default - CHAR(X*65536+Y*256+Z) is now equal to CHAR(X,Y,Z) independent of the character set for CHAR() - Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() (Some old systems returns ETIME and it's safer to test for both values than to try to write a wrapper for each old system) - Fixed new introduced bug in NOT BETWEEN X and X - Ensure we call commit_by_xid or rollback_by_xid for all engines, even if one engine has failed - Use octet2hex() for all conversion of string to hex - Simplify and optimize code
Diffstat (limited to 'sql/password.c')
-rw-r--r--sql/password.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/password.c b/sql/password.c
index aa05be8c740..562df3ae226 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -316,18 +316,21 @@ void create_random_string(char *to, uint length, struct rand_struct *rand_st)
octet2hex()
buf OUT output buffer. Must be at least 2*len+1 bytes
str, len IN the beginning and the length of the input string
+
+ RETURN
+ buf+len*2
*/
-void
-octet2hex(char *to, const unsigned char *str, uint len)
+char *octet2hex(char *to, const char *str, uint len)
{
- const uint8 *str_end= str + len;
+ const byte *str_end= str + len;
for (; str != str_end; ++str)
{
- *to++= _dig_vec_upper[(*str & 0xF0) >> 4];
- *to++= _dig_vec_upper[*str & 0x0F];
+ *to++= _dig_vec_upper[((uchar) *str) >> 4];
+ *to++= _dig_vec_upper[((uchar) *str) & 0x0F];
}
*to= '\0';
+ return to;
}