Merge of mysql-5.1-bugteam into mysql-trunk-merge.

This commit is contained in:
Davi Arnaut 2010-07-02 16:38:04 -03:00
commit 74283a052e
60 changed files with 260 additions and 365 deletions

View File

@ -90,22 +90,19 @@ SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" != "xpedantic" ]; then if [ "x$warning_mode" != "xpedantic" ]; then
# Both C and C++ warnings # Both C and C++ warnings
warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W" warnings="-Wall -Wextra -Wunused -Wwrite-strings"
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
# For more warnings, uncomment the following line # For more warnings, uncomment the following line
# warnings="$global_warnings -Wshadow" # warnings="$warnings -Wshadow"
# C warnings # C warnings
c_warnings="$warnings -Wunused-parameter" c_warnings="$warnings"
# C++ warnings # C++ warnings
cxx_warnings="$warnings" cxx_warnings="$warnings -Wno-unused-parameter"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo" # cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
cxx_warnings="$cxx_warnings -Wreorder"
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
# Added unless --with-debug=full # Added unless --with-debug=full
debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized" debug_extra_cflags="-O0 -g3 -gdwarf-2"
else else
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE" warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
c_warnings="$warnings" c_warnings="$warnings"

View File

@ -187,14 +187,24 @@ check_cpu () {
cc=$CC cc=$CC
fi fi
if test "x$compiler" = "x" ; then if test "x$core2" = "xyes" ; then
cc_ver=`$cc --version | sed 1q` cpu_arg="core2"
cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'` fi
if test "x$compiler" != "x" ; then
return 0
fi
# 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 '.' ' '` set -- `echo $cc_verno | tr '.' ' '`
cc_ver="GCC"
cc_major=$1 cc_major=$1
cc_minor=$2 cc_minor=$2
cc_patch=$3 cc_patch=$3
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
fi
case "$cc_ver--$cc_verno" in case "$cc_ver--$cc_verno" in
*GCC*) *GCC*)
@ -227,6 +237,7 @@ check_cpu () {
return return
;; ;;
esac esac
# now we check whether the compiler really understands the cpu type # now we check whether the compiler really understands the cpu type
touch __test.c touch __test.c
@ -245,10 +256,6 @@ check_cpu () {
break; break;
done done
rm __test.* rm __test.*
fi
if test "x$core2" = "xyes" ; then
cpu_arg="core2"
fi
return 0 return 0
} }

View File

