From bdba1d11c4f3f2b1e2fe391a036ecdb703b8812f Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 24 Sep 2010 01:00:32 +0300 Subject: Change some my_bool in C++ classes and a few functions to bool to detect wrong usage of bool/my_bool. Fix some bugs where we stored values other than 0 or 1 in my_bool Fixed some compiler warnings client/mysql.cc: Changed interrupted_query from my_bool to int, as we stored 2 in it. client/mysqladmin.cc: Changed return variable type to same type as function value type client/mysqltest.cc: Changed 'found' to int as we store other values than 0 or 1 into it Changed type for parameter of set_reconnect() to match usage. extra/libevent/evbuffer.c: Added __attribute__((unused)) extra/libevent/event.c: Added __attribute__((unused)) extra/libevent/signal.c: Added __attribute__((unused)) sql/event_data_objects.h: my_bool -> bool sql/event_db_repository.cc: my_bool -> bool sql/event_db_repository.h: my_bool -> bool sql/event_parse_data.h: my_bool -> bool sql/events.cc: my_bool -> bool sql/events.h: my_bool -> bool sql/field.cc: my_bool -> bool sql/field.h: my_bool -> bool sql/hash_filo.h: my_bool -> bool sql/item.cc: my_bool -> bool sql/item.h: my_bool -> bool sql/item_cmpfunc.h: my_bool -> bool Changed result_for_null_param from my_bool to int as we stored -1 in it. sql/item_func.cc: my_bool -> bool Modified udf wrapper functions so that the UDF functions would continue to use my_bool. (To keep compatibility with UDF:s) sql/item_func.h: my_bool -> bool sql/item_subselect.h: my_bool -> bool sql/item_sum.cc: Modified udf wrapper functions so that the UDF functions would continue to use my_bool. (To keep compatibility with UDF:s) sql/parse_file.h: my_bool -> bool sql/rpl_mi.h: my_bool -> bool sql/sp_rcontext.h: my_bool -> bool sql/sql_analyse.h: my_bool -> bool sql/sql_base.cc: Change some assignments so that we don't initialize bool variables with int's. sql/sql_bitmap.h: my_bool -> bool sql/sql_cache.cc: my_bool -> bool sql/sql_cache.h: my_bool -> bool sql/sql_class.h: my_bool -> bool sql/sql_insert.cc: Change some assignments so that we don't initialize bool variables with int's. sql/sql_prepare.cc: my_bool -> bool sql/table.h: my_bool -> bool storage/maria/ma_check.c: Removed duplicate assignment strings/decimal.c: Fixed wrong variable usage. Don't do complex arithmetic on bool when simple works. --- strings/decimal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'strings') diff --git a/strings/decimal.c b/strings/decimal.c index 631750cf219..a1c02cb68bd 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -346,7 +346,7 @@ int decimal2string(decimal_t *from, char *to, int *to_len, char *s=to; dec1 *buf, *buf0=from->buf, tmp; - DBUG_ASSERT(*to_len >= 2+from->sign); + DBUG_ASSERT(*to_len >= 2+ (int) from->sign); /* removing leading zeroes */ buf0= remove_leading_zeroes(from, &intg); @@ -1801,7 +1801,8 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac); int frac0=max(frac1, frac2), error; - dec1 *buf1, *buf2, *buf0, *stop1, *stop2, *start1, *start2, carry=0; + dec1 *buf1, *buf2, *buf0, *stop1, *stop2, *start1, *start2; + my_bool carry=0; /* let carry:=1 if from2 > from1 */ start1=buf1=from1->buf; stop1=buf1+intg1; @@ -1869,7 +1870,7 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) swap_variables(dec1 *,start1, start2); swap_variables(int,intg1,intg2); swap_variables(int,frac1,frac2); - to->sign= 1 - to->sign; + to->sign= !to->sign; } FIX_INTG_FRAC_ERROR(to->len, intg1, frac0, error); -- cgit v1.2.1