mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
This commit is contained in:
@@ -1190,7 +1190,7 @@ int decimal2longlong(decimal_t *from, longlong *to)
|
||||
|
||||
7E F2 04 37 2D FB 2D
|
||||
*/
|
||||
int decimal2bin(decimal_t *from, char *to, int precision, int frac)
|
||||
int decimal2bin(decimal_t *from, uchar *to, int precision, int frac)
|
||||
{
|
||||
dec1 mask=from->sign ? -1 : 0, *buf1=from->buf, *stop1;
|
||||
int error=E_DEC_OK, intg=precision-frac,
|
||||
@@ -1206,7 +1206,7 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac)
|
||||
fsize1=frac1*sizeof(dec1)+dig2bytes[frac1x];
|
||||
const int orig_isize0= isize0;
|
||||
const int orig_fsize0= fsize0;
|
||||
char *orig_to= to;
|
||||
uchar *orig_to= to;
|
||||
|
||||
buf1= remove_leading_zeroes(from, &from_intg);
|
||||
|
||||
@@ -1296,10 +1296,10 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac)
|
||||
}
|
||||
if (fsize0 > fsize1)
|
||||
{
|
||||
char *to_end= orig_to + orig_fsize0 + orig_isize0;
|
||||
uchar *to_end= orig_to + orig_fsize0 + orig_isize0;
|
||||
|
||||
while (fsize0-- > fsize1 && to < to_end)
|
||||
*to++=(uchar)mask;
|
||||
*to++= (uchar)mask;
|
||||
}
|
||||
orig_to[0]^= 0x80;
|
||||
|
||||
@@ -1325,19 +1325,19 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac)
|
||||
E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW
|
||||
*/
|
||||
|
||||
int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
||||
int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale)
|
||||
{
|
||||
int error=E_DEC_OK, intg=precision-scale,
|
||||
intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1,
|
||||
intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1,
|
||||
intg1=intg0+(intg0x>0), frac1=frac0+(frac0x>0);
|
||||
dec1 *buf=to->buf, mask=(*from & 0x80) ? 0 : -1;
|
||||
char *stop;
|
||||
char *d_copy;
|
||||
const uchar *stop;
|
||||
uchar *d_copy;
|
||||
int bin_size= decimal_bin_size(precision, scale);
|
||||
|
||||
sanity(to);
|
||||
d_copy= (char *)my_alloca(bin_size);
|
||||
d_copy= (uchar*) my_alloca(bin_size);
|
||||
memcpy(d_copy, from, bin_size);
|
||||
d_copy[0]^= 0x80;
|
||||
from= d_copy;
|
||||
|
||||
Reference in New Issue
Block a user