@ -88,7 +88,6 @@ extern "C" {
#endif #endif
#endif #endif
#undef bcmp // Fix problem with new readline
#if defined(__WIN__) #if defined(__WIN__)
#include <conio.h> #include <conio.h>
#elif !defined(__NETWARE__) #elif !defined(__NETWARE__)

View File

@ -5827,7 +5827,7 @@ int read_command(struct st_command** command_ptr)
(struct st_command*) my_malloc(sizeof(*command), (struct st_command*) my_malloc(sizeof(*command),
MYF(MY_WME|MY_ZEROFILL))) || MYF(MY_WME|MY_ZEROFILL))) ||
insert_dynamic(&q_lines, (uchar*) &command)) insert_dynamic(&q_lines, (uchar*) &command))
die(NullS); die("Out of memory");
command->type= Q_UNKNOWN; command->type= Q_UNKNOWN;
read_command_buf[0]= 0; read_command_buf[0]= 0;
@ -6326,7 +6326,7 @@ void init_win_path_patterns()
} }
if (insert_dynamic(&patterns, (uchar*) &p)) if (insert_dynamic(&patterns, (uchar*) &p))
die(NullS); die("Out of memory");
DBUG_PRINT("info", ("p: %s", p)); DBUG_PRINT("info", ("p: %s", p));
while (*p) while (*p)
@ -9421,8 +9421,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++) for (i=1 ; i <= found_sets ; i++)
{ {
pos=from[found_set[i-1].table_offset]; pos=from[found_set[i-1].table_offset];
rep_str[i].found= !bcmp((const uchar*) pos, rep_str[i].found= !memcmp(pos, "\\^", 3) ? 2 : 1;
(const uchar*) "\\^", 3) ? 2 : 1;
rep_str[i].replace_string=to_array[found_set[i-1].table_offset]; 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].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)+ rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
@ -9550,7 +9549,7 @@ void copy_bits(REP_SET *to,REP_SET *from)
int cmp_bits(REP_SET *set1,REP_SET *set2) int cmp_bits(REP_SET *set1,REP_SET *set2)
{ {
return bcmp((uchar*) set1->bits,(uchar*) set2->bits, return memcmp(set1->bits, set2->bits,
sizeof(uint) * set1->size_of_bits); sizeof(uint) * set1->size_of_bits);
} }
@ -9620,17 +9619,15 @@ int find_found(FOUND_SET *found_set,uint table_offset, int found_offset)
uint start_at_word(char * pos) uint start_at_word(char * pos)
{ {
return (((!bcmp((const uchar*) pos, (const uchar*) "\\b",2) && pos[2]) || return (((!memcmp(pos, "\\b",2) && pos[2]) ||
!bcmp((const uchar*) pos, (const uchar*) "\\^", 2)) ? 1 : 0); !memcmp(pos, "\\^", 2)) ? 1 : 0);
} }
uint end_of_word(char * pos) uint end_of_word(char * pos)
{ {
char * end=strend(pos); char * end=strend(pos);
return ((end > pos+2 && !bcmp((const uchar*) end-2, return ((end > pos+2 && !memcmp(end-2, "\\b", 2)) ||
(const uchar*) "\\b", 2)) || (end >= pos+2 && !memcmp(end-2, "\\$",2))) ? 1 : 0;
(end >= pos+2 && !bcmp((const uchar*) end-2,
(const uchar*) "\\$",2))) ? 1 : 0;
} }
/**************************************************************************** /****************************************************************************

View File

@ -30,7 +30,6 @@ SET(HAVE_ASM_MSR_H CACHE INTERNAL "")
SET(HAVE_BACKTRACE CACHE INTERNAL "") SET(HAVE_BACKTRACE CACHE INTERNAL "")
SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "")
SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "")
SET(HAVE_BCMP CACHE INTERNAL "")
SET(HAVE_BFILL CACHE INTERNAL "") SET(HAVE_BFILL CACHE INTERNAL "")
SET(HAVE_BMOVE CACHE INTERNAL "") SET(HAVE_BMOVE CACHE INTERNAL "")
SET(HAVE_BSD_SIGNALS CACHE INTERNAL "") SET(HAVE_BSD_SIGNALS CACHE INTERNAL "")

View File

@ -31,4 +31,4 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \
EXTRA_DIST= emacs_keymap.c vi_keymap.c CMakeLists.txt EXTRA_DIST= emacs_keymap.c vi_keymap.c CMakeLists.txt
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

View File

@ -125,7 +125,6 @@
#cmakedefine HAVE_AIOWAIT 1 #cmakedefine HAVE_AIOWAIT 1
#cmakedefine HAVE_ALARM 1 #cmakedefine HAVE_ALARM 1
#cmakedefine HAVE_ALLOCA 1 #cmakedefine HAVE_ALLOCA 1
#cmakedefine HAVE_BCMP 1
#cmakedefine HAVE_BFILL 1 #cmakedefine HAVE_BFILL 1
#cmakedefine HAVE_BMOVE 1 #cmakedefine HAVE_BMOVE 1
#cmakedefine HAVE_BZERO 1 #cmakedefine HAVE_BZERO 1

View File

@ -273,7 +273,6 @@ CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE)
CHECK_FUNCTION_EXISTS (backtrace_symbols HAVE_BACKTRACE_SYMBOLS) CHECK_FUNCTION_EXISTS (backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
CHECK_FUNCTION_EXISTS (backtrace_symbols_fd HAVE_BACKTRACE_SYMBOLS_FD) CHECK_FUNCTION_EXISTS (backtrace_symbols_fd HAVE_BACKTRACE_SYMBOLS_FD)
CHECK_FUNCTION_EXISTS (printstack HAVE_PRINTSTACK) CHECK_FUNCTION_EXISTS (printstack HAVE_PRINTSTACK)
CHECK_FUNCTION_EXISTS (bcmp HAVE_BCMP)
CHECK_FUNCTION_EXISTS (bfill HAVE_BFILL) CHECK_FUNCTION_EXISTS (bfill HAVE_BFILL)
CHECK_FUNCTION_EXISTS (bmove HAVE_BMOVE) CHECK_FUNCTION_EXISTS (bmove HAVE_BMOVE)
CHECK_FUNCTION_EXISTS (bsearch HAVE_BSEARCH) CHECK_FUNCTION_EXISTS (bsearch HAVE_BSEARCH)

View File

@ -2342,7 +2342,7 @@ MYSQL_TYPE_QSORT
AC_FUNC_UTIME_NULL AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \ AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \
chsize cuserid fchmod fcntl \ chsize cuserid fchmod fcntl \
fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \ fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \ getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \

View File

@ -665,9 +665,9 @@ static struct message *find_message(struct errors *err, const char *lang,
static ha_checksum checksum_format_specifier(const char* msg) static ha_checksum checksum_format_specifier(const char* msg)
{ {
ha_checksum chksum= 0; ha_checksum chksum= 0;
const char* p= msg; const uchar* p= (const uchar*) msg;
const char* start= 0; const uchar* start= NULL;
int num_format_specifiers= 0; uint32 num_format_specifiers= 0;
while (*p) while (*p)
{ {

View File

@ -648,7 +648,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++) for (i=1 ; i <= found_sets ; i++)
{ {
pos=from[found_set[i-1].table_offset]; 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].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].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)+ rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
@ -776,7 +776,7 @@ static void copy_bits(REP_SET *to,REP_SET *from)
static int cmp_bits(REP_SET *set1,REP_SET *set2) static int cmp_bits(REP_SET *set1,REP_SET *set2)
{ {
return bcmp((uchar*) set1->bits,(uchar*) set2->bits, return memcmp(set1->bits, set2->bits,
sizeof(uint) * set1->size_of_bits); sizeof(uint) * set1->size_of_bits);
} }
@ -849,14 +849,14 @@ static short find_found(FOUND_SET *found_set,uint table_offset,
static uint start_at_word(char * pos) 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) static uint end_of_word(char * pos)
{ {
char * end=strend(pos); char * end=strend(pos);
return ((end > pos+2 && !bcmp(end-2,"\\b",2)) || return ((end > pos+2 && !memcmp(end-2,"\\b",2)) ||
(end >= pos+2 && !bcmp(end-2,"\\$",2))) ? (end >= pos+2 && !memcmp(end-2,"\\$",2))) ?
1 : 0; 1 : 0;
} }

View File

@ -953,7 +953,8 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info)
info->set = true; info->set = true;
} }
} }
fgets(line,sizeof(line), file); // get blank line // get blank line
if (fgets(line, sizeof(line), file))
begin = ftell(file); begin = ftell(file);
} }

View File

@ -51,7 +51,7 @@ public:
enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 }; enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 };
Blowfish(CipherDir DIR, Mode MODE) 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 #ifdef DO_BLOWFISH_ASM
void Process(byte*, const byte*, word32); void Process(byte*, const byte*, word32);
@ -62,8 +62,8 @@ private:
static const word32 p_init_[ROUNDS + 2]; static const word32 p_init_[ROUNDS + 2];
static const word32 s_init_[4 * 256]; static const word32 s_init_[4 * 256];
word32 pbox_[ROUNDS + 2]; word32 pbox_[ROUNDS + 2 + 4 * 256];
word32 sbox_[4 * 256]; word32* sbox_;
void crypt_block(const word32 in[2], word32 out[2]) const; void crypt_block(const word32 in[2], word32 out[2]) const;
void AsmProcess(const byte* in, byte* out) const; void AsmProcess(const byte* in, byte* out) const;

View File

@ -35,10 +35,7 @@
// Handler for pure virtual functions // Handler for pure virtual functions
namespace __Crun { namespace __Crun {
static void pure_error(void) void pure_error(void);
{
assert("Pure virtual method called." == "Aborted");
}
} // namespace __Crun } // namespace __Crun
#endif // __sun #endif // __sun
@ -54,16 +51,7 @@ extern "C" {
#else #else
#include "kernelc.hpp" #include "kernelc.hpp"
#endif #endif
int __cxa_pure_virtual () __attribute__ ((weak));
/* 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;
}
} // extern "C" } // extern "C"
#endif // __GNUC__ > 2 #endif // __GNUC__ > 2

View File

@ -51,7 +51,7 @@ void AES::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE; out += BLOCK_SIZE;
in += BLOCK_SIZE; in += BLOCK_SIZE;
} }
else if (mode_ == CBC) else if (mode_ == CBC) {
if (dir_ == ENCRYPTION) if (dir_ == ENCRYPTION)
while (blocks--) { while (blocks--) {
r_[0] ^= *(word32*)in; r_[0] ^= *(word32*)in;
@ -79,6 +79,7 @@ void AES::Process(byte* out, const byte* in, word32 sz)
in += BLOCK_SIZE; in += BLOCK_SIZE;
} }
} }
}
#endif // DO_AES_ASM #endif // DO_AES_ASM

View File

@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
struct WindowSlider struct WindowSlider
{ {
WindowSlider(const Integer &exp, bool fastNegate, WindowSlider(const Integer &expIn, bool fastNegateIn,
unsigned int windowSizeIn=0) unsigned int windowSizeIn=0)
: exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn), : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn),
windowBegin(0), fastNegate(fastNegate), firstTime(true), windowBegin(0), fastNegate(fastNegateIn), firstTime(true),
finished(false) finished(false)
{ {
if (windowSize == 0) if (windowSize == 0)

View File

@ -53,7 +53,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE; out += BLOCK_SIZE;
in += BLOCK_SIZE; in += BLOCK_SIZE;
} }
else if (mode_ == CBC) else if (mode_ == CBC) {
if (dir_ == ENCRYPTION) if (dir_ == ENCRYPTION)
while (blocks--) { while (blocks--) {
r_[0] ^= *(word32*)in; r_[0] ^= *(word32*)in;
@ -79,6 +79,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz)
in += BLOCK_SIZE; in += BLOCK_SIZE;
} }
} }
}
#endif // DO_BLOWFISH_ASM #endif // DO_BLOWFISH_ASM

View File

@ -283,12 +283,7 @@ DWord() {}
word GetHighHalfAsBorrow() const {return 0-halfs_.high;} word GetHighHalfAsBorrow() const {return 0-halfs_.high;}
private: private:
union struct dword_struct
{
#ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE
dword whole_;
#endif
struct
{ {
#ifdef LITTLE_ENDIAN_ORDER #ifdef LITTLE_ENDIAN_ORDER
word low; word low;
@ -297,7 +292,14 @@ private:
word high; word high;
word low; word low;
#endif #endif
} halfs_; };
union
{
#ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE
dword whole_;
#endif
struct dword_struct halfs_;
}; };
}; };
@ -1214,20 +1216,24 @@ public:
#define AS1(x) #x ";" #define AS1(x) #x ";"
#define AS2(x, y) #x ", " #y ";" #define AS2(x, y) #x ", " #y ";"
#define AddPrologue \ #define AddPrologue \
word res; \
__asm__ __volatile__ \ __asm__ __volatile__ \
( \ ( \
"push %%ebx;" /* save this manually, in case of -fPIC */ \ "push %%ebx;" /* save this manually, in case of -fPIC */ \
"mov %2, %%ebx;" \ "mov %3, %%ebx;" \
".intel_syntax noprefix;" \ ".intel_syntax noprefix;" \
"push ebp;" "push ebp;"
#define AddEpilogue \ #define AddEpilogue \
"pop ebp;" \ "pop ebp;" \
".att_syntax prefix;" \ ".att_syntax prefix;" \
"pop %%ebx;" \ "pop %%ebx;" \
: \ "mov %%eax, %0;" \
: "=g" (res) \
: "c" (C), "d" (A), "m" (B), "S" (N) \ : "c" (C), "d" (A), "m" (B), "S" (N) \
: "%edi", "memory", "cc" \ : "%edi", "memory", "cc" \
); ); \
return res;
#define MulPrologue \ #define MulPrologue \
__asm__ __volatile__ \ __asm__ __volatile__ \
( \ ( \

View File

@ -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" { extern "C" {
int __cxa_pure_virtual() { int __cxa_pure_virtual() {
assert("Pure virtual method called." == "Aborted"); assert(!"Aborted: pure virtual method called.");
return 0; return 0;
} }
@ -166,14 +177,6 @@ word Crop(word value, unsigned int size)
#ifdef TAOCRYPT_X86ASM_AVAILABLE #ifdef TAOCRYPT_X86ASM_AVAILABLE
#ifndef _MSC_VER
static jmp_buf s_env;
static void SigIllHandler(int)
{
longjmp(s_env, 1);
}
#endif
bool HaveCpuId() bool HaveCpuId()
{ {

View File

@ -54,7 +54,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE; out += BLOCK_SIZE;
in += BLOCK_SIZE; in += BLOCK_SIZE;
} }
else if (mode_ == CBC) else if (mode_ == CBC) {
if (dir_ == ENCRYPTION) if (dir_ == ENCRYPTION)
while (blocks--) { while (blocks--) {
r_[0] ^= *(word32*)in; r_[0] ^= *(word32*)in;
@ -83,6 +83,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz)
in += BLOCK_SIZE; in += BLOCK_SIZE;
} }
} }
}
#endif // DO_TWOFISH_ASM #endif // DO_TWOFISH_ASM

