mirror of
https://github.com/MariaDB/server.git
synced 2025-06-13 13:01:51 +03:00
Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris
Faster thr_alarm() Added 'Opened_files' status variable to track calls to my_open() Don't give warnings when running mysql_install_db Added option --source-install to mysql_install_db I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems index_read() -> index_read_map() index_read_idx() -> index_read_idx_map() index_read_last() -> index_read_last_map()
This commit is contained in:
@ -341,7 +341,7 @@ my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
|
||||
DBUG_RETURN(1);
|
||||
master->reconnect= 1;
|
||||
mysql->last_used_con = master;
|
||||
DBUG_RETURN(simple_command(master, COM_QUERY, q, length, 1));
|
||||
DBUG_RETURN(simple_command(master, COM_QUERY, (const uchar*) q, length, 1));
|
||||
}
|
||||
|
||||
|
||||
@ -375,7 +375,8 @@ my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
|
||||
0,0,0,0))
|
||||
DBUG_RETURN(1);
|
||||
slave_to_use->reconnect= 1;
|
||||
DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, q, length, 1));
|
||||
DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, (const uchar*) q,
|
||||
length, 1));
|
||||
}
|
||||
|
||||
|
||||
@ -669,7 +670,8 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
|
||||
password in old format. The reply contains scramble_323.
|
||||
*/
|
||||
scramble_323(buff, mysql->scramble, passwd);
|
||||
if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net))
|
||||
if (my_net_write(net, (uchar*) buff, SCRAMBLE_LENGTH_323 + 1) ||
|
||||
net_flush(net))
|
||||
{
|
||||
net->last_errno= CR_SERVER_LOST;
|
||||
strmov(net->sqlstate, unknown_sqlstate);
|
||||
@ -720,7 +722,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
||||
end= strmov(end, db ? db : "") + 1;
|
||||
|
||||
/* Write authentication package */
|
||||
simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (end-buff),1);
|
||||
simple_command(mysql,COM_CHANGE_USER, (uchar*) buff, (ulong) (end-buff), 1);
|
||||
|
||||
rc= (*mysql->methods->read_change_user_result)(mysql, buff, passwd);
|
||||
|
||||
@ -830,7 +832,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
|
||||
if ((*options->local_infile_init)(&li_ptr, net_filename,
|
||||
options->local_infile_userdata))
|
||||
{
|
||||
VOID(my_net_write(net,"",0)); /* Server needs one packet */
|
||||
VOID(my_net_write(net,(const uchar*) "",0)); /* Server needs one packet */
|
||||
net_flush(net);
|
||||
strmov(net->sqlstate, unknown_sqlstate);
|
||||
net->last_errno= (*options->local_infile_error)(li_ptr,
|
||||
@ -844,7 +846,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
|
||||
(*options->local_infile_read)(li_ptr, buf,
|
||||
packet_length)) > 0)
|
||||
{
|
||||
if (my_net_write(net,buf,readcount))
|
||||
if (my_net_write(net, (uchar*) buf, readcount))
|
||||
{
|
||||
DBUG_PRINT("error",
|
||||
("Lost connection to MySQL server during LOAD DATA of local file"));
|
||||
@ -856,7 +858,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
|
||||
}
|
||||
|
||||
/* Send empty packet to mark end of file */
|
||||
if (my_net_write(net,"",0) || net_flush(net))
|
||||
if (my_net_write(net, (const uchar*) "", 0) || net_flush(net))
|
||||
{
|
||||
strmov(net->sqlstate, unknown_sqlstate);
|
||||
net->last_errno=CR_SERVER_LOST;
|
||||
@ -1242,7 +1244,8 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
|
||||
|
||||
end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128);
|
||||
free_old_query(mysql);
|
||||
if (simple_command(mysql,COM_FIELD_LIST,buff,(ulong) (end-buff),1) ||
|
||||
if (simple_command(mysql, COM_FIELD_LIST, (uchar*) buff,
|
||||
(ulong) (end-buff), 1) ||
|
||||
!(fields= (*mysql->methods->list_fields)(mysql)))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
@ -1313,7 +1316,7 @@ mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level)
|
||||
uchar level[1];
|
||||
DBUG_ENTER("mysql_shutdown");
|
||||
level[0]= (uchar) shutdown_level;
|
||||
DBUG_RETURN(simple_command(mysql, COM_SHUTDOWN, (char *)level, 1, 0));
|
||||
DBUG_RETURN(simple_command(mysql, COM_SHUTDOWN, level, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
@ -1323,14 +1326,14 @@ mysql_refresh(MYSQL *mysql,uint options)
|
||||
uchar bits[1];
|
||||
DBUG_ENTER("mysql_refresh");
|
||||
bits[0]= (uchar) options;
|
||||
DBUG_RETURN(simple_command(mysql,COM_REFRESH,(char*) bits,1,0));
|
||||
DBUG_RETURN(simple_command(mysql, COM_REFRESH, bits, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
int STDCALL
|
||||
mysql_kill(MYSQL *mysql,ulong pid)
|
||||
{
|
||||
char buff[4];
|
||||
uchar buff[4];
|
||||
DBUG_ENTER("mysql_kill");
|
||||
int4store(buff,pid);
|
||||
DBUG_RETURN(simple_command(mysql,COM_PROCESS_KILL,buff,sizeof(buff),0));
|
||||
@ -1340,7 +1343,7 @@ mysql_kill(MYSQL *mysql,ulong pid)
|
||||
int STDCALL
|
||||
mysql_set_server_option(MYSQL *mysql, enum enum_mysql_set_option option)
|
||||
{
|
||||
char buff[2];
|
||||
uchar buff[2];
|
||||
DBUG_ENTER("mysql_set_server_option");
|
||||
int2store(buff, (uint) option);
|
||||
DBUG_RETURN(simple_command(mysql, COM_SET_OPTION, buff, sizeof(buff), 0));
|
||||
@ -2059,7 +2062,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
|
||||
if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE)
|
||||
{
|
||||
/* This is second prepare with another statement */
|
||||
char buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */
|
||||
uchar buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */
|
||||
|
||||
if (reset_stmt_handle(stmt, RESET_LONG_DATA | RESET_STORE_RESULT))
|
||||
DBUG_RETURN(1);
|
||||
@ -2089,7 +2092,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
|
||||
}
|
||||
}
|
||||
|
||||
if (stmt_command(mysql, COM_STMT_PREPARE, query, length, stmt))
|
||||
if (stmt_command(mysql, COM_STMT_PREPARE, (const uchar*) query, length, stmt))
|
||||
{
|
||||
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
|
||||
mysql->net.sqlstate);
|
||||
@ -2425,9 +2428,9 @@ static void store_param_str(NET *net, MYSQL_BIND *param)
|
||||
{
|
||||
/* param->length is always set in mysql_stmt_bind_param */
|
||||
ulong length= *param->length;
|
||||
char *to= (char *) net_store_length((char *) net->write_pos, length);
|
||||
uchar *to= net_store_length(net->write_pos, length);
|
||||
memcpy(to, param->buffer, length);
|
||||
net->write_pos= (uchar*) to+length;
|
||||
net->write_pos= to+length;
|
||||
}
|
||||
|
||||
|
||||
@ -2495,10 +2498,9 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
|
||||
{
|
||||
MYSQL *mysql= stmt->mysql;
|
||||
NET *net= &mysql->net;
|
||||
char buff[4 /* size of stmt id */ +
|
||||
5 /* execution flags */];
|
||||
uchar buff[4 /* size of stmt id */ +
|
||||
5 /* execution flags */];
|
||||
my_bool res;
|
||||
|
||||
DBUG_ENTER("execute");
|
||||
DBUG_DUMP("packet", packet, length);
|
||||
|
||||
@ -2508,7 +2510,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
|
||||
int4store(buff+5, 1); /* iteration count */
|
||||
|
||||
res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
|
||||
packet, length, 1, NULL) ||
|
||||
(uchar*) packet, length, 1, NULL) ||
|
||||
(*mysql->methods->read_query_result)(mysql));
|
||||
stmt->affected_rows= mysql->affected_rows;
|
||||
stmt->server_status= mysql->server_status;
|
||||
@ -2587,7 +2589,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
|
||||
}
|
||||
length= (ulong) (net->write_pos - net->buff);
|
||||
/* TODO: Look into avoding the following memdup */
|
||||
if (!(param_data= my_memdup((const char*) net->buff, length, MYF(0))))
|
||||
if (!(param_data= my_memdup(net->buff, length, MYF(0))))
|
||||
{
|
||||
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
@ -2714,8 +2716,8 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
|
||||
MYSQL *mysql= stmt->mysql;
|
||||
NET *net= &mysql->net;
|
||||
MYSQL_DATA *result= &stmt->result;
|
||||
char buff[4 /* statement id */ +
|
||||
4 /* number of rows to fetch */];
|
||||
uchar buff[4 /* statement id */ +
|
||||
4 /* number of rows to fetch */];
|
||||
|
||||
free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
|
||||
result->data= NULL;
|
||||
@ -2724,7 +2726,7 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
|
||||
int4store(buff, stmt->stmt_id);
|
||||
int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */
|
||||
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
|
||||
buff, sizeof(buff), NullS, 0,
|
||||
buff, sizeof(buff), (uchar*) 0, 0,
|
||||
1, NULL))
|
||||
{
|
||||
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
|
||||
@ -3380,7 +3382,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
|
||||
{
|
||||
MYSQL *mysql= stmt->mysql;
|
||||
/* Packet header: stmt id (4 bytes), param no (2 bytes) */
|
||||
char buff[MYSQL_LONG_DATA_HEADER];
|
||||
uchar buff[MYSQL_LONG_DATA_HEADER];
|
||||
|
||||
int4store(buff, stmt->stmt_id);
|
||||
int2store(buff + 4, param_number);
|
||||
@ -3391,7 +3393,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
|
||||
This is intentional to save bandwidth.
|
||||
*/
|
||||
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_SEND_LONG_DATA,
|
||||
buff, sizeof(buff), data,
|
||||
buff, sizeof(buff), (uchar*) data,
|
||||
length, 1, NULL))
|
||||
{
|
||||
set_stmt_errmsg(stmt, mysql->net.last_error,
|
||||
@ -3719,19 +3721,20 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
}
|
||||
default:
|
||||
{
|
||||
char buff[22]; /* Enough for longlong */
|
||||
char *end= longlong10_to_str(value, buff, is_unsigned ? 10: -10);
|
||||
uchar buff[22]; /* Enough for longlong */
|
||||
uchar *end= (uchar*) longlong10_to_str(value, (char*) buff,
|
||||
is_unsigned ? 10: -10);
|
||||
/* Resort to string conversion which supports all typecodes */
|
||||
uint length= (uint) (end-buff);
|
||||
|
||||
if (field->flags & ZEROFILL_FLAG && length < field->length &&
|
||||
field->length < 21)
|
||||
{
|
||||
bmove_upp((char*) buff+field->length,buff+length, length);
|
||||
bfill((char*) buff, field->length - length,'0');
|
||||
bmove_upp(buff+field->length,buff+length, length);
|
||||
bfill(buff, field->length - length,'0');
|
||||
length= field->length;
|
||||
}
|
||||
fetch_string_with_conversion(param, buff, length);
|
||||
fetch_string_with_conversion(param, (char*) buff, length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4785,14 +4788,14 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
|
||||
Server side cursor exist, tell server to start sending the rows
|
||||
*/
|
||||
NET *net= &mysql->net;
|
||||
char buff[4 /* statement id */ +
|
||||
4 /* number of rows to fetch */];
|
||||
uchar buff[4 /* statement id */ +
|
||||
4 /* number of rows to fetch */];
|
||||
|
||||
/* Send row request to the server */
|
||||
int4store(buff, stmt->stmt_id);
|
||||
int4store(buff + 4, (int)~0); /* number of rows to fetch */
|
||||
if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
|
||||
NullS, 0, 1, NULL))
|
||||
(uchar*) 0, 0, 1, NULL))
|
||||
{
|
||||
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
@ -4976,7 +4979,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
|
||||
Reset the server side statement and close the server side
|
||||
cursor if it exists.
|
||||
*/
|
||||
char buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */
|
||||
uchar buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */
|
||||
int4store(buff, stmt->stmt_id);
|
||||
if ((*mysql->methods->advanced_command)(mysql, COM_STMT_RESET, buff,
|
||||
sizeof(buff), 0, 0, 0, NULL))
|
||||
@ -5037,7 +5040,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
|
||||
net_clear_error(&mysql->net);
|
||||
if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE)
|
||||
{
|
||||
char buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */
|
||||
uchar buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */
|
||||
|
||||
if (mysql->unbuffered_fetch_owner == &stmt->unbuffered_fetch_cancelled)
|
||||
mysql->unbuffered_fetch_owner= 0;
|
||||
|
Reference in New Issue
Block a user