1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

After merge fixes

Added initialization of all important global variables
This commit is contained in:
monty@mashka.mysql.fi
2003-05-21 21:39:58 +03:00
parent dd2b7918cd
commit 6aa8929cf3
64 changed files with 694 additions and 548 deletions

View File

@ -85,3 +85,33 @@ gptr sql_memdup(const void *ptr,uint len)
void sql_element_free(void *ptr __attribute__((unused)))
{} /* purecov: deadcode */
char *sql_strmake_with_convert(const char *str, uint32 arg_length,
CHARSET_INFO *from_cs,
uint32 max_res_length,
CHARSET_INFO *to_cs, uint32 *result_length)
{
char *pos;
uint32 new_length= to_cs->mbmaxlen*arg_length;
max_res_length--; // Reserve place for end null
set_if_smaller(new_length, max_res_length);
if (!(pos= sql_alloc(new_length+1)))
return pos; // Error
if ((from_cs == &my_charset_bin) || (to_cs == &my_charset_bin))
{
// Safety if to_cs->mbmaxlen > 0
new_length= min(arg_length, max_res_length);
memcpy(pos, str, new_length);
}
else
new_length= copy_and_convert((char*) pos, new_length, to_cs, str,
arg_length, from_cs);
pos[new_length]= 0;
*result_length= new_length;
return pos;
}