diff options
author | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-02-22 16:59:57 +0200 |
---|---|---|
committer | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-02-22 16:59:57 +0200 |
commit | 50bd97a9436afe01606ad0cef323e7bda4d77e9b (patch) | |
tree | 260c15e9d6f383c404ea95e9e68ef07f0eba2cea | |
parent | e5706080f08eea5a5e67f85778307fd2cc021861 (diff) | |
download | mariadb-git-50bd97a9436afe01606ad0cef323e7bda4d77e9b.tar.gz |
Fixed compiler warnings (for linux and win32 and win64)
Fixed a couple of usage of not initialized warnings (unlikely cases)
client/mysqldump.c:
Fixed compiler warnings from 'max' build
client/mysqltest.c:
Removed compiler warnings
cmd-line-utils/readline/xmalloc.c:
Fixed compiler warnings from 'max' build
extra/comp_err.c:
Fixed compiler warnings from 'max' build
extra/yassl/include/openssl/ssl.h:
Changed prototype for SSL_set_fd() to fix compiler warnings (and possible errors) on windows 64 bit
extra/yassl/include/socket_wrapper.hpp:
Moved socket_t to ssl.h, to be able to removed compiler warnings on windows 64 bit
extra/yassl/src/ssl.cpp:
Changed prototype for SSL_set_fd() to fix compiler warnings (and possible errors) on windows 64 bit
extra/yassl/taocrypt/src/integer.cpp:
Fixed compiler warnings
include/my_global.h:
Added my_offsetof() macro from 5.1 to get rid of compiler warnings
innobase/include/ut0byte.ic:
Fixed compiler warnings on win64
innobase/include/ut0ut.ic:
Fixed compiler warnings on win64
libmysql/libmysql.def:
Fixed compiler warnings on win64
myisam/mi_packrec.c:
Fixed compiler warnings on win64
myisam/myisamchk.c:
Fixed compiler warnings from 'max' build
mysys/base64.c:
Fixed compiler warnings on win64
mysys/mf_keycache.c:
Fixed compiler warnings from 'max' build
mysys/my_getopt.c:
Fixed compiler warnings from 'max' build
mysys/my_init.c:
Fixed compiler warnings from 'max' build
mysys/my_thr_init.c:
Fixed compiler warnings
mysys/ptr_cmp.c:
Fixed compiler warnings from 'max' build
ndb/include/kernel/signaldata/DictTabInfo.hpp:
Fixed compiler warnings
server-tools/instance-manager/mysql_connection.cc:
Fixed compiler warnings
server-tools/instance-manager/mysqlmanager.cc:
Fixed compiler warnings
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/ha_berkeley.cc:
Moved get_auto_primary_key() here as int5store() gives (wrong) compiler warnings in win64
sql/ha_berkeley.h:
Moved get_auto_primary_key() to ha_berkeley.cc
sql/ha_innodb.cc:
Fixed compiler warnings
sql/item.cc:
Fixed compiler warnings from 'max' build
sql/item_timefunc.cc:
Fixed compiler warnings
sql/mysqld.cc:
Fixed compiler warnings
sql/sql_acl.cc:
Fixed compiler warnings from 'max' build
sql/sql_base.cc:
Fixed compiler warnings from 'max' build
sql/sql_insert.cc:
Initialize variable that may be used unitialized on error conditions (not fatal)
sql/sql_prepare.cc:
Fixed compiler warnings from 'max' build
sql/sql_select.cc:
Fixed compiler warnings
sql/sql_show.cc:
Fixed compiler warnings
sql/udf_example.def:
Fixed compiler warnings on win64
sql/unireg.cc:
Initialize variable that may be used unitialized on error conditions
strings/ctype-ucs2.c:
Fixed compiler warnings
strings/ctype-utf8.c:
Fixed compiler warnings
strings/decimal.c:
Fixed compiler warnings
support-files/compiler_warnings.supp:
Ignore warnings from sql_yacc.cc that are hard to remove
Ignore some not important warnings from windows 64 bit build
tools/mysqlmanager.c:
Fixed compiler warnings
43 files changed, 122 insertions, 61 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index 6863de93224..94ab9dac5ac 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2016,7 +2016,8 @@ continue_xml: */ -static void dump_triggers_for_table(char *table, char *db) +static void dump_triggers_for_table(char *table, + char *db __attribute__((unused))) { char *result_table; char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3]; @@ -2025,7 +2026,6 @@ static void dump_triggers_for_table(char *table, char *db) FILE *sql_file= md_result_file; MYSQL_RES *result; MYSQL_ROW row; - DBUG_ENTER("dump_triggers_for_table"); DBUG_PRINT("enter", ("db: %s, table: %s", db, table)); diff --git a/client/mysqltest.c b/client/mysqltest.c index 15f2e161ba8..616077fea9b 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1844,7 +1844,7 @@ void do_copy_file(struct st_command *command) void do_chmod_file(struct st_command *command) { - ulong mode= 0; + long mode= 0; static DYNAMIC_STRING ds_mode; static DYNAMIC_STRING ds_file; const struct command_arg chmod_file_args[] = { @@ -1864,7 +1864,7 @@ void do_chmod_file(struct st_command *command) die("You must write a 4 digit octal number for mode"); DBUG_PRINT("info", ("chmod %o %s", (uint)mode, ds_file.str)); - handle_command_error(command, chmod(ds_file.str, mode)); + handle_command_error(command, chmod(ds_file.str, (mode_t) mode)); dynstr_free(&ds_mode); dynstr_free(&ds_file); DBUG_VOID_RETURN; @@ -6275,7 +6275,8 @@ typedef struct st_replace_found { void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds, - const char *str, int len) + const char *str, + int len __attribute__((unused))) { reg1 REPLACE *rep_pos; reg2 REPLACE_STRING *rep_str; @@ -6666,7 +6667,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, we need at least what we have so far in the buffer + the part before this match */ - need_buf_len= (res_p - buf) + subs[0].rm_so; + need_buf_len= (res_p - buf) + (int) subs[0].rm_so; /* on this pass, calculate the memory for the result buffer */ while (expr_p < replace_end) @@ -6676,17 +6677,17 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, if (c == '\\' && expr_p + 1 < replace_end) { - back_ref_num= expr_p[1] - '0'; + back_ref_num= (int) (expr_p[1] - '0'); } /* found a valid back_ref (eg. \1)*/ if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub) { - int start_off,end_off; + regoff_t start_off, end_off; if ((start_off=subs[back_ref_num].rm_so) > -1 && (end_off=subs[back_ref_num].rm_eo) > -1) { - need_buf_len += (end_off - start_off); + need_buf_len += (int) (end_off - start_off); } expr_p += 2; } @@ -6706,7 +6707,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, /* copy the pre-match part */ if (subs[0].rm_so) { - memcpy(res_p, str_p, subs[0].rm_so); + memcpy(res_p, str_p, (size_t) subs[0].rm_so); res_p+= subs[0].rm_so; } diff --git a/cmd-line-utils/readline/xmalloc.c b/cmd-line-utils/readline/xmalloc.c index 698807addf9..848a3563fa9 100644 --- a/cmd-line-utils/readline/xmalloc.c +++ b/cmd-line-utils/readline/xmalloc.c @@ -57,7 +57,7 @@ xmalloc (bytes) temp = malloc (bytes); if (temp == 0) - memory_error_and_abort ("xmalloc"); + memory_error_and_abort ((char*) "xmalloc"); return (temp); } @@ -71,7 +71,7 @@ xrealloc (pointer, bytes) temp = pointer ? realloc (pointer, bytes) : malloc (bytes); if (temp == 0) - memory_error_and_abort ("xrealloc"); + memory_error_and_abort ((char*) "xrealloc"); return (temp); } diff --git a/extra/comp_err.c b/extra/comp_err.c index df6df1678a6..a9bda6e3124 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -41,7 +41,9 @@ static char *NAMEFILE= (char*) "mysqld_ername.h"; static char *STATEFILE= (char*) "sql_state.h"; static char *TXTFILE= (char*) "../sql/share/errmsg.txt"; static char *DATADIRECTORY= (char*) "../sql/share/"; +#ifndef DBUG_OFF static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace"; +#endif /* Header for errmsg.sys files */ uchar file_head[]= { 254, 254, 2, 1 }; @@ -402,6 +404,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, int rcount= 0; DBUG_ENTER("parse_input_file"); + *top_error= 0; + *top_lang= 0; if (!(file= my_fopen(file_name, O_RDONLY | O_SHARE, MYF(MY_WME)))) DBUG_RETURN(0); diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 16110c52f43..d0c49d6816c 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -33,7 +33,6 @@ #include "opensslv.h" /* for version number */ #include "rsa.h" - #define YASSL_VERSION "1.5.8" @@ -190,11 +189,16 @@ enum { /* ERR Constants */ EVP_R_BAD_DECRYPT = 2 }; +#ifdef WIN + typedef SOCKET socket_t; +#else + typedef int socket_t; +#endif SSL_CTX* SSL_CTX_new(SSL_METHOD*); SSL* SSL_new(SSL_CTX*); -int SSL_set_fd (SSL*, int); +int SSL_set_fd (SSL*, socket_t); int SSL_connect(SSL*); int SSL_write(SSL*, const void*, int); int SSL_read(SSL*, void*, int); diff --git a/extra/yassl/include/socket_wrapper.hpp b/extra/yassl/include/socket_wrapper.hpp index 308704c2af0..de28778ead9 100644 --- a/extra/yassl/include/socket_wrapper.hpp +++ b/extra/yassl/include/socket_wrapper.hpp @@ -38,16 +38,14 @@ #include <netinet/in.h> #include <arpa/inet.h> #endif +#include "openssl/ssl.h" /* for socket_t */ namespace yaSSL { typedef unsigned int uint; -#ifdef _WIN32 - typedef SOCKET socket_t; -#else - typedef int socket_t; +#ifndef _WIN32 const socket_t INVALID_SOCKET = -1; const int SD_RECEIVE = 0; const int SD_SEND = 1; diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index 837121c249d..1f9d0dd4020 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -229,7 +229,7 @@ void SSL_free(SSL* ssl) } -int SSL_set_fd(SSL* ssl, int fd) +int SSL_set_fd(SSL* ssl, socket_t fd) { ssl->useSocket().set_fd(fd); return SSL_SUCCESS; diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 419783403ea..84255aa8544 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -3390,7 +3390,7 @@ void Integer::DivideByPowerOf2(Integer &r, Integer &q, const Integer &a, CopyWords(r.reg_.get_buffer(), a.reg_.get_buffer(), wordCount); SetWords(r.reg_+wordCount, 0, r.reg_.size()-wordCount); if (n % WORD_BITS != 0) - r.reg_[wordCount-1] %= (1 << (n % WORD_BITS)); + r.reg_[wordCount-1] %= ((word) 1 << (n % WORD_BITS)); } else { diff --git a/include/my_global.h b/include/my_global.h index 23fe71caa8d..21fe1ebc3cb 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -846,6 +846,21 @@ typedef long long my_ptrdiff_t; #define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B)) +/* + Custom version of standard offsetof() macro which can be used to get + offsets of members in class for non-POD types (according to the current + version of C++ standard offsetof() macro can't be used in such cases and + attempt to do so causes warnings to be emitted, OTOH in many cases it is + still OK to assume that all instances of the class has the same offsets + for the same members). + + This is temporary solution which should be removed once File_parser class + and related routines are refactored. +*/ + +#define my_offsetof(TYPE, MEMBER) \ + ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) + #define NullS (char *) 0 /* Nowdays we do not support MessyDos */ #ifndef NEAR diff --git a/innobase/include/ut0byte.ic b/innobase/include/ut0byte.ic index e141de3aa3f..3d268325674 100644 --- a/innobase/include/ut0byte.ic +++ b/innobase/include/ut0byte.ic @@ -388,8 +388,8 @@ ut_bit_set_nth( ut_ad(TRUE == 1); if (val) { - return((1 << n) | a); + return(((ulint) 1 << n) | a); } else { - return(~(1 << n) & a); + return(~((ulint) 1 << n) & a); } } diff --git a/innobase/include/ut0ut.ic b/innobase/include/ut0ut.ic index 9a0ef1c0d5b..4bbb4eac3c3 100644 --- a/innobase/include/ut0ut.ic +++ b/innobase/include/ut0ut.ic @@ -170,5 +170,5 @@ ut_2_exp( /* out: 2 to power n */ ulint n) /* in: number */ { - return(1 << n); + return((ulint) 1 << n); } diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index cf45e20a697..8c6b71d9553 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -1,5 +1,4 @@ LIBRARY LIBMYSQL -DESCRIPTION 'MySQL 5.0 Client Library' VERSION 6.0 EXPORTS _dig_vec_lower diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 6df64ae2cd4..0bd13d228d1 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -564,7 +564,7 @@ static void fill_quick_table(uint16 *table, uint bits, uint max_bits, */ value|= (max_bits - bits) << 8 | IS_CHAR; - for (end= table + (1 << bits); table < end; table++) + for (end= table + ((uint) 1 << bits); table < end; table++) { *table= (uint16) value; } diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index eab06525cd4..0332644c5a6 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -720,6 +720,7 @@ get_one_option(int optid, case 2: method_conv= MI_STATS_METHOD_IGNORE_NULLS; break; + default: assert(0); /* Impossible */ } check_param.stats_method= method_conv; break; diff --git a/mysys/base64.c b/mysys/base64.c index 6a6b7eae359..47b93942784 100644 --- a/mysys/base64.c +++ b/mysys/base64.c @@ -98,10 +98,10 @@ base64_encode(const void *src, size_t src_len, char *dst) } -static inline unsigned +static inline uint pos(unsigned char c) { - return strchr(base64_table, c) - base64_table; + return (uint) (strchr(base64_table, c) - base64_table); } diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 0762d10ab08..87f136dbf81 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -167,8 +167,10 @@ static void unlink_from_queue(KEYCACHE_WQUEUE *wqueue, struct st_my_thread_var *thread); #endif static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block); +#ifndef DBUG_OFF static void test_key_cache(KEY_CACHE *keycache, const char *where, my_bool lock); +#endif #define KEYCACHE_HASH(f, pos) \ (((ulong) ((pos) >> keycache->key_cache_shift)+ \ @@ -2605,7 +2607,8 @@ static int flush_all_key_blocks(KEY_CACHE *keycache) 0 on success (always because it can't fail) */ -int reset_key_cache_counters(const char *name, KEY_CACHE *key_cache) +int reset_key_cache_counters(const char *name __attribute__((unused)), + KEY_CACHE *key_cache) { DBUG_ENTER("reset_key_cache_counters"); if (!key_cache->key_cache_inited) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 250c10e8479..623c48b2e55 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -194,6 +194,7 @@ 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))) { diff --git a/mysys/my_init.c b/mysys/my_init.c index cc4bef10e8d..2bcf5f44c4d 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -197,7 +197,9 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", } if (!(infoflag & MY_DONT_FREE_DBUG)) + { DBUG_END(); /* Must be done before my_thread_end */ + } #ifdef THREAD my_thread_end(); my_thread_global_end(); diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 67ab1e4a38a..7a5fdbf8ad6 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -54,8 +54,8 @@ pthread_mutexattr_t my_errorcheck_mutexattr; race conditions in NPTL pthread_exit code. */ -static -pthread_handler_t nptl_pthread_exit_hack_handler(void *arg) +static pthread_handler_t +nptl_pthread_exit_hack_handler(void *arg __attribute__((unused))) { /* Do nothing! */ pthread_exit(0); @@ -400,9 +400,9 @@ const char *my_thread_name(void) static uint get_thread_lib(void) { +#ifdef _CS_GNU_LIBPTHREAD_VERSION char buff[64]; -#ifdef _CS_GNU_LIBPTHREAD_VERSION confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); if (!strncasecmp(buff, "NPTL", 4)) diff --git a/mysys/ptr_cmp.c b/mysys/ptr_cmp.c index a3bc3702c34..33c28160a4c 100644 --- a/mysys/ptr_cmp.c +++ b/mysys/ptr_cmp.c @@ -185,7 +185,7 @@ my_off_t my_get_ptr(byte *ptr, uint pack_length) case 3: pos= (my_off_t) mi_uint3korr(ptr); break; case 2: pos= (my_off_t) mi_uint2korr(ptr); break; case 1: pos= (my_off_t) mi_uint2korr(ptr); break; - default: DBUG_ASSERT(0); + default: DBUG_ASSERT(0); return 0; } return pos; } diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp index 57111a8aea1..9f4898174fe 100644 --- a/ndb/include/kernel/signaldata/DictTabInfo.hpp +++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp @@ -46,17 +46,17 @@ inline int my_decimal_get_binary_size(uint precision, uint scale) #endif #define DTIMAP(x, y, z) \ - { DictTabInfo::y, offsetof(x, z), SimpleProperties::Uint32Value, 0, (~0), 0 } + { DictTabInfo::y, my_offsetof(x, z), SimpleProperties::Uint32Value, 0, (~0), 0 } #define DTIMAP2(x, y, z, u, v) \ - { DictTabInfo::y, offsetof(x, z), SimpleProperties::Uint32Value, u, v, 0 } + { DictTabInfo::y, my_offsetof(x, z), SimpleProperties::Uint32Value, u, v, 0 } #define DTIMAPS(x, y, z, u, v) \ - { DictTabInfo::y, offsetof(x, z), SimpleProperties::StringValue, u, v, 0 } + { DictTabInfo::y, my_offsetof(x, z), SimpleProperties::StringValue, u, v, 0 } #define DTIMAPB(x, y, z, u, v, l) \ - { DictTabInfo::y, offsetof(x, z), SimpleProperties::BinaryValue, u, v, \ - offsetof(x, l) } + { DictTabInfo::y, my_offsetof(x, z), SimpleProperties::BinaryValue, u, v, \ + my_offsetof(x, l) } #define DTIBREAK(x) \ { DictTabInfo::x, 0, SimpleProperties::InvalidValue, 0, 0, 0 } diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc index 32618a6cdd6..3e1694e24ee 100644 --- a/server-tools/instance-manager/mysql_connection.cc +++ b/server-tools/instance-manager/mysql_connection.cc @@ -135,7 +135,7 @@ int Mysql_connection_thread::init() /* Initialize random number generator */ { ulong seed1= (ulong) &rand_st + rand(); - ulong seed2= rand() + time(0); + ulong seed2= rand() + (ulong) time(0); randominit(&rand_st, seed1, seed2); } /* Fill scramble - server's random message used for handshake */ diff --git a/server-tools/instance-manager/mysqlmanager.cc b/server-tools/instance-manager/mysqlmanager.cc index 2b6921d59aa..66fc0b68ac4 100644 --- a/server-tools/instance-manager/mysqlmanager.cc +++ b/server-tools/instance-manager/mysqlmanager.cc @@ -199,7 +199,7 @@ static void init_environment(char *progname) MY_INIT(progname); log_init(); umask(0117); - srand(time(0)); + srand((uint) time(0)); } diff --git a/sql/filesort.cc b/sql/filesort.cc index 93fa566349c..e40c492fe8e 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -98,7 +98,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, uint maxbuffer; BUFFPEK *buffpek; ha_rows records= HA_POS_ERROR; - uchar **sort_keys; + uchar **sort_keys= 0; IO_CACHE tempfile, buffpek_pointers, *selected_records_file, *outfile; SORTPARAM param; bool multi_byte_charset; diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index d63935f1a9c..e78808e3308 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -233,6 +233,7 @@ static int berkeley_close_connection(THD *thd) return 0; } + bool berkeley_flush_logs() { int error; @@ -439,6 +440,15 @@ ulong ha_berkeley::index_flags(uint idx, uint part, bool all_parts) const } +void ha_berkeley::get_auto_primary_key(byte *to) +{ + pthread_mutex_lock(&share->mutex); + share->auto_ident++; + int5store(to,share->auto_ident); + pthread_mutex_unlock(&share->mutex); +} + + static int berkeley_cmp_hidden_key(DB* file, const DBT *new_key, const DBT *saved_key) { diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 051990b0ee5..336c90f009a 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -141,13 +141,7 @@ class ha_berkeley: public handler enum thr_lock_type lock_type); void get_status(); - inline void get_auto_primary_key(byte *to) - { - pthread_mutex_lock(&share->mutex); - share->auto_ident++; - int5store(to,share->auto_ident); - pthread_mutex_unlock(&share->mutex); - } + void get_auto_primary_key(byte *to); ulonglong get_auto_increment(); void print_error(int error, myf errflag); uint8 table_cache_type() { return HA_CACHE_TBL_TRANSACT; } diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index d854c362df8..8a35ff000a8 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2711,7 +2711,8 @@ ha_innobase::store_key_val_for_row( true_len = (ulint) cs->cset->well_formed_len(cs, (const char *) data, (const char *) data + len, - key_len / cs->mbmaxlen, + (uint) (key_len / + cs->mbmaxlen), &error); } @@ -2780,7 +2781,8 @@ ha_innobase::store_key_val_for_row( (const char *) blob_data, (const char *) blob_data + blob_len, - key_len / cs->mbmaxlen, + (uint) (key_len / + cs->mbmaxlen), &error); } @@ -2852,7 +2854,8 @@ ha_innobase::store_key_val_for_row( (const char *)src_start, (const char *)src_start + key_len, - key_len / cs->mbmaxlen, + (uint) (key_len / + cs->mbmaxlen), &error); } } diff --git a/sql/item.cc b/sql/item.cc index 205ae49a3cb..4c346070f10 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1521,6 +1521,8 @@ bool agg_item_charsets(DTCollation &coll, const char *fname, doesn't display each argument's characteristics. - if nargs is 1, then this error cannot happen. */ + LINT_INIT(safe_args[0]); + LINT_INIT(safe_args[1]); if (nargs >=2 && nargs <= 3) { safe_args[0]= args[0]; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 8b4e93fa085..683cd8803d6 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1608,7 +1608,7 @@ int Item_func_now::save_in_field(Field *to, bool no_conversions) void Item_func_sysdate_local::store_now_in_TIME(TIME *now_time) { THD *thd= current_thd; - thd->variables.time_zone->gmt_sec_to_TIME(now_time, time(NULL)); + thd->variables.time_zone->gmt_sec_to_TIME(now_time, (my_time_t) time(NULL)); thd->time_zone_used= 1; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index fe3ba1c6d5a..74aad27d0fe 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -324,6 +324,7 @@ static I_List<THD> thread_cache; #ifndef EMBEDDED_LIBRARY static struct passwd *user_info; static pthread_t select_thread; +static uint thr_kill_signal; #endif static pthread_cond_t COND_thread_cache, COND_flush_thread_cache; @@ -522,7 +523,6 @@ rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; pthread_cond_t COND_refresh,COND_thread_count, COND_global_read_lock; pthread_t signal_thread; pthread_attr_t connection_attrib; -static uint thr_kill_signal; File_parser_dummy_hook file_parser_dummy_hook; @@ -3216,7 +3216,7 @@ server."); #ifdef HAVE_REPLICATION if (opt_bin_log && expire_logs_days) { - long purge_time= time(0) - expire_logs_days*24*60*60; + long purge_time= (long) (time(0) - expire_logs_days*24*60*60); if (purge_time >= 0) mysql_bin_log.purge_logs_before_date(purge_time); } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 39a38f3c44e..298fb61d5f0 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5021,6 +5021,8 @@ static int handle_grant_struct(uint struct_no, bool drop, user= grant_name->user; host= grant_name->host.hostname; break; + default: + assert(0); } if (! user) user= ""; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ad9cd5985d1..767b955252c 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2975,6 +2975,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name, if (nj_col->view_field) { Item *item; + LINT_INIT(arena); if (register_tree_change) arena= thd->activate_stmt_arena_if_needed(&backup); /* diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index aa429f9250e..3e7c3d15e78 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -410,6 +410,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, #ifndef EMBEDDED_LIBRARY if (lock_type == TL_WRITE_DELAYED) { + res= 1; if (thd->locked_tables) { DBUG_ASSERT(table_list->db); /* Must be set in the parser */ diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ccf70444385..774b82ce618 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2015,6 +2015,7 @@ void mysql_sql_stmt_prepare(THD *thd) uint query_len; DBUG_ENTER("mysql_sql_stmt_prepare"); DBUG_ASSERT(thd->protocol == &thd->protocol_simple); + LINT_INIT(query_len); if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bbb76616733..63c8ddad3ae 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8081,7 +8081,7 @@ static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list, */ if (nested_join->join_list.elements != 1) { - nested_join->nj_map= 1 << first_unused++; + nested_join->nj_map= (nested_join_map) 1 << first_unused++; first_unused= build_bitmap_for_nested_joins(&nested_join->join_list, first_unused); } @@ -10056,6 +10056,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) enum_nested_loop_state error= NESTED_LOOP_OK; JOIN_TAB *join_tab; DBUG_ENTER("do_select"); + LINT_INIT(join_tab); join->procedure=procedure; join->tmp_table= table; /* Save for easy recursion */ @@ -10100,7 +10101,6 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) else { DBUG_ASSERT(join->tables); - DBUG_ASSERT(join_tab); error= sub_select(join,join_tab,0); if (error == NESTED_LOOP_OK || error == NESTED_LOOP_NO_MORE_ROWS) error= sub_select(join,join_tab,1); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index c2b2c77fbda..c4b06934fc3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2515,20 +2515,21 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables, if (file->create_time) { thd->variables.time_zone->gmt_sec_to_TIME(&time, - file->create_time); + (my_time_t) file->create_time); table->field[14]->store_time(&time, MYSQL_TIMESTAMP_DATETIME); table->field[14]->set_notnull(); } if (file->update_time) { thd->variables.time_zone->gmt_sec_to_TIME(&time, - file->update_time); + (my_time_t) file->update_time); table->field[15]->store_time(&time, MYSQL_TIMESTAMP_DATETIME); table->field[15]->set_notnull(); } if (file->check_time) { - thd->variables.time_zone->gmt_sec_to_TIME(&time, file->check_time); + thd->variables.time_zone->gmt_sec_to_TIME(&time, + (my_time_t) file->check_time); table->field[16]->store_time(&time, MYSQL_TIMESTAMP_DATETIME); table->field[16]->set_notnull(); } diff --git a/sql/udf_example.def b/sql/udf_example.def index ee107d58e51..7a87147d7b6 100644 --- a/sql/udf_example.def +++ b/sql/udf_example.def @@ -1,5 +1,4 @@ LIBRARY udf_example -DESCRIPTION 'MySQL Sample for UDF' VERSION 1.0 EXPORTS lookup diff --git a/sql/unireg.cc b/sql/unireg.cc index 033daa20524..06b2e0c10a2 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -839,7 +839,10 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type, field->field_name, &table); if (!regfield) + { + error= 1; goto err; // End of memory + } if (!(field->flags & NOT_NULL_FLAG)) { diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index baee37c103b..6b1ba3c1ef6 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -206,6 +206,7 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs, const uchar *se=s+slen; const uchar *te=t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); while ( s < se && t < te ) { @@ -320,7 +321,8 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs, const char *se=s+len; const char *te=t+len; MY_UNICASE_INFO **uni_plane= cs->caseinfo; - + LINT_INIT(s_wc); + while ( s < se && t < te ) { int plane; @@ -1382,6 +1384,7 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, my_wc_t s_wc,t_wc; const uchar *se=s+slen; const uchar *te=t+tlen; + LINT_INIT(s_wc); while ( s < se && t < te ) { diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index a3403579181..0e28ff7e342 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2310,6 +2310,7 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs, const uchar *se=s+slen; const uchar *te=t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); while ( s < se && t < te ) { @@ -2379,6 +2380,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs, my_wc_t s_wc,t_wc; const uchar *se= s+slen, *te= t+tlen; MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE diff_if_only_endspace_difference= 0; diff --git a/strings/decimal.c b/strings/decimal.c index bfbf6187064..ea92174bfc8 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1356,6 +1356,7 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale) { int i=dig2bytes[intg0x]; dec1 x; + LINT_INIT(x); switch (i) { case 1: x=mi_sint1korr(from); break; @@ -1397,6 +1398,7 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale) { int i=dig2bytes[frac0x]; dec1 x; + LINT_INIT(x); switch (i) { case 1: x=mi_sint1korr(from); break; @@ -1483,6 +1485,7 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, sanity(to); + LINT_INIT(round_digit); switch (mode) { case HALF_UP: case HALF_EVEN: round_digit=5; break; diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index d97ffbfafe2..9e18bee0f9e 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -2,3 +2,11 @@ DictTabInfo.cpp : .*invalid access to non-static.* DictTabInfo.cpp : .*macro was used incorrectly.* DbdihMain.cpp : .*unused variable.* : 6666-6705 DbtupExecQuery.cpp : .*unused variable.* : 1448-1449 +sql_yacc.cc : .*switch statement contains 'default' but no 'case' labels.* + +# +# Ignore all conversion warnings on windows 64 +# (Is safe as we are not yet supporting strings >= 2G) +# +.* : conversion from 'size_t' to .*int'.* +.* : conversion from '__int64' to .*int'.* diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index 6a8621fac42..f952a5806b4 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -1312,7 +1312,7 @@ static void usage() static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), - char *argument) + char *argument __attribute__((unused))) { switch (optid) { case '#': |