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.
This commit is contained in:
parent
6d5b440126
commit
93fb8bb235
@ -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"
|
||||
|
@ -181,14 +181,17 @@ 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_ver="GCC"
|
||||
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
|
||||
@ -229,7 +232,7 @@ check_cpu () {
|
||||
fi
|
||||
while [ "$cpu_arg" ] ; do
|
||||
printf "testing $cpu_arg ... " >&2
|
||||
|
||||
|
||||
# compile check
|
||||
eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
|
||||
if test "x$?" = "x0" ; then
|
||||
@ -243,5 +246,5 @@ check_cpu () {
|
||||
done
|
||||
rm __test.*
|
||||
}
|
||||
|
||||
|
||||
check_cpu
|
||||
|
@ -93,7 +93,6 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef bcmp // Fix problem with new readline
|
||||
#if defined(__WIN__)
|
||||
#include <conio.h>
|
||||
#elif !defined(__NETWARE__)
|
||||
|
@ -5780,7 +5780,7 @@ int read_command(struct st_command** command_ptr)
|
||||
(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 * *to,uint count,
|
||||
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 table_offset, int found_offset)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \
|
||||
|
||||
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.%
|
||||
|
@ -318,7 +318,9 @@ _rl_input_available ()
|
||||
return (_kbhit ());
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_SELECT)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -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 \
|
||||
|
@ -639,9 +639,9 @@ static struct message *find_message(struct errors *err, const char *lang,
|
||||
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)
|
||||
{
|
||||
|
||||
|
@ -648,7 +648,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
|
||||
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_SET *from)
|
||||
|
||||
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_set,uint table_offset,
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -953,8 +953,9 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info)
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -51,7 +51,7 @@ void AES::Process(byte* out, const byte* in, word32 sz)
|
||||
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* in, word32 sz)
|
||||
out += BLOCK_SIZE;
|
||||
in += BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DO_AES_ASM
|
||||
|
@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
|
||||
|
||||
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)
|
||||
|
@ -53,7 +53,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz)
|
||||
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 byte* in, word32 sz)
|
||||
out += BLOCK_SIZE;
|
||||
in += BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DO_BLOWFISH_ASM
|
||||
|
@ -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__ \
|
||||
( \
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz)
|
||||
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 byte* in, word32 sz)
|
||||
out += BLOCK_SIZE;
|
||||
in += BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DO_TWOFISH_ASM
|
||||
|
@ -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);
|
||||
|
@ -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,pchar fill);
|
||||
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
|
||||
|
@ -159,22 +159,6 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
|
||||
#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
|
||||
|
@ -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 */
|
||||
|
@ -38,7 +38,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.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 \
|
||||
|
@ -4425,7 +4425,6 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
|
||||
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;
|
||||
|
@ -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");
|
||||
|
||||
|
@ -42,7 +42,7 @@ char * my_load_path(char * to, const char *path,
|
||||
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 */
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ void pack_dirname(char * to, const char *from)
|
||||
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 *from)
|
||||
}
|
||||
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 *from)
|
||||
{ /* 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, const char *from)
|
||||
*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, const char *from)
|
||||
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, const char *from)
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
@ -508,10 +508,8 @@ uint bitmap_get_first_set(const MY_BITMAP *map)
|
||||
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 *map)
|
||||
{
|
||||
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 *map)
|
||||
if (!(*byte_ptr & (1 << k)))
|
||||
return (i*32) + (j*8) + k;
|
||||
}
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
}
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
}
|
||||
return MY_BIT_NONE;
|
||||
|
@ -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;
|
||||
|
@ -30,7 +30,7 @@ my_error_reporter my_getopt_error_reporter= &default_reporter;
|
||||
|
||||
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 ***argv,
|
||||
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 ***argv,
|
||||
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 *opts, void *value, char *argument,
|
||||
|
||||
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 length,
|
||||
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))
|
||||
{
|
||||
|
@ -269,7 +269,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
|
||||
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
|
||||
a+=a_length;
|
||||
b+=b_length;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HA_KEYTYPE_INT8:
|
||||
|
@ -163,7 +163,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
|
||||
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)
|
||||
|
@ -125,8 +125,7 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
|
||||
{
|
||||
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)
|
||||
|
@ -690,7 +690,6 @@ register cset *cs;
|
||||
case '-':
|
||||
SETERROR(REG_ERANGE);
|
||||
return; /* NOTE RETURN */
|
||||
break;
|
||||
default:
|
||||
c = '\0';
|
||||
break;
|
||||
|
@ -8691,7 +8691,13 @@ int Field_set::store(longlong nr, bool unsigned_val)
|
||||
{
|
||||
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;
|
||||
|
@ -4130,8 +4130,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
|
||||
context->first_name_resolution_table,
|
||||
context->last_name_resolution_table,
|
||||
reference, REPORT_ALL_ERRORS,
|
||||
!any_privileges &&
|
||||
TRUE, TRUE);
|
||||
!any_privileges, TRUE);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -5051,8 +5051,6 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
|
||||
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_target cast_type,
|
||||
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_target cast_type,
|
||||
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_target cast_type,
|
||||
}
|
||||
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_target cast_type,
|
||||
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;
|
||||
|
@ -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);
|
||||
|
@ -2905,7 +2905,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
|
||||
|
||||
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(IO_CACHE* file,
|
||||
}
|
||||
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_log_info const *rli)
|
||||
{
|
||||
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_operations(const Slave_reporting_capability
|
||||
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_operations(const Slave_reporting_capability *
|
||||
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_log_info *const rli,
|
||||
|
||||
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);
|
||||
|
@ -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 *table, uchar *key)
|
||||
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_row(TABLE *table)
|
||||
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);
|
||||
|
||||
/*
|
||||
|
@ -559,7 +559,7 @@ ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
|
||||
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(int sig)
|
||||
{
|
||||
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.mysql.com/doc/mysql/en/linux.html\n\n",
|
||||
#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 **argv)
|
||||
/* 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)
|
||||
|
@ -1120,8 +1120,7 @@ bool Relay_log_info::cached_charset_compare(char *charset) const
|
||||
{
|
||||
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);
|
||||
|
@ -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, enum_var_type type,
|
||||
|
||||
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 *thd, set_var *var)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1446,7 +1446,7 @@ sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
|
||||
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;
|
||||
|
@ -2113,7 +2113,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",
|
||||
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 *arg)
|
||||
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;
|
||||
|
@ -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 */
|
||||
|
@ -83,9 +83,10 @@ enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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! */
|
||||
|
||||
|
@ -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); \
|
||||
|
@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
|
||||
}
|
||||
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 uchar *rec, const uchar *key)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bcmp(rec+seg->start,key,seg->length))
|
||||
if (memcmp(rec+seg->start,key,seg->length))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -139,7 +139,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
||||
(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;
|
||||
|
@ -49,7 +49,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
|
||||
{
|
||||
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;
|
||||
|
@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
|
||||
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 *keyinfo, uint nod_flag,
|
||||
{
|
||||
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_KEYDEF *keyinfo, uint nod_flag,
|
||||
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 */
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
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;
|
||||
|
@ -293,8 +293,9 @@ static int myisammrg_parent_open_callback(void *callback_param,
|
||||
}
|
||||
}
|
||||
|
||||
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_children_callback(void *callback_param)
|
||||
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;
|
||||
|
@ -18,7 +18,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUT
|
||||
|
||||
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
|
||||
|
@ -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 ctype-czech.c ctype-eucjpms.c ctype-euc
|
||||
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
|
||||
|
@ -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 */
|
@ -203,7 +203,7 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs,
|
||||
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_INFO *cs,
|
||||
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 *cs,
|
||||
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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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, char * b1, char * b2, int length,
|
||||
{
|
||||
int i,error=0;
|
||||
|
||||
if (bcmp(b1,b2,length))
|
||||
if (memcmp(b1,b2,length))
|
||||
{
|
||||
errors++;
|
||||
printf("func: '%s' Buffers differ\nIs: ",message);
|
||||
|
@ -123,16 +123,16 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
|
||||
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++)
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user