← Back to team overview

maria-developers team mailing list archive

bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2770)

 

#At lp:maria based on revid:monty@xxxxxxxxxxxx-20091126201933-dgoynszp2z90gknl

 2770 Michael Widenius	2009-11-30
      Remove compiler warnings (Including some warnings from -Wstrict-aliasing)
      Don't use static link by default (in compile-pentium) as some new systems doesn't have all static libraries available
      Change type for functions in plugin.h:str_mysql_ftparser_param() to const unsigned char and string lengths to size_t.
      One effect of the above change is that one needs to include mysql_global.h or define size_t before including plugin.h
      This fixes a case where mysql_client_test failed with newer gcc that enables strict-aliasing by default
      modified:
        BUILD/compile-pentium
        client/mysql_upgrade.c
        cmd-line-utils/readline/config_readline.h
        cmd-line-utils/readline/display.c
        cmd-line-utils/readline/history.c
        cmd-line-utils/readline/rlmbutil.h
        cmd-line-utils/readline/text.c
        cmd-line-utils/readline/xmalloc.c
        configure.in
        include/mysql/plugin.h
        include/mysql/plugin.h.pp
        libmysql/libmysql.c
        mysql-test/t/information_schema.test
        mysql-test/t/not_partition.test
        mysys/lf_hash.c
        mysys/my_redel.c
        regex/engine.c
        regex/engine.ih
        sql/sp_head.cc
        sql/sql_base.cc
        sql/sql_builtin.cc.in
        sql/sql_parse.cc
        sql/sql_select.cc
        sql/sql_show.cc
        sql/table.cc
        storage/maria/ha_maria.cc
        storage/maria/lockman.c
        storage/maria/ma_check.c
        storage/maria/ma_check_standalone.h
        storage/maria/ma_ft_boolean_search.c
        storage/maria/ma_ft_nlq_search.c
        storage/maria/ma_ft_parser.c
        storage/maria/ma_ftdefs.h
        storage/maria/ma_sort.c
        storage/maria/ma_state.c
        storage/maria/maria_def.h
        storage/maria/maria_ftdump.c
        storage/maria/trnman.c
        storage/myisam/ft_boolean_search.c
        storage/myisam/ft_nlq_search.c
        storage/myisam/ft_parser.c
        storage/myisam/ft_stopwords.c
        storage/myisam/ftdefs.h
        storage/myisam/ha_myisam.cc
        storage/myisam/mi_check.c
        storage/myisam/myisam_ftdump.c
        storage/myisam/myisamchk.c
        storage/myisam/myisamdef.h
        storage/myisam/myisamlog.c
        storage/myisam/sort.c
        storage/xtradb/fil/fil0fil.c
        storage/xtradb/trx/trx0i_s.c

