mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Simplified 'wrong xxx name' error messages by introducing 'general' ER_WRONG_NAME error
Cleaned up (and disabled part of) date/time/datetime format patch. One can't anymore change default read/write date/time/formats. This is becasue the non standard datetime formats can't be compared as strings and MySQL does still a lot of datetime comparisons as strings Changed flag argument to str_to_TIME() and get_date() from bool to uint Removed THD from str_to_xxxx functions and Item class. Fixed core dump when doing --print-defaults Move some common string functions to strfunc.cc Dates as strings are now of type my_charset_bin instead of default_charset() Introduce IDENT_QUOTED to not have to create an extra copy of simple identifiers (all chars < 128) Removed xxx_FORMAT_TYPE enums and replaced them with the old TIMESTAMP_xxx enums Renamed some TIMESTAMP_xxx enums to more appropriate names Use defines instead of integers for date/time/datetime string lengths Added to build system and use the new my_strtoll10() function.
This commit is contained in:
@@ -95,26 +95,32 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
|
||||
else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */
|
||||
{
|
||||
register int iarg;
|
||||
char *to_start= to;
|
||||
if ((uint) (end-to) < max(16,length))
|
||||
break;
|
||||
uint res_length, to_length;
|
||||
char *store_start= to, *store_end;
|
||||
char buff[16];
|
||||
|
||||
if ((to_length= (uint) (end-to)) < 16 || length)
|
||||
store_start= buff;
|
||||
iarg = va_arg(ap, int);
|
||||
if (*fmt == 'd')
|
||||
to=int10_to_str((long) iarg,to, -10);
|
||||
store_end= int10_to_str((long) iarg, store_start, -10);
|
||||
else
|
||||
to=int10_to_str((long) (uint) iarg,to,10);
|
||||
store_end= int10_to_str((long) (uint) iarg, store_start, 10);
|
||||
if ((res_length= (uint) (store_end - store_start)) > to_length)
|
||||
break; /* num doesn't fit in output */
|
||||
/* If %#d syntax was used, we have to pre-zero/pre-space the string */
|
||||
if (length)
|
||||
if (store_start == buff)
|
||||
{
|
||||
uint res_length= (uint) (to - to_start);
|
||||
length= min(length, to_length);
|
||||
if (res_length < length)
|
||||
{
|
||||
uint diff= (length- res_length);
|
||||
bmove_upp(to+diff, to, res_length);
|
||||
bfill(to-res_length, diff, pre_zero ? '0' : ' ');
|
||||
bfill(to, diff, pre_zero ? '0' : ' ');
|
||||
to+= diff;
|
||||
}
|
||||
bmove(to, store_start, res_length);
|
||||
}
|
||||
to+= res_length;
|
||||
continue;
|
||||
}
|
||||
/* We come here on '%%', unknown code or too long parameter */
|
||||
|
||||
Reference in New Issue
Block a user