View File

@ -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) static int PasswordCallBack(char* passwd, int sz, int rw, void* userdata)
{ {
strncpy(passwd, "12345678", sz); strncpy(passwd, "12345678", sz);

View File

@ -36,10 +36,6 @@
/* need by my_vsnprintf */ /* need by my_vsnprintf */
#include <stdarg.h> #include <stdarg.h>
#ifdef _AIX
#undef HAVE_BCMP
#endif
/* This is needed for the definitions of bzero... on solaris */ /* This is needed for the definitions of bzero... on solaris */
#if defined(HAVE_STRINGS_H) #if defined(HAVE_STRINGS_H)
#include <strings.h> #include <strings.h>
@ -63,14 +59,6 @@
/* Unixware 7 */ /* Unixware 7 */
#if !defined(HAVE_BFILL) #if !defined(HAVE_BFILL)
# define bfill(A,B,C) memset((A),(C),(B)) # 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 #endif
#if defined(__cplusplus) #if defined(__cplusplus)
@ -120,15 +108,6 @@ extern void bfill(uchar *dst,size_t len,pchar fill);
extern void bzero(uchar * dst,size_t len); extern void bzero(uchar * dst,size_t len);
#endif #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 #ifndef bmove512
extern void bmove512(uchar *dst,const uchar *src,size_t len); extern void bmove512(uchar *dst,const uchar *src,size_t len);
#endif #endif

View File

@ -159,22 +159,6 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
#define bitmap_set_all(MAP) \ #define bitmap_set_all(MAP) \
(memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((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 #ifdef __cplusplus
} }
#endif #endif

View File

@ -631,8 +631,15 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#define SIGNAL_HANDLER_RESET_ON_DELIVERY #define SIGNAL_HANDLER_RESET_ON_DELIVERY
#endif #endif
#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 #else
#define LINT_INIT(var) #define LINT_INIT(var)
#endif #endif
@ -643,10 +650,11 @@ extern "C" int madvise(void *addr, size_t len, int behav);
The _cplusplus is a temporary workaround for C++ code pending a fix 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) || \ #if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
!defined(__GNUC__) defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0 #define UNINIT_VAR(x) x= 0
#else #else
/* GCC specific self-initialization which inhibits the warning. */
#define UNINIT_VAR(x) x= x #define UNINIT_VAR(x) x= x
#endif #endif
@ -670,7 +678,6 @@ typedef unsigned short ushort;
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #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 set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
#define test_all_bits(a,b) (((a) & (b)) == (b)) #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 array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
/* Define some general constants */ /* Define some general constants */

View File

@ -38,7 +38,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
strmake.lo strend.lo \ strmake.lo strend.lo \
strnlen.lo strfill.lo is_prefix.lo \ strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.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 \ bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \ strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \ ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \

View File

@ -159,7 +159,7 @@ int main(int argc, char* const argv[] )
signal(SIGCHLD, handle_signal); signal(SIGCHLD, handle_signal);
signal(SIGABRT, handle_abort); 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"); message("Started");

View File

@ -42,7 +42,7 @@ char * my_load_path(char * to, const char *path,
if (is_cur) if (is_cur)
is_cur=2; /* Remove current dir */ is_cur=2; /* Remove current dir */
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0))) 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 else
(void) strnmov(buff, path, FN_REFLEN); /* Return org file name */ (void) strnmov(buff, path, FN_REFLEN); /* Return org file name */
} }

