# At a local mysql-5.1-bugteam repository of davi
3458 Davi Arnaut 2010-07-02
Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.
One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.
There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.
@ BUILD/SETUP.sh
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
@ BUILD/check-cpu
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
@ client/mysql.cc
bcmp is no longer defined.
@ client/mysqltest.cc
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
@ cmd-line-utils/readline/Makefile.am
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
@ cmd-line-utils/readline/input.c
Condition for the code to be meaningful.
@ configure.in
Remove check for bcmp.
@ extra/comp_err.c
Use appropriate type.
@ extra/replace.c
Replace use of bcmp with memcmp.
@ extra/yassl/src/crypto_wrapper.cpp
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
@ extra/yassl/taocrypt/include/blowfish.hpp
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
@ extra/yassl/taocrypt/include/runtime.hpp
One definition of such functions is enough.
@ extra/yassl/taocrypt/src/aes.cpp
Avoid potentially ambiguous conditions.
@ extra/yassl/taocrypt/src/algebra.cpp
Rename arguments to avoid shadowing related warnings.
@ extra/yassl/taocrypt/src/blowfish.cpp
Avoid potentially ambiguous conditions.
@ extra/yassl/taocrypt/src/integer.cpp
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
@ extra/yassl/taocrypt/src/misc.cpp
Define handler for pure virtual functions.
Remove unused code.
@ extra/yassl/taocrypt/src/twofish.cpp
Avoid potentially ambiguous conditions.
@ extra/yassl/testsuite/test.hpp
Function must have C language linkage.
@ include/m_string.h
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
@ include/my_bitmap.h
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
@ include/my_global.h
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
@ libmysql/Makefile.shared
Remove built-in implementation of bcmp.
@ mysql-test/lib/My/SafeProcess/safe_process.cc
Cast pid to largest possible type for a process identifier.
@ mysys/mf_loadpath.c
Leave space of the ending nul.
@ mysys/mf_pack.c
Replace bcmp with memcmp.
@ mysys/my_bitmap.c
Dead code removal.
@ mysys/my_gethwaddr.c
Remove unused variable.
@ mysys/my_getopt.c
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
@ mysys/safemalloc.c
Cast to expected type.
@ mysys/thr_lock.c
Silence bogus uninitialized variable warning.
@ sql/field.cc
Replace bogus helper with a more appropriate logic which is
used throughout the code.
@ sql/item.cc
Remove bogus logical condition which always evaluates to TRUE.
@ sql/item_create.cc
Simplify code to avoid signedness related warnings.
@ sql/log_event.cc
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
@ sql/log_event_old.cc
Replace bmove_align with memcpy.
@ sql/mysqld.cc
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
@ sql/set_var.cc
Replace bogus helpers with simple and classic bit operations.
@ sql/slave.cc
Cast to expected type and silence bogus warning.
@ sql/sql_class.h
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
@ sql/udf_example.c
Only declare variable when necessary.
@ sql/unireg.h
Replace use of bmove_align with memcpy.
@ storage/innobase/os/os0file.c
Silence bogus warning.
@ storage/myisam/mi_open.c
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
@ storage/myisam/mi_page.c
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
@ strings/bcmp.c
Remove built-in bcmp.
@ strings/ctype-ucs2.c
Silence bogus warning.
@ tests/mysql_client_test.c
Use a appropriate type as expected by simple_command().
removed:
strings/bcmp.c
modified:
BUILD/SETUP.sh
BUILD/check-cpu
client/mysql.cc
client/mysqltest.cc
cmd-line-utils/readline/Makefile.am
cmd-line-utils/readline/input.c
configure.in
extra/comp_err.c
extra/replace.c
extra/yassl/src/crypto_wrapper.cpp
extra/yassl/taocrypt/include/blowfish.hpp
extra/yassl/taocrypt/include/runtime.hpp
extra/yassl/taocrypt/src/aes.cpp
extra/yassl/taocrypt/src/algebra.cpp
extra/yassl/taocrypt/src/blowfish.cpp
extra/yassl/taocrypt/src/integer.cpp
extra/yassl/taocrypt/src/misc.cpp
extra/yassl/taocrypt/src/twofish.cpp
extra/yassl/testsuite/test.hpp
include/m_string.h
include/my_bitmap.h
include/my_global.h
libmysql/Makefile.shared
libmysql/libmysql.c
mysql-test/lib/My/SafeProcess/safe_process.cc
mysys/mf_loadpath.c
mysys/mf_pack.c
mysys/my_bitmap.c
mysys/my_gethwaddr.c
mysys/my_getopt.c
mysys/my_handler.c
mysys/safemalloc.c
mysys/thr_lock.c
regex/regcomp.c
sql/field.cc
sql/item.cc
sql/item_create.cc
sql/log.cc
sql/log_event.cc
sql/log_event_old.cc
sql/mysqld.cc
sql/rpl_rli.cc
sql/set_var.cc
sql/set_var.h
sql/slave.cc
sql/sql_base.cc
sql/sql_class.h
sql/sql_repl.cc
sql/udf_example.c
sql/unireg.h
storage/heap/hp_hash.c
storage/heap/hp_test2.c
storage/innobase/os/os0file.c
storage/myisam/mi_open.c
storage/myisam/mi_page.c
storage/myisam/mi_search.c
storage/myisam/mi_test2.c
storage/myisam/mi_unique.c
storage/myisammrg/ha_myisammrg.cc
strings/CMakeLists.txt
strings/Makefile.am
strings/ctype-ucs2.c
strings/make-ccc
strings/str_test.c
strings/xml.c
tests/mysql_client_test.c
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh 2010-06-03 12:54:37 +0000
+++ b/BUILD/SETUP.sh 2010-07-02 18:06:23 +0000
@@ -90,22 +90,19 @@ SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" != "xpedantic" ]; then
# Both C and C++ warnings
- warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
- warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
- warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
+ warnings="-Wall -Wextra -Wunused -Wwrite-strings"
# For more warnings, uncomment the following line
-# warnings="$global_warnings -Wshadow"
+# warnings="$warnings -Wshadow"
# C warnings
- c_warnings="$warnings -Wunused-parameter"
+ c_warnings="$warnings"
# C++ warnings
- cxx_warnings="$warnings"
+ cxx_warnings="$warnings -Wno-unused-parameter"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
- cxx_warnings="$cxx_warnings -Wreorder"
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
# Added unless --with-debug=full
- debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized"
+ debug_extra_cflags="-O0 -g3 -gdwarf-2"
else
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
c_warnings="$warnings"
=== modified file 'BUILD/check-cpu'
--- a/BUILD/check-cpu 2009-09-01 13:39:13 +0000
+++ b/BUILD/check-cpu 2010-07-02 18:06:23 +0000
@@ -181,14 +181,16 @@ check_cpu () {
cc=$CC
fi
- cc_ver=`$cc --version | sed 1q`
- cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
- set -- `echo $cc_verno | tr '.' ' '`
- cc_major=$1
- cc_minor=$2
- cc_patch=$3
- cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
-
+ # check if compiler is gcc and dump its version
+ cc_verno=`$cc -dumpversion 2>/dev/null`
+ if test "x$?" = "x0" ; then
+ set -- `echo $cc_verno | tr '.' ' '`
+ cc_major=$1
+ cc_minor=$2
+ cc_patch=$3
+ cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
+ fi
+
case "$cc_ver--$cc_verno" in
*GCC*)
# different gcc backends (and versions) have different CPU flags
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2010-06-10 20:16:43 +0000
+++ b/client/mysql.cc 2010-07-02 18:06:23 +0000
@@ -93,7 +93,6 @@ extern "C" {
#endif
#endif
-#undef bcmp // Fix problem with new readline
#if defined(__WIN__)
#include <conio.h>
#elif !defined(__NETWARE__)
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2010-06-10 20:16:43 +0000
+++ b/client/mysqltest.cc 2010-07-02 18:06:23 +0000
@@ -5780,7 +5780,7 @@ int read_command(struct st_command** com
(struct st_command*) my_malloc(sizeof(*command),
MYF(MY_WME|MY_ZEROFILL))) ||
insert_dynamic(&q_lines, (uchar*) &command))
- die(NullS);
+ die("Out of memory");
command->type= Q_UNKNOWN;
read_command_buf[0]= 0;
@@ -6260,7 +6260,7 @@ void init_win_path_patterns()
}
if (insert_dynamic(&patterns, (uchar*) &p))
- die(NullS);
+ die("Out of memory");
DBUG_PRINT("info", ("p: %s", p));
while (*p)
@@ -9331,8 +9331,7 @@ REPLACE *init_replace(char * *from, char
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
- rep_str[i].found= !bcmp((const uchar*) pos,
- (const uchar*) "\\^", 3) ? 2 : 1;
+ rep_str[i].found= !memcmp(pos, "\\^", 3) ? 2 : 1;
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
@@ -9460,8 +9459,8 @@ void copy_bits(REP_SET *to,REP_SET *from
int cmp_bits(REP_SET *set1,REP_SET *set2)
{
- return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
- sizeof(uint) * set1->size_of_bits);
+ return memcmp(set1->bits, set2->bits,
+ sizeof(uint) * set1->size_of_bits);
}
@@ -9530,17 +9529,15 @@ int find_found(FOUND_SET *found_set,uint
uint start_at_word(char * pos)
{
- return (((!bcmp((const uchar*) pos, (const uchar*) "\\b",2) && pos[2]) ||
- !bcmp((const uchar*) pos, (const uchar*) "\\^", 2)) ? 1 : 0);
+ return (((!memcmp(pos, "\\b",2) && pos[2]) ||
+ !memcmp(pos, "\\^", 2)) ? 1 : 0);
}
uint end_of_word(char * pos)
{
char * end=strend(pos);
- return ((end > pos+2 && !bcmp((const uchar*) end-2,
- (const uchar*) "\\b", 2)) ||
- (end >= pos+2 && !bcmp((const uchar*) end-2,
- (const uchar*) "\\$",2))) ? 1 : 0;
+ return ((end > pos+2 && !memcmp(end-2, "\\b", 2)) ||
+ (end >= pos+2 && !memcmp(end-2, "\\$",2))) ? 1 : 0;
}
/****************************************************************************
=== modified file 'cmd-line-utils/readline/Makefile.am'
--- a/cmd-line-utils/readline/Makefile.am 2009-07-08 14:49:45 +0000
+++ b/cmd-line-utils/readline/Makefile.am 2010-07-02 18:06:23 +0000
@@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h k
EXTRA_DIST= emacs_keymap.c vi_keymap.c
-DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR
+DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1
# Don't update the files from bitkeeper
%::SCCS/s.%
=== modified file 'cmd-line-utils/readline/input.c'
--- a/cmd-line-utils/readline/input.c 2009-06-29 13:17:01 +0000
+++ b/cmd-line-utils/readline/input.c 2010-07-02 18:06:23 +0000
@@ -318,7 +318,9 @@ _rl_input_available ()
return (_kbhit ());
#endif
+#if !defined (HAVE_SELECT)
return 0;
+#endif
}
int
=== modified file 'configure.in'
--- a/configure.in 2010-07-02 11:23:07 +0000
+++ b/configure.in 2010-07-02 18:06:23 +0000
@@ -2102,7 +2102,7 @@ MYSQL_TYPE_QSORT
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
+AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \
chsize cuserid fchmod fcntl \
fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
=== modified file 'extra/comp_err.c'
--- a/extra/comp_err.c 2010-06-10 20:16:43 +0000
+++ b/extra/comp_err.c 2010-07-02 18:06:23 +0000
@@ -639,9 +639,9 @@ static struct message *find_message(stru
static ha_checksum checksum_format_specifier(const char* msg)
{
ha_checksum chksum= 0;
- const char* p= msg;
- const char* start= 0;
- int num_format_specifiers= 0;
+ const uchar* p= (const uchar*) msg;
+ const uchar* start= NULL;
+ uint32 num_format_specifiers= 0;
while (*p)
{
=== modified file 'extra/replace.c'
--- a/extra/replace.c 2008-02-18 22:29:39 +0000
+++ b/extra/replace.c 2010-07-02 18:06:23 +0000
@@ -648,7 +648,7 @@ static REPLACE *init_replace(char * *fro
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
- rep_str[i].found= (my_bool) (!bcmp(pos,"\\^",3) ? 2 : 1);
+ rep_str[i].found= (my_bool) (!memcmp(pos,"\\^",3) ? 2 : 1);
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
@@ -776,8 +776,8 @@ static void copy_bits(REP_SET *to,REP_SE
static int cmp_bits(REP_SET *set1,REP_SET *set2)
{
- return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
- sizeof(uint) * set1->size_of_bits);
+ return memcmp(set1->bits, set2->bits,
+ sizeof(uint) * set1->size_of_bits);
}
@@ -849,14 +849,14 @@ static short find_found(FOUND_SET *found
static uint start_at_word(char * pos)
{
- return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0);
+ return (((!memcmp(pos,"\\b",2) && pos[2]) || !memcmp(pos,"\\^",2)) ? 1 : 0);
}
static uint end_of_word(char * pos)
{
char * end=strend(pos);
- return ((end > pos+2 && !bcmp(end-2,"\\b",2)) ||
- (end >= pos+2 && !bcmp(end-2,"\\$",2))) ?
+ return ((end > pos+2 && !memcmp(end-2,"\\b",2)) ||
+ (end >= pos+2 && !memcmp(end-2,"\\$",2))) ?
1 : 0;
}
=== modified file 'extra/yassl/src/crypto_wrapper.cpp'
--- a/extra/yassl/src/crypto_wrapper.cpp 2007-03-23 12:43:09 +0000
+++ b/extra/yassl/src/crypto_wrapper.cpp 2010-07-02 18:06:23 +0000
@@ -953,8 +953,9 @@ x509* PemToDer(FILE* file, CertType type
info->set = true;
}
}
- fgets(line,sizeof(line), file); // get blank line
- begin = ftell(file);
+ // get blank line
+ if (fgets(line, sizeof(line), file))
+ begin = ftell(file);
}
}
=== modified file 'extra/yassl/taocrypt/include/blowfish.hpp'
--- a/extra/yassl/taocrypt/include/blowfish.hpp 2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/include/blowfish.hpp 2010-07-02 18:06:23 +0000
@@ -51,7 +51,7 @@ public:
enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 };
Blowfish(CipherDir DIR, Mode MODE)
- : Mode_BASE(BLOCK_SIZE, DIR, MODE) {}
+ : Mode_BASE(BLOCK_SIZE, DIR, MODE), sbox_(pbox_ + ROUNDS + 2) {}
#ifdef DO_BLOWFISH_ASM
void Process(byte*, const byte*, word32);
@@ -62,8 +62,8 @@ private:
static const word32 p_init_[ROUNDS + 2];
static const word32 s_init_[4 * 256];
- word32 pbox_[ROUNDS + 2];
- word32 sbox_[4 * 256];
+ word32 pbox_[ROUNDS + 2 + 4 * 256];
+ word32* sbox_;
void crypt_block(const word32 in[2], word32 out[2]) const;
void AsmProcess(const byte* in, byte* out) const;
=== modified file 'extra/yassl/taocrypt/include/runtime.hpp'
--- a/extra/yassl/taocrypt/include/runtime.hpp 2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/include/runtime.hpp 2010-07-02 18:06:23 +0000
@@ -35,10 +35,7 @@
// Handler for pure virtual functions
namespace __Crun {
- static void pure_error(void)
- {
- assert("Pure virtual method called." == "Aborted");
- }
+ void pure_error(void);
} // namespace __Crun
#endif // __sun
@@ -54,16 +51,7 @@ extern "C" {
#else
#include "kernelc.hpp"
#endif
-
-/* Disallow inline __cxa_pure_virtual() */
-static int __cxa_pure_virtual() __attribute__((noinline, used));
-static int __cxa_pure_virtual()
-{
- // oops, pure virtual called!
- assert("Pure virtual method called." == "Aborted");
- return 0;
-}
-
+ int __cxa_pure_virtual () __attribute__ ((weak));
} // extern "C"
#endif // __GNUC__ > 2
=== modified file 'extra/yassl/taocrypt/src/aes.cpp'
--- a/extra/yassl/taocrypt/src/aes.cpp 2007-03-23 12:43:09 +0000
+++ b/extra/yassl/taocrypt/src/aes.cpp 2010-07-02 18:06:23 +0000
@@ -51,7 +51,7 @@ void AES::Process(byte* out, const byte*
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
- else if (mode_ == CBC)
+ else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
@@ -78,6 +78,7 @@ void AES::Process(byte* out, const byte*
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
+ }
}
#endif // DO_AES_ASM
=== modified file 'extra/yassl/taocrypt/src/algebra.cpp'
--- a/extra/yassl/taocrypt/src/algebra.cpp 2009-02-13 16:41:47 +0000
+++ b/extra/yassl/taocrypt/src/algebra.cpp 2010-07-02 18:06:23 +0000
@@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMult
struct WindowSlider
{
- WindowSlider(const Integer &exp, bool fastNegate,
+ WindowSlider(const Integer &expIn, bool fastNegateIn,
unsigned int windowSizeIn=0)
- : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn),
- windowBegin(0), fastNegate(fastNegate), firstTime(true),
+ : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn),
+ windowBegin(0), fastNegate(fastNegateIn), firstTime(true),
finished(false)
{
if (windowSize == 0)
=== modified file 'extra/yassl/taocrypt/src/blowfish.cpp'
--- a/extra/yassl/taocrypt/src/blowfish.cpp 2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/src/blowfish.cpp 2010-07-02 18:06:23 +0000
@@ -53,7 +53,7 @@ void Blowfish::Process(byte* out, const
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
- else if (mode_ == CBC)
+ else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
@@ -78,6 +78,7 @@ void Blowfish::Process(byte* out, const
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
+ }
}
#endif // DO_BLOWFISH_ASM
=== modified file 'extra/yassl/taocrypt/src/integer.cpp'
--- a/extra/yassl/taocrypt/src/integer.cpp 2007-03-23 16:15:44 +0000
+++ b/extra/yassl/taocrypt/src/integer.cpp 2010-07-02 18:06:23 +0000
@@ -283,21 +283,23 @@ DWord() {}
word GetHighHalfAsBorrow() const {return 0-halfs_.high;}
private:
+ struct dword_struct
+ {
+ #ifdef LITTLE_ENDIAN_ORDER
+ word low;
+ word high;
+ #else
+ word high;
+ word low;
+ #endif
+ };
+
union
{
#ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE
dword whole_;
#endif
- struct
- {
- #ifdef LITTLE_ENDIAN_ORDER
- word low;
- word high;
- #else
- word high;
- word low;
- #endif
- } halfs_;
+ struct dword_struct halfs_;
};
};
@@ -1214,20 +1216,24 @@ public:
#define AS1(x) #x ";"
#define AS2(x, y) #x ", " #y ";"
#define AddPrologue \
+ word res; \
__asm__ __volatile__ \
( \
"push %%ebx;" /* save this manually, in case of -fPIC */ \
- "mov %2, %%ebx;" \
+ "mov %3, %%ebx;" \
".intel_syntax noprefix;" \
"push ebp;"
#define AddEpilogue \
"pop ebp;" \
".att_syntax prefix;" \
"pop %%ebx;" \
- : \
+ "mov %%eax, %0;" \
+ : "=g" (res) \
: "c" (C), "d" (A), "m" (B), "S" (N) \
: "%edi", "memory", "cc" \
- );
+ ); \
+ return res;
+
#define MulPrologue \
__asm__ __volatile__ \
( \
=== modified file 'extra/yassl/taocrypt/src/misc.cpp'
--- a/extra/yassl/taocrypt/src/misc.cpp 2007-04-11 20:07:24 +0000
+++ b/extra/yassl/taocrypt/src/misc.cpp 2010-07-02 18:06:23 +0000
@@ -84,12 +84,23 @@ namespace STL = STL_NAMESPACE;
}
-#if defined(__ICC) || defined(__INTEL_COMPILER)
+#ifdef __sun
+
+// Handler for pure virtual functions
+namespace __Crun {
+ void pure_error() {
+ assert(!"Aborted: pure virtual method called.");
+ }
+}
+
+#endif
+
+#if defined(__ICC) || defined(__INTEL_COMPILER) || (__GNUC__ > 2)
extern "C" {
int __cxa_pure_virtual() {
- assert("Pure virtual method called." == "Aborted");
+ assert(!"Aborted: pure virtual method called.");
return 0;
}
@@ -166,14 +177,6 @@ word Crop(word value, unsigned int size)
#ifdef TAOCRYPT_X86ASM_AVAILABLE
-#ifndef _MSC_VER
- static jmp_buf s_env;
- static void SigIllHandler(int)
- {
- longjmp(s_env, 1);
- }
-#endif
-
bool HaveCpuId()
{
=== modified file 'extra/yassl/taocrypt/src/twofish.cpp'
--- a/extra/yassl/taocrypt/src/twofish.cpp 2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/src/twofish.cpp 2010-07-02 18:06:23 +0000
@@ -54,7 +54,7 @@ void Twofish::Process(byte* out, const b
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
- else if (mode_ == CBC)
+ else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
@@ -82,6 +82,7 @@ void Twofish::Process(byte* out, const b
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
+ }
}
#endif // DO_TWOFISH_ASM
=== modified file 'extra/yassl/testsuite/test.hpp'
--- a/extra/yassl/testsuite/test.hpp 2007-01-22 11:34:39 +0000
+++ b/extra/yassl/testsuite/test.hpp 2010-07-02 18:06:23 +0000
@@ -160,6 +160,11 @@ inline void err_sys(const char* msg)
}
+extern "C" {
+ static int PasswordCallBack(char*, int, int, void*);
+}
+
+
static int PasswordCallBack(char* passwd, int sz, int rw, void* userdata)
{
strncpy(passwd, "12345678", sz);
=== modified file 'include/m_string.h'
--- a/include/m_string.h 2010-05-20 10:40:42 +0000
+++ b/include/m_string.h 2010-07-02 18:06:23 +0000
@@ -33,10 +33,6 @@
/* need by my_vsnprintf */
#include <stdarg.h>
-#ifdef _AIX
-#undef HAVE_BCMP
-#endif
-
/* This is needed for the definitions of bzero... on solaris */
#if defined(HAVE_STRINGS_H)
#include <strings.h>
@@ -60,14 +56,6 @@
/* Unixware 7 */
#if !defined(HAVE_BFILL)
# define bfill(A,B,C) memset((A),(C),(B))
-# define bmove_align(A,B,C) memcpy((A),(B),(C))
-#endif
-
-#if !defined(HAVE_BCMP)
-# define bcopy(s, d, n) memcpy((d), (s), (n))
-# define bcmp(A,B,C) memcmp((A),(B),(C))
-# define bzero(A,B) memset((A),0,(B))
-# define bmove_align(A,B,C) memcpy((A),(B),(C))
#endif
#if defined(__cplusplus)
@@ -120,15 +108,6 @@ extern void bfill(uchar *dst,size_t len,
extern void bzero(uchar * dst,size_t len);
#endif
-#if !defined(bcmp) && !defined(HAVE_BCMP)
-extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
-#endif
-#ifdef HAVE_purify
-extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
-#undef bcmp
-#define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#endif /* HAVE_purify */
-
#ifndef bmove512
extern void bmove512(uchar *dst,const uchar *src,size_t len);
#endif
=== modified file 'include/my_bitmap.h'
--- a/include/my_bitmap.h 2007-12-12 10:14:59 +0000
+++ b/include/my_bitmap.h 2010-07-02 18:06:23 +0000
@@ -159,22 +159,6 @@ static inline my_bool bitmap_cmp(const M
#define bitmap_set_all(MAP) \
(memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
-/**
- check, set and clear a bit of interest of an integer.
-
- If the bit is out of range @retval -1. Otherwise
- bit_is_set @return 0 or 1 reflecting the bit is set or not;
- bit_do_set @return 1 (bit is set 1)
- bit_do_clear @return 0 (bit is cleared to 0)
-*/
-
-#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1)
-#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- ((I) |= (ULL(1) << (B)), 1) : -1)
-#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
- ((I) &= ~(ULL(1) << (B)), 0) : -1)
-
#ifdef __cplusplus
}
#endif
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2010-07-01 08:02:00 +0000
+++ b/include/my_global.h 2010-07-02 18:06:23 +0000
@@ -556,22 +556,30 @@ int __void__;
#endif
#endif /* DONT_DEFINE_VOID */
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
-#define LINT_INIT(var) var=0 /* No uninitialize-warning */
+/*
+ Deprecated workaround for false-positive uninitialized variables
+ warnings. Those should be silenced using tool-specific heuristics.
+
+ Enabled by default for g++ due to the bug referenced below.
+*/
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+ (defined(__GNUC__) && defined(__cplusplus))
+#define LINT_INIT(var) var= 0
#else
#define LINT_INIT(var)
#endif
-/*
+/*
Suppress uninitialized variable warning without generating code.
The _cplusplus is a temporary workaround for C++ code pending a fix
- for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
+ for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
*/
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
- !defined(__GNUC__)
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+ defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else
+/* GCC specific self-initialization which inhibits the warning. */
#define UNINIT_VAR(x) x= x
#endif
@@ -595,7 +603,6 @@ typedef unsigned short ushort;
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
#define test_all_bits(a,b) (((a) & (b)) == (b))
-#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
/* Define some general constants */
=== modified file 'libmysql/Makefile.shared'
--- a/libmysql/Makefile.shared 2009-07-31 19:28:15 +0000
+++ b/libmysql/Makefile.shared 2010-07-02 18:06:23 +0000
@@ -38,7 +38,7 @@ mystringsobjects = strmov.lo strxmov.lo
strmake.lo strend.lo strtod.lo \
strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.lo \
- strcend.lo bcmp.lo ctype-latin1.lo \
+ strcend.lo ctype-latin1.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c 2010-07-01 08:10:35 +0000
+++ b/libmysql/libmysql.c 2010-07-02 18:06:23 +0000
@@ -4425,7 +4425,6 @@ static my_bool setup_one_fetch_function(
field->max_length= 10; /* 2003-11-11 */
param->skip_result= skip_result_with_length;
break;
- break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->skip_result= skip_result_with_length;
=== modified file 'mysql-test/lib/My/SafeProcess/safe_process.cc'
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc 2009-07-08 12:31:22 +0000
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc 2010-07-02 18:06:23 +0000
@@ -159,7 +159,7 @@ int main(int argc, char* const argv[] )
signal(SIGCHLD, handle_signal);
signal(SIGABRT, handle_abort);
- sprintf(safe_process_name, "safe_process[%d]", own_pid);
+ sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);
message("Started");
=== modified file 'mysys/mf_loadpath.c'
--- a/mysys/mf_loadpath.c 2010-05-05 08:54:52 +0000
+++ b/mysys/mf_loadpath.c 2010-07-02 18:06:23 +0000
@@ -42,7 +42,7 @@ char * my_load_path(char * to, const cha
if (is_cur)
is_cur=2; /* Remove current dir */
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
- VOID(strncat(buff, path+is_cur, FN_REFLEN));
+ VOID(strncat(buff, path+is_cur, FN_REFLEN-1));
else
VOID(strnmov(buff, path, FN_REFLEN)); /* Return org file name */
}
=== modified file 'mysys/mf_pack.c'
--- a/mysys/mf_pack.c 2010-03-30 12:10:25 +0000
+++ b/mysys/mf_pack.c 2010-07-02 18:06:23 +0000
@@ -52,7 +52,7 @@ void pack_dirname(char * to, const char
buff_length= strlen(buff);
d_length= (size_t) (start-to);
if ((start == to ||
- (buff_length == d_length && !bcmp(buff,start,d_length))) &&
+ (buff_length == d_length && !memcmp(buff,start,d_length))) &&
*start != FN_LIBCHAR && *start)
{ /* Put current dir before */
bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1);
@@ -70,7 +70,7 @@ void pack_dirname(char * to, const char
}
if (length > 1 && length < d_length)
{ /* test if /xx/yy -> ~/yy */
- if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
+ if (memcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
{
to[0]=FN_HOMELIB; /* Filename begins with ~ */
(void) strmov_overlapp(to+1,to+length);
@@ -80,7 +80,7 @@ void pack_dirname(char * to, const char
{ /* Test if cwd is ~/... */
if (length > 1 && length < buff_length)
{
- if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
+ if (memcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
{
buff[0]=FN_HOMELIB;
(void) strmov_overlapp(buff+1,buff+length);
@@ -166,7 +166,7 @@ size_t cleanup_dirname(register char *to
*pos = FN_LIBCHAR;
if (*pos == FN_LIBCHAR)
{
- if ((size_t) (pos-start) > length && bcmp(pos-length,parent,length) == 0)
+ if ((size_t) (pos-start) > length && memcmp(pos-length,parent,length) == 0)
{ /* If .../../; skip prev */
pos-=length;
if (pos != start)
@@ -197,7 +197,7 @@ size_t cleanup_dirname(register char *to
end_parentdir=pos;
while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */
pos--;
- if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0)
+ if (pos[1] == FN_HOMELIB || memcmp(pos,parent,length) == 0)
{ /* Don't remove ~user/ */
pos=strmov(end_parentdir+1,parent);
*pos=FN_LIBCHAR;
@@ -206,7 +206,7 @@ size_t cleanup_dirname(register char *to
}
}
else if ((size_t) (pos-start) == length-1 &&
- !bcmp(start,parent+1,length-1))
+ !memcmp(start,parent+1,length-1))
start=pos; /* Starts with "../" */
else if (pos-start > 0 && pos[-1] == FN_LIBCHAR)
{
=== modified file 'mysys/my_bitmap.c'
--- a/mysys/my_bitmap.c 2007-10-11 15:07:40 +0000
+++ b/mysys/my_bitmap.c 2010-07-02 18:06:23 +0000
@@ -508,10 +508,8 @@ uint bitmap_get_first_set(const MY_BITMA
if (*byte_ptr & (1 << k))
return (i*32) + (j*8) + k;
}
- DBUG_ASSERT(0);
}
}
- DBUG_ASSERT(0);
}
}
return MY_BIT_NONE;
@@ -534,7 +532,7 @@ uint bitmap_get_first(const MY_BITMAP *m
{
byte_ptr= (uchar*)data_ptr;
for (j=0; ; j++, byte_ptr++)
- {
+ {
if (*byte_ptr != 0xFF)
{
for (k=0; ; k++)
@@ -542,10 +540,8 @@ uint bitmap_get_first(const MY_BITMAP *m
if (!(*byte_ptr & (1 << k)))
return (i*32) + (j*8) + k;
}
- DBUG_ASSERT(0);
}
}
- DBUG_ASSERT(0);
}
}
return MY_BIT_NONE;
=== modified file 'mysys/my_gethwaddr.c'
--- a/mysys/my_gethwaddr.c 2007-08-09 12:56:57 +0000
+++ b/mysys/my_gethwaddr.c 2010-07-02 18:06:23 +0000
@@ -47,7 +47,7 @@ my_bool my_gethwaddr(uchar *to)
uchar *buf, *next, *end, *addr;
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;
- int i, res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
+ int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
goto err;
=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c 2010-06-10 20:16:43 +0000
+++ b/mysys/my_getopt.c 2010-07-02 18:06:23 +0000
@@ -30,7 +30,7 @@ my_error_reporter my_getopt_error_report
static int findopt(char *optpat, uint length,
const struct my_option **opt_res,
- char **ffname);
+ const char **ffname);
my_bool getopt_compare_strings(const char *s,
const char *t,
uint length);
@@ -115,8 +115,8 @@ int handle_options(int *argc, char ***ar
uint opt_found, argvpos= 0, length;
my_bool end_of_options= 0, must_be_var, set_maximum_value,
option_is_loose;
- char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found),
- *opt_str, key_name[FN_REFLEN];
+ char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN];
+ const char *UNINIT_VAR(prev_found);
const struct my_option *optp;
void *value;
int error, i;
@@ -225,7 +225,6 @@ int handle_options(int *argc, char ***ar
Find first the right option. Return error in case of an ambiguous,
or unknown option
*/
- LINT_INIT(prev_found);
optp= longopts;
if (!(opt_found= findopt(opt_str, length, &optp, &prev_found)))
{
@@ -709,10 +708,10 @@ static int setval(const struct my_option
static int findopt(char *optpat, uint length,
const struct my_option **opt_res,
- char **ffname)
+ const char **ffname)
{
uint count;
- struct my_option *opt= (struct my_option *) *opt_res;
+ const struct my_option *opt= *opt_res;
for (count= 0; opt->name; opt++)
{
@@ -723,8 +722,9 @@ static int findopt(char *optpat, uint le
return 1;
if (!count)
{
+ /* We only need to know one prev */
count= 1;
- *ffname= (char *) opt->name; /* We only need to know one prev */
+ *ffname= opt->name;
}
else if (strcmp(*ffname, opt->name))
{
=== modified file 'mysys/my_handler.c'
--- a/mysys/my_handler.c 2008-03-28 16:45:03 +0000
+++ b/mysys/my_handler.c 2010-07-02 18:06:23 +0000
@@ -269,7 +269,6 @@ int ha_key_cmp(register HA_KEYSEG *keyse
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a+=a_length;
b+=b_length;
- break;
}
break;
case HA_KEYTYPE_INT8:
=== modified file 'mysys/safemalloc.c'
--- a/mysys/safemalloc.c 2010-06-11 12:52:06 +0000
+++ b/mysys/safemalloc.c 2010-07-02 18:06:23 +0000
@@ -163,7 +163,7 @@ void *_mymalloc(size_t size, const char
my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
}
DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
- sf_malloc_max_memory,lineno, filename));
+ (ulong) sf_malloc_max_memory, lineno, filename));
DBUG_EXECUTE_IF("simulate_out_of_memory",
DBUG_SET("-d,simulate_out_of_memory"););
if (MyFlags & MY_FAE)
=== modified file 'mysys/thr_lock.c'
--- a/mysys/thr_lock.c 2009-09-29 15:38:40 +0000
+++ b/mysys/thr_lock.c 2010-07-02 18:06:23 +0000
@@ -125,8 +125,7 @@ static int check_lock(struct st_lock_lis
{
THR_LOCK_DATA *data,**prev;
uint count=0;
- THR_LOCK_OWNER *first_owner;
- LINT_INIT(first_owner);
+ THR_LOCK_OWNER *UNINIT_VAR(first_owner);
prev= &list->data;
if (list->data)
=== modified file 'regex/regcomp.c'
--- a/regex/regcomp.c 2009-08-28 16:21:54 +0000
+++ b/regex/regcomp.c 2010-07-02 18:06:23 +0000
@@ -690,7 +690,6 @@ register cset *cs;
case '-':
SETERROR(REG_ERANGE);
return; /* NOTE RETURN */
- break;
default:
c = '\0';
break;
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2010-05-31 09:25:11 +0000
+++ b/sql/field.cc 2010-07-02 18:06:23 +0000
@@ -8691,7 +8691,13 @@ int Field_set::store(longlong nr, bool u
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
int error= 0;
- ulonglong max_nr= set_bits(ulonglong, typelib->count);
+ ulonglong max_nr;
+
+ if (sizeof(ulonglong)*8 <= typelib->count)
+ max_nr= ULONGLONG_MAX;
+ else
+ max_nr= (ULL(1) << typelib->count) - 1;
+
if ((ulonglong) nr > max_nr)
{
nr&= max_nr;
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2010-06-10 20:45:22 +0000
+++ b/sql/item.cc 2010-07-02 18:06:23 +0000
@@ -4130,8 +4130,7 @@ Item_field::fix_outer_field(THD *thd, Fi
context->first_name_resolution_table,
context->last_name_resolution_table,
reference, REPORT_ALL_ERRORS,
- !any_privileges &&
- TRUE, TRUE);
+ !any_privileges, TRUE);
}
return -1;
}
=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc 2010-03-14 16:01:45 +0000
+++ b/sql/item_create.cc 2010-07-02 18:06:23 +0000
@@ -5051,8 +5051,6 @@ create_func_cast(THD *thd, Item *a, Cast
CHARSET_INFO *cs)
{
Item *UNINIT_VAR(res);
- ulong len;
- uint dec;
switch (cast_type) {
case ITEM_CAST_BINARY:
@@ -5075,11 +5073,10 @@ create_func_cast(THD *thd, Item *a, Cast
break;
case ITEM_CAST_DECIMAL:
{
- if (c_len == NULL)
- {
- len= 0;
- }
- else
+ ulong len= 0;
+ uint dec= 0;
+
+ if (c_len)
{
ulong decoded_size;
errno= 0;
@@ -5093,11 +5090,7 @@ create_func_cast(THD *thd, Item *a, Cast
len= decoded_size;
}
- if (c_dec == NULL)
- {
- dec= 0;
- }
- else
+ if (c_dec)
{
ulong decoded_size;
errno= 0;
@@ -5133,12 +5126,9 @@ create_func_cast(THD *thd, Item *a, Cast
}
case ITEM_CAST_CHAR:
{
+ int len= -1;
CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection);
- if (c_len == NULL)
- {
- len= LL(-1);
- }
- else
+ if (c_len)
{
ulong decoded_size;
errno= 0;
@@ -5148,7 +5138,7 @@ create_func_cast(THD *thd, Item *a, Cast
my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH);
return NULL;
}
- len= decoded_size;
+ len= (int) decoded_size;
}
res= new (thd->mem_root) Item_char_typecast(a, len, real_cs);
break;
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2010-06-17 00:25:07 +0000
+++ b/sql/log.cc 2010-07-02 18:06:23 +0000
@@ -1862,7 +1862,7 @@ static int find_uniq_filename(char *name
file_info= dir_info->dir_entry;
for (i=dir_info->number_off_files ; i-- ; file_info++)
{
- if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 &&
+ if (memcmp(file_info->name, start, length) == 0 &&
test_if_number(file_info->name+length, &number,0))
{
set_if_bigger(max_found,(ulong) number);
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2010-06-28 20:59:41 +0000
+++ b/sql/log_event.cc 2010-07-02 18:06:23 +0000
@@ -2905,7 +2905,7 @@ void Query_log_event::print_query_header
if (likely(charset_inited) &&
(unlikely(!print_event_info->charset_inited ||
- bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6))))
+ memcmp(print_event_info->charset, charset, 6))))
{
CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
if (cs_info)
@@ -2928,8 +2928,8 @@ void Query_log_event::print_query_header
}
if (time_zone_len)
{
- if (bcmp((uchar*) print_event_info->time_zone_str,
- (uchar*) time_zone_str, time_zone_len+1))
+ if (memcmp(print_event_info->time_zone_str,
+ time_zone_str, time_zone_len+1))
{
my_b_printf(file,"SET @@session.time_zone='%s'%s\n",
time_zone_str, print_event_info->delimiter);
@@ -7503,8 +7503,7 @@ int Rows_log_event::do_apply_event(Relay
{
int actual_error= convert_handler_error(error, thd, table);
bool idempotent_error= (idempotent_error_code(error) &&
- ((bit_is_set(slave_exec_mode,
- SLAVE_EXEC_MODE_IDEMPOTENT)) == 1));
+ (slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT));
bool ignored_error= (idempotent_error == 0 ?
ignored_error_code(actual_error) : 0);
@@ -8332,7 +8331,7 @@ Write_rows_log_event::do_before_row_oper
todo: to introduce a property for the event (handler?) which forces
applying the event in the replace (idempotent) fashion.
*/
- if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 ||
+ if ((slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT) ||
m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER)
{
/*
@@ -8411,7 +8410,7 @@ Write_rows_log_event::do_after_row_opera
int local_error= 0;
m_table->next_number_field=0;
m_table->auto_increment_field_not_null= FALSE;
- if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 ||
+ if ((slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT) ||
m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER)
{
m_table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
@@ -8514,7 +8513,7 @@ Rows_log_event::write_row(const Relay_lo
TABLE *table= m_table; // pointer to event's table
int error;
- int keynum;
+ int UNINIT_VAR(keynum);
auto_afree_ptr<char> key(NULL);
/* fill table->record[0] with default values */
@@ -8712,10 +8711,8 @@ int
Write_rows_log_event::do_exec_row(const Relay_log_info *const rli)
{
DBUG_ASSERT(m_table != NULL);
- int error=
- write_row(rli, /* if 1 then overwrite */
- bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1);
-
+ int error= write_row(rli, (slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT));
+
if (error && !thd->is_error())
{
DBUG_ASSERT(0);
=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc 2010-06-17 00:25:07 +0000
+++ b/sql/log_event_old.cc 2010-07-02 18:06:23 +0000
@@ -441,7 +441,7 @@ copy_extra_record_fields(TABLE *table,
DBUG_ASSERT(master_reclength <= table->s->reclength);
if (master_reclength < table->s->reclength)
- bmove_align(table->record[0] + master_reclength,
+ memcpy(table->record[0] + master_reclength,
table->record[1] + master_reclength,
table->s->reclength - master_reclength);
@@ -720,7 +720,7 @@ static int find_and_fetch_row(TABLE *tab
rnd_pos() returns the record in table->record[0], so we have to
move it to table->record[1].
*/
- bmove_align(table->record[1], table->record[0], table->s->reclength);
+ memcpy(table->record[1], table->record[0], table->s->reclength);
DBUG_RETURN(error);
}
@@ -1213,7 +1213,7 @@ int Update_rows_log_event_old::do_exec_r
overwriting the default values that where put there by the
unpack_row() function.
*/
- bmove_align(table->record[0], m_after_image, table->s->reclength);
+ memcpy(table->record[0], m_after_image, table->s->reclength);
copy_extra_record_fields(table, m_master_reclength, m_width);
/*
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-07-01 08:10:35 +0000
+++ b/sql/mysqld.cc 2010-07-02 18:06:23 +0000
@@ -559,7 +559,7 @@ ulong query_buff_size, slow_launch_time,
ulong open_files_limit, max_binlog_size, max_relay_log_size;
ulong slave_net_timeout, slave_trans_retries;
ulong slave_exec_mode_options;
-const char *slave_exec_mode_str= "STRICT";
+static const char *slave_exec_mode_str= "STRICT";
ulong thread_cache_size=0, thread_pool_size= 0;
ulong binlog_cache_size=0;
ulonglong max_binlog_cache_size=0;
@@ -2464,7 +2464,6 @@ extern "C" sig_handler handle_segfault(i
{
time_t curr_time;
struct tm tm;
- THD *thd=current_thd;
/*
Strictly speaking, one needs a mutex here
@@ -2523,13 +2522,15 @@ the thread stack. Please read http://dev
#endif /* HAVE_LINUXTHREADS */
#ifdef HAVE_STACKTRACE
+ THD *thd=current_thd;
+
if (!(test_flags & TEST_NO_STACKTRACE))
{
- fprintf(stderr,"thd: 0x%lx\n",(long) thd);
- fprintf(stderr,"\
-Attempting backtrace. You can use the following information to find out\n\
-where mysqld died. If you see no messages after this, something went\n\
-terribly wrong...\n");
+ fprintf(stderr, "thd: 0x%lx\n",(long) thd);
+ fprintf(stderr, "Attempting backtrace. You can use the following "
+ "information to find out\nwhere mysqld died. If "
+ "you see no messages after this, something went\n"
+ "terribly wrong...\n");
my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL,
my_thread_stack_size);
}
@@ -7879,10 +7880,11 @@ static int mysql_init_variables(void)
/* Things with default values that are not zero */
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
- slave_exec_mode_options= 0;
- slave_exec_mode_options= (uint)
- find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL,
- &error);
+ slave_exec_mode_options= find_bit_type_or_exit(slave_exec_mode_str,
+ &slave_exec_mode_typelib,
+ NULL, &error);
+ /* Default mode string must not yield a error. */
+ DBUG_ASSERT(!error);
if (error)
return 1;
opt_specialflag= SPECIAL_ENGLISH;
@@ -8118,8 +8120,9 @@ mysqld_get_one_option(int optid,
init_slave_skip_errors(argument);
break;
case OPT_SLAVE_EXEC_MODE:
- slave_exec_mode_options= (uint)
- find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "", &error);
+ slave_exec_mode_options= find_bit_type_or_exit(argument,
+ &slave_exec_mode_typelib,
+ "", &error);
if (error)
return 1;
break;
@@ -8773,7 +8776,7 @@ static int get_options(int *argc,char **
/* Set global MyISAM variables from delay_key_write_options */
fix_delay_key_write((THD*) 0, OPT_GLOBAL);
/* Set global slave_exec_mode from its option */
- fix_slave_exec_mode(OPT_GLOBAL);
+ fix_slave_exec_mode();
#ifndef EMBEDDED_LIBRARY
if (mysqld_chroot)
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2010-05-24 16:43:27 +0000
+++ b/sql/rpl_rli.cc 2010-07-02 18:06:23 +0000
@@ -1120,8 +1120,7 @@ bool Relay_log_info::cached_charset_comp
{
DBUG_ENTER("Relay_log_info::cached_charset_compare");
- if (bcmp((uchar*) cached_charset, (uchar*) charset,
- sizeof(cached_charset)))
+ if (memcmp(cached_charset, charset, sizeof(cached_charset)))
{
memcpy(const_cast<char*>(cached_charset), charset, sizeof(cached_charset));
DBUG_RETURN(1);
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2010-06-04 14:10:22 +0000
+++ b/sql/set_var.cc 2010-07-02 18:06:23 +0000
@@ -92,14 +92,13 @@ TYPELIB delay_key_write_typelib=
delay_key_write_type_names, NULL
};
-const char *slave_exec_mode_names[]=
-{ "STRICT", "IDEMPOTENT", NullS };
-static const unsigned int slave_exec_mode_names_len[]=
-{ sizeof("STRICT") - 1, sizeof("IDEMPOTENT") - 1, 0 };
+static const char *slave_exec_mode_names[]= { "STRICT", "IDEMPOTENT", NullS };
+static unsigned int slave_exec_mode_names_len[]= { sizeof("STRICT") - 1,
+ sizeof("IDEMPOTENT") - 1, 0 };
TYPELIB slave_exec_mode_typelib=
{
array_elements(slave_exec_mode_names)-1, "",
- slave_exec_mode_names, (unsigned int *) slave_exec_mode_names_len
+ slave_exec_mode_names, slave_exec_mode_names_len
};
static int sys_check_ftb_syntax(THD *thd, set_var *var);
@@ -1215,16 +1214,14 @@ uchar *sys_var_set::value_ptr(THD *thd,
void sys_var_set_slave_mode::set_default(THD *thd, enum_var_type type)
{
- slave_exec_mode_options= 0;
- bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT);
+ slave_exec_mode_options= SLAVE_EXEC_MODE_STRICT;
}
bool sys_var_set_slave_mode::check(THD *thd, set_var *var)
{
bool rc= sys_var_set::check(thd, var);
- if (!rc &&
- bit_is_set(var->save_result.ulong_value, SLAVE_EXEC_MODE_STRICT) == 1 &&
- bit_is_set(var->save_result.ulong_value, SLAVE_EXEC_MODE_IDEMPOTENT) == 1)
+ if (!rc && (var->save_result.ulong_value & SLAVE_EXEC_MODE_STRICT) &&
+ (var->save_result.ulong_value & SLAVE_EXEC_MODE_IDEMPOTENT))
{
rc= true;
my_error(ER_SLAVE_AMBIGOUS_EXEC_MODE, MYF(0), "");
@@ -1241,20 +1238,18 @@ bool sys_var_set_slave_mode::update(THD
return rc;
}
-void fix_slave_exec_mode(enum_var_type type)
+void fix_slave_exec_mode(void)
{
DBUG_ENTER("fix_slave_exec_mode");
- compile_time_assert(sizeof(slave_exec_mode_options) * CHAR_BIT
- > SLAVE_EXEC_MODE_LAST_BIT - 1);
- if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT) == 1 &&
- bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 1)
+
+ if ((slave_exec_mode_options & SLAVE_EXEC_MODE_STRICT) &&
+ (slave_exec_mode_options & SLAVE_EXEC_MODE_IDEMPOTENT))
{
- sql_print_error("Ambiguous slave modes combination."
- " STRICT will be used");
- bit_do_clear(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT);
+ sql_print_error("Ambiguous slave modes combination. STRICT will be used");
+ slave_exec_mode_options&= ~SLAVE_EXEC_MODE_IDEMPOTENT;
}
- if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 0)
- bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT);
+ if (!(slave_exec_mode_options & SLAVE_EXEC_MODE_IDEMPOTENT))
+ slave_exec_mode_options|= SLAVE_EXEC_MODE_STRICT;
DBUG_VOID_RETURN;
}
=== modified file 'sql/set_var.h'
--- a/sql/set_var.h 2010-06-04 14:10:22 +0000
+++ b/sql/set_var.h 2010-07-02 18:06:23 +0000
@@ -1446,7 +1446,7 @@ sys_var *find_sys_var(THD *thd, const ch
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
bool not_all_support_one_shot(List<set_var_base> *var_list);
void fix_delay_key_write(THD *thd, enum_var_type type);
-void fix_slave_exec_mode(enum_var_type type);
+void fix_slave_exec_mode(void);
ulong fix_sql_mode(ulong sql_mode);
extern sys_var_const_str sys_charset_system;
extern sys_var_str sys_init_connect;
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2010-05-24 16:43:27 +0000
+++ b/sql/slave.cc 2010-07-02 18:06:23 +0000
@@ -2113,7 +2113,7 @@ int apply_event_and_update_pos(Log_event
DBUG_PRINT("info", ("thd->options: %s%s; rli->last_event_start_time: %lu",
FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT),
FLAGSTR(thd->options, OPTION_BEGIN),
- rli->last_event_start_time));
+ (ulong) rli->last_event_start_time));
/*
Execute the event to change the database and update the binary
@@ -2885,8 +2885,8 @@ pthread_handler_t handle_slave_sql(void
char llbuff[22],llbuff1[22];
char saved_log_name[FN_REFLEN];
char saved_master_log_name[FN_REFLEN];
- my_off_t saved_log_pos;
- my_off_t saved_master_log_pos;
+ my_off_t UNINIT_VAR(saved_log_pos);
+ my_off_t UNINIT_VAR(saved_master_log_pos);
my_off_t saved_skip= 0;
Relay_log_info* rli = &((Master_info*)arg)->rli;
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2010-05-27 20:07:40 +0000
+++ b/sql/sql_base.cc 2010-07-02 18:06:23 +0000
@@ -8403,15 +8403,15 @@ my_bool mysql_rm_tmp_tables(void)
(file->name[1] == '.' && !file->name[2])))
continue;
- if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix,
- tmp_file_prefix_length))
+ if (!memcmp(file->name, tmp_file_prefix,
+ tmp_file_prefix_length))
{
char *ext= fn_ext(file->name);
uint ext_len= strlen(ext);
uint filePath_len= my_snprintf(filePath, sizeof(filePath),
"%s%c%s", tmpdir, FN_LIBCHAR,
file->name);
- if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len))
+ if (!memcmp(reg_ext, ext, ext_len))
{
handler *handler_file= 0;
/* We should cut file extention before deleting of table */
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2010-06-28 20:59:41 +0000
+++ b/sql/sql_class.h 2010-07-02 18:06:23 +0000
@@ -83,9 +83,10 @@ enum enum_ha_read_modes { RFIRST, RNEXT,
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
DELAY_KEY_WRITE_ALL };
-enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
- SLAVE_EXEC_MODE_IDEMPOTENT,
- SLAVE_EXEC_MODE_LAST_BIT};
+
+#define SLAVE_EXEC_MODE_STRICT (1U << 0)
+#define SLAVE_EXEC_MODE_IDEMPOTENT (1U << 1)
+
enum enum_mark_columns
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
@@ -2418,7 +2419,7 @@ class select_result :public Sql_alloc {
protected:
THD *thd;
SELECT_LEX_UNIT *unit;
- uint nest_level;
+ int nest_level;
public:
select_result();
virtual ~select_result() {};
@@ -2559,7 +2560,7 @@ public:
Creates a select_export to represent INTO OUTFILE <filename> with a
defined level of subquery nesting.
*/
- select_export(sql_exchange *ex, uint nest_level_arg) :select_to_file(ex)
+ select_export(sql_exchange *ex, int nest_level_arg) :select_to_file(ex)
{
nest_level= nest_level_arg;
}
@@ -2576,7 +2577,7 @@ public:
Creates a select_export to represent INTO DUMPFILE <filename> with a
defined level of subquery nesting.
*/
- select_dump(sql_exchange *ex, uint nest_level_arg) :
+ select_dump(sql_exchange *ex, int nest_level_arg) :
select_to_file(ex)
{
nest_level= nest_level_arg;
@@ -3046,7 +3047,7 @@ public:
Creates a select_dumpvar to represent INTO <variable> with a defined
level of subquery nesting.
*/
- select_dumpvar(uint nest_level_arg)
+ select_dumpvar(int nest_level_arg)
{
var_list.empty();
row_count= 0;
=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc 2010-05-24 16:43:27 +0000
+++ b/sql/sql_repl.cc 2010-07-02 18:06:23 +0000
@@ -218,8 +218,7 @@ bool log_in_use(const char* log_name)
if ((linfo = tmp->current_linfo))
{
pthread_mutex_lock(&linfo->lock);
- result = !bcmp((uchar*) log_name, (uchar*) linfo->log_file_name,
- log_name_len);
+ result = !memcmp(log_name, linfo->log_file_name, log_name_len);
pthread_mutex_unlock(&linfo->lock);
if (result)
break;
=== modified file 'sql/udf_example.c'
--- a/sql/udf_example.c 2009-09-17 15:25:52 +0000
+++ b/sql/udf_example.c 2010-07-02 18:06:23 +0000
@@ -141,7 +141,9 @@ typedef long long longlong;
#ifdef HAVE_DLOPEN
+#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
static pthread_mutex_t LOCK_hostname;
+#endif
/* These must be right or mysqld will not find the symbol! */
=== modified file 'sql/unireg.h'
--- a/sql/unireg.h 2009-07-31 19:28:15 +0000
+++ b/sql/unireg.h 2010-07-02 18:06:23 +0000
@@ -129,8 +129,8 @@
#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */
/* Extern defines */
-#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
-#define restore_record(A,B) bmove_align((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
+#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
+#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
#define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
#define empty_record(A) { \
restore_record((A),s->default_values); \
=== modified file 'storage/heap/hp_hash.c'
--- a/storage/heap/hp_hash.c 2007-10-15 04:41:30 +0000
+++ b/storage/heap/hp_hash.c 2010-07-02 18:06:23 +0000
@@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, co
}
else
{
- if (bcmp(rec1+seg->start,rec2+seg->start,seg->length))
+ if (memcmp(rec1+seg->start,rec2+seg->start,seg->length))
return 1;
}
}
@@ -660,7 +660,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const
}
else
{
- if (bcmp(rec+seg->start,key,seg->length))
+ if (memcmp(rec+seg->start,key,seg->length))
return 1;
}
}
=== modified file 'storage/heap/hp_test2.c'
--- a/storage/heap/hp_test2.c 2009-08-28 16:21:54 +0000
+++ b/storage/heap/hp_test2.c 2010-07-02 18:06:23 +0000
@@ -406,7 +406,7 @@ int main(int argc, char *argv[])
bmove(record2,record,reclength);
if (heap_rsame(file,record,-1) || heap_rsame(file,record2,2))
goto err;
- if (bcmp(record2,record,reclength))
+ if (memcmp(record2,record,reclength))
{
puts("heap_rsame didn't find right record");
goto end;
@@ -415,7 +415,7 @@ int main(int argc, char *argv[])
puts("- Test of read through position");
if (heap_rrnd(file,record,position))
goto err;
- if (bcmp(record3,record,reclength))
+ if (memcmp(record3,record,reclength))
{
puts("heap_frnd didn't find right record");
goto end;
=== modified file 'storage/innobase/os/os0file.c'
--- a/storage/innobase/os/os0file.c 2010-02-11 10:24:19 +0000
+++ b/storage/innobase/os/os0file.c 2010-07-02 18:06:23 +0000
@@ -3974,6 +3974,9 @@ os_aio_simulated_handle(
ulint n;
ulint i;
+ /* Fix compiler warning */
+ *consecutive_ios = NULL;
+
segment = os_aio_get_array_and_local_segment(&array, global_segment);
restart:
=== modified file 'storage/myisam/mi_open.c'
--- a/storage/myisam/mi_open.c 2010-03-25 11:18:14 +0000
+++ b/storage/myisam/mi_open.c 2010-07-02 18:06:23 +0000
@@ -139,7 +139,7 @@ MI_INFO *mi_open(const char *name, int m
(uchar*) myisam_file_magic, 4))
{
DBUG_PRINT("error",("Wrong header in %s",name_buff));
- DBUG_DUMP("error_dump",(char*) share->state.header.file_version,
+ DBUG_DUMP("error_dump", share->state.header.file_version,
head_length);
my_errno=HA_ERR_NOT_A_TABLE;
goto err;
=== modified file 'storage/myisam/mi_page.c'
--- a/storage/myisam/mi_page.c 2010-03-25 11:18:14 +0000
+++ b/storage/myisam/mi_page.c 2010-07-02 18:06:23 +0000
@@ -49,7 +49,7 @@ uchar *_mi_fetch_keypage(register MI_INF
{
DBUG_PRINT("error",("page %lu had wrong page length: %u",
(ulong) page, page_size));
- DBUG_DUMP("page", (char*) tmp, keyinfo->block_length);
+ DBUG_DUMP("page", tmp, keyinfo->block_length);
info->last_keypage = HA_OFFSET_ERROR;
mi_print_error(info->s, HA_ERR_CRASHED);
my_errno = HA_ERR_CRASHED;
=== modified file 'storage/myisam/mi_search.c'
--- a/storage/myisam/mi_search.c 2009-09-17 15:25:52 +0000
+++ b/storage/myisam/mi_search.c 2010-07-02 18:06:23 +0000
@@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF
DBUG_PRINT("error",
("Found too long null packed key: %u of %u at 0x%lx",
length, keyseg->length, (long) *page_pos));
- DBUG_DUMP("key",(char*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
return 0;
@@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF
{
DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx",
length, keyseg->length, (long) *page_pos));
- DBUG_DUMP("key",(char*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
return 0; /* Error */
@@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI
DBUG_PRINT("error",
("Found too long binary packed key: %u of %u at 0x%lx",
length, keyinfo->maxlength, (long) *page_pos));
- DBUG_DUMP("key",(char*) *page_pos,16);
+ DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); /* Wrong key */
=== modified file 'storage/myisam/mi_test2.c'
--- a/storage/myisam/mi_test2.c 2008-03-31 07:40:39 +0000
+++ b/storage/myisam/mi_test2.c 2010-07-02 18:06:23 +0000
@@ -415,7 +415,7 @@ int main(int argc, char *argv[])
}
ant=0;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys)
{
printf("prev: Found: %d records of %d\n",ant,dupp_keys);
@@ -453,7 +453,7 @@ int main(int argc, char *argv[])
goto end;
}
if (mi_rlast(file,read_record2,0) ||
- bcmp(read_record2,read_record3,reclength))
+ memcmp(read_record2,read_record3,reclength))
{
printf("Can't find last record\n");
DBUG_DUMP("record2",(uchar*) read_record2,reclength);
@@ -468,7 +468,7 @@ int main(int argc, char *argv[])
printf("prev: I found: %d records of %d\n",ant,write_count);
goto end;
}
- if (bcmp(read_record,read_record3,reclength))
+ if (memcmp(read_record,read_record3,reclength))
{
printf("Can't find first record\n");
goto end;
@@ -483,7 +483,7 @@ int main(int argc, char *argv[])
mi_rprev(file,read_record3,0) == 0 ||
mi_rnext(file,read_record3,0))
goto err;
- if (bcmp(read_record,read_record3,reclength) != 0)
+ if (memcmp(read_record,read_record3,reclength) != 0)
printf("Can't find first record\n");
if (!silent)
@@ -495,7 +495,7 @@ int main(int argc, char *argv[])
mi_rnext(file,read_record3,0) == 0 ||
mi_rprev(file,read_record3,0))
goto err;
- if (bcmp(read_record2,read_record3,reclength))
+ if (memcmp(read_record2,read_record3,reclength))
printf("Can't find last record\n");
#ifdef NOT_ANYMORE
if (!silent)
@@ -509,7 +509,7 @@ int main(int argc, char *argv[])
bzero((char*) file->lastkey,file->s->base.max_key_length*2);
if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX))
goto err;
- if (bcmp(read_record+start,key,(uint) i))
+ if (memcmp(read_record+start,key,(uint) i))
{
puts("Didn't find right record");
goto end;
@@ -528,7 +528,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=1;
while (mi_rnext(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-1)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-1);
@@ -546,7 +546,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=1;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-2)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-2);
@@ -566,7 +566,7 @@ int main(int argc, char *argv[])
if (mi_rnext(file,read_record,0))
goto err; /* Skall finnas poster */
while (mi_rnext(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-3)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-3);
@@ -581,7 +581,7 @@ int main(int argc, char *argv[])
opt_delete++;
ant=0;
while (mi_rprev(file,read_record3,0) == 0 &&
- bcmp(read_record3+start,key,length) == 0) ant++;
+ memcmp(read_record3+start,key,length) == 0) ant++;
if (ant != dupp_keys-4)
{
printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-4);
@@ -604,7 +604,7 @@ int main(int argc, char *argv[])
for (i=min(2,keys) ; i-- > 0 ;)
{
if (mi_rsame(file,read_record2,(int) i)) goto err;
- if (bcmp(read_record,read_record2,reclength) != 0)
+ if (memcmp(read_record,read_record2,reclength) != 0)
{
printf("is_rsame didn't find same record\n");
goto end;
=== modified file 'storage/myisam/mi_unique.c'
--- a/storage/myisam/mi_unique.c 2007-10-11 15:07:40 +0000
+++ b/storage/myisam/mi_unique.c 2010-07-02 18:06:23 +0000
@@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, M
if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey,
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
info->s->state.key_root[def->key]) ||
- bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH))
+ memcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH))
{
info->page_changed=1; /* Can't optimize read next */
info->lastpos=lastpos;
=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc 2010-06-10 20:45:22 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc 2010-07-02 18:06:23 +0000
@@ -293,8 +293,9 @@ static int myisammrg_parent_open_callbac
}
}
- DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", child_l->db_length, child_l->db,
- child_l->table_name_length, child_l->table_name));
+ DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int) child_l->db_length,
+ child_l->db, (int) child_l->table_name_length,
+ child_l->table_name));
/* Convert to lowercase if required. */
if (lower_case_table_names && child_l->table_name_length)
@@ -341,7 +342,7 @@ static MI_INFO *myisammrg_attach_childre
TABLE *parent;
TABLE *child;
TABLE_LIST *child_l;
- MI_INFO *myisam;
+ MI_INFO *UNINIT_VAR(myisam);
DBUG_ENTER("myisammrg_attach_children_callback");
my_errno= 0;
=== modified file 'strings/CMakeLists.txt'
--- a/strings/CMakeLists.txt 2008-05-22 22:25:21 +0000
+++ b/strings/CMakeLists.txt 2010-07-02 18:06:23 +0000
@@ -18,7 +18,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-SET(STRINGS_SOURCES bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
+SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c
ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c
ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c int2str.c
=== modified file 'strings/Makefile.am'
--- a/strings/Makefile.am 2010-01-11 14:31:06 +0000
+++ b/strings/Makefile.am 2010-07-02 18:06:23 +0000
@@ -21,19 +21,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
-CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c strmov.c
+CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c strmov.c
else
if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
-CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c strmov.c
+CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c strmov.c
else
#no assembler
ASRCS =
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
-CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c
+CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c
endif
endif
@@ -57,7 +57,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c
CHARSET_INFO.txt
libmystrings_a_LIBADD=
-conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c
+conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c
conf_to_src_LDADD=
#force static linking of conf_to_src - essential when linking against
#custom installation of libc
=== removed file 'strings/bcmp.c'
--- a/strings/bcmp.c 2007-05-10 09:59:39 +0000
+++ b/strings/bcmp.c 1970-01-01 00:00:00 +0000
@@ -1,66 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are
- identical to the "len" bytes starting at "s2", non-zero if they are
- different.
- Now only used with purify because purify gives wrong warnings when
- comparing a shorter string with bcmp.
-*/
-
-#include <my_global.h>
-#include "m_string.h"
-
-#ifdef HAVE_purify
-#undef bcmp
-#undef HAVE_BCMP
-#endif
-
-#if !defined(bcmp) && !defined(HAVE_BCMP)
-
-#if defined(MC68000) && defined(DS90)
-
-int bcmp(s1,s2, len)
-const char *s1;
-const char *s2;
-uint len; /* 0 <= len <= 65535 */
-{
- asm(" movl 12(a7),d0 ");
- asm(" subqw #1,d0 ");
- asm(" blt .L5 ");
- asm(" movl 4(a7),a1 ");
- asm(" movl 8(a7),a0 ");
- asm(".L4: cmpmb (a0)+,(a1)+ ");
- asm(" dbne d0,.L4 ");
- asm(".L5: addqw #1,d0 ");
-}
-
-#else
-
-#ifndef HAVE_purify
-size_t bcmp(register const uchar *s1,register const uchar *s2,
- register size_t len)
-#else
-size_t my_bcmp(register const uchar *s1,register const uchar *s2,
- register size_t len)
-#endif
-{
- while (len-- != 0 && *s1++ == *s2++) ;
- return len+1;
-}
-
-#endif
-#endif /* BSD_FUNCS */
=== modified file 'strings/ctype-ucs2.c'
--- a/strings/ctype-ucs2.c 2009-12-14 15:11:47 +0000
+++ b/strings/ctype-ucs2.c 2010-07-02 18:06:23 +0000
@@ -203,7 +203,7 @@ static int my_strnncoll_ucs2(CHARSET_INF
my_bool t_is_prefix)
{
int s_res,t_res;
- my_wc_t UNINIT_VAR(s_wc),t_wc;
+ my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
@@ -317,7 +317,7 @@ static int my_strncasecmp_ucs2(CHARSET_I
const char *s, const char *t, size_t len)
{
int s_res,t_res;
- my_wc_t UNINIT_VAR(s_wc),t_wc;
+ my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const char *se=s+len;
const char *te=t+len;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
@@ -1384,7 +1384,7 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *
my_bool t_is_prefix)
{
int s_res,t_res;
- my_wc_t UNINIT_VAR(s_wc),t_wc;
+ my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
const uchar *se=s+slen;
const uchar *te=t+tlen;
=== modified file 'strings/make-ccc'
--- a/strings/make-ccc 2000-07-31 19:29:14 +0000
+++ b/strings/make-ccc 2010-07-02 18:06:23 +0000
@@ -1,3 +1,3 @@
-ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include -O -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c atof.c bchange.c bcmp.c bfill.c bmove.c bmove512.c bmove_upp.c ct_init.c ctype-latin1.c int2str.c is_prefix.c llstr.c longlong2str.c r_strinstr.c str2int.c strappend.c strcend.c strcont.c strend.c strfill.c strinstr.c strmake.c strmov.c strnmov.c strstr.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c
+ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include -O -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c atof.c bchange.c bfill.c bmove.c bmove512.c bmove_upp.c ct_init.c ctype-latin1.c int2str.c is_prefix.c llstr.c longlong2str.c r_strinstr.c str2int.c strappend.c strcend.c strcont.c strend.c strfill.c strinstr.c strmake.c strmov.c strnmov.c strstr.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c
rm libmystrings.a
ar -cr libmystrings.a atof.o
=== modified file 'strings/str_test.c'
--- a/strings/str_test.c 2007-05-10 09:59:39 +0000
+++ b/strings/str_test.c 2010-07-02 18:06:23 +0000
@@ -50,10 +50,10 @@ int main(void)
errors=tests=0;
init_strings();
- test_arg("bcmp(from,to,5)",(long) my_test(bcmp(from,to,5)),1L);
- test_arg("bcmp(from,from,5)",(long) bcmp(from,from,5),0L);
+ test_arg("memcmp(from,to,5)",(long) my_test(memcmp(from,to,5)),1L);
+ test_arg("memcmp(from,from,5)",(long) memcmp(from,from,5),0L);
- test_arg("bcmp(from,to,0)",(long) bcmp(from,to,0),0L);
+ test_arg("memcmp(from,to,0)",(long) memcmp(from,to,0),0L);
test_arg("strend(from)",(long) strend(from),(long) from+F_LEN);
test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1);
test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4);
@@ -93,7 +93,7 @@ int main(void)
test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32,
3,T_CHAR,3,F_CHAR,0,0);
test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0);
- test_strarg("bmove_align(to,from,8)",(bmove_align(to,from,8),0L),INT_MAX32,
+ test_strarg("memcpy(to,from,8)",(memcpy(to,from,8),0L),INT_MAX32,
8,F_CHAR,0,0);
test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32,
3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0);
@@ -233,7 +233,7 @@ int compare_buff(const char *message, ch
{
int i,error=0;
- if (bcmp(b1,b2,length))
+ if (memcmp(b1,b2,length))
{
errors++;
printf("func: '%s' Buffers differ\nIs: ",message);
=== modified file 'strings/xml.c'
--- a/strings/xml.c 2009-02-13 16:41:47 +0000
+++ b/strings/xml.c 2010-07-02 18:06:23 +0000
@@ -123,16 +123,16 @@ static int my_xml_scan(MY_XML_PARSER *p,
a->beg=p->cur;
a->end=p->cur;
- if ((p->end - p->cur > 3) && !bcmp(p->cur,"<!--",4))
+ if ((p->end - p->cur > 3) && !memcmp(p->cur,"<!--",4))
{
- for (; (p->cur < p->end) && bcmp(p->cur, "-->", 3); p->cur++)
+ for (; (p->cur < p->end) && memcmp(p->cur, "-->", 3); p->cur++)
{}
- if (!bcmp(p->cur, "-->", 3))
+ if (!memcmp(p->cur, "-->", 3))
p->cur+=3;
a->end=p->cur;
lex=MY_XML_COMMENT;
}
- else if (!bcmp(p->cur, "<![CDATA[",9))
+ else if (!memcmp(p->cur, "<![CDATA[",9))
{
p->cur+= 9;
for (; p->cur < p->end - 2 ; p->cur++)
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2010-06-28 20:29:19 +0000
+++ b/tests/mysql_client_test.c 2010-07-02 18:06:23 +0000
@@ -18096,7 +18096,7 @@ static void test_bug53371()
static void test_bug53907()
{
int rc;
- char buf[] = "\x4test\x14../client_test_db/t1";
+ uchar buf[] = "\x4test\x14../client_test_db/t1";
myheader("test_bug53907");
Attachment: [text/bzr-bundle] bzr/davi.arnaut@sun.com-20100702180623-2z7gd30sj6d02y9n.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (davi:3458) Bug#53445 | Davi Arnaut | 2 Jul |