per-file messages:
  BUILD/compile-pentium
    Don't use static link by default as some new systems doesn't have all static libraries available
  client/mysql_upgrade.c
    Remove not used variable
  cmd-line-utils/readline/config_readline.h
    Define some constants to get rid of compiler warnings on Linux
  cmd-line-utils/readline/display.c
    Get rid of compiler warnings
  cmd-line-utils/readline/history.c
    Got rid of compiler warnings:
    - Defining some strings as const
    - Added cast
  cmd-line-utils/readline/rlmbutil.h
    Added cast to get rid of compiler warnings
  cmd-line-utils/readline/text.c
    Remove not needed initialization to get rid of compiler warnings
  cmd-line-utils/readline/xmalloc.c
    Changed types to 'const char* to get rid of compiler warnings
  configure.in
    Ensure that we use MariaDB as suffix
  include/mysql/plugin.h
    Changed types to 'const unsigned char* to get rid of compiler warnings (in other parts of the code)
    Change length for not \0 terminated string to size_t
  include/mysql/plugin.h.pp
    Update related to plugin.h
  libmysql/libmysql.c
    Fixed bug that caused core dump with newer gcc when strict aliasing is not turned off
  mysql-test/t/information_schema.test
    Test is depending on innodb
  mysql-test/t/not_partition.test
    Fixed wrong directory name
    (Not noticed before as we don't ususally run this test)
  mysys/lf_hash.c
    Got rid of compiler warnings from -Wstrict-aliasing
  mysys/my_redel.c
    Removed not used variable
  regex/engine.c
    Changed types to 'const char* to get rid of compiler warnings
  regex/engine.ih
    Changed types to 'const char* to get rid of compiler warnings
  sql/sp_head.cc
    Got rid of compiler warning from -Wstrict-aliasing
  sql/sql_base.cc
    Got rid of compiler warnings from -Wstrict-aliasing
    (The original code was probably wrong as nj_col->table_field was
  sql/sql_builtin.cc.in
    plugin.h needs to have size_t defined
  sql/sql_parse.cc
    Remove used variable
  sql/sql_select.cc
    Got rid of compiler warnings from -Wstrict-aliasing
  sql/sql_show.cc
    Added #ifdef to get rid of compiler warning when not using partition engine
  sql/table.cc
    Got rid of compiler warning from -Wstrict-aliasing
  storage/maria/ha_maria.cc
    Got rid of compiler warnings from -Wstrict-aliasing:
    - Use the thd_killed() API function
  storage/maria/lockman.c
    Got rid of compiler warnings from -Wstrict-aliasing
  storage/maria/ma_check.c
    Got rid of compiler warnings from -Wstrict-aliasing
    Change to use new version of _ma_killed_ptr; Don't call it as often as before
  storage/maria/ma_check_standalone.h
    Update to compatible _ma_killed_ptr() from ha_maria.cc
  storage/maria/ma_ft_boolean_search.c
    Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
  storage/maria/ma_ft_nlq_search.c
    Got rid of compiler warnings from -Wstrict-aliasing
    Ensure that 'subkeys' is 32 bit
  storage/maria/ma_ft_parser.c
    Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
  storage/maria/ma_ftdefs.h
    Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
  storage/maria/ma_sort.c
    Change to use new version of _ma_killed_ptr; Don't call it as often as before
  storage/maria/ma_state.c
    Got rid of compiler warnings from -Wstrict-aliasing
  storage/maria/maria_def.h
    Redefine ma_killed_ptr()
  storage/maria/maria_ftdump.c
    Got rid of compiler warnings from -Wstrict-aliasing
  storage/maria/trnman.c
    Got rid of compiler warnings from -Wstrict-aliasing
  storage/myisam/ft_boolean_search.c
    Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
  storage/myisam/ft_nlq_search.c
    Got rid of compiler warnings from -Wstrict-aliasing
  storage/myisam/ft_parser.c
    Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
  storage/myisam/ft_stopwords.c
    Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
  storage/myisam/ftdefs.h
    Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
  storage/myisam/ha_myisam.cc
    Got rid of compiler warnings from -Wstrict-aliasing:
    - Use the thd_killed() API function
  storage/myisam/mi_check.c
    Use new killed_ptr() function
  storage/myisam/myisam_ftdump.c
    Got rid of compiler warnings from -Wstrict-aliasing
  storage/myisam/myisamchk.c
    Update to compatible killed_ptr() from ha_myisam.cc
  storage/myisam/myisamdef.h
    Redefine killed_ptr()
  storage/myisam/myisamlog.c
    Got rid of compiler warnings from -Wstrict-aliasing
  storage/myisam/sort.c
    Change to use new version of killed_ptr; Don't call it as often as before
  storage/xtradb/fil/fil0fil.c
    Fixedc ompiler warning
  storage/xtradb/trx/trx0i_s.c
    Include mysql_plugin.h later to ensure that size_t is defined
=== modified file 'BUILD/compile-pentium'
--- a/BUILD/compile-pentium	2007-04-11 12:12:00 +0000
+++ b/BUILD/compile-pentium	2009-11-29 23:08:56 +0000
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$pentium_cflags $fast_cflags"
-extra_configs="$pentium_configs $static_link"
+extra_configs="$pentium_configs"
 strip=yes
 
 . "$path/FINISH.sh"

=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2009-11-06 17:22:32 +0000
+++ b/client/mysql_upgrade.c	2009-11-29 23:08:56 +0000
@@ -552,7 +552,6 @@ static int upgrade_already_done(void)
   FILE *in;
   char upgrade_info_file[FN_REFLEN]= {0};
   char buf[sizeof(MYSQL_SERVER_VERSION)+1];
-  char *res;
 
   if (get_upgrade_info_file_name(upgrade_info_file))
     return 0; /* Could not get filename => not sure */

=== modified file 'cmd-line-utils/readline/config_readline.h'
--- a/cmd-line-utils/readline/config_readline.h	2005-04-20 10:02:07 +0000
+++ b/cmd-line-utils/readline/config_readline.h	2009-11-29 23:08:56 +0000
@@ -7,6 +7,11 @@
 #  include <config.h>
 #endif
 
+/* to get wcwidth() defined */
+#define _XOPEN_SOURCE 600
+#define _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_
+
 /*
  Ultrix botches type-ahead when switching from canonical to
    non-canonical mode, at least through version 4.3

=== modified file 'cmd-line-utils/readline/display.c'
--- a/cmd-line-utils/readline/display.c	2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/display.c	2009-11-29 23:08:56 +0000
@@ -461,12 +461,12 @@ rl_redisplay ()
   register char *line;
   int inv_botlin, lb_linenum, o_cpos;
   int newlines, lpos, temp, modmark;
-  char *prompt_this_line;
+  const char *prompt_this_line;
 #if defined (HANDLE_MULTIBYTE)
-  int num, n0;
+  int num, n0= 0;
   wchar_t wc;
   size_t wc_bytes;
-  int wc_width;
+  int wc_width= 0;
   mbstate_t ps;
   int _rl_wrapped_multicolumn = 0;
 #endif
@@ -824,7 +824,7 @@ rl_redisplay ()
 		  cpos_buffer_position = out;
 		  lb_linenum = newlines;
 		}
-	      for (i = in; i < in+wc_bytes; i++)
+	      for (i = in; (size_t) i < in+wc_bytes; i++)
 		line[out++] = rl_line_buffer[i];
 	      for (i = 0; i < wc_width; i++)
 		CHECK_LPOS();

=== modified file 'cmd-line-utils/readline/history.c'
--- a/cmd-line-utils/readline/history.c	2008-04-28 16:24:05 +0000
+++ b/cmd-line-utils/readline/history.c	2009-11-29 23:08:56 +0000
@@ -211,14 +211,14 @@ history_get (offset)
 
 HIST_ENTRY *
 alloc_history_entry (string, ts)
-     char *string;
+     const char *string;
      char *ts;
 {
   HIST_ENTRY *temp;
 
   temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
 
-  temp->line = string ? savestring (string) : string;
+  temp->line = string ? savestring ((char*) string) : (char*) string;
   temp->data = (char *)NULL;
   temp->timestamp = ts;
 

=== modified file 'cmd-line-utils/readline/rlmbutil.h'
--- a/cmd-line-utils/readline/rlmbutil.h	2007-11-19 13:38:08 +0000
+++ b/cmd-line-utils/readline/rlmbutil.h	2009-11-29 23:08:56 +0000
@@ -109,8 +109,8 @@ extern int _rl_is_mbchar_matched PARAMS(
 extern wchar_t _rl_char_value PARAMS((char *, int));
 extern int _rl_walphabetic PARAMS((wchar_t));
 
-#define _rl_to_wupper(wc)	(iswlower (wc) ? towupper (wc) : (wc))
-#define _rl_to_wlower(wc)	(iswupper (wc) ? towlower (wc) : (wc))
+#define _rl_to_wupper(wc)	(iswlower (wc) ? (wchar_t) towupper (wc) : (wc))
+#define _rl_to_wlower(wc)	(iswupper (wc) ? (wchar_t) towlower (wc) : (wc))
 
 #define MB_NEXTCHAR(b,s,c,f) \
 	((MB_CUR_MAX > 1 && rl_byte_oriented == 0) \

=== modified file 'cmd-line-utils/readline/text.c'
--- a/cmd-line-utils/readline/text.c	2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/text.c	2009-11-29 23:08:56 +0000
@@ -614,7 +614,7 @@ rl_arrow_keys (count, c)
 #ifdef HANDLE_MULTIBYTE
 static char pending_bytes[MB_LEN_MAX];
 static int pending_bytes_length = 0;
-static mbstate_t ps = {0};
+static mbstate_t ps;
 #endif
 
 /* Insert the character C at the current location, moving point forward.

=== modified file 'cmd-line-utils/readline/xmalloc.c'
--- a/cmd-line-utils/readline/xmalloc.c	2008-01-23 16:43:46 +0000
+++ b/cmd-line-utils/readline/xmalloc.c	2009-11-29 23:08:56 +0000
@@ -42,7 +42,7 @@
 
 static void
 memory_error_and_abort (fname)
-     char *fname;
+     const char *fname;
 {
   fprintf (stderr, "%s: out of virtual memory\n", fname);
   exit (2);

=== modified file 'configure.in'
--- a/configure.in	2009-11-07 15:56:51 +0000
+++ b/configure.in	2009-11-29 23:08:56 +0000
@@ -15,7 +15,7 @@ AC_CANONICAL_SYSTEM
 # MySQL version number.
 #
 # Note: the following line must be parseable by win/configure.js:GetVersion()
-AM_INIT_AUTOMAKE(mysql, 5.1.39-maria-beta)
+AM_INIT_AUTOMAKE(mysql, 5.1.39-MariaDB-beta)
 AM_CONFIG_HEADER([include/config.h:config.h.in])
 
 PROTOCOL_VERSION=10

=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h	2009-09-07 20:50:10 +0000
+++ b/include/mysql/plugin.h	2009-11-29 23:08:56 +0000
@@ -567,9 +567,9 @@ typedef struct st_mysql_ftparser_boolean
 typedef struct st_mysql_ftparser_param
 {
   int (*mysql_parse)(struct st_mysql_ftparser_param *,
-                     char *doc, int doc_len);
+                     const unsigned char *doc, size_t doc_len);
   int (*mysql_add_word)(struct st_mysql_ftparser_param *,
-                        char *word, int word_len,
+                        const unsigned char *word, size_t word_len,
                         MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
   void *ftparser_state;
   void *mysql_ftparam;

=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp	2008-10-10 15:28:41 +0000
+++ b/include/mysql/plugin.h.pp	2009-11-29 23:08:56 +0000
@@ -73,9 +73,9 @@ typedef struct st_mysql_ftparser_boolean
 typedef struct st_mysql_ftparser_param
 {
   int (*mysql_parse)(struct st_mysql_ftparser_param *,
-                     char *doc, int doc_len);
+                     const unsigned char *doc, size_t doc_len);
   int (*mysql_add_word)(struct st_mysql_ftparser_param *,
-                        char *word, int word_len,
+                        const unsigned char *word, size_t word_len,
                         MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
   void *ftparser_state;
   void *mysql_ftparam;

=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c	2009-11-06 17:22:32 +0000
+++ b/libmysql/libmysql.c	2009-11-29 23:08:56 +0000
@@ -2284,7 +2284,7 @@ mysql_stmt_param_metadata(MYSQL_STMT *st
 
 /* Store type of parameter in network buffer. */
 
-static void store_param_type(char **pos, MYSQL_BIND *param)
+static void store_param_type(uchar **pos, MYSQL_BIND *param)
 {
   uint typecode= param->buffer_type | (param->is_unsigned ? 32768 : 0);
   int2store(*pos, typecode);
@@ -2564,7 +2564,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
 	that is sent to the server.
       */
       for (param= stmt->params;	param < param_end ; param++)
-        store_param_type((char**) &net->write_pos, param);
+        store_param_type(&net->write_pos, param);
     }
 
     for (param= stmt->params; param < param_end; param++)

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2009-09-29 20:19:43 +0000
+++ b/mysql-test/t/information_schema.test	2009-11-29 23:08:56 +0000
@@ -5,6 +5,9 @@
 # on the presence of the log tables (which are CSV-based).
 --source include/have_csv.inc
 
+# Check that innodb/xtradb is incompiled in as result depends on it
+-- source include/have_innodb.inc
+
 # Save the initial number of concurrent sessions
 --source include/count_sessions.inc
 

=== modified file 'mysql-test/t/not_partition.test'
--- a/mysql-test/t/not_partition.test	2009-01-08 14:16:44 +0000
+++ b/mysql-test/t/not_partition.test	2009-11-29 23:08:56 +0000
@@ -15,7 +15,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
 # Bug#39893: Crash if select on a partitioned table,
 #            when partitioning is disabled
 FLUSH TABLES;
---copy_file $MYSQLTEST_VARDIR/std_data_ln/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
 SELECT * FROM t1;
 TRUNCATE TABLE t1;
 ANALYZE TABLE t1;

=== modified file 'mysys/lf_hash.c'
--- a/mysys/lf_hash.c	2009-01-15 21:27:36 +0000
+++ b/mysys/lf_hash.c	2009-11-29 23:08:56 +0000
@@ -124,8 +124,8 @@ retry:
         we found a deleted node - be nice, help the other thread
         and remove this deleted node
       */
-      if (my_atomic_casptr((void **)cursor->prev,
-                           (void **)&cursor->curr, cursor->next))
+      if (my_atomic_casptr((void **) cursor->prev,
+                           (void **)(char*) &cursor->curr, cursor->next))
         _lf_alloc_free(pins, cursor->curr);
       else
       {
@@ -171,7 +171,8 @@ static LF_SLIST *linsert(LF_SLIST * vola
       node->link= (intptr)cursor.curr;
       DBUG_ASSERT(node->link != (intptr)node); /* no circular references */
       DBUG_ASSERT(cursor.prev != &node->link); /* no circular references */
-      if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+      if (my_atomic_casptr((void **) cursor.prev,
+                           (void **)(char*) &cursor.curr, node))
       {
         res= 1; /* inserted ok */
         break;
@@ -218,13 +219,13 @@ static int ldelete(LF_SLIST * volatile *
     else
     {
       /* mark the node deleted */
-      if (my_atomic_casptr((void **)&(cursor.curr->link),
-                           (void **)&cursor.next,
+      if (my_atomic_casptr((void **) (char*) &(cursor.curr->link),
+                           (void **) (char*) &cursor.next,
                            (void *)(((intptr)cursor.next) | 1)))
       {
         /* and remove it from the list */
         if (my_atomic_casptr((void **)cursor.prev,
-                             (void **)&cursor.curr, cursor.next))
+                             (void **)(char*)&cursor.curr, cursor.next))
           _lf_alloc_free(pins, cursor.curr);
         else
         {
@@ -493,7 +494,7 @@ static int initialize_bucket(LF_HASH *ha
     my_free((void *)dummy, MYF(0));
     dummy= cur;
   }
-  my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+  my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
   /*
     note that if the CAS above failed (after linsert() succeeded),
     it would mean that some other thread has executed linsert() for

=== modified file 'mysys/my_redel.c'
--- a/mysys/my_redel.c	2009-11-06 17:22:32 +0000
+++ b/mysys/my_redel.c	2009-11-29 23:08:56 +0000
@@ -77,9 +77,6 @@ end:
 int my_copystat(const char *from, const char *to, int MyFlags)
 {
   struct stat statbuf;
-#if !defined(__WIN__) && !defined(__NETWARE__)
-  int res;
-#endif
 
   if (stat((char*) from, &statbuf))
   {

=== modified file 'regex/engine.c'
--- a/regex/engine.c	2005-09-29 01:20:31 +0000
+++ b/regex/engine.c	2009-11-29 23:08:56 +0000
@@ -33,11 +33,11 @@ struct match {
 	struct re_guts *g;
 	int eflags;
 	my_regmatch_t *pmatch;	/* [nsub+1] (0 element unused) */
-	char *offp;		/* offsets work from here */
-	char *beginp;		/* start of string -- virtual NUL precedes */
-	char *endp;		/* end of string -- virtual NUL here */
-	char *coldp;		/* can be no match starting before here */
-	char **lastpos;		/* [nplus+1] */
+	const char *offp;	/* offsets work from here */
+	const char *beginp;	/* start of string -- virtual NUL precedes */
+	const char *endp;	/* end of string -- virtual NUL here */
+	const char *coldp;	/* can be no match starting before here */
+	const char **lastpos;	/* [nplus+1] */
 	STATEVARS;
 	states st;		/* current states */
 	states fresh;		/* states for a fresh start */
@@ -66,20 +66,20 @@ static int			/* 0 success, REG_NOMATCH f
 matcher(charset,g, str, nmatch, pmatch, eflags)
 CHARSET_INFO *charset;
 register struct re_guts *g;
-char *str;
+const char *str;
 size_t nmatch;
 my_regmatch_t pmatch[];
 int eflags;
 {
-	register char *endp;
+	register const char *endp;
 	register uint i;
 	struct match mv;
 	register struct match *m = &mv;
-	register char *dp;
+	register const char *dp;
 	register const sopno gf = g->firststate+1;	/* +1 for OEND */
 	register const sopno gl = g->laststate;
-	char *start;
-	char *stop;
+	const char *start;
+	const char *stop;
 
 	/* simplify the situation where possible */
 	if (g->cflags&REG_NOSUB)
@@ -163,7 +163,7 @@ int eflags;
 			dp = dissect(charset, m, m->coldp, endp, gf, gl);
 		} else {
 			if (g->nplus > 0 && m->lastpos == NULL)
-				m->lastpos = (char **)malloc((g->nplus+1) *
+				m->lastpos = (const char **)malloc((g->nplus+1) *
 							sizeof(char *));
 			if (g->nplus > 0 && m->lastpos == NULL) {
 				free(m->pmatch);
@@ -235,28 +235,28 @@ int eflags;
  == static char *dissect(register struct match *m, char *start, \
  ==	char *stop, sopno startst, sopno stopst);
  */
-static char *			/* == stop (success) always */
+static const char *			/* == stop (success) always */
 dissect(charset, m, start, stop, startst, stopst)
 CHARSET_INFO *charset;
 register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
 sopno startst;
 sopno stopst;
 {
 	register uint i;
 	register sopno ss;	/* start sop of current subRE */
 	register sopno es;	/* end sop of current subRE */
-	register char *sp;	/* start of string matched by it */
-	register char *stp;	/* string matched by it cannot pass here */
-	register char *rest;	/* start of rest of string */
-	register char *tail;	/* string unmatched by rest of RE */
+	register const char *sp;	/* start of string matched by it */
+	register const char *stp;	/* string matched by it cannot pass here */
+	register const char *rest;	/* start of rest of string */
+	register const char *tail;	/* string unmatched by rest of RE */
 	register sopno ssub;	/* start sop of subsubRE */
 	register sopno esub;	/* end sop of subsubRE */
-	register char *ssp;	/* start of string matched by subsubRE */
-	register char *sep;	/* end of string matched by subsubRE */
-	register char *oldssp;	/* previous ssp */
-	register char *dp;      /* used in debug mode to check asserts */
+	register const char *ssp;	/* start of string matched by subsubRE */
+	register const char *sep;	/* end of string matched by subsubRE */
+	register const char *oldssp;	/* previous ssp */
+	register const char *dp;      /* used in debug mode to check asserts */
 
 	AT("diss", start, stop, startst, stopst);
 	sp = start;
@@ -424,23 +424,23 @@ sopno stopst;
  == static char *backref(register struct match *m, char *start, \
  ==	char *stop, sopno startst, sopno stopst, sopno lev);
  */
-static char *			/* == stop (success) or NULL (failure) */
+static const char *			/* == stop (success) or NULL (failure) */
 backref(charset,m, start, stop, startst, stopst, lev)
 CHARSET_INFO *charset;
 register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
 sopno startst;
 sopno stopst;
 sopno lev;			/* PLUS nesting level */
 {
 	register uint i;
 	register sopno ss;	/* start sop of current subRE */
-	register char *sp;	/* start of string matched by it */
+	register const char *sp;	/* start of string matched by it */
 	register sopno ssub;	/* start sop of subsubRE */
 	register sopno esub;	/* end sop of subsubRE */
-	register char *ssp;	/* start of string matched by subsubRE */
-	register char *dp;
+	register const char *ssp;	/* start of string matched by subsubRE */
+	register const char *dp;
 	register size_t len;
 	register int hard;
 	register sop s;
@@ -630,24 +630,24 @@ sopno lev;			/* PLUS nesting level */
  == static char *fast(register struct match *m, char *start, \
  ==	char *stop, sopno startst, sopno stopst);
  */
-static char *			/* where tentative match ended, or NULL */
+static const char *		/* where tentative match ended, or NULL */
 fast(charset, m, start, stop, startst, stopst)
 CHARSET_INFO *charset;
 register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
 sopno startst;
 sopno stopst;
 {
 	register states st = m->st;
 	register states fresh = m->fresh;
 	register states tmp = m->tmp;
-	register char *p = start;
+	register const char *p = start;
 	register int c = (start == m->beginp) ? OUT : *(start-1);
 	register int lastc;	/* previous c */
 	register int flagch;
 	register int i;
-	register char *coldp;	/* last p after which no match was underway */
+	register const char *coldp;	/* last p after which no match was underway */
 
 	CLEAR(st);
 	SET1(st, startst);
@@ -722,24 +722,24 @@ sopno stopst;
  == static char *slow(register struct match *m, char *start, \
  ==	char *stop, sopno startst, sopno stopst);
  */
-static char *			/* where it ended */
+static const char *			/* where it ended */
 slow(charset, m, start, stop, startst, stopst)
 CHARSET_INFO *charset;
 register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
 sopno startst;
 sopno stopst;
 {
 	register states st = m->st;
 	register states empty = m->empty;
 	register states tmp = m->tmp;
-	register char *p = start;
+	register const char *p = start;
 	register int c = (start == m->beginp) ? OUT : *(start-1);
 	register int lastc;	/* previous c */
 	register int flagch;
 	register int i;
-	register char *matchp;	/* last p at which a match ended */
+	register const char *matchp;	/* last p at which a match ended */
 
 	AT("slow", start, stop, startst, stopst);
 	CLEAR(st);

=== modified file 'regex/engine.ih'
--- a/regex/engine.ih	2005-09-29 00:08:24 +0000
+++ b/regex/engine.ih	2009-11-29 23:08:56 +0000
@@ -4,11 +4,11 @@ extern "C" {
 #endif
 
 /* === engine.c === */
-static int matcher(CHARSET_INFO *charset,register struct re_guts *g, char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
-static char *dissect(CHARSET_INFO *charset,register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static int matcher(CHARSET_INFO *charset,register struct re_guts *g, const char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
+static const char *dissect(CHARSET_INFO *charset,register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *backref(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev);
+static const char *fast(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *slow(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
 static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
 #define	BOL	(OUT+1)
 #define	EOL	(BOL+1)

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2009-09-15 10:46:35 +0000
+++ b/sql/sp_head.cc	2009-11-29 23:08:56 +0000
@@ -1924,9 +1924,10 @@ sp_head::execute_procedure(THD *thd, Lis
       if (spvar->mode == sp_param_out)
       {
         Item_null *null_item= new Item_null();
+        Item *tmp_item= (Item*) null_item;
 
         if (!null_item ||
-            nctx->set_variable(thd, i, (Item **)&null_item))
+            nctx->set_variable(thd, i, &tmp_item))
         {
           err_status= TRUE;
           break;

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2009-10-15 21:38:29 +0000
+++ b/sql/sql_base.cc	2009-11-29 23:08:56 +0000
@@ -5823,6 +5823,7 @@ find_field_in_natural_join(THD *thd, TAB
   {
     /* This is a base table. */
     DBUG_ASSERT(nj_col->view_field == NULL);
+    Item *ref= 0;
     /*
       This fix_fields is not necessary (initially this item is fixed by
       the Item_field constructor; after reopen_tables the Item_func_eq
@@ -5830,12 +5831,13 @@ find_field_in_natural_join(THD *thd, TAB
       reopening for columns that was dropped by the concurrent connection.
     */
     if (!nj_col->table_field->fixed &&
-        nj_col->table_field->fix_fields(thd, (Item **)&nj_col->table_field))
+        nj_col->table_field->fix_fields(thd, &ref))
     {
       DBUG_PRINT("info", ("column '%s' was dropped by the concurrent connection",
                           nj_col->table_field->name));
       DBUG_RETURN(NULL);
     }
+    DBUG_ASSERT(ref == 0);                      // Should not have changed
     DBUG_ASSERT(nj_col->table_ref->table == nj_col->table_field->field->table);
     found_field= nj_col->table_field->field;
     update_field_dependencies(thd, found_field, nj_col->table_ref->table);

=== modified file 'sql/sql_builtin.cc.in'
--- a/sql/sql_builtin.cc.in	2006-12-31 01:29:11 +0000
+++ b/sql/sql_builtin.cc.in	2009-11-29 23:08:56 +0000
@@ -13,6 +13,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
+#include <my_global.h>
 #include <mysql/plugin.h>
 
 typedef struct st_mysql_plugin builtin_plugin[];

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-11-06 17:22:32 +0000
+++ b/sql/sql_parse.cc	2009-11-29 23:08:56 +0000
@@ -464,7 +464,7 @@ pthread_handler_t handle_bootstrap(void 
   thd->init_for_queries();
   while (fgets(buff, thd->net.max_packet, file))
   {
-    char *query, *res;
+    char *query;
     /* strlen() can't be deleted because fgets() doesn't return length */
     ulong length= (ulong) strlen(buff);
     while (buff[length-1] != '\n' && !feof(file))

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-11-06 17:22:32 +0000
+++ b/sql/sql_select.cc	2009-11-29 23:08:56 +0000
@@ -3586,8 +3586,9 @@ add_key_fields(JOIN *join, KEY_FIELD **k
         {
           if (!field->eq(item->field))
           {
+            Item *tmp_item= (Item*) item;
             add_key_field(key_fields, *and_level, cond_func, field,
-                          TRUE, (Item **) &item, 1, usable_tables,
+                          TRUE, &tmp_item, 1, usable_tables,
                           sargables);
           }
         }
@@ -15748,7 +15749,11 @@ static bool add_ref_to_table_cond(THD *t
     DBUG_RETURN(TRUE);
 
   if (!cond->fixed)
-    cond->fix_fields(thd, (Item**)&cond);
+  {
+    Item *tmp_item= (Item*) cond;
+    cond->fix_fields(thd, &tmp_item);
+    DBUG_ASSERT(cond == tmp_item);
+  }
   if (join_tab->select)
   {
     error=(int) cond->add(join_tab->select->cond);

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2009-11-26 20:19:33 +0000
+++ b/sql/sql_show.cc	2009-11-29 23:08:56 +0000
@@ -3551,7 +3551,9 @@ static int get_schema_tables_record(THD 
     TABLE_SHARE *share= show_table->s;
     handler *file= show_table->file;
     handlerton *tmp_db_type= share->db_type();
+#ifdef WITH_PARTITION_STORAGE_ENGINE
     bool is_partitioned= FALSE;
+#endif
     if (share->tmp_table == SYSTEM_TMP_TABLE)
       table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
     else if (share->tmp_table)

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2009-10-15 21:38:29 +0000
+++ b/sql/table.cc	2009-11-29 23:08:56 +0000
@@ -2077,8 +2077,9 @@ ulong get_form_pos(File file, uchar *hea
   else
   {
     char *str;
+    const char **tmp = (const char**) (char*) buf;
     str=(char *) (buf+a_length);
-    fix_type_pointers((const char ***) &buf,save_names,1,&str);
+    fix_type_pointers(&tmp, save_names, 1, &str);
   }
   DBUG_RETURN(ret_value);
 }

=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2009-11-07 10:34:19 +0000
+++ b/storage/maria/ha_maria.cc	2009-11-29 23:08:56 +0000
@@ -665,10 +665,9 @@ int maria_check_definition(MARIA_KEYDEF 
 
 extern "C" {
 
-volatile int *_ma_killed_ptr(HA_CHECK *param)
+int _ma_killed_ptr(HA_CHECK *param)
 {
-  /* In theory Unsafe conversion, but should be ok for now */
-  return (int*) &(((THD *) (param->thd))->killed);
+  return thd_killed((THD*)param->thd);
 }
 
 

=== modified file 'storage/maria/lockman.c'
--- a/storage/maria/lockman.c	2008-02-21 00:51:51 +0000
+++ b/storage/maria/lockman.c	2009-11-29 23:08:56 +0000
@@ -360,7 +360,7 @@ retry:
     else
     {
       if (my_atomic_casptr((void **)cursor->prev,
-                           (void **)&cursor->curr, cursor->next))
+                           (void **)(char*) &cursor->curr, cursor->next))
         _lf_alloc_free(pins, cursor->curr);
       else
       {
@@ -421,7 +421,8 @@ static int lockinsert(LOCK * volatile *h
       node->link= (intptr)cursor.curr;
       DBUG_ASSERT(node->link != (intptr)node);
       DBUG_ASSERT(cursor.prev != &node->link);
-      if (!my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+      if (!my_atomic_casptr((void **)cursor.prev,
+                            (void **)(char*) &cursor.curr, node))
       {
         res= REPEAT_ONCE_MORE;
         node->flags&= ~ACTIVE;
@@ -498,11 +499,11 @@ static int lockdelete(LOCK * volatile *h
       then we can delete. Good news is - this is only required when rolling
       back a savepoint.
     */
-    if (my_atomic_casptr((void **)&(cursor.curr->link),
-                         (void **)&cursor.next, 1+(char *)cursor.next))
+    if (my_atomic_casptr((void **)(char*)&(cursor.curr->link),
+                         (void **)(char*)&cursor.next, 1+(char *)cursor.next))
     {
       if (my_atomic_casptr((void **)cursor.prev,
-                           (void **)&cursor.curr, cursor.next))
+                           (void **)(char*)&cursor.curr, cursor.next))
         _lf_alloc_free(pins, cursor.curr);
       else
         lockfind(head, node, &cursor, pins);
@@ -573,7 +574,7 @@ static void initialize_bucket(LOCKMAN *l
     my_free((void *)dummy, MYF(0));
     dummy= cur;
   }
-  my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+  my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
 }
 
 static inline uint calc_hash(uint64 resource)

=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c	2009-05-06 12:03:24 +0000
+++ b/storage/maria/ma_check.c	2009-11-29 23:08:56 +0000
@@ -215,7 +215,7 @@ int maria_chk_del(HA_CHECK *param, regis
     empty=0;
     for (i= share->state.state.del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
     {
-      if (*_ma_killed_ptr(param))
+      if (_ma_killed_ptr(param))
         DBUG_RETURN(1);
       if (test_flag & T_VERBOSE)
 	printf(" %9s",llstr(next_link,buff));
@@ -310,7 +310,7 @@ static int check_k_link(HA_CHECK *param,
   records= (ha_rows) (share->state.state.key_file_length / block_size);
   while (next_link != HA_OFFSET_ERROR && records > 0)
   {
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
       DBUG_RETURN(1);
     if (param->testflag & T_VERBOSE)
       printf("%16s",llstr(next_link,llbuff));
@@ -876,10 +876,10 @@ static int chk_index(HA_CHECK *param, MA
   tmp_key.data= tmp_key_buff;
   for ( ;; )
   {
-    if (*_ma_killed_ptr(param))
-      goto err;
     if (nod_flag)
     {
+      if (_ma_killed_ptr(param))
+        goto err;
       next_page= _ma_kpos(nod_flag,keypos);
       if (chk_index_down(param,info,keyinfo,next_page,
                          temp_buff,keys,key_checksum,level+1))
@@ -1180,7 +1180,7 @@ static int check_static_record(HA_CHECK 
   pos= 0;
   while (pos < share->state.state.data_file_length)
   {
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
       return -1;
     if (my_b_read(&param->read_cache, record,
                   share->base.pack_reclength))
@@ -1230,7 +1230,7 @@ static int check_dynamic_record(HA_CHECK
   {
     my_bool got_error= 0;
     int flag;
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
       DBUG_RETURN(-1);
 
     flag= block_info.second_read=0;
@@ -1451,7 +1451,7 @@ static int check_compressed_record(HA_CH
   pos= share->pack.header_length;             /* Skip header */
   while (pos < share->state.state.data_file_length)
   {
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
       DBUG_RETURN(-1);
 
     if (_ma_read_cache(&param->read_cache, block_info.header, pos,
@@ -1815,7 +1815,7 @@ static int check_block_record(HA_CHECK *
     LINT_INIT(row_count);
     LINT_INIT(empty_space);
 
-    if (*_ma_killed_ptr(param))
+    if (_ma_killed_ptr(param))
     {
       _ma_scan_end_block_record(info);
       return -1;
@@ -4631,7 +4631,7 @@ static int sort_get_next_record(MARIA_SO
   char llbuff[22],llbuff2[22];
   DBUG_ENTER("sort_get_next_record");
 
-  if (*_ma_killed_ptr(param))
+  if (_ma_killed_ptr(param))
     DBUG_RETURN(1);
 
   switch (sort_info->org_data_file_type) {

=== modified file 'storage/maria/ma_check_standalone.h'
--- a/storage/maria/ma_check_standalone.h	2007-10-03 16:10:32 +0000
+++ b/storage/maria/ma_check_standalone.h	2009-11-29 23:08:56 +0000
@@ -30,11 +30,9 @@
   Check if check/repair operation was killed by a signal
 */
 
-static int not_killed= 0;
-
-volatile int *_ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
+int _ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
 {
-  return &not_killed;			/* always NULL */
+  return 0;
 }
 
 	/* print warnings and errors */

=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- a/storage/maria/ma_ft_boolean_search.c	2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_ft_boolean_search.c	2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
 
 
 static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
-                              char *word, int word_len,
+                              const uchar *word, size_t word_len,
                               MYSQL_FTPARSER_BOOLEAN_INFO *info)
 {
   MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@ static int ftb_query_add_word(MYSQL_FTPA
 
 
 static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
-                                    char *query, int len)
+                                    const uchar *query, size_t len)
 {
   MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
   MYSQL_FTPARSER_BOOLEAN_INFO info;
   CHARSET_INFO *cs= ftb_param->ftb->charset;
-  uchar **start= (uchar**) &query;
-  uchar *end= (uchar*) query + len;
+  const uchar **start= &query;
+  const uchar *end= query + len;
   FT_WORD w;
 
   info.prev= ' ';
   info.quot= 0;
   while (maria_ft_get_word(cs, start, end, &w, &info))
-    param->mysql_add_word(param, (char *) w.pos, w.len, &info);
+    param->mysql_add_word(param, w.pos, w.len, &info);
   return(0);
 }
 
@@ -615,7 +615,7 @@ typedef struct st_my_ftb_phrase_param
 
 
 static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
-                               char *word, int word_len,
+                               const uchar *word, size_t word_len,
     MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
 {
   MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -647,15 +647,15 @@ static int ftb_phrase_add_word(MYSQL_FTP
 
 
 static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
-                                     char *document, int len)
+                                     const uchar *document, size_t len)
 {
   FT_WORD word;
   MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
-  const uchar *docend= (uchar*) document + len;
-  while (maria_ft_simple_get_word(phrase_param->cs, (uchar**) &document,
+  const uchar *docend= document + len;
+  while (maria_ft_simple_get_word(phrase_param->cs, &document,
                                   docend, &word, FALSE))
   {
-    param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+    param->mysql_add_word(param, word.pos, word.len, 0);
     if (phrase_param->match)
       break;
   }
@@ -872,7 +872,7 @@ typedef struct st_my_ftb_find_param
 
 
 static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
-                                       char *word, int len,
+                                       const uchar *word, size_t len,
              MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
 {
   MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -933,15 +933,14 @@ static int ftb_find_relevance_add_word(M
 
 
 static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
-                                    char *doc, int len)
+                                    const uchar *doc, size_t len)
 {
   MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
   FT_INFO *ftb= ftb_param->ftb;
-  uchar *end= (uchar*) doc + len;
+  const uchar *end= doc + len;
   FT_WORD w;
-  while (maria_ft_simple_get_word(ftb->charset, (uchar**) &doc,
-                                  end, &w, TRUE))
-    param->mysql_add_word(param, (char *) w.pos, w.len, 0);
+  while (maria_ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+    param->mysql_add_word(param, w.pos, w.len, 0);
   return(0);
 }
 

=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- a/storage/maria/ma_ft_nlq_search.c	2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_ft_nlq_search.c	2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
 
 static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
 {
-  int	       subkeys, r;
+  int32	       subkeys;
+  int          r;
   uint	       doc_cnt;
   FT_SUPERDOC  sdoc, *sptr;
   TREE_ELEMENT *selem;
@@ -127,7 +128,7 @@ static int walk_and_match(FT_WORD *word,
       goto do_skip;
     }
 #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
-    tmp_weight=*(float*)&subkeys;
+    tmp_weight=*(float*) (char*) &subkeys;
 #else
 #error
 #endif

=== modified file 'storage/maria/ma_ft_parser.c'
--- a/storage/maria/ma_ft_parser.c	2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_ft_parser.c	2009-11-29 23:08:56 +0000
@@ -109,10 +109,11 @@ my_bool maria_ft_boolean_check_syntax_st
   3 - right bracket
   4 - stopword found
 */
-uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar maria_ft_get_word(CHARSET_INFO *cs, const uchar **start,
+                        const uchar *end,
                         FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
 {
-  uchar *doc=*start;
+  const uchar *doc= *start;
   int ctype;
   uint mwc, length;
   int mbl;
@@ -203,11 +204,11 @@ ret:
   return param->type;
 }
 
-uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
+uchar maria_ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
                                const uchar *end, FT_WORD *word,
                                my_bool skip_stopwords)
 {
-  uchar *doc= *start;
+  const uchar *doc= *start;
   uint mwc, length;
   int ctype, mbl;
   DBUG_ENTER("maria_ft_simple_get_word");
@@ -259,8 +260,9 @@ void maria_ft_parse_init(TREE *wtree, CH
 
 
 static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
-                       char *word, int word_len,
-             MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+                             const uchar *word, size_t word_len,
+                             MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+                             __attribute__((unused)))
 {
   TREE *wtree;
   FT_WORD w;
@@ -276,7 +278,7 @@ static int maria_ft_add_word(MYSQL_FTPAR
     w.pos= ptr;
   }
   else
-    w.pos= (uchar *) word;
+    w.pos= word;
   w.len= word_len;
   if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
   {
@@ -288,17 +290,17 @@ static int maria_ft_add_word(MYSQL_FTPAR
 
 
 static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
-                                   char *doc_arg, int doc_len)
+                                   const uchar *doc_arg, size_t doc_len)
 {
-  uchar *doc= (uchar*) doc_arg;
-  uchar *end= doc + doc_len;
+  const uchar *doc= doc_arg;
+  const uchar *end= doc + doc_len;
   MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
   TREE *wtree= ft_param->wtree;
   FT_WORD w;
   DBUG_ENTER("maria_ft_parse_internal");
 
   while (maria_ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
-    if (param->mysql_add_word(param, (char *) w.pos, w.len, 0))
+    if (param->mysql_add_word(param, w.pos, w.len, 0))
       DBUG_RETURN(1);
   DBUG_RETURN(0);
 }
@@ -378,7 +380,7 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_cal
        mysql_add_word != 0 - parser is initialized, or no
                              initialization needed. */
     info->ftparser_param[ftparser_nr].mysql_add_word=
-      (int (*)(struct st_mysql_ftparser_param *, char *, int,
+      (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
                MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
     if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
       return 0;

=== modified file 'storage/maria/ma_ftdefs.h'
--- a/storage/maria/ma_ftdefs.h	2009-02-12 17:51:00 +0000
+++ b/storage/maria/ma_ftdefs.h	2009-11-29 23:08:56 +0000
@@ -96,7 +96,7 @@
 #define FTB_RQUOT (ft_boolean_syntax[11])
 
 typedef struct st_maria_ft_word {
-  uchar * pos;
+  const uchar * pos;
   uint	 len;
   double weight;
 } FT_WORD;
@@ -106,9 +106,9 @@ int is_stopword(char *word, uint len);
 MARIA_KEY *_ma_ft_make_key(MARIA_HA *, MARIA_KEY *, uint , uchar *, FT_WORD *,
                            my_off_t);
 
-uchar maria_ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
-                        MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar maria_ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar maria_ft_get_word(CHARSET_INFO *, const uchar **, const uchar *,
+                        FT_WORD *, MYSQL_FTPARSER_BOOLEAN_INFO *);
+uchar maria_ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
                                FT_WORD *, my_bool);
 
 typedef struct _st_maria_ft_seg_iterator {

=== modified file 'storage/maria/ma_sort.c'
--- a/storage/maria/ma_sort.c	2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_sort.c	2009-11-29 23:08:56 +0000
@@ -920,7 +920,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
   uchar *strpos;
   BUFFPEK *buffpek,**refpek;
   QUEUE queue;
-  volatile int *killed= _ma_killed_ptr(info->sort_info->param);
   DBUG_ENTER("merge_buffers");
 
   count=error=0;
@@ -953,10 +952,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
   {
     for (;;)
     {
-      if (*killed)
-      {
-        error=1; goto err;
-      }
       buffpek=(BUFFPEK*) queue_top(&queue);
       if (to_file)
       {
@@ -976,6 +971,12 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
       buffpek->key+=sort_length;
       if (! --buffpek->mem_count)
       {
+        /* It's enough to check for killedptr before a slow operation */
+        if (_ma_killed_ptr(info->sort_info->param))
+        {
+          error=1;
+          goto err;
+        }
         if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
         {
           uchar *base= buffpek->base;

=== modified file 'storage/maria/ma_state.c'
--- a/storage/maria/ma_state.c	2009-10-06 06:57:22 +0000
+++ b/storage/maria/ma_state.c	2009-11-29 23:08:56 +0000
@@ -528,7 +528,7 @@ void _ma_remove_table_from_trnman(MARIA_
 
   safe_mutex_assert_owner(&share->intern_lock);
   
-  for (prev= (MARIA_USED_TABLES**) &trn->used_tables, tables= *prev;
+  for (prev= (MARIA_USED_TABLES**) (char*) &trn->used_tables, tables= *prev;
        tables;
        tables= *prev)
   {

=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h	2009-10-06 06:57:22 +0000
+++ b/storage/maria/maria_def.h	2009-11-29 23:08:56 +0000
@@ -1160,7 +1160,7 @@ int _ma_flush_table_files(MARIA_HA *info
   Functions needed by _ma_check (are overridden in MySQL/ha_maria.cc).
   See ma_check_standalone.h .
 */
-volatile int *_ma_killed_ptr(HA_CHECK *param);
+int _ma_killed_ptr(HA_CHECK *param);
 void _ma_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...))
   ATTRIBUTE_FORMAT(printf, 2, 3);
 void _ma_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...))

=== modified file 'storage/maria/maria_ftdump.c'
--- a/storage/maria/maria_ftdump.c	2008-08-25 11:49:47 +0000
+++ b/storage/maria/maria_ftdump.c	2009-11-29 23:08:56 +0000
@@ -116,7 +116,7 @@ int main(int argc,char *argv[])
 
     subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
     if (subkeys >= 0)
-      weight=*(float*)&subkeys;
+      weight=*(float*) (char*) &subkeys;
 
 #ifdef HAVE_SNPRINTF
     snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);

=== modified file 'storage/maria/trnman.c'
--- a/storage/maria/trnman.c	2009-03-05 13:46:45 +0000
+++ b/storage/maria/trnman.c	2009-11-29 23:08:56 +0000
@@ -300,8 +300,8 @@ TRN *trnman_new_trn(WT_THD *wt)
     (ABA isn't possible, we're behind a mutex
   */
   my_atomic_rwlock_wrlock(&LOCK_pool);
-  while (tmp.trn && !my_atomic_casptr((void **)&pool, &tmp.v,
-                                  (void *)tmp.trn->next))
+  while (tmp.trn && !my_atomic_casptr((void **)(char*) &pool, &tmp.v,
+                                      (void *)tmp.trn->next))
     /* no-op */;
   my_atomic_rwlock_wrunlock(&LOCK_pool);
 
@@ -545,7 +545,7 @@ static void trnman_free_trn(TRN *trn)
       down after the loop at -O2
     */
     *(TRN * volatile *)&(trn->next)= tmp.trn;
-  } while (!my_atomic_casptr((void **)&pool, &tmp.v, trn));
+  } while (!my_atomic_casptr((void **)(char*)&pool, &tmp.v, trn));
   my_atomic_rwlock_wrunlock(&LOCK_pool);
 }
 

=== modified file 'storage/myisam/ft_boolean_search.c'
--- a/storage/myisam/ft_boolean_search.c	2009-10-15 21:38:29 +0000
+++ b/storage/myisam/ft_boolean_search.c	2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
 
 
 static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
-                              char *word, int word_len,
+                              const uchar *word, size_t word_len,
                               MYSQL_FTPARSER_BOOLEAN_INFO *info)
 {
   MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@ static int ftb_query_add_word(MYSQL_FTPA
 
 
 static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
-                                    char *query, int len)
+                                    const uchar *query, size_t len)
 {
   MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
   MYSQL_FTPARSER_BOOLEAN_INFO info;
   CHARSET_INFO *cs= ftb_param->ftb->charset;
-  uchar **start= (uchar**) &query;
-  uchar *end= (uchar*) query + len;
+  const uchar **start= &query;
+  const uchar *end= query + len;
   FT_WORD w;
 
   info.prev= ' ';
   info.quot= 0;
   while (ft_get_word(cs, start, end, &w, &info))
-    param->mysql_add_word(param, (char*) w.pos, w.len, &info);
+    param->mysql_add_word(param, w.pos, w.len, &info);
   return(0);
 }
 
@@ -616,7 +616,7 @@ typedef struct st_my_ftb_phrase_param
 
 
 static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
-                               char *word, int word_len,
+                               const uchar *word, size_t word_len,
     MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
 {
   MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -648,15 +648,15 @@ static int ftb_phrase_add_word(MYSQL_FTP
 
 
 static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
-                                     char *document, int len)
+                                     const uchar *document, size_t len)
 {
   FT_WORD word;
   MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
   const uchar *docend= (uchar*) document + len;
-  while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
+  while (ft_simple_get_word(phrase_param->cs, &document, docend,
                             &word, FALSE))
   {
-    param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+    param->mysql_add_word(param, word.pos, word.len, 0);
     if (phrase_param->match)
       break;
   }
@@ -874,7 +874,7 @@ typedef struct st_my_ftb_find_param
 
 
 static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
-                                       char *word, int len,
+                                       const uchar *word, size_t len,
              MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
 {
   MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -888,8 +888,8 @@ static int ftb_find_relevance_add_word(M
   for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2)
   {
     ftbw= ftb->list[c];
-    if (ha_compare_text(ftb->charset, (uchar*)word, len,
-                        (uchar*)ftbw->word+1, ftbw->len-1,
+    if (ha_compare_text(ftb->charset, word, len,
+                        ftbw->word+1, ftbw->len-1,
                         (my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
       b= c;
     else
@@ -915,8 +915,8 @@ static int ftb_find_relevance_add_word(M
   for (; c >= 0; c--)
   {
     ftbw= ftb->list[c];
-    if (ha_compare_text(ftb->charset, (uchar*)word, len,
-                        (uchar*)ftbw->word + 1,ftbw->len - 1,
+    if (ha_compare_text(ftb->charset, word, len,
+                        ftbw->word + 1,ftbw->len - 1,
                         (my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
     {
       if (ftb->with_scan & FTB_FLAG_TRUNC)
@@ -935,14 +935,14 @@ static int ftb_find_relevance_add_word(M
 
 
 static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
-                                    char *doc, int len)
+                                    const uchar *doc, size_t len)
 {
   MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
   FT_INFO *ftb= ftb_param->ftb;
-  uchar *end= (uchar*) doc + len;
+  const uchar *end= doc + len;
   FT_WORD w;
-  while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
-    param->mysql_add_word(param, (char*) w.pos, w.len, 0);
+  while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+    param->mysql_add_word(param, w.pos, w.len, 0);
   return(0);
 }
 

=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c	2008-04-28 16:24:05 +0000
+++ b/storage/myisam/ft_nlq_search.c	2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
 
 static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
 {
-  int	       subkeys, r;
+  int32	       subkeys;
+  int          r;
   uint	       keylen, doc_cnt;
   FT_SUPERDOC  sdoc, *sptr;
   TREE_ELEMENT *selem;
@@ -123,7 +124,8 @@ static int walk_and_match(FT_WORD *word,
       goto do_skip;
     }
 #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
-    tmp_weight=*(float*)&subkeys;
+    /* The weight we read was actually a float */
+    tmp_weight=*(float*) (char*) &subkeys;
 #else
 #error
 #endif

=== modified file 'storage/myisam/ft_parser.c'
--- a/storage/myisam/ft_parser.c	2009-02-12 14:08:56 +0000
+++ b/storage/myisam/ft_parser.c	2009-11-29 23:08:56 +0000
@@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(c
   3 - right bracket
   4 - stopword found
 */
-uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end,
                   FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
 {
-  uchar *doc=*start;
+  const uchar *doc= *start;
   int ctype;
   uint mwc, length;
   int mbl;
@@ -201,10 +201,11 @@ ret:
   return param->type;
 }
 
-uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
-                         FT_WORD *word, my_bool skip_stopwords)
+uchar ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
+                         const uchar *end, FT_WORD *word,
+                         my_bool skip_stopwords)
 {
-  uchar *doc= *start;
+  const uchar *doc= *start;
   uint mwc, length;
   int mbl;
   int ctype;
@@ -216,7 +217,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
     {
       if (doc >= end)
         DBUG_RETURN(0);
-      mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+      mbl= cs->cset->ctype(cs, &ctype, doc, end);
       if (true_word_char(ctype, *doc))
         break;
     }
@@ -225,7 +226,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
     for (word->pos= doc; doc < end; length++,
          doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
     {
-      mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+      mbl= cs->cset->ctype(cs, &ctype, doc, end);
       if (true_word_char(ctype, *doc))
         mwc= 0;
       else if (!misc_word_char(*doc) || mwc)
@@ -238,7 +239,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
 
     if (skip_stopwords == FALSE ||
         (length >= ft_min_word_len && length < ft_max_word_len &&
-         !is_stopword((char*) word->pos, word->len)))
+         !is_stopword(word->pos, word->len)))
     {
       *start= doc;
       DBUG_RETURN(1);
@@ -257,8 +258,9 @@ void ft_parse_init(TREE *wtree, CHARSET_
 
 
 static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
-                       char *word, int word_len,
-             MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+                       const uchar *word, size_t word_len,
+                       MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+                       __attribute__((unused)))
 {
   TREE *wtree;
   FT_WORD w;
@@ -286,10 +288,10 @@ static int ft_add_word(MYSQL_FTPARSER_PA
 
 
 static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
-                             char *doc_arg, int doc_len)
+                             const uchar *doc_arg, size_t doc_len)
 {
-  uchar *doc= (uchar*) doc_arg;
-  uchar *end= doc + doc_len;
+  const uchar *doc= doc_arg;
+  const uchar *end= doc + doc_len;
   MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
   TREE *wtree= ft_param->wtree;
   FT_WORD w;
@@ -302,7 +304,7 @@ static int ft_parse_internal(MYSQL_FTPAR
 }
 
 
-int ft_parse(TREE *wtree, uchar *doc, int doclen,
+int ft_parse(TREE *wtree, const uchar *doc, int doclen,
              struct st_mysql_ftparser *parser,
              MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
 {
@@ -377,7 +379,7 @@ MYSQL_FTPARSER_PARAM *ftparser_call_init
        mysql_add_word != 0 - parser is initialized, or no
                              initialization needed. */
     info->ftparser_param[ftparser_nr].mysql_add_word=
-      (int (*)(struct st_mysql_ftparser_param *, char *, int,
+      (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
               MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
     if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
       return 0;

=== modified file 'storage/myisam/ft_stopwords.c'
--- a/storage/myisam/ft_stopwords.c	2008-04-28 16:24:05 +0000
+++ b/storage/myisam/ft_stopwords.c	2009-11-29 23:08:56 +0000
@@ -66,7 +66,8 @@ int ft_init_stopwords()
   {
     File fd;
     uint len;
-    uchar *buffer, *start, *end;
+    uchar *buffer;
+    const uchar *start, *end;
     FT_WORD w;
     int error=-1;
 
@@ -109,7 +110,7 @@ err0:
 }
 
 
-int is_stopword(char *word, uint len)
+int is_stopword(const uchar *word, size_t len)
 {
   FT_STOPWORD sw;
   sw.pos=word;

=== modified file 'storage/myisam/ftdefs.h'
--- a/storage/myisam/ftdefs.h	2009-01-26 06:35:15 +0000
+++ b/storage/myisam/ftdefs.h	2009-11-29 23:08:56 +0000
@@ -96,18 +96,18 @@
 #define FTB_RQUOT (ft_boolean_syntax[11])
 
 typedef struct st_ft_word {
-  uchar * pos;
+  const uchar *pos;
   uint	 len;
   double weight;
 } FT_WORD;
 
-int is_stopword(char *word, uint len);
+int is_stopword(const uchar *word, size_t len);
 
 uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t);
 
-uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
+uchar ft_get_word(CHARSET_INFO *, const uchar **, const uchar *, FT_WORD *,
                   MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
                          FT_WORD *, my_bool);
 
 typedef struct _st_ft_seg_iterator {
@@ -121,7 +121,7 @@ void _mi_ft_segiterator_dummy_init(const
 uint _mi_ft_segiterator(FT_SEG_ITERATOR *);
 
 void ft_parse_init(TREE *, CHARSET_INFO *);
-int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
+int ft_parse(TREE *, const uchar *, int, struct st_mysql_ftparser *parser,
              MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
 FT_WORD * ft_linearize(TREE *, MEM_ROOT *);
 FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *);

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2009-10-06 14:53:46 +0000
+++ b/storage/myisam/ha_myisam.cc	2009-11-29 23:08:56 +0000
@@ -497,10 +497,9 @@ int check_definition(MI_KEYDEF *t1_keyin
 
 extern "C" {
 
-volatile int *killed_ptr(HA_CHECK *param)
+int killed_ptr(HA_CHECK *param)
 {
-  /* In theory Unsafe conversion, but should be ok for now */
-  return (int*) &(((THD *)(param->thd))->killed);
+  return thd_killed((THD*)param->thd);
 }
 
 void mi_check_print_error(HA_CHECK *param, const char *fmt,...)

=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c	2009-10-15 21:38:29 +0000
+++ b/storage/myisam/mi_check.c	2009-11-29 23:08:56 +0000
@@ -166,7 +166,7 @@ int chk_del(HA_CHECK *param, register MI
     empty=0;
     for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
     {
-      if (*killed_ptr(param))
+      if (killed_ptr(param))
         DBUG_RETURN(1);
       if (test_flag & T_VERBOSE)
 	printf(" %9s",llstr(next_link,buff));
@@ -261,7 +261,7 @@ static int check_k_link(HA_CHECK *param,
   records= (ha_rows) (info->state->key_file_length / block_size);
   while (next_link != HA_OFFSET_ERROR && records > 0)
   {
-    if (*killed_ptr(param))
+    if (killed_ptr(param))
       DBUG_RETURN(1);
     if (param->testflag & T_VERBOSE)
       printf("%16s",llstr(next_link,llbuff));
@@ -778,7 +778,7 @@ static int chk_index(HA_CHECK *param, MI
   }
   for ( ;; )
   {
-    if (*killed_ptr(param))
+    if (killed_ptr(param))
       goto err;
     memcpy((char*) info->lastkey,(char*) key,key_length);
     info->lastkey_length=key_length;
@@ -990,7 +990,7 @@ int chk_data_link(HA_CHECK *param, MI_IN
   bzero((char*) key_checksum, info->s->base.keys * sizeof(key_checksum[0]));
   while (pos < info->state->data_file_length)
   {
-    if (*killed_ptr(param))
+    if (killed_ptr(param))
       goto err2;
     switch (info->s->data_file_type) {
     case BLOCK_RECORD:
@@ -3247,7 +3247,7 @@ static int sort_get_next_record(MI_SORT_
   char llbuff[22],llbuff2[22];
   DBUG_ENTER("sort_get_next_record");
 
-  if (*killed_ptr(param))
+  if (killed_ptr(param))
     DBUG_RETURN(1);
 
   switch (share->data_file_type) {

=== modified file 'storage/myisam/myisam_ftdump.c'
--- a/storage/myisam/myisam_ftdump.c	2007-05-10 09:59:39 +0000
+++ b/storage/myisam/myisam_ftdump.c	2009-11-29 23:08:56 +0000
@@ -113,7 +113,7 @@ int main(int argc,char *argv[])
 
     subkeys=ft_sintXkorr(info->lastkey+keylen+1);
     if (subkeys >= 0)
-      weight=*(float*)&subkeys;
+      weight= *(float*) (char*) &subkeys;
 
 #ifdef HAVE_SNPRINTF
     snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);

=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c	2009-09-19 21:21:29 +0000
+++ b/storage/myisam/myisamchk.c	2009-11-29 23:08:56 +0000
@@ -1745,11 +1745,9 @@ err:
   sorting
 */
 
-static int not_killed= 0;
-
-volatile int *killed_ptr(HA_CHECK *param __attribute__((unused)))
+int killed_ptr(HA_CHECK *param __attribute__((unused)))
 {
-  return &not_killed;			/* always NULL */
+  return 0;
 }
 
 	/* print warnings and errors */

=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h	2009-10-06 06:57:22 +0000
+++ b/storage/myisam/myisamdef.h	2009-11-29 23:08:56 +0000
@@ -725,7 +725,7 @@ my_bool mi_dynmap_file(MI_INFO *info, my
 void mi_remap_file(MI_INFO *info, my_off_t size);
 
     /* Functions needed by mi_check */
-volatile int *killed_ptr(HA_CHECK *param);
+int killed_ptr(HA_CHECK *param);
 void mi_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...));
 void mi_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...));
 void mi_check_print_info _VARARGS((HA_CHECK *param, const char *fmt, ...));

=== modified file 'storage/myisam/myisamlog.c'
--- a/storage/myisam/myisamlog.c	2008-02-18 22:35:17 +0000
+++ b/storage/myisam/myisamlog.c	2009-11-29 23:08:56 +0000
@@ -385,7 +385,7 @@ static int examine_log(char * file_name,
       file_info.name=0;
       file_info.show_name=0;
       file_info.record=0;
-      if (read_string(&cache,(uchar**) &file_info.name,
+      if (read_string(&cache,(uchar**) (char*) &file_info.name,
 		      (uint) mi_uint2korr(head)))
 	goto err;
       {

=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c	2009-10-15 21:38:29 +0000
+++ b/storage/myisam/sort.c	2009-11-29 23:08:56 +0000
@@ -900,7 +900,6 @@ merge_buffers(MI_SORT_PARAM *info, uint 
   uchar *strpos;
   BUFFPEK *buffpek,**refpek;
   QUEUE queue;
-  volatile int *killed= killed_ptr(info->sort_info->param);
   DBUG_ENTER("merge_buffers");
 
   count=error=0;
@@ -933,10 +932,6 @@ merge_buffers(MI_SORT_PARAM *info, uint 
   {
     for (;;)
     {
-      if (*killed)
-      {
-        error=1; goto err;
-      }
       buffpek=(BUFFPEK*) queue_top(&queue);
       if (to_file)
       {
@@ -956,6 +951,12 @@ merge_buffers(MI_SORT_PARAM *info, uint 
       buffpek->key+=sort_length;
       if (! --buffpek->mem_count)
       {
+        /* It's enough to check for killedptr before a slow operation */
+        if (killed_ptr(info->sort_info->param))
+        {
+          error=1;
+          goto err;
+        }
         if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
         {
           uchar *base= buffpek->base;

=== modified file 'storage/xtradb/fil/fil0fil.c'
--- a/storage/xtradb/fil/fil0fil.c	2009-11-13 21:26:08 +0000
+++ b/storage/xtradb/fil/fil0fil.c	2009-11-29 23:08:56 +0000
@@ -3139,7 +3139,7 @@ skip_info:
 				if (mach_read_from_4(page + FIL_PAGE_OFFSET) || !offset) {
 					mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
 
-					for (i = 0; i < n_index; i++) {
+					for (i = 0; (ulint) i < n_index; i++) {
 						if (offset / UNIV_PAGE_SIZE == root_page[i]) {
 							/* this is index root page */
 							mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF

=== modified file 'storage/xtradb/trx/trx0i_s.c'
--- a/storage/xtradb/trx/trx0i_s.c	2009-09-07 10:22:53 +0000
+++ b/storage/xtradb/trx/trx0i_s.c	2009-11-29 23:08:56 +0000
@@ -28,11 +28,11 @@ table cache" for later retrieval.
 Created July 17, 2007 Vasil Dimov
 *******************************************************/
 
-#include <mysql/plugin.h>
 
 #include "mysql_addons.h"
 
 #include "univ.i"
+#include <mysql/plugin.h>
 #include "buf0buf.h"
 #include "dict0dict.h"
 #include "ha0storage.h"




Follow ups