View File

@ -52,7 +52,7 @@ void pack_dirname(char * to, const char *from)
buff_length= strlen(buff); buff_length= strlen(buff);
d_length= (size_t) (start-to); d_length= (size_t) (start-to);
if ((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) *start != FN_LIBCHAR && *start)
{ /* Put current dir before */ { /* Put current dir before */
bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1); bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1);
@ -70,7 +70,7 @@ void pack_dirname(char * to, const char *from)
} }
if (length > 1 && length < d_length) if (length > 1 && length < d_length)
{ /* test if /xx/yy -> ~/yy */ { /* 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 ~ */ to[0]=FN_HOMELIB; /* Filename begins with ~ */
(void) strmov_overlapp(to+1,to+length); (void) strmov_overlapp(to+1,to+length);
@ -80,7 +80,7 @@ void pack_dirname(char * to, const char *from)
{ /* Test if cwd is ~/... */ { /* Test if cwd is ~/... */
if (length > 1 && length < buff_length) 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; buff[0]=FN_HOMELIB;
(void) strmov_overlapp(buff+1,buff+length); (void) strmov_overlapp(buff+1,buff+length);
@ -166,7 +166,7 @@ size_t cleanup_dirname(register char *to, const char *from)
*pos = FN_LIBCHAR; *pos = FN_LIBCHAR;
if (*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 */ { /* If .../../; skip prev */
pos-=length; pos-=length;
if (pos != start) if (pos != start)
@ -197,7 +197,7 @@ size_t cleanup_dirname(register char *to, const char *from)
end_parentdir=pos; end_parentdir=pos;
while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */ while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */
pos--; 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/ */ { /* Don't remove ~user/ */
pos=strmov(end_parentdir+1,parent); pos=strmov(end_parentdir+1,parent);
*pos=FN_LIBCHAR; *pos=FN_LIBCHAR;
@ -206,7 +206,7 @@ size_t cleanup_dirname(register char *to, const char *from)
} }
} }
else if ((size_t) (pos-start) == length-1 && else if ((size_t) (pos-start) == length-1 &&
!bcmp(start,parent+1,length-1)) !memcmp(start,parent+1,length-1))
start=pos; /* Starts with "../" */ start=pos; /* Starts with "../" */
else if (pos-start > 0 && pos[-1] == FN_LIBCHAR) else if (pos-start > 0 && pos[-1] == FN_LIBCHAR)
{ {

View File

@ -508,10 +508,8 @@ uint bitmap_get_first_set(const MY_BITMAP *map)
if (*byte_ptr & (1 << k)) if (*byte_ptr & (1 << k))
return (i*32) + (j*8) + k; return (i*32) + (j*8) + k;
} }
DBUG_ASSERT(0);
} }
} }
DBUG_ASSERT(0);
} }
} }
return MY_BIT_NONE; return MY_BIT_NONE;
@ -542,10 +540,8 @@ uint bitmap_get_first(const MY_BITMAP *map)
if (!(*byte_ptr & (1 << k))) if (!(*byte_ptr & (1 << k)))
return (i*32) + (j*8) + k; return (i*32) + (j*8) + k;
} }
DBUG_ASSERT(0);
} }
} }
DBUG_ASSERT(0);
} }
} }
return MY_BIT_NONE; return MY_BIT_NONE;

View File

@ -47,7 +47,7 @@ my_bool my_gethwaddr(uchar *to)
uchar *buf, *next, *end, *addr; uchar *buf, *next, *end, *addr;
struct if_msghdr *ifm; struct if_msghdr *ifm;
struct sockaddr_dl *sdl; 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) if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
goto err; goto err;

View File

@ -28,7 +28,7 @@ typedef void (*init_func_p)(const struct my_option *option, void *variable,
static void default_reporter(enum loglevel level, const char *format, ...); static void default_reporter(enum loglevel level, const char *format, ...);
my_error_reporter my_getopt_error_reporter= &default_reporter; my_error_reporter my_getopt_error_reporter= &default_reporter;
static int findopt(char *, uint, const struct my_option **, char **); static int findopt(char *, uint, const struct my_option **, const char **);
my_bool getopt_compare_strings(const char *, const char *, uint); my_bool getopt_compare_strings(const char *, const char *, uint);
static longlong getopt_ll(char *arg, const struct my_option *optp, int *err); static longlong getopt_ll(char *arg, const struct my_option *optp, int *err);
static ulonglong getopt_ull(char *, const struct my_option *, int *); static ulonglong getopt_ull(char *, const struct my_option *, int *);
@ -113,8 +113,8 @@ int handle_options(int *argc, char ***argv,
uint opt_found, argvpos= 0, length; uint opt_found, argvpos= 0, length;
my_bool end_of_options= 0, must_be_var, set_maximum_value, my_bool end_of_options= 0, must_be_var, set_maximum_value,
option_is_loose; option_is_loose;
char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found), char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN];
*opt_str, key_name[FN_REFLEN]; const char *UNINIT_VAR(prev_found);
const struct my_option *optp; const struct my_option *optp;
void *value; void *value;
int error, i; int error, i;
@ -185,7 +185,6 @@ int handle_options(int *argc, char ***argv,
Find first the right option. Return error in case of an ambiguous, Find first the right option. Return error in case of an ambiguous,
or unknown option or unknown option
*/ */
LINT_INIT(prev_found);
optp= longopts; optp= longopts;
if (!(opt_found= findopt(opt_str, length, &optp, &prev_found))) if (!(opt_found= findopt(opt_str, length, &optp, &prev_found)))
{ {
@ -696,10 +695,10 @@ ret:
static int findopt(char *optpat, uint length, static int findopt(char *optpat, uint length,
const struct my_option **opt_res, const struct my_option **opt_res,
char **ffname) const char **ffname)
{ {
uint count; uint count;
struct my_option *opt= (struct my_option *) *opt_res; const struct my_option *opt= *opt_res;
for (count= 0; opt->name; opt++) for (count= 0; opt->name; opt++)
{ {
@ -710,8 +709,9 @@ static int findopt(char *optpat, uint length,
return 1; return 1;
if (!count) if (!count)
{ {
/* We only need to know one prev */
count= 1; count= 1;
*ffname= (char *) opt->name; /* We only need to know one prev */ *ffname= opt->name;
} }
else if (strcmp(*ffname, opt->name)) else if (strcmp(*ffname, opt->name))
{ {

View File

@ -269,7 +269,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a+=a_length; a+=a_length;
b+=b_length; b+=b_length;
break;
} }
break; break;
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:

View File

@ -122,8 +122,7 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
{ {
THR_LOCK_DATA *data,**prev; THR_LOCK_DATA *data,**prev;
uint count=0; uint count=0;
THR_LOCK_OWNER *first_owner; THR_LOCK_OWNER *UNINIT_VAR(first_owner);
LINT_INIT(first_owner);
prev= &list->data; prev= &list->data;
if (list->data) if (list->data)

View File

@ -690,7 +690,6 @@ register cset *cs;
case '-': case '-':
SETERROR(REG_ERANGE); SETERROR(REG_ERANGE);
return; /* NOTE RETURN */ return; /* NOTE RETURN */
break;
default: default:
c = '\0'; c = '\0';
break; break;

View File

@ -8280,7 +8280,13 @@ int Field_set::store(longlong nr, bool unsigned_val)
{ {
ASSERT_COLUMN_MARKED_FOR_WRITE; ASSERT_COLUMN_MARKED_FOR_WRITE;
int error= 0; 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) if ((ulonglong) nr > max_nr)
{ {
nr&= max_nr; nr&= max_nr;

View File

@ -4400,8 +4400,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
context->first_name_resolution_table, context->first_name_resolution_table,
context->last_name_resolution_table, context->last_name_resolution_table,
reference, REPORT_ALL_ERRORS, reference, REPORT_ALL_ERRORS,
!any_privileges && !any_privileges, TRUE);
TRUE, TRUE);
} }
return -1; return -1;
} }

View File

@ -5131,8 +5131,6 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
CHARSET_INFO *cs) CHARSET_INFO *cs)
{ {
Item *UNINIT_VAR(res); Item *UNINIT_VAR(res);
ulong len;
uint dec;
switch (cast_type) { switch (cast_type) {
case ITEM_CAST_BINARY: case ITEM_CAST_BINARY:
@ -5155,11 +5153,10 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
break; break;
case ITEM_CAST_DECIMAL: case ITEM_CAST_DECIMAL:
{ {
if (c_len == NULL) ulong len= 0;
{ uint dec= 0;
len= 0;
} if (c_len)
else
{ {
ulong decoded_size; ulong decoded_size;
errno= 0; errno= 0;
@ -5173,11 +5170,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
len= decoded_size; len= decoded_size;
} }
if (c_dec == NULL) if (c_dec)
{
dec= 0;
}
else
{ {
ulong decoded_size; ulong decoded_size;
errno= 0; errno= 0;
@ -5213,12 +5206,9 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
} }
case ITEM_CAST_CHAR: case ITEM_CAST_CHAR:
{ {
int len= -1;
CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection); CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection);
if (c_len == NULL) if (c_len)
{
len= LL(-1);
}
else
{ {
ulong decoded_size; ulong decoded_size;
errno= 0; errno= 0;
@ -5228,7 +5218,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH); my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH);
return NULL; return NULL;
} }
len= decoded_size; len= (int) decoded_size;
} }
res= new (thd->mem_root) Item_char_typecast(a, len, real_cs); res= new (thd->mem_root) Item_char_typecast(a, len, real_cs);
break; break;

View File

@ -2044,7 +2044,7 @@ static int find_uniq_filename(char *name)
file_info= dir_info->dir_entry; file_info= dir_info->dir_entry;
for (i= dir_info->number_off_files ; i-- ; file_info++) 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)) test_if_number(file_info->name+length, &number,0))
{ {
set_if_bigger(max_found,(ulong) number); set_if_bigger(max_found,(ulong) number);

View File

@ -2982,7 +2982,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
if (likely(charset_inited) && if (likely(charset_inited) &&
(unlikely(!print_event_info->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)); CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
if (cs_info) if (cs_info)
@ -3005,8 +3005,8 @@ void Query_log_event::print_query_header(IO_CACHE* file,
} }
if (time_zone_len) if (time_zone_len)
{ {
if (bcmp((uchar*) print_event_info->time_zone_str, if (memcmp(print_event_info->time_zone_str,
(uchar*) time_zone_str, time_zone_len+1)) time_zone_str, time_zone_len+1))
{ {
my_b_printf(file,"SET @@session.time_zone='%s'%s\n", my_b_printf(file,"SET @@session.time_zone='%s'%s\n",
time_zone_str, print_event_info->delimiter); time_zone_str, print_event_info->delimiter);
@ -8654,7 +8654,7 @@ Rows_log_event::write_row(const Relay_log_info *const rli,
TABLE *table= m_table; // pointer to event's table TABLE *table= m_table; // pointer to event's table
int error; int error;
int keynum; int UNINIT_VAR(keynum);
auto_afree_ptr<char> key(NULL); auto_afree_ptr<char> key(NULL);
/* fill table->record[0] with default values */ /* fill table->record[0] with default values */

View File

@ -418,7 +418,7 @@ copy_extra_record_fields(TABLE *table,
DBUG_ASSERT(master_reclength <= table->s->reclength); DBUG_ASSERT(master_reclength <= table->s->reclength);
if (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->record[1] + master_reclength,
table->s->reclength - master_reclength); table->s->reclength - master_reclength);
@ -697,7 +697,7 @@ static int find_and_fetch_row(TABLE *table, uchar *key)
rnd_pos() returns the record in table->record[0], so we have to rnd_pos() returns the record in table->record[0], so we have to
move it to table->record[1]. 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); DBUG_RETURN(error);
} }
@ -1190,7 +1190,7 @@ int Update_rows_log_event_old::do_exec_row(TABLE *table)
overwriting the default values that where put there by the overwriting the default values that where put there by the
unpack_row() function. 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); copy_extra_record_fields(table, m_master_reclength, m_width);
/* /*

View File

@ -2649,7 +2649,6 @@ extern "C" sig_handler handle_segfault(int sig)
{ {
time_t curr_time; time_t curr_time;
struct tm tm; struct tm tm;
THD *thd=current_thd;
/* /*
Strictly speaking, one needs a mutex here Strictly speaking, one needs a mutex here
@ -2709,13 +2708,15 @@ the thread stack. Please read http://dev.mysql.com/doc/mysql/en/linux.html\n\n",
#endif /* HAVE_LINUXTHREADS */ #endif /* HAVE_LINUXTHREADS */
#ifdef HAVE_STACKTRACE #ifdef HAVE_STACKTRACE
THD *thd=current_thd;
if (!(test_flags & TEST_NO_STACKTRACE)) if (!(test_flags & TEST_NO_STACKTRACE))
{ {
fprintf(stderr, "thd: 0x%lx\n",(long) thd); fprintf(stderr, "thd: 0x%lx\n",(long) thd);
fprintf(stderr,"\ fprintf(stderr, "Attempting backtrace. You can use the following "
Attempting backtrace. You can use the following information to find out\n\ "information to find out\nwhere mysqld died. If "
where mysqld died. If you see no messages after this, something went\n\ "you see no messages after this, something went\n"
terribly wrong...\n"); "terribly wrong...\n");
my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL, my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL,
my_thread_stack_size); my_thread_stack_size);
} }

View File

@ -1138,8 +1138,7 @@ bool Relay_log_info::cached_charset_compare(char *charset) const
{ {
DBUG_ENTER("Relay_log_info::cached_charset_compare"); DBUG_ENTER("Relay_log_info::cached_charset_compare");
if (bcmp((uchar*) cached_charset, (uchar*) charset, if (memcmp(cached_charset, charset, sizeof(cached_charset)))
sizeof(cached_charset)))
{ {
memcpy(const_cast<char*>(cached_charset), charset, sizeof(cached_charset)); memcpy(const_cast<char*>(cached_charset), charset, sizeof(cached_charset));
DBUG_RETURN(1); DBUG_RETURN(1);

View File

@ -518,9 +518,9 @@ bool is_conversion_ok(int order, Relay_log_info *rli)
{ {
DBUG_ENTER("is_conversion_ok"); DBUG_ENTER("is_conversion_ok");
bool allow_non_lossy= bool allow_non_lossy=
bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY); slave_type_conversions_options & SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY;
bool allow_lossy= bool allow_lossy=
bit_is_set(slave_type_conversions_options, SLAVE_TYPE_CONVERSIONS_ALL_LOSSY); slave_type_conversions_options & SLAVE_TYPE_CONVERSIONS_ALL_LOSSY;
DBUG_PRINT("enter", ("order: %d, flags:%s%s", order, DBUG_PRINT("enter", ("order: %d, flags:%s%s", order,
allow_non_lossy ? " ALL_NON_LOSSY" : "", allow_non_lossy ? " ALL_NON_LOSSY" : "",

View File

@ -2295,7 +2295,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli)
DBUG_PRINT("info", ("thd->options: %s%s; rli->last_event_start_time: %lu", DBUG_PRINT("info", ("thd->options: %s%s; rli->last_event_start_time: %lu",
FLAGSTR(thd->variables.option_bits, OPTION_NOT_AUTOCOMMIT), FLAGSTR(thd->variables.option_bits, OPTION_NOT_AUTOCOMMIT),
FLAGSTR(thd->variables.option_bits, OPTION_BEGIN), FLAGSTR(thd->variables.option_bits, OPTION_BEGIN),
rli->last_event_start_time)); (ulong) rli->last_event_start_time));
/* /*
Execute the event to change the database and update the binary Execute the event to change the database and update the binary
@ -3125,8 +3125,8 @@ pthread_handler_t handle_slave_sql(void *arg)
char llbuff[22],llbuff1[22]; char llbuff[22],llbuff1[22];
char saved_log_name[FN_REFLEN]; char saved_log_name[FN_REFLEN];
char saved_master_log_name[FN_REFLEN]; char saved_master_log_name[FN_REFLEN];
my_off_t saved_log_pos; my_off_t UNINIT_VAR(saved_log_pos);
my_off_t saved_master_log_pos; my_off_t UNINIT_VAR(saved_master_log_pos);
my_off_t saved_skip= 0; my_off_t saved_skip= 0;
Relay_log_info* rli = &((Master_info*)arg)->rli; Relay_log_info* rli = &((Master_info*)arg)->rli;

View File

@ -8544,7 +8544,7 @@ my_bool mysql_rm_tmp_tables(void)
(file->name[1] == '.' && !file->name[2]))) (file->name[1] == '.' && !file->name[2])))
continue; continue;
if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix, if (!memcmp(file->name, tmp_file_prefix,
tmp_file_prefix_length)) tmp_file_prefix_length))
{ {
char *ext= fn_ext(file->name); char *ext= fn_ext(file->name);
@ -8552,7 +8552,7 @@ my_bool mysql_rm_tmp_tables(void)
uint filePath_len= my_snprintf(filePath, sizeof(filePath), uint filePath_len= my_snprintf(filePath, sizeof(filePath),
"%s%c%s", tmpdir, FN_LIBCHAR, "%s%c%s", tmpdir, FN_LIBCHAR,
file->name); file->name);
if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len)) if (!memcmp(reg_ext, ext, ext_len))
{ {
handler *handler_file= 0; handler *handler_file= 0;
/* We should cut file extention before deleting of table */ /* We should cut file extention before deleting of table */

View File

@ -257,8 +257,7 @@ bool log_in_use(const char* log_name)
if ((linfo = tmp->current_linfo)) if ((linfo = tmp->current_linfo))
{ {
mysql_mutex_lock(&linfo->lock); mysql_mutex_lock(&linfo->lock);
result = !bcmp((uchar*) log_name, (uchar*) linfo->log_file_name, result = !memcmp(log_name, linfo->log_file_name, log_name_len);
log_name_len);
mysql_mutex_unlock(&linfo->lock); mysql_mutex_unlock(&linfo->lock);
if (result) if (result)
break; break;

View File

@ -146,7 +146,9 @@ typedef long long longlong;
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
#if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_SOLARIS_STYLE_GETHOST)
static pthread_mutex_t LOCK_hostname; static pthread_mutex_t LOCK_hostname;
#endif
/* These must be right or mysqld will not find the symbol! */ /* These must be right or mysqld will not find the symbol! */

View File

@ -77,8 +77,8 @@ typedef struct st_ha_create_information HA_CREATE_INFO;
#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */ #define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */
/* Extern defines */ /* Extern defines */
#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(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) bmove_align((A)->record[0],(A)->B,(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 cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
#define empty_record(A) { \ #define empty_record(A) { \
restore_record((A),s->default_values); \ restore_record((A),s->default_values); \

View File

@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
} }
else else
{ {
if (bcmp(rec1+seg->start,rec2+seg->start,seg->length)) if (memcmp(rec1+seg->start,rec2+seg->start,seg->length))
return 1; return 1;
} }
} }
@ -660,7 +660,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
} }
else else
{ {
if (bcmp(rec+seg->start,key,seg->length)) if (memcmp(rec+seg->start,key,seg->length))
return 1; return 1;
} }
} }

View File

@ -401,7 +401,7 @@ int main(int argc, char *argv[])
bmove(record2,record,reclength); bmove(record2,record,reclength);
if (heap_rsame(file,record,-1) || heap_rsame(file,record2,2)) if (heap_rsame(file,record,-1) || heap_rsame(file,record2,2))
goto err; goto err;
if (bcmp(record2,record,reclength)) if (memcmp(record2,record,reclength))
{ {
puts("heap_rsame didn't find right record"); puts("heap_rsame didn't find right record");
goto end; goto end;
@ -410,7 +410,7 @@ int main(int argc, char *argv[])
puts("- Test of read through position"); puts("- Test of read through position");
if (heap_rrnd(file,record,position)) if (heap_rrnd(file,record,position))
goto err; goto err;
if (bcmp(record3,record,reclength)) if (memcmp(record3,record,reclength))
{ {
puts("heap_frnd didn't find right record"); puts("heap_frnd didn't find right record");
goto end; goto end;

View File

@ -84,7 +84,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff, if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff,
test(!(nextflag & SEARCH_SAVE_BUFF))))) test(!(nextflag & SEARCH_SAVE_BUFF)))))
goto err; goto err;
DBUG_DUMP("page",(uchar*) buff,mi_getint(buff)); DBUG_DUMP("page", buff, mi_getint(buff));
flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag, flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag,
&keypos,lastkey, &last_key); &keypos,lastkey, &last_key);
@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_PRINT("error", DBUG_PRINT("error",
("Found too long null packed key: %u of %u at 0x%lx", ("Found too long null packed key: %u of %u at 0x%lx",
length, keyseg->length, (long) *page_pos)); length, keyseg->length, (long) *page_pos));
DBUG_DUMP("key",(uchar*) *page_pos,16); DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED); mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
return 0; return 0;
@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
{ {
DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx", DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx",
length, keyseg->length, (long) *page_pos)); length, keyseg->length, (long) *page_pos));
DBUG_DUMP("key",(uchar*) *page_pos,16); DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED); mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
return 0; /* Error */ return 0; /* Error */
@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
DBUG_PRINT("error", DBUG_PRINT("error",
("Found too long binary packed key: %u of %u at 0x%lx", ("Found too long binary packed key: %u of %u at 0x%lx",
length, keyinfo->maxlength, (long) *page_pos)); length, keyinfo->maxlength, (long) *page_pos));
DBUG_DUMP("key",(uchar*) *page_pos,16); DBUG_DUMP("key", *page_pos, 16);
mi_print_error(keyinfo->share, HA_ERR_CRASHED); mi_print_error(keyinfo->share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(0); /* Wrong key */ DBUG_RETURN(0); /* Wrong key */

View File

@ -415,7 +415,7 @@ int main(int argc, char *argv[])
} }
ant=0; ant=0;
while (mi_rprev(file,read_record3,0) == 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) if (ant != dupp_keys)
{ {
printf("prev: Found: %d records of %d\n",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; goto end;
} }
if (mi_rlast(file,read_record2,0) || 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"); printf("Can't find last record\n");
DBUG_DUMP("record2",(uchar*) read_record2,reclength); 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); printf("prev: I found: %d records of %d\n",ant,write_count);
goto end; goto end;
} }
if (bcmp(read_record,read_record3,reclength)) if (memcmp(read_record,read_record3,reclength))
{ {
printf("Can't find first record\n"); printf("Can't find first record\n");
goto end; goto end;
@ -483,7 +483,7 @@ int main(int argc, char *argv[])
mi_rprev(file,read_record3,0) == 0 || mi_rprev(file,read_record3,0) == 0 ||
mi_rnext(file,read_record3,0)) mi_rnext(file,read_record3,0))
goto err; 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"); printf("Can't find first record\n");
if (!silent) if (!silent)
@ -495,7 +495,7 @@ int main(int argc, char *argv[])
mi_rnext(file,read_record3,0) == 0 || mi_rnext(file,read_record3,0) == 0 ||
mi_rprev(file,read_record3,0)) mi_rprev(file,read_record3,0))
goto err; goto err;
if (bcmp(read_record2,read_record3,reclength)) if (memcmp(read_record2,read_record3,reclength))
printf("Can't find last record\n"); printf("Can't find last record\n");
#ifdef NOT_ANYMORE #ifdef NOT_ANYMORE
if (!silent) if (!silent)
@ -509,7 +509,7 @@ int main(int argc, char *argv[])
bzero((char*) file->lastkey,file->s->base.max_key_length*2); bzero((char*) file->lastkey,file->s->base.max_key_length*2);
if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX)) if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX))
goto err; goto err;
if (bcmp(read_record+start,key,(uint) i)) if (memcmp(read_record+start,key,(uint) i))
{ {
puts("Didn't find right record"); puts("Didn't find right record");
goto end; goto end;
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
opt_delete++; opt_delete++;
ant=1; ant=1;
while (mi_rnext(file,read_record3,0) == 0 && 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) if (ant != dupp_keys-1)
{ {
printf("next: I can only find: %d keys of %d\n",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++; opt_delete++;
ant=1; ant=1;
while (mi_rprev(file,read_record3,0) == 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-2) if (ant != dupp_keys-2)
{ {
printf("next: I can only find: %d keys of %d\n",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)) if (mi_rnext(file,read_record,0))
goto err; /* Skall finnas poster */ goto err; /* Skall finnas poster */
while (mi_rnext(file,read_record3,0) == 0 && 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) if (ant != dupp_keys-3)
{ {
printf("next: I can only find: %d keys of %d\n",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++; opt_delete++;
ant=0; ant=0;
while (mi_rprev(file,read_record3,0) == 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) if (ant != dupp_keys-4)
{ {
printf("next: I can only find: %d keys of %d\n",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 ;) for (i=min(2,keys) ; i-- > 0 ;)
{ {
if (mi_rsame(file,read_record2,(int) i)) goto err; 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"); printf("is_rsame didn't find same record\n");
goto end; goto end;

View File

@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record,
if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey, if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey,
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER, MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
info->s->state.key_root[def->key]) || 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->page_changed=1; /* Can't optimize read next */
info->lastpos=lastpos; info->lastpos=lastpos;

View File

@ -298,9 +298,8 @@ extern "C" int myisammrg_parent_open_callback(void *callback_param,
if (! db || ! table_name) if (! db || ! table_name)
DBUG_RETURN(1); DBUG_RETURN(1);
DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", db_length, db, DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int) db_length, db,
table_name_length, table_name)); (int) table_name_length, table_name));
/* Convert to lowercase if required. */ /* Convert to lowercase if required. */
if (lower_case_table_names && table_name_length) if (lower_case_table_names && table_name_length)

View File

@ -15,7 +15,7 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) 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-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-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 dtoa.c int2str.c ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c

View File

@ -30,19 +30,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X # Exact one of ASSEMBLER_X
if ASSEMBLER_x86 if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s 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 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 dtoa.c strmov.c CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.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 dtoa.c strmov.c
else else
if ASSEMBLER_sparc32 if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake # These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile # 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 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 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 dtoa.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 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 dtoa.c strmov.c
else else
#no assembler #no assembler
ASRCS = ASRCS =
# These file MUST all be on the same line!! Otherwise automake # These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile # 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 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 dtoa.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 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 dtoa.c
endif endif
endif endif
@ -66,7 +66,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc
CHARSET_INFO.txt CHARSET_INFO.txt
libmystrings_a_LIBADD= 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= conf_to_src_LDADD=
#force static linking of conf_to_src - essential when linking against #force static linking of conf_to_src - essential when linking against
#custom installation of libc #custom installation of libc

View File

@ -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 */

View File

@ -50,10 +50,10 @@ int main(void)
errors=tests=0; errors=tests=0;
init_strings(); init_strings();
test_arg("bcmp(from,to,5)",(long) my_test(bcmp(from,to,5)),1L); test_arg("memcmp(from,to,5)",(long) my_test(memcmp(from,to,5)),1L);
test_arg("bcmp(from,from,5)",(long) bcmp(from,from,5),0L); 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("strend(from)",(long) strend(from),(long) from+F_LEN);
test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1); test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1);
test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4); 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, 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); 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_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); 8,F_CHAR,0,0);
test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32, 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); 3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0);
@ -233,7 +233,7 @@ int compare_buff(const char *message, char * b1, char * b2, int length,
{ {
int i,error=0; int i,error=0;
if (bcmp(b1,b2,length)) if (memcmp(b1,b2,length))
{ {
errors++; errors++;
printf("func: '%s' Buffers differ\nIs: ",message); printf("func: '%s' Buffers differ\nIs: ",message);

View File

@ -123,16 +123,16 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
a->beg=p->cur; a->beg=p->cur;
a->end=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; p->cur+=3;
a->end=p->cur; a->end=p->cur;
lex=MY_XML_COMMENT; lex=MY_XML_COMMENT;
} }
else if (!bcmp(p->cur, "<![CDATA[",9)) else if (!memcmp(p->cur, "<![CDATA[",9))
{ {
p->cur+= 9; p->cur+= 9;
for (; p->cur < p->end - 2 ; p->cur++) for (; p->cur < p->end - 2 ; p->cur++)