diff options
author | jani@a88-113-38-195.elisa-laajakaista.fi <> | 2007-05-24 13:24:36 +0300 |
---|---|---|
committer | jani@a88-113-38-195.elisa-laajakaista.fi <> | 2007-05-24 13:24:36 +0300 |
commit | fc3b3a0a864fd142f65bbd5ff611d2f09041a258 (patch) | |
tree | 94027c861a0c3fd6ad62c4bee7ae5f7b1088f056 /strings/decimal.c | |
parent | 2ff938d21c596d1769076d2703b22120d2cf8336 (diff) | |
parent | 088e2395f1833f16c2ea3f7405f604165b4aa2cc (diff) | |
download | mariadb-git-fc3b3a0a864fd142f65bbd5ff611d2f09041a258.tar.gz |
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
Diffstat (limited to 'strings/decimal.c')
-rw-r--r-- | strings/decimal.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index 0768c8cd4ca..ac82e7b16d6 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -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; |