diff options
author | unknown <monty@mashka.mysql.fi> | 2003-01-18 21:55:01 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-01-18 21:55:01 +0200 |
commit | 663e79c44b8216d3c8254f8d9a2670e8a754a14d (patch) | |
tree | 97b522f52075c3855c327594ac9b723be83db9bd | |
parent | f71de9b7d0879b273187b57d3f47ea91b9eb4bec (diff) | |
download | mariadb-git-663e79c44b8216d3c8254f8d9a2670e8a754a14d.tar.gz |
Removed compiler warnings
client/insert_test.c:
Fixed core dump in test
-rw-r--r-- | client/insert_test.c | 1 | ||||
-rw-r--r-- | libmysql/libmysql.c | 31 | ||||
-rw-r--r-- | sql/password.c | 16 |
3 files changed, 26 insertions, 22 deletions
diff --git a/client/insert_test.c b/client/insert_test.c index d8ca71bffce..e4eb852af52 100644 --- a/client/insert_test.c +++ b/client/insert_test.c @@ -34,6 +34,7 @@ int main(int argc, char **argv) exit(1); } + mysql_init(&mysql); if (!(sock = mysql_real_connect(&mysql,NULL,NULL,NULL,argv[1],0,NULL,0))) { fprintf(stderr,"Couldn't connect to engine!\n%s\n",mysql_error(&mysql)); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index a2bd668aca9..a491da51298 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2317,10 +2317,10 @@ Try also with PIPE or TCP/IP /* Store copy as we'll need it later */ memcpy(password_hash,buff,SCRAMBLE41_LENGTH); /* Finally hash complete password using hash we got from server */ - password_hash_stage2(password_hash,net->read_pos); + password_hash_stage2(password_hash,(const char*) net->read_pos); /* Decypt and store scramble 4 = hash for stage2 */ - password_crypt(net->read_pos+4,mysql->scramble_buff,password_hash, - SCRAMBLE41_LENGTH); + password_crypt((const char*) net->read_pos+4,mysql->scramble_buff, + password_hash, SCRAMBLE41_LENGTH); mysql->scramble_buff[SCRAMBLE41_LENGTH]=0; /* Encode scramble with password. Recycle buffer */ password_crypt(mysql->scramble_buff,buff,buff,SCRAMBLE41_LENGTH); @@ -2534,10 +2534,10 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, /* Store copy as we'll need it later */ memcpy(password_hash,buff,SCRAMBLE41_LENGTH); /* Finally hash complete password using hash we got from server */ - password_hash_stage2(password_hash,net->read_pos); + password_hash_stage2(password_hash, (const char*) net->read_pos); /* Decypt and store scramble 4 = hash for stage2 */ - password_crypt(net->read_pos+4,mysql->scramble_buff,password_hash, - SCRAMBLE41_LENGTH); + password_crypt((const char*) net->read_pos+4, mysql->scramble_buff, + password_hash, SCRAMBLE41_LENGTH); mysql->scramble_buff[SCRAMBLE41_LENGTH]=0; /* Encode scramble with password. Recycle buffer */ password_crypt(mysql->scramble_buff,buff,buff,SCRAMBLE41_LENGTH); @@ -2547,8 +2547,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, /* Create password to decode scramble */ create_key_from_old_password(passwd,password_hash); /* Decypt and store scramble 4 = hash for stage2 */ - password_crypt(net->read_pos+4,mysql->scramble_buff,password_hash, - SCRAMBLE41_LENGTH); + password_crypt((const char*) net->read_pos+4,mysql->scramble_buff, + password_hash, SCRAMBLE41_LENGTH); mysql->scramble_buff[SCRAMBLE41_LENGTH]=0; /* Finally scramble decoded scramble with password */ scramble(buff, mysql->scramble_buff, passwd, @@ -4059,7 +4059,7 @@ static void store_param_str(NET *net, MYSQL_BIND *param) ulong length= *param->length; char *to= (char *) net_store_length((char *) net->write_pos, length); memcpy(to, param->buffer, length); - net->write_pos= to+length; + net->write_pos= (uchar*) to+length; } @@ -4211,7 +4211,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt) } length= (ulong) (net->write_pos - net->buff); /* TODO: Look into avoding the following memdup */ - if (!(param_data= my_memdup( net->buff, length, MYF(0)))) + if (!(param_data= my_memdup((const char*) net->buff, length, MYF(0)))) { set_stmt_error(stmt, CR_OUT_OF_MEMORY); DBUG_RETURN(1); @@ -4538,19 +4538,22 @@ static void send_data_str(MYSQL_BIND *param, char *value, uint length) switch(param->buffer_type) { case MYSQL_TYPE_TINY: { - uchar data= (uchar)my_strntol(system_charset_info,value,length,10,NULL,&err); + uchar data= (uchar)my_strntol(system_charset_info,value,length,10,NULL, + &err); *buffer= data; break; } case MYSQL_TYPE_SHORT: { - short data= (short)my_strntol(system_charset_info,value,length,10,NULL,&err); + short data= (short)my_strntol(system_charset_info,value,length,10,NULL, + &err); int2store(buffer, data); break; } case MYSQL_TYPE_LONG: { - int32 data= (int32)my_strntol(system_charset_info,value,length,10,NULL,&err); + int32 data= (int32)my_strntol(system_charset_info,value,length,10,NULL, + &err); int4store(buffer, data); break; } @@ -4738,7 +4741,7 @@ static my_bool fetch_results(MYSQL_STMT *stmt, MYSQL_BIND *param, } default: length= net_field_length(row); - send_data_str(param,*row,length); + send_data_str(param,(char*) *row,length); break; } *row+= length; diff --git a/sql/password.c b/sql/password.c index da7a499ba09..9b6189a161c 100644 --- a/sql/password.c +++ b/sql/password.c @@ -236,7 +236,7 @@ void password_hash_stage1(char *to, const char *password) { if (*password == ' ' || *password == '\t') continue;/* skip space in password */ - sha1_input(&context,(int8*)&password[0],1); + sha1_input(&context,(uint8*) &password[0],1); } sha1_result(&context,(uint8*)to); } @@ -259,9 +259,9 @@ void password_hash_stage2(char *to,const char *salt) { SHA1_CONTEXT context; sha1_reset(&context); - sha1_input(&context,(uint8*)salt,4); - sha1_input(&context,to,SHA1_HASH_SIZE); - sha1_result(&context,(uint8*)to); + sha1_input(&context,(uint8*) salt, 4); + sha1_input(&context,(uint8*) to, SHA1_HASH_SIZE); + sha1_result(&context,(uint8*) to); } @@ -295,14 +295,14 @@ void make_scrambled_password(char *to,const char *password, else /* New password 4.1 password scrambling */ { to[0]=PVERSION41_CHAR; /* New passwords have version prefix */ - /* Random returns number from 0 to 1 so this would be good salt generation.*/ + /* Rnd returns number from 0 to 1 so this would be good salt generation.*/ salt=rnd(rand_st)*65535+1; /* Use only 2 first bytes from it */ sprintf(to+1,"%04x",salt); /* First hasing is done without salt */ - password_hash_stage1(digest,password); + password_hash_stage1((char*) digest, password); /* Second stage is done with salt */ - password_hash_stage2(digest,(char*)to+1), + password_hash_stage2((char*) digest,(char*)to+1), /* Print resulting hash into the password*/ sprintf(to+5, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", @@ -376,7 +376,7 @@ my_bool validate_password(const char* password, const char* message, password_hash_stage2(buffer,tmpsalt); /* Convert password to salt to compare */ - get_salt_from_bin_password(salt_candidate,buffer,salt[0]); + get_salt_from_bin_password(salt_candidate,(uchar*) buffer,salt[0]); /* Now we shall get exactly the same password as we have stored for user */ for (salt_end=salt+5 ; salt < salt_end; ) |