Commit 8daa5188 authored by unknown's avatar unknown

fixed C++ syntax in C code

fixed end of string detection in string->decimal conversion to avoid false alarm about some string part left unconverted (string can be not null terminated)
ignore my_decimal.cc in libmysqld directory


BitKeeper/etc/ignore:
  Added libmysqld/my_decimal.cc to the ignore list
sql/my_decimal.cc:
  fixed end of string detection in string->decimal conversion to avoid false alarm about some string part left unconverted (string can be not null terminated)
strings/decimal.c:
  fixed C++ syntax in C code
parent f4eef98e
...@@ -1059,3 +1059,4 @@ support-files/ndb-config-2-node.ini ...@@ -1059,3 +1059,4 @@ support-files/ndb-config-2-node.ini
client/decimal.c client/decimal.c
client/my_decimal.cc client/my_decimal.cc
client/my_decimal.h client/my_decimal.h
libmysqld/my_decimal.cc
...@@ -171,7 +171,7 @@ int str2my_decimal(uint mask, const char *from, uint length, ...@@ -171,7 +171,7 @@ int str2my_decimal(uint mask, const char *from, uint length,
} }
my_decimal_set_zero(decimal_value); my_decimal_set_zero(decimal_value);
err= string2decimal((char *)from, (decimal *)decimal_value, &end); err= string2decimal((char *)from, (decimal *)decimal_value, &end);
if (*end && !err) if ((end-from) != length && !err)
err= E_DEC_TRUNCATED; err= E_DEC_TRUNCATED;
check_result(mask, err); check_result(mask, err);
return err; return err;
......
...@@ -686,12 +686,13 @@ int decimal_shift(decimal *dec, int shift) ...@@ -686,12 +686,13 @@ int decimal_shift(decimal *dec, int shift)
{ {
/* need to move digits */ /* need to move digits */
int d_shift; int d_shift;
dec1 *to, *barier;
if (new_front > 0) if (new_front > 0)
{ {
/* move left */ /* move left */
d_shift= new_front / DIG_PER_DEC1; d_shift= new_front / DIG_PER_DEC1;
dec1 *to= dec->buf + (ROUND_UP(beg + 1) - 1 - d_shift); to= dec->buf + (ROUND_UP(beg + 1) - 1 - d_shift);
dec1 *barier= dec->buf + (ROUND_UP(end) - 1 - d_shift); barier= dec->buf + (ROUND_UP(end) - 1 - d_shift);
DBUG_ASSERT(to >= dec->buf); DBUG_ASSERT(to >= dec->buf);
DBUG_ASSERT(barier + d_shift < dec->buf + dec->len); DBUG_ASSERT(barier + d_shift < dec->buf + dec->len);
for(; to <= barier; to++) for(; to <= barier; to++)
...@@ -704,8 +705,8 @@ int decimal_shift(decimal *dec, int shift) ...@@ -704,8 +705,8 @@ int decimal_shift(decimal *dec, int shift)
{ {
/* move right */ /* move right */
d_shift= (1 - new_front) / DIG_PER_DEC1; d_shift= (1 - new_front) / DIG_PER_DEC1;
dec1 *to= dec->buf + ROUND_UP(end) - 1 + d_shift; to= dec->buf + ROUND_UP(end) - 1 + d_shift;
dec1 *barier= dec->buf + ROUND_UP(beg + 1) - 1 + d_shift; barier= dec->buf + ROUND_UP(beg + 1) - 1 + d_shift;
DBUG_ASSERT(to < dec->buf + dec->len); DBUG_ASSERT(to < dec->buf + dec->len);
DBUG_ASSERT(barier - d_shift >= dec->buf); DBUG_ASSERT(barier - d_shift >= dec->buf);
for(; to >= barier; to--) for(; to >= barier; to--)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment