List:Maria Storage Engine« Previous MessageNext Message »
From:Michael Widenius Date:January 9 2009 4:23am
Subject:bzr commit into MySQL/Maria:mysql-maria branch (monty:2668)
View as plain text  
#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/

 2668 Michael Widenius	2009-01-09
      Code cleanup:
      - Removed not needed casts
      - Indentation fixes
      - Changed some buffer variables to uchar, to be able to remove casts
modified:
  storage/maria/ma_bitmap.c
  storage/maria/ma_blockrec.c
  storage/maria/ma_check.c
  storage/maria/ma_create.c
  storage/maria/ma_delete.c
  storage/maria/ma_dynrec.c
  storage/maria/ma_extra.c
  storage/maria/ma_ft_boolean_search.c
  storage/maria/ma_ft_nlq_search.c
  storage/maria/ma_ft_parser.c
  storage/maria/ma_loghandler.c
  storage/maria/ma_open.c
  storage/maria/ma_packrec.c
  storage/maria/ma_pagecache.c
  storage/maria/ma_preload.c
  storage/maria/ma_rnext_same.c
  storage/maria/ma_rt_index.c
  storage/maria/ma_search.c
  storage/maria/ma_sort.c
  storage/maria/ma_statrec.c
  storage/maria/ma_test2.c
  storage/maria/ma_write.c
  storage/maria/maria_chk.c
  storage/maria/maria_pack.c

per-file messages:
  storage/maria/ma_bitmap.c
    Removed not needed casts
  storage/maria/ma_blockrec.c
    Removed not needed casts
  storage/maria/ma_check.c
    Removed not needed casts.
    Changed type of buffers to be able to remove casts
  storage/maria/ma_create.c
    Removed not needed casts
  storage/maria/ma_delete.c
    Removed not needed casts
  storage/maria/ma_dynrec.c
    Removed not needed casts
  storage/maria/ma_extra.c
    Removed not needed casts
  storage/maria/ma_ft_boolean_search.c
    Removed not needed casts
  storage/maria/ma_ft_nlq_search.c
    Removed not needed casts
  storage/maria/ma_ft_parser.c
    Removed not needed casts
  storage/maria/ma_loghandler.c
    Removed not needed casts
  storage/maria/ma_open.c
    Removed not needed casts
  storage/maria/ma_packrec.c
    Removed not needed casts
  storage/maria/ma_pagecache.c
    Removed not needed casts
  storage/maria/ma_preload.c
    Removed not needed casts
    Removed not needed initialization
  storage/maria/ma_rnext_same.c
    Removed not needed casts
  storage/maria/ma_rt_index.c
    Removed not needed casts
  storage/maria/ma_search.c
    Removed not needed casts
  storage/maria/ma_sort.c
    Removed not needed casts
    Removed not needed if
    Fixed indentation
  storage/maria/ma_statrec.c
    Removed not needed casts
  storage/maria/ma_test2.c
    Removed not needed casts
  storage/maria/ma_write.c
    Removed not needed casts
    Indentation fixes
  storage/maria/maria_chk.c
    Removed not needed casts
  storage/maria/maria_pack.c
    Removed not needed casts
=== modified file 'storage/maria/ma_bitmap.c'
--- a/storage/maria/ma_bitmap.c	2008-04-03 13:40:25 +0000
+++ b/storage/maria/ma_bitmap.c	2009-01-09 04:23:25 +0000
@@ -155,7 +155,7 @@ static inline my_bool write_changed_bitm
   {
     my_bool res= pagecache_write(share->pagecache,
                                  &bitmap->file, bitmap->page, 0,
-                                 (uchar*) bitmap->map, PAGECACHE_PLAIN_PAGE,
+                                 bitmap->map, PAGECACHE_PLAIN_PAGE,
                                  PAGECACHE_LOCK_LEFT_UNLOCKED,
                                  PAGECACHE_PIN_LEFT_UNPINNED,
                                  PAGECACHE_WRITE_DELAY, 0, LSN_IMPOSSIBLE);
@@ -166,7 +166,7 @@ static inline my_bool write_changed_bitm
     MARIA_PINNED_PAGE page_link;
     int res= pagecache_write(share->pagecache,
                              &bitmap->file, bitmap->page, 0,
-                             (uchar*) bitmap->map, PAGECACHE_PLAIN_PAGE,
+                             bitmap->map, PAGECACHE_PLAIN_PAGE,
                              PAGECACHE_LOCK_WRITE, PAGECACHE_PIN,
                              PAGECACHE_WRITE_DELAY, &page_link.link,
                              LSN_IMPOSSIBLE);
@@ -263,7 +263,7 @@ my_bool _ma_bitmap_end(MARIA_SHARE *shar
   pthread_mutex_destroy(&share->bitmap.bitmap_lock);
   pthread_cond_destroy(&share->bitmap.bitmap_cond);
   delete_dynamic(&share->bitmap.pinned_pages);
-  my_free((uchar*) share->bitmap.map, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(share->bitmap.map, MYF(MY_ALLOW_ZERO_PTR));
   share->bitmap.map= 0;
   return res;
 }
@@ -768,8 +768,7 @@ static my_bool _ma_read_bitmap_page(MARI
   DBUG_ASSERT(share->pagecache->block_size == bitmap->block_size);
   res= pagecache_read(share->pagecache,
                       &bitmap->file, page, 0,
-                      (uchar*) bitmap->map,
-                      PAGECACHE_PLAIN_PAGE,
+                      bitmap->map, PAGECACHE_PLAIN_PAGE,
                       PAGECACHE_LOCK_LEFT_UNLOCKED, 0) == NULL;
 
   /*

=== modified file 'storage/maria/ma_blockrec.c'
--- a/storage/maria/ma_blockrec.c	2008-08-11 14:40:32 +0000
+++ b/storage/maria/ma_blockrec.c	2009-01-09 04:23:25 +0000
@@ -539,9 +539,9 @@ err:
 void _ma_end_block_record(MARIA_HA *info)
 {
   DBUG_ENTER("_ma_end_block_record");
-  my_free((uchar*) info->cur_row.empty_bits, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(info->cur_row.empty_bits, MYF(MY_ALLOW_ZERO_PTR));
   delete_dynamic(&info->bitmap_blocks);
-  my_free((uchar*) info->cur_row.extents, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(info->cur_row.extents, MYF(MY_ALLOW_ZERO_PTR));
   my_free(info->blob_buff, MYF(MY_ALLOW_ZERO_PTR));
   /*
     The data file is closed, when needed, in ma_once_end_block_record().

=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c	2008-09-01 17:31:40 +0000
+++ b/storage/maria/ma_check.c	2009-01-09 04:23:25 +0000
@@ -344,8 +344,7 @@ static int check_k_link(HA_CHECK *param,
                                &share->kfile,
                                (pgcache_page_no_t) (next_link / block_size),
                                DFLT_INIT_HITS,
-                               (uchar*) info->buff,
-                               PAGECACHE_READ_UNKNOWN_PAGE,
+                               info->buff, PAGECACHE_READ_UNKNOWN_PAGE,
                                PAGECACHE_LOCK_LEFT_UNLOCKED, 0)))
     {
       /* purecov: begin tested */
@@ -937,7 +936,7 @@ static int chk_index(HA_CHECK *param, MA
       if (*keys != 1L)				/* not first_key */
       {
         if (param->stats_method == MI_STATS_METHOD_NULLS_NOT_EQUAL)
-          ha_key_cmp(keyinfo->seg, (uchar*) info->last_key.data,
+          ha_key_cmp(keyinfo->seg, info->last_key.data,
                      tmp_key.data, tmp_key.data_length,
                      SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL,
                      diff_pos);
@@ -1019,10 +1018,10 @@ static int chk_index(HA_CHECK *param, MA
                           (uint) (keypos - anc_page->buff));
     goto err;
   }
-  my_afree((uchar*) temp_buff);
+  my_afree(temp_buff);
   DBUG_RETURN(0);
  err:
-  my_afree((uchar*) temp_buff);
+  my_afree(temp_buff);
   DBUG_RETURN(1);
 } /* chk_index */
 
@@ -1183,7 +1182,7 @@ static int check_static_record(HA_CHECK 
   {
     if (*_ma_killed_ptr(param))
       return -1;
-    if (my_b_read(&param->read_cache,(uchar*) record,
+    if (my_b_read(&param->read_cache, record,
                   share->base.pack_reclength))
     {
       _ma_check_print_error(param,
@@ -1238,7 +1237,7 @@ static int check_dynamic_record(HA_CHECK
     block_info.next_filepos=pos;
     do
     {
-      if (_ma_read_cache(&param->read_cache,(uchar*) block_info.header,
+      if (_ma_read_cache(&param->read_cache, block_info.header,
                          (start_block=block_info.next_filepos),
                          sizeof(block_info.header),
                          (flag ? 0 : READING_NEXT) | READING_HEADER))
@@ -1352,7 +1351,7 @@ static int check_dynamic_record(HA_CHECK
         got_error=1;
         break;
       }
-      if (_ma_read_cache(&param->read_cache,(uchar*) to,block_info.filepos,
+      if (_ma_read_cache(&param->read_cache, to, block_info.filepos,
                          (uint) block_info.data_len,
                          flag == 1 ? READING_NEXT : 0))
       {
@@ -1455,7 +1454,7 @@ static int check_compressed_record(HA_CH
     if (*_ma_killed_ptr(param))
       DBUG_RETURN(-1);
 
-    if (_ma_read_cache(&param->read_cache,(uchar*) block_info.header, pos,
+    if (_ma_read_cache(&param->read_cache, block_info.header, pos,
                        share->pack.ref_length, READING_NEXT))
     {
       _ma_check_print_error(param,
@@ -1480,7 +1479,7 @@ static int check_compressed_record(HA_CH
       got_error=1;
       goto end;
     }
-    if (_ma_read_cache(&param->read_cache,(uchar*) info->rec_buff,
+    if (_ma_read_cache(&param->read_cache, info->rec_buff,
                        block_info.filepos, block_info.rec_len, READING_NEXT))
     {
       _ma_check_print_error(param,
@@ -1881,7 +1880,7 @@ static int check_block_record(HA_CHECK *
       DBUG_ASSERT(0);                           /* Impossible */
       break;
     case HEAD_PAGE:
-      row_count= ((uchar*) page_buff)[DIR_COUNT_OFFSET];
+      row_count= page_buff[DIR_COUNT_OFFSET];
       empty_space= uint2korr(page_buff + EMPTY_SPACE_OFFSET);
       param->used+= block_size - empty_space;
       param->link_used+= (PAGE_HEADER_SIZE + PAGE_SUFFIX_SIZE +
@@ -1895,7 +1894,7 @@ static int check_block_record(HA_CHECK *
                  page_buff[DIR_FREE_OFFSET] == END_OF_DIR_FREE_LIST);
       break;
     case TAIL_PAGE:
-      row_count= ((uchar*) page_buff)[DIR_COUNT_OFFSET];
+      row_count= page_buff[DIR_COUNT_OFFSET];
       empty_space= uint2korr(page_buff + EMPTY_SPACE_OFFSET);
       param->used+= block_size - empty_space;
       param->link_used+= (PAGE_HEADER_SIZE + PAGE_SUFFIX_SIZE +
@@ -2182,11 +2181,11 @@ int maria_chk_data_link(HA_CHECK *param,
              llstr(param->max_found_trid, llbuff));
     }
   }
-  my_free((uchar*) record,MYF(0));
+  my_free(record,MYF(0));
   DBUG_RETURN (error);
 
 err:
-  my_free((uchar*) record,MYF(0));
+  my_free(record,MYF(0));
   param->testflag|=T_RETRY_WITHOUT_QUICK;
   DBUG_RETURN(1);
 } /* maria_chk_data_link */
@@ -2594,7 +2593,7 @@ int maria_repair(HA_CHECK *param, regist
     {
       if (my_errno != HA_ERR_FOUND_DUPP_KEY)
 	goto err;
-      DBUG_DUMP("record", (uchar*) sort_param.record,
+      DBUG_DUMP("record", sort_param.record,
                 share->base.default_rec_buff_size);
       _ma_check_print_warning(param,
                               "Duplicate key %2d for record at %10s against "
@@ -3160,18 +3159,18 @@ static int sort_one_index(HA_CHECK *para
 
   /* Fill block with zero and write it to the new index file */
   length= page.size;
-  bzero((uchar*) buff+length,keyinfo->block_length-length);
+  bzero(buff+length,keyinfo->block_length-length);
   put_crc(buff, new_page_pos, share);
-  if (my_pwrite(new_file,(uchar*) buff,(uint) keyinfo->block_length,
+  if (my_pwrite(new_file, buff,(uint) keyinfo->block_length,
 		new_page_pos,MYF(MY_NABP | MY_WAIT_IF_FULL)))
   {
     _ma_check_print_error(param,"Can't write indexblock, error: %d",my_errno);
     goto err;
   }
-  my_afree((uchar*) buff);
+  my_afree(buff);
   DBUG_RETURN(0);
 err:
-  my_afree((uchar*) buff);
+  my_afree(buff);
   DBUG_RETURN(1);
 } /* sort_one_index */
 
@@ -3467,9 +3466,9 @@ int maria_change_to_newfile(const char *
 /* Copy a block between two files */
 
 int maria_filecopy(HA_CHECK *param, File to,File from,my_off_t start,
-	     my_off_t length, const char *type)
+                   my_off_t length, const char *type)
 {
-  char tmp_buff[IO_SIZE],*buff;
+  uchar tmp_buff[IO_SIZE], *buff;
   ulong buff_length;
   DBUG_ENTER("maria_filecopy");
 
@@ -3482,13 +3481,13 @@ int maria_filecopy(HA_CHECK *param, File
   VOID(my_seek(from,start,MY_SEEK_SET,MYF(0)));
   while (length > buff_length)
   {
-    if (my_read(from,(uchar*) buff,buff_length,MYF(MY_NABP)) ||
-	my_write(to,(uchar*) buff,buff_length,param->myf_rw))
+    if (my_read(from, buff, buff_length, MYF(MY_NABP)) ||
+	my_write(to,  buff, buff_length, param->myf_rw))
       goto err;
     length-= buff_length;
   }
-  if (my_read(from,(uchar*) buff,(uint) length,MYF(MY_NABP)) ||
-      my_write(to,(uchar*) buff,(uint) length,param->myf_rw))
+  if (my_read(from, buff, (size_t) length,MYF(MY_NABP)) ||
+      my_write(to,  buff, (size_t) length,param->myf_rw))
     goto err;
   if (buff != tmp_buff)
     my_free(buff,MYF(0));
@@ -3958,8 +3957,8 @@ err:
 
   my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR));
   my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
-  my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
-  my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(sort_info.key_block, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
   my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
   DBUG_RETURN(got_error);
 }
@@ -4470,9 +4469,9 @@ err:
   pthread_cond_destroy (&sort_info.cond);
   pthread_mutex_destroy(&sort_info.mutex);
 
-  my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
-  my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
-  my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(sort_param,MYF(MY_ALLOW_ZERO_PTR));
   my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
   if (!got_error && (param->testflag & T_UNPACK))
     restore_data_file_type(share);
@@ -4767,7 +4766,7 @@ static int sort_get_next_record(MARIA_SO
 		     llstr(param->search_after_block,llbuff),
 		     llstr(sort_param->start_recpos,llbuff2));
 	if (_ma_read_cache(&sort_param->read_cache,
-                           (uchar*) block_info.header,pos,
+                           block_info.header, pos,
 			   MARIA_BLOCK_INFO_HEADER_LENGTH,
 			   (! found_record ? READING_NEXT : 0) |
 			   parallel_flag | READING_HEADER))
@@ -5049,7 +5048,7 @@ static int sort_get_next_record(MARIA_SO
   case COMPRESSED_RECORD:
     for (searching=0 ;; searching=1, sort_param->pos++)
     {
-      if (_ma_read_cache(&sort_param->read_cache,(uchar*) block_info.header,
+      if (_ma_read_cache(&sort_param->read_cache, block_info.header,
 			 sort_param->pos,
 			 share->pack.ref_length,READING_NEXT))
 	DBUG_RETURN(-1);
@@ -5081,7 +5080,7 @@ static int sort_get_next_record(MARIA_SO
                                llstr(sort_param->pos,llbuff));
 	continue;
       }
-      if (_ma_read_cache(&sort_param->read_cache,(uchar*) sort_param->rec_buff,
+      if (_ma_read_cache(&sort_param->read_cache, sort_param->rec_buff,
 			 block_info.filepos, block_info.rec_len,
 			 READING_NEXT))
       {
@@ -5234,7 +5233,7 @@ int _ma_sort_write_record(MARIA_SORT_PAR
 	length+= _ma_save_pack_length((uint) share->pack.version,
 	                          block_buff + length, info->blob_length);
       if (my_b_write(&info->rec_cache,block_buff,length) ||
-	  my_b_write(&info->rec_cache,(uchar*) sort_param->rec_buff,reclength))
+	  my_b_write(&info->rec_cache, sort_param->rec_buff, reclength))
       {
 	_ma_check_print_error(param,"%d when writing to datafile",my_errno);
 	DBUG_RETURN(1);
@@ -5281,12 +5280,12 @@ static int sort_key_write(MARIA_SORT_PAR
 
   if (sort_info->key_block->inited)
   {
-    cmp= ha_key_cmp(sort_param->seg, (uchar*) sort_info->key_block->lastkey,
+    cmp= ha_key_cmp(sort_param->seg, sort_info->key_block->lastkey,
                     a, USE_WHOLE_KEY,
                     SEARCH_FIND | SEARCH_UPDATE | SEARCH_INSERT,
                     diff_pos);
     if (param->stats_method == MI_STATS_METHOD_NULLS_NOT_EQUAL)
-      ha_key_cmp(sort_param->seg, (uchar*) sort_info->key_block->lastkey,
+      ha_key_cmp(sort_param->seg, sort_info->key_block->lastkey,
                  a, USE_WHOLE_KEY,
                  SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL, diff_pos);
     else if (param->stats_method == MI_STATS_METHOD_IGNORE_NULLS)
@@ -5420,7 +5419,7 @@ static int sort_maria_ft_key_write(MARIA
 
   if (ha_compare_text(sort_param->seg->charset,
                       a+1,a_len-1,
-                      (uchar*) ft_buf->lastkey+1,val_off-1, 0, 0)==0)
+                      ft_buf->lastkey+1,val_off-1, 0, 0)==0)
   {
     uchar *p;
     if (!ft_buf->buf)                   /* store in second-level tree */
@@ -5802,22 +5801,22 @@ int maria_recreate_table(HA_CHECK *param
   if (!(keysegs=(HA_KEYSEG*) my_alloca(sizeof(HA_KEYSEG)*
 				       (key_parts+share.base.keys))))
   {
-    my_afree((uchar*) keyinfo);
+    my_afree(keyinfo);
     DBUG_RETURN(1);
   }
   if (!(columndef=(MARIA_COLUMNDEF*)
 	my_alloca(sizeof(MARIA_COLUMNDEF)*(share.base.fields+1))))
   {
-    my_afree((uchar*) keyinfo);
-    my_afree((uchar*) keysegs);
+    my_afree(keyinfo);
+    my_afree(keysegs);
     DBUG_RETURN(1);
   }
   if (!(uniquedef=(MARIA_UNIQUEDEF*)
 	my_alloca(sizeof(MARIA_UNIQUEDEF)*(share.state.header.uniques+1))))
   {
-    my_afree((uchar*) columndef);
-    my_afree((uchar*) keyinfo);
-    my_afree((uchar*) keysegs);
+    my_afree(columndef);
+    my_afree(keyinfo);
+    my_afree(keysegs);
     DBUG_RETURN(1);
   }
 
@@ -5944,10 +5943,10 @@ int maria_recreate_table(HA_CHECK *param
     goto end;
   error=0;
 end:
-  my_afree((uchar*) uniquedef);
-  my_afree((uchar*) keyinfo);
-  my_afree((uchar*) columndef);
-  my_afree((uchar*) keysegs);
+  my_afree(uniquedef);
+  my_afree(keyinfo);
+  my_afree(columndef);
+  my_afree(keysegs);
   DBUG_RETURN(error);
 }
 

=== modified file 'storage/maria/ma_create.c'
--- a/storage/maria/ma_create.c	2008-08-25 11:49:47 +0000
+++ b/storage/maria/ma_create.c	2009-01-09 04:23:25 +0000
@@ -659,7 +659,7 @@ int maria_create(const char *name, enum 
     goto err_no_lock;
   }
 
-  bmove(share.state.header.file_version,(uchar*) maria_file_magic,4);
+  bmove(share.state.header.file_version, maria_file_magic, 4);
   ci->old_options=options | (ci->old_options & HA_OPTION_TEMP_COMPRESS_RECORD ?
                              HA_OPTION_COMPRESS_RECORD |
                              HA_OPTION_TEMP_COMPRESS_RECORD: 0);
@@ -956,11 +956,11 @@ int maria_create(const char *name, enum 
       column_array[col_order[i]->column_nr]= i;
       if (_ma_columndef_write(file, col_order[i]))
       {
-        my_free((uchar*) col_order, MYF(0));
+        my_free(col_order, MYF(0));
         goto err;
       }
     }
-    my_free((uchar*) col_order, MYF(0));
+    my_free(col_order, MYF(0));
   }
   else
   {

=== modified file 'storage/maria/ma_delete.c'
--- a/storage/maria/ma_delete.c	2008-09-01 17:31:40 +0000
+++ b/storage/maria/ma_delete.c	2009-01-09 04:23:25 +0000
@@ -257,7 +257,7 @@ my_bool _ma_ck_real_delete(register MARI
     }
   }
 err:
-  my_afree((uchar*) root_buff);
+  my_afree(root_buff);
   DBUG_PRINT("exit",("Return: %d",result));
   DBUG_RETURN(result);
 } /* _ma_ck_real_delete */

=== modified file 'storage/maria/ma_dynrec.c'
--- a/storage/maria/ma_dynrec.c	2008-05-29 18:39:25 +0000
+++ b/storage/maria/ma_dynrec.c	2009-01-09 04:23:25 +0000
@@ -578,7 +578,7 @@ static my_bool delete_dynamic_record(MAR
       bfill(block_info.header+12,8,255);
     else
       mi_sizestore(block_info.header+12,block_info.next_filepos);
-    if (info->s->file_write(info,(uchar*) block_info.header,20,filepos,
+    if (info->s->file_write(info, block_info.header, 20, filepos,
 		  MYF(MY_NABP)))
       DBUG_RETURN(1);
     info->s->state.dellink = filepos;
@@ -650,7 +650,7 @@ int _ma_write_part_record(MARIA_HA *info
 	temp[0]=13;
 	mi_int4store(temp+1,*reclength);
 	mi_int3store(temp+5,length-head_length);
-	mi_sizestore((uchar*) temp+8,next_filepos);
+	mi_sizestore(temp+8,next_filepos);
       }
       else
       {
@@ -660,13 +660,13 @@ int _ma_write_part_record(MARIA_HA *info
 	{
 	  mi_int3store(temp+1,*reclength);
 	  mi_int3store(temp+4,length-head_length);
-	  mi_sizestore((uchar*) temp+7,next_filepos);
+	  mi_sizestore(temp+7,next_filepos);
 	}
 	else
 	{
 	  mi_int2store(temp+1,*reclength);
 	  mi_int2store(temp+3,length-head_length);
-	  mi_sizestore((uchar*) temp+5,next_filepos);
+	  mi_sizestore(temp+5,next_filepos);
 	}
       }
     }
@@ -677,12 +677,12 @@ int _ma_write_part_record(MARIA_HA *info
       if (long_block)
       {
 	mi_int3store(temp+1,length-head_length);
-	mi_sizestore((uchar*) temp+4,next_filepos);
+	mi_sizestore(temp+4,next_filepos);
       }
       else
       {
 	mi_int2store(temp+1,length-head_length);
-	mi_sizestore((uchar*) temp+3,next_filepos);
+	mi_sizestore(temp+3,next_filepos);
       }
     }
   }
@@ -701,16 +701,16 @@ int _ma_write_part_record(MARIA_HA *info
       mi_int2store(temp+1,*reclength);
       temp[3]= (uchar) (extra_length);
     }
-    length=	  *reclength+head_length;	/* Write only what is needed */
+    length= *reclength+head_length;	/* Write only what is needed */
   }
-  DBUG_DUMP("header",(uchar*) temp,head_length);
+  DBUG_DUMP("header", temp, head_length);
 
 	/* Make a long block for one write */
   record_end= *record+length-head_length;
   del_length=(res_length ? MARIA_DYN_DELETE_BLOCK_HEADER : 0);
-  bmove((uchar*) (*record-head_length),(uchar*) temp,head_length);
+  bmove((*record-head_length), temp, head_length);
   memcpy(temp,record_end,(size_t) (extra_length+del_length));
-  bzero((uchar*) record_end,extra_length);
+  bzero(record_end, extra_length);
 
   if (res_length)
   {
@@ -750,18 +750,18 @@ int _ma_write_part_record(MARIA_HA *info
     if (info->update & HA_STATE_EXTEND_BLOCK)
     {
       info->update&= ~HA_STATE_EXTEND_BLOCK;
-      if (my_block_write(&info->rec_cache,(uchar*) *record-head_length,
+      if (my_block_write(&info->rec_cache, *record-head_length,
 			 length+extra_length+del_length,filepos))
       goto err;
     }
-    else if (my_b_write(&info->rec_cache,(uchar*) *record-head_length,
+    else if (my_b_write(&info->rec_cache, *record-head_length,
 			length+extra_length+del_length))
       goto err;
   }
   else
   {
     info->rec_cache.seek_not_done=1;
-    if (info->s->file_write(info,(uchar*) *record-head_length,
+    if (info->s->file_write(info, *record-head_length,
                             length+extra_length+
                             del_length,filepos,info->s->write_flag))
       goto err;
@@ -903,7 +903,7 @@ static my_bool update_dynamic_record(MAR
 	      mi_int3store(del_block.header+1, rest_length);
 	      mi_sizestore(del_block.header+4,info->s->state.dellink);
 	      bfill(del_block.header+12,8,255);
-	      if (info->s->file_write(info,(uchar*) del_block.header, 20,
+	      if (info->s->file_write(info, del_block.header, 20,
                                       next_pos, MYF(MY_NABP)))
 		DBUG_RETURN(1);
 	      info->s->state.dellink= next_pos;
@@ -980,7 +980,7 @@ uint _ma_rec_pack(MARIA_HA *info, regist
 	{
 	  char *temp_pos;
 	  size_t tmp_length=length-portable_sizeof_char_ptr;
-	  memcpy((uchar*) to,from,tmp_length);
+	  memcpy(to,from,tmp_length);
 	  memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*));
 	  memcpy(to+tmp_length,temp_pos,(size_t) blob->length);
 	  to+=tmp_length+blob->length;
@@ -993,7 +993,7 @@ uint _ma_rec_pack(MARIA_HA *info, regist
 	  flag|=bit;
 	else
 	{
-          memcpy((uchar*) to,from,(size_t) length);
+          memcpy(to, from, (size_t) length);
           to+=length;
 	}
       }
@@ -1023,7 +1023,7 @@ uint _ma_rec_pack(MARIA_HA *info, regist
 	  }
 	  else
 	    *to++= (uchar) new_length;
-	  memcpy((uchar*) to,pos,(size_t) new_length); to+=new_length;
+	  memcpy(to, pos, (size_t) new_length); to+=new_length;
 	  flag|=bit;
 	}
 	else
@@ -1271,7 +1271,7 @@ ulong _ma_rec_unpack(register MARIA_HA *
       if (flag & bit)
       {
 	if (type == FIELD_BLOB || type == FIELD_SKIP_ZERO)
-	  bzero((uchar*) to,column_length);
+	  bzero(to, column_length);
 	else if (type == FIELD_SKIP_ENDSPACE ||
 		 type == FIELD_SKIP_PRESPACE)
 	{
@@ -1293,13 +1293,13 @@ ulong _ma_rec_unpack(register MARIA_HA *
 	    goto err;
 	  if (type == FIELD_SKIP_ENDSPACE)
 	  {
-	    memcpy(to,(uchar*) from,(size_t) length);
-	    bfill((uchar*) to+length,column_length-length,' ');
+	    memcpy(to, from, (size_t) length);
+	    bfill(to+length, column_length-length, ' ');
 	  }
 	  else
 	  {
-	    bfill((uchar*) to,column_length-length,' ');
-	    memcpy(to+column_length-length,(uchar*) from,(size_t) length);
+	    bfill(to, column_length-length, ' ');
+	    memcpy(to+column_length-length, from, (size_t) length);
 	  }
 	  from+=length;
 	}
@@ -1313,9 +1313,9 @@ ulong _ma_rec_unpack(register MARIA_HA *
             from_left - size_length < blob_length ||
             from_left - size_length - blob_length < min_pack_length)
 	  goto err;
-	memcpy((uchar*) to,(uchar*) from,(size_t) size_length);
+	memcpy(to, from, (size_t) size_length);
 	from+=size_length;
-	memcpy_fixed((uchar*) to+size_length,(uchar*) &from,sizeof(char*));
+	memcpy_fixed(to+size_length,(uchar*) &from,sizeof(char*));
 	from+=blob_length;
       }
       else
@@ -1324,7 +1324,7 @@ ulong _ma_rec_unpack(register MARIA_HA *
 	  min_pack_length--;
 	if (min_pack_length + column_length > (uint) (from_end - from))
 	  goto err;
-	memcpy(to,(uchar*) from,(size_t) column_length); from+=column_length;
+	memcpy(to, from, (size_t) column_length); from+=column_length;
       }
       if ((bit= bit << 1) >= 256)
       {
@@ -1336,7 +1336,7 @@ ulong _ma_rec_unpack(register MARIA_HA *
       if (min_pack_length > (uint) (from_end - from))
 	goto err;
       min_pack_length-=column_length;
-      memcpy(to, (uchar*) from, (size_t) column_length);
+      memcpy(to, from, (size_t) column_length);
       from+=column_length;
     }
   }
@@ -1349,7 +1349,7 @@ err:
   my_errno= HA_ERR_WRONG_IN_RECORD;
   DBUG_PRINT("error",("to_end: 0x%lx -> 0x%lx  from_end: 0x%lx -> 0x%lx",
 		      (long) to, (long) to_end, (long) from, (long) from_end));
-  DBUG_DUMP("from",(uchar*) info->rec_buff,info->s->base.min_pack_length);
+  DBUG_DUMP("from", info->rec_buff, info->s->base.min_pack_length);
   DBUG_RETURN(MY_FILE_ERROR);
 } /* _ma_rec_unpack */
 
@@ -1508,7 +1508,7 @@ int _ma_read_dynamic_record(MARIA_HA *in
         prefetch_len= block_info.data_len;
       if (prefetch_len)
       {
-        memcpy((uchar*) to, block_info.header + offset, prefetch_len);
+        memcpy(to, block_info.header + offset, prefetch_len);
         block_info.data_len-= prefetch_len;
         left_length-= prefetch_len;
         to+= prefetch_len;
@@ -1526,7 +1526,7 @@ int _ma_read_dynamic_record(MARIA_HA *in
         there is no equivalent without seeking. We are at the right
         position already. :(
       */
-      if (info->s->file_read(info, (uchar*) to, block_info.data_len,
+      if (info->s->file_read(info, to, block_info.data_len,
                              filepos, MYF(MY_NABP)))
         goto panic;
       left_length-=block_info.data_len;
@@ -1668,7 +1668,7 @@ my_bool _ma_cmp_dynamic_record(register 
   error= 0;
 err:
   if (buffer != info->rec_buff)
-    my_afree((uchar*) buffer);
+    my_afree(buffer);
   DBUG_PRINT("exit", ("result: %d", error));
   DBUG_RETURN(error);
 }
@@ -1779,7 +1779,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA
     }
     if (info->opt_flag & READ_CACHE_USED)
     {
-      if (_ma_read_cache(&info->rec_cache,(uchar*) block_info.header,filepos,
+      if (_ma_read_cache(&info->rec_cache, block_info.header, filepos,
 			 sizeof(block_info.header),
 			 (!block_of_record && skip_deleted_blocks ?
                           READING_NEXT : 0) | READING_HEADER))
@@ -1843,7 +1843,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA
 	tmp_length= block_info.data_len;
       if (tmp_length)
       {
-	memcpy((uchar*) to, block_info.header+offset,tmp_length);
+	memcpy(to, block_info.header+offset, tmp_length);
 	block_info.data_len-=tmp_length;
 	left_len-=tmp_length;
 	to+=tmp_length;
@@ -1855,7 +1855,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA
     {
       if (info->opt_flag & READ_CACHE_USED)
       {
-	if (_ma_read_cache(&info->rec_cache,(uchar*) to,filepos,
+	if (_ma_read_cache(&info->rec_cache, to,filepos,
 			   block_info.data_len,
 			   (!block_of_record && skip_deleted_blocks) ?
                            READING_NEXT : 0))
@@ -1869,8 +1869,7 @@ int _ma_read_rnd_dynamic_record(MARIA_HA
             flush_io_cache(&info->rec_cache))
           goto err;
 	/* VOID(my_seek(info->dfile.file, filepos, MY_SEEK_SET, MYF(0))); */
-	if (my_read(info->dfile.file, (uchar*)to, block_info.data_len,
-                    MYF(MY_NABP)))
+	if (my_read(info->dfile.file, to, block_info.data_len, MYF(MY_NABP)))
 	{
 	  if (my_errno == HA_ERR_FILE_TOO_SHORT)
 	    my_errno= HA_ERR_WRONG_IN_RECORD;	/* Unexpected end of file */

=== modified file 'storage/maria/ma_extra.c'
--- a/storage/maria/ma_extra.c	2008-08-18 22:21:22 +0000
+++ b/storage/maria/ma_extra.c	2009-01-09 04:23:25 +0000
@@ -189,8 +189,8 @@ int maria_extra(MARIA_HA *info, enum ha_
   case HA_EXTRA_KEYREAD:			/* Read only keys to record */
   case HA_EXTRA_REMEMBER_POS:
     info->opt_flag|= REMEMBER_OLD_POS;
-    bmove((uchar*) info->last_key.data + share->base.max_key_length*2,
-	  (uchar*) info->last_key.data,
+    bmove(info->last_key.data + share->base.max_key_length*2,
+	  info->last_key.data,
           info->last_key.data_length + info->last_key.ref_length);
     info->save_update=	info->update;
     info->save_lastinx= info->lastinx;
@@ -208,8 +208,8 @@ int maria_extra(MARIA_HA *info, enum ha_
   case HA_EXTRA_RESTORE_POS:
     if (info->opt_flag & REMEMBER_OLD_POS)
     {
-      bmove((uchar*) info->last_key.data,
-	    (uchar*) info->last_key.data + share->base.max_key_length*2,
+      bmove(info->last_key.data,
+	    info->last_key.data + share->base.max_key_length*2,
 	    info->save_lastkey_data_length + info->save_lastkey_ref_length);
       info->update=	info->save_update | HA_STATE_WRITTEN;
       info->lastinx=	info->save_lastinx;

=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- a/storage/maria/ma_ft_boolean_search.c	2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_ft_boolean_search.c	2009-01-09 04:23:25 +0000
@@ -598,7 +598,7 @@ FT_INFO * maria_ft_init_boolean_search(M
   return ftb;
 err:
   free_root(& ftb->mem_root, MYF(0));
-  my_free((uchar*)ftb,MYF(0));
+  my_free(ftb, MYF(0));
   return 0;
 }
 
@@ -997,7 +997,7 @@ void maria_ft_boolean_close_search(FT_IN
     delete_tree(& ftb->no_dupes);
   }
   free_root(& ftb->mem_root, MYF(0));
-  my_free((uchar*)ftb,MYF(0));
+  my_free(ftb, MYF(0));
 }
 
 

=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- a/storage/maria/ma_ft_nlq_search.c	2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_ft_nlq_search.c	2009-01-09 04:23:25 +0000
@@ -69,8 +69,8 @@ static int walk_and_match(FT_WORD *word,
   TREE_ELEMENT *selem;
   double       gweight=1;
   MARIA_HA     *info= aio->info;
-  uchar         *keybuff= (uchar*) aio->keybuff;
-  MARIA_KEYDEF    *keyinfo=info->s->keyinfo+aio->keynr;
+  uchar        *keybuff= aio->keybuff;
+  MARIA_KEYDEF *keyinfo= info->s->keyinfo+aio->keynr;
   my_off_t     key_root=info->s->state.key_root[aio->keynr];
   uint         extra=HA_FT_WLEN+info->s->base.rec_reflength;
   MARIA_KEY    key;
@@ -360,7 +360,7 @@ float maria_ft_nlq_find_relevance(FT_INF
 
 void maria_ft_nlq_close_search(FT_INFO *handler)
 {
-  my_free((uchar*)handler,MYF(0));
+  my_free(handler, MYF(0));
 }
 
 

=== modified file 'storage/maria/ma_ft_parser.c'
--- a/storage/maria/ma_ft_parser.c	2008-06-24 14:14:56 +0000
+++ b/storage/maria/ma_ft_parser.c	2009-01-09 04:23:25 +0000
@@ -125,7 +125,7 @@ uchar maria_ft_get_word(CHARSET_INFO *cs
   {
     for (; doc < end; 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))
         break;
       if (*doc == FTB_RQUOT && param->quot)
@@ -165,7 +165,7 @@ uchar maria_ft_get_word(CHARSET_INFO *cs
     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)

=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c	2008-08-25 11:49:47 +0000
+++ b/storage/maria/ma_loghandler.c	2009-01-09 04:23:25 +0000
@@ -2973,7 +2973,7 @@ restart:
               This IF should be true because we use in-memory data which
               supposed to be correct.
             */
-            if (translog_page_validator((uchar*) buffer,
+            if (translog_page_validator(buffer,
                                         LSN_OFFSET(addr) / TRANSLOG_PAGE_SIZE,
                                         (uchar*) &file_copy))
             {
@@ -2996,15 +2996,14 @@ restart:
   }
   file= get_logfile_by_number(file_no);
   DBUG_ASSERT(file != NULL);
-  buffer=
-    (uchar*) pagecache_read(log_descriptor.pagecache, &file->handler,
-                            LSN_OFFSET(addr) / TRANSLOG_PAGE_SIZE,
-                            3, (direct_link ? NULL : buffer),
-                            PAGECACHE_PLAIN_PAGE,
-                            (direct_link ?
-                             PAGECACHE_LOCK_READ :
-                             PAGECACHE_LOCK_LEFT_UNLOCKED),
-                            direct_link);
+  buffer= pagecache_read(log_descriptor.pagecache, &file->handler,
+                         LSN_OFFSET(addr) / TRANSLOG_PAGE_SIZE,
+                         3, (direct_link ? NULL : buffer),
+                         PAGECACHE_PLAIN_PAGE,
+                         (direct_link ?
+                          PAGECACHE_LOCK_READ :
+                          PAGECACHE_LOCK_LEFT_UNLOCKED),
+                         direct_link);
   DBUG_PRINT("info", ("Direct link is assigned to : 0x%lx * 0x%lx",
                       (ulong) direct_link,
                       (ulong)(direct_link ? *direct_link : NULL)));
@@ -4083,7 +4082,7 @@ void translog_destroy()
     my_close(log_descriptor.directory_fd, MYF(MY_WME));
   my_atomic_rwlock_destroy(&LOCK_id_to_share);
   if (id_to_share != NULL)
-    my_free((uchar*)(id_to_share + 1), MYF(MY_WME));
+    my_free((id_to_share + 1), MYF(MY_WME));
   DBUG_VOID_RETURN;
 }
 
@@ -6248,7 +6247,7 @@ void translog_free_record_header(TRANSLO
   DBUG_ENTER("translog_free_record_header");
   if (buff->groups_no != 0)
   {
-    my_free((uchar*) buff->groups, MYF(0));
+    my_free(buff->groups, MYF(0));
     buff->groups_no= 0;
   }
   DBUG_VOID_RETURN;

=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c	2008-08-26 12:34:57 +0000
+++ b/storage/maria/ma_open.c	2009-01-09 04:23:25 +0000
@@ -313,8 +313,7 @@ MARIA_HA *maria_open(const char *name, i
       my_errno= HA_ERR_NOT_A_TABLE;
       goto err;
     }
-    if (memcmp((uchar*) share->state.header.file_version,
-	       (uchar*) maria_file_magic, 4))
+    if (memcmp(share->state.header.file_version, maria_file_magic, 4))
     {
       DBUG_PRINT("error",("Wrong header in %s",name_buff));
       DBUG_DUMP("error_dump", share->state.header.file_version,
@@ -911,12 +910,12 @@ err:
     (*share->once_end)(share);
     /* fall through */
   case 4:
-    my_free((uchar*) share,MYF(0));
+    my_free(share,MYF(0));
     /* fall through */
   case 3:
     /* fall through */
   case 2:
-    my_afree((uchar*) disk_cache);
+    my_afree(disk_cache);
     /* fall through */
   case 1:
     VOID(my_close(kfile,MYF(0)));
@@ -941,8 +940,8 @@ my_bool _ma_alloc_buffer(uchar **old_add
   if (*old_size < new_size)
   {
     uchar *addr;
-    if (!(addr= (uchar*) my_realloc((uchar*) *old_addr, new_size,
-                                   MYF(MY_ALLOW_ZERO_PTR))))
+    if (!(addr= (uchar*) my_realloc(*old_addr, new_size,
+                                    MYF(MY_ALLOW_ZERO_PTR))))
       return 1;
     *old_addr= addr;
     *old_size= new_size;

=== modified file 'storage/maria/ma_packrec.c'
--- a/storage/maria/ma_packrec.c	2008-04-01 14:57:30 +0000
+++ b/storage/maria/ma_packrec.c	2009-01-09 04:23:25 +0000
@@ -156,8 +156,8 @@ my_bool _ma_once_end_pack_row(MARIA_SHAR
 {
   if (share->decode_trees)
   {
-    my_free((uchar*) share->decode_trees,MYF(0));
-    my_free((uchar*) share->decode_tables,MYF(0));
+    my_free(share->decode_trees,MYF(0));
+    my_free(share->decode_tables,MYF(0));
   }
   return 0;
 }
@@ -184,14 +184,14 @@ static my_bool _ma_read_pack_info(MARIA_
     maria_quick_table_bits=MAX_QUICK_TABLE_BITS;
 
   my_errno=0;
-  if (my_read(file,(uchar*) header,sizeof(header),MYF(MY_NABP)))
+  if (my_read(file, header, sizeof(header), MYF(MY_NABP)))
   {
     if (!my_errno)
       my_errno=HA_ERR_END_OF_FILE;
     goto err0;
   }
   /* Only the first three bytes of magic number are independent of version. */
-  if (memcmp((uchar*) header, (uchar*) maria_pack_file_magic, 3))
+  if (memcmp(header, maria_pack_file_magic, 3))
   {
     my_errno=HA_ERR_WRONG_IN_RECORD;
     goto err0;
@@ -332,9 +332,9 @@ static my_bool _ma_read_pack_info(MARIA_
 err3:
   my_errno=HA_ERR_WRONG_IN_RECORD;
 err2:
-  my_free((uchar*) share->decode_tables,MYF(0));
+  my_free(share->decode_tables, MYF(0));
 err1:
-  my_free((uchar*) share->decode_trees,MYF(0));
+  my_free(share->decode_trees, MYF(0));
 err0:
   DBUG_RETURN(1);
 }
@@ -752,7 +752,7 @@ int _ma_read_pack_record(MARIA_HA *info,
                               &info->rec_buff, &info->rec_buff_size, file,
                               filepos))
     goto err;
-  if (my_read(file,(uchar*) info->rec_buff + block_info.offset ,
+  if (my_read(file, info->rec_buff + block_info.offset ,
 	      block_info.rec_len - block_info.offset, MYF(MY_NABP)))
     goto panic;
   info->update|= HA_STATE_AKTIV;
@@ -782,7 +782,7 @@ int _ma_pack_rec_unpack(register MARIA_H
     from+= info->s->base.null_bytes;
     reclength-= info->s->base.null_bytes;
   }
-  init_bit_buffer(bit_buff, (uchar*) from, reclength);
+  init_bit_buffer(bit_buff, from, reclength);
   for (current_field=share->columndef, end=current_field+share->base.fields ;
        current_field < end ;
        current_field++,to=end_field)
@@ -882,7 +882,7 @@ static void uf_space_normal(MARIA_COLUMN
                             uchar *to, uchar *end)
 {
   if (get_bit(bit_buff))
-    bfill((uchar*) to,(end-to),' ');
+    bfill(to, (end-to), ' ');
   else
     decode_bytes(rec,bit_buff,to,end);
 }
@@ -893,7 +893,7 @@ static void uf_space_endspace_selected(M
 {
   uint spaces;
   if (get_bit(bit_buff))
-    bfill((uchar*) to,(end-to),' ');
+    bfill(to, (end-to), ' ');
   else
   {
     if (get_bit(bit_buff))
@@ -905,7 +905,7 @@ static void uf_space_endspace_selected(M
       }
       if (to+spaces != end)
 	decode_bytes(rec,bit_buff,to,end-spaces);
-      bfill((uchar*) end-spaces,spaces,' ');
+      bfill(end - spaces, spaces, ' ');
     }
     else
       decode_bytes(rec,bit_buff,to,end);
@@ -926,7 +926,7 @@ static void uf_endspace_selected(MARIA_C
     }
     if (to+spaces != end)
       decode_bytes(rec,bit_buff,to,end-spaces);
-    bfill((uchar*) end-spaces,spaces,' ');
+    bfill(end - spaces, spaces, ' ');
   }
   else
     decode_bytes(rec,bit_buff,to,end);
@@ -937,7 +937,7 @@ static void uf_space_endspace(MARIA_COLU
 {
   uint spaces;
   if (get_bit(bit_buff))
-    bfill((uchar*) to,(end-to),' ');
+    bfill(to, (end-to), ' ');
   else
   {
     if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@@ -947,7 +947,7 @@ static void uf_space_endspace(MARIA_COLU
     }
     if (to+spaces != end)
       decode_bytes(rec,bit_buff,to,end-spaces);
-    bfill((uchar*) end-spaces,spaces,' ');
+    bfill(end - spaces, spaces, ' ');
   }
 }
 
@@ -962,7 +962,7 @@ static void uf_endspace(MARIA_COLUMNDEF 
   }
   if (to+spaces != end)
     decode_bytes(rec,bit_buff,to,end-spaces);
-  bfill((uchar*) end-spaces,spaces,' ');
+  bfill(end - spaces, spaces, ' ');
 }
 
 static void uf_space_prespace_selected(MARIA_COLUMNDEF *rec,
@@ -971,7 +971,7 @@ static void uf_space_prespace_selected(M
 {
   uint spaces;
   if (get_bit(bit_buff))
-    bfill((uchar*) to,(end-to),' ');
+    bfill(to, (end-to), ' ');
   else
   {
     if (get_bit(bit_buff))
@@ -981,7 +981,7 @@ static void uf_space_prespace_selected(M
 	bit_buff->error=1;
 	return;
       }
-      bfill((uchar*) to,spaces,' ');
+      bfill(to, spaces, ' ');
       if (to+spaces != end)
 	decode_bytes(rec,bit_buff,to+spaces,end);
     }
@@ -1003,7 +1003,7 @@ static void uf_prespace_selected(MARIA_C
       bit_buff->error=1;
       return;
     }
-    bfill((uchar*) to,spaces,' ');
+    bfill(to, spaces, ' ');
     if (to+spaces != end)
       decode_bytes(rec,bit_buff,to+spaces,end);
   }
@@ -1017,7 +1017,7 @@ static void uf_space_prespace(MARIA_COLU
 {
   uint spaces;
   if (get_bit(bit_buff))
-    bfill((uchar*) to,(end-to),' ');
+    bfill(to, (end-to), ' ');
   else
   {
     if ((spaces=get_bits(bit_buff,rec->space_length_bits))+to > end)
@@ -1025,7 +1025,7 @@ static void uf_space_prespace(MARIA_COLU
       bit_buff->error=1;
       return;
     }
-    bfill((uchar*) to,spaces,' ');
+    bfill(to, spaces, ' ');
     if (to+spaces != end)
       decode_bytes(rec,bit_buff,to+spaces,end);
   }
@@ -1040,7 +1040,7 @@ static void uf_prespace(MARIA_COLUMNDEF 
     bit_buff->error=1;
     return;
   }
-  bfill((uchar*) to,spaces,' ');
+  bfill(to, spaces, ' ');
   if (to+spaces != end)
     decode_bytes(rec,bit_buff,to+spaces,end);
 }
@@ -1091,14 +1091,14 @@ static void uf_blob(MARIA_COLUMNDEF *rec
     if (bit_buff->blob_pos+length > bit_buff->blob_end)
     {
       bit_buff->error=1;
-      bzero((uchar*) to,(end-to));
+      bzero(to, (end-to));
       return;
     }
-    decode_bytes(rec,bit_buff,(uchar*) bit_buff->blob_pos,
-                 (uchar*) bit_buff->blob_pos+length);
-    _ma_store_blob_length((uchar*) to,pack_length,length);
-    memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos,
-		 sizeof(char*));
+    decode_bytes(rec, bit_buff, bit_buff->blob_pos,
+                 bit_buff->blob_pos + length);
+    _ma_store_blob_length(to, pack_length, length);
+    memcpy_fixed((uchar*) to+pack_length,(uchar*) &bit_buff->blob_pos,
+		 sizeof(uchar*));
     bit_buff->blob_pos+=length;
   }
 }
@@ -1359,7 +1359,7 @@ int _ma_read_rnd_pack_record(MARIA_HA *i
   file= info->dfile.file;
   if (info->opt_flag & READ_CACHE_USED)
   {
-    if (_ma_read_cache(&info->rec_cache, (uchar*) block_info.header,
+    if (_ma_read_cache(&info->rec_cache, block_info.header,
                        filepos, share->pack.ref_length,
                        skip_deleted_blocks ? READING_NEXT : 0))
       goto err;
@@ -1379,14 +1379,14 @@ int _ma_read_rnd_pack_record(MARIA_HA *i
 
   if (info->opt_flag & READ_CACHE_USED)
   {
-    if (_ma_read_cache(&info->rec_cache, (uchar*) info->rec_buff,
+    if (_ma_read_cache(&info->rec_cache, info->rec_buff,
                        block_info.filepos, block_info.rec_len,
                        skip_deleted_blocks ? READING_NEXT : 0))
       goto err;
   }
   else
   {
-    if (my_read(info->dfile.file, (uchar*)info->rec_buff + block_info.offset,
+    if (my_read(info->dfile.file, info->rec_buff + block_info.offset,
 		block_info.rec_len-block_info.offset,
 		MYF(MY_NABP)))
       goto err;
@@ -1424,7 +1424,7 @@ uint _ma_pack_get_block_info(MARIA_HA *m
     VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
     if (my_read(file, header,ref_length,MYF(MY_NABP)))
       return BLOCK_FATAL_ERROR;
-    DBUG_DUMP("header",(uchar*) header,ref_length);
+    DBUG_DUMP("header", header, ref_length);
   }
   head_length= read_pack_length((uint) maria->s->pack.version, header,
                                 &info->rec_len);
@@ -1441,7 +1441,7 @@ uint _ma_pack_get_block_info(MARIA_HA *m
                          info->rec_len + info->blob_len +
                          maria->s->base.extra_rec_buff_size))
       return BLOCK_FATAL_ERROR;			/* not enough memory */
-    bit_buff->blob_pos= (uchar*) *rec_buff_p + info->rec_len;
+    bit_buff->blob_pos= *rec_buff_p + info->rec_len;
     bit_buff->blob_end= bit_buff->blob_pos + info->blob_len;
     maria->blob_length=info->blob_len;
   }
@@ -1588,8 +1588,8 @@ _ma_mempack_get_block_info(MARIA_HA *mar
     if (_ma_alloc_buffer(rec_buff_p, rec_buff_size_p,
                          info->blob_len + maria->s->base.extra_rec_buff_size))
       return 0;				/* not enough memory */
-    bit_buff->blob_pos= (uchar*) *rec_buff_p;
-    bit_buff->blob_end= (uchar*) *rec_buff_p + info->blob_len;
+    bit_buff->blob_pos= *rec_buff_p;
+    bit_buff->blob_end= *rec_buff_p + info->blob_len;
   }
   return header;
 }

=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c	2008-08-25 18:26:50 +0000
+++ b/storage/maria/ma_pagecache.c	2009-01-09 04:23:25 +0000
@@ -851,12 +851,12 @@ err:
   pagecache->blocks=  0;
   if (pagecache->block_mem)
   {
-    my_large_free((uchar*) pagecache->block_mem, MYF(0));
+    my_large_free(pagecache->block_mem, MYF(0));
     pagecache->block_mem= NULL;
   }
   if (pagecache->block_root)
   {
-    my_free((uchar*) pagecache->block_root, MYF(0));
+    my_free(pagecache->block_root, MYF(0));
     pagecache->block_root= NULL;
   }
   my_errno= error;
@@ -1101,9 +1101,9 @@ void end_pagecache(PAGECACHE *pagecache,
   {
     if (pagecache->block_mem)
     {
-      my_large_free((uchar*) pagecache->block_mem, MYF(0));
+      my_large_free(pagecache->block_mem, MYF(0));
       pagecache->block_mem= NULL;
-      my_free((uchar*) pagecache->block_root, MYF(0));
+      my_free(pagecache->block_root, MYF(0));
       pagecache->block_root= NULL;
     }
     pagecache->disk_blocks= -1;
@@ -2164,7 +2164,7 @@ static void remove_pin(PAGECACHE_BLOCK_L
     PAGECACHE_PIN_INFO *info= info_find(block->pin_list, my_thread_var);
     DBUG_ASSERT(info != 0);
     info_unlink(info);
-    my_free((uchar*) info, MYF(0));
+    my_free(info, MYF(0));
   }
 #endif
   DBUG_VOID_RETURN;
@@ -2186,7 +2186,7 @@ static void info_remove_lock(PAGECACHE_B
                                      my_thread_var);
   DBUG_ASSERT(info != 0);
   info_unlink((PAGECACHE_PIN_INFO *)info);
-  my_free((uchar*)info, MYF(0));
+  my_free(info, MYF(0));
 }
 static void info_change_lock(PAGECACHE_BLOCK_LINK *block, my_bool wl)
 {
@@ -3267,7 +3267,7 @@ no_key_cache:					/* Key cache is not us
   /* We can't use mutex here as the key cache may not be initialized */
   pagecache->global_cache_r_requests++;
   pagecache->global_cache_read++;
-  if (pagecache_fread(pagecache, file, (uchar*) buff, pageno,
+  if (pagecache_fread(pagecache, file, buff, pageno,
                       pagecache->readwrite_flags))
     error= 1;
   DBUG_RETURN(error ? (uchar*) 0 : buff);
@@ -3882,7 +3882,7 @@ no_key_cache:
       memcpy((char *)page_buffer + offset, buff, size);
       buff= page_buffer;
     }
-    if (pagecache_fwrite(pagecache, file, (uchar*) buff, pageno, type,
+    if (pagecache_fwrite(pagecache, file, buff, pageno, type,
                          pagecache->readwrite_flags))
       error= 1;
   }
@@ -4427,7 +4427,7 @@ restart:
                test_key_cache(pagecache, "end of flush_pagecache_blocks", 0););
 #endif
   if (cache != cache_buff)
-    my_free((uchar*) cache, MYF(0));
+    my_free(cache, MYF(0));
   if (rc != 0)
   {
     if (last_errno)

=== modified file 'storage/maria/ma_preload.c'
--- a/storage/maria/ma_preload.c	2008-03-04 11:47:02 +0000
+++ b/storage/maria/ma_preload.c	2009-01-09 04:23:25 +0000
@@ -42,7 +42,7 @@
 int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves)
 {
   ulong block_length= 0;
-  uchar *buff= NULL;
+  uchar *buff;
   MARIA_SHARE* share= info->s;
   uint keynr;
   my_off_t key_file_length= share->state.state.key_file_length;
@@ -84,7 +84,7 @@ int maria_preload(MARIA_HA *info, ulongl
       consecutive pages (like the my_pread() in mi_preload()).
     */
     if (pagecache_read(share->pagecache, &share->kfile, page_no,
-                       DFLT_INIT_HITS, (uchar*) buff, share->page_type,
+                       DFLT_INIT_HITS, buff, share->page_type,
                        PAGECACHE_LOCK_WRITE, &page_link) == NULL)
       goto err;
     keynr= _ma_get_keynr(share, buff);

=== modified file 'storage/maria/ma_rnext_same.c'
--- a/storage/maria/ma_rnext_same.c	2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_rnext_same.c	2009-01-09 04:23:25 +0000
@@ -69,8 +69,8 @@ int maria_rnext_same(MARIA_HA *info, uch
                                     SEARCH_BIGGER,
                                     info->s->state.key_root[inx])))
           break;
-        if (ha_key_cmp(keyinfo->seg, (uchar*) info->last_key.data,
-                       (uchar*) info->lastkey_buff2,
+        if (ha_key_cmp(keyinfo->seg, info->last_key.data,
+                       info->lastkey_buff2,
                        info->last_rkey_length, SEARCH_FIND,
                        not_used))
         {

=== modified file 'storage/maria/ma_rt_index.c'
--- a/storage/maria/ma_rt_index.c	2008-09-01 17:31:40 +0000
+++ b/storage/maria/ma_rt_index.c	2009-01-09 04:23:25 +0000
@@ -166,11 +166,11 @@ static int maria_rtree_find_req(MARIA_HA
   res= 1;
 
 ok:
-  my_afree((uchar*)page_buf);
+  my_afree(page_buf);
   return res;
 
 err:
-  my_afree((uchar*)page_buf);
+  my_afree(page_buf);
   info->cur_row.lastpos= HA_OFFSET_ERROR;
   return -1;
 }
@@ -405,11 +405,11 @@ static int maria_rtree_get_req(MARIA_HA 
   res= 1;
 
 ok:
-  my_afree((uchar*)page_buf);
+  my_afree(page_buf);
   return res;
 
 err:
-  my_afree((uchar*)page_buf);
+  my_afree(page_buf);
   info->cur_row.lastpos= HA_OFFSET_ERROR;
   return -1;
 }
@@ -1058,11 +1058,11 @@ static int maria_rtree_delete_req(MARIA_
   res= 1;
 
 ok:
-  my_afree((uchar*)page_buf);
+  my_afree(page_buf);
   DBUG_RETURN(res);
 
 err:
-  my_afree((uchar*)page_buf);
+  my_afree(page_buf);
   DBUG_RETURN(-1); /* purecov: inspected */
 }
 
@@ -1197,7 +1197,7 @@ my_bool maria_rtree_real_delete(MARIA_HA
         }
       }
       my_afree(page_buf);
-      my_free((uchar*) ReinsertList.pages, MYF(0));
+      my_free(ReinsertList.pages, MYF(0));
     }
 
     /* check for redundant root (not leaf, 1 child) and eliminate */
@@ -1329,7 +1329,7 @@ ha_rows maria_rtree_estimate(MARIA_HA *i
       res= HA_POS_ERROR;
   }
 
-  my_afree((uchar*)page_buf);
+  my_afree(page_buf);
   return res;
 
 err:

=== modified file 'storage/maria/ma_search.c'
--- a/storage/maria/ma_search.c	2008-09-01 17:31:40 +0000
+++ b/storage/maria/ma_search.c	2009-01-09 04:23:25 +0000
@@ -322,7 +322,7 @@ int _ma_seq_search(const MARIA_KEY *key,
   page=      ma_page->buff;
   end= page + ma_page->size;
   page+= share->keypage_header + nod_flag;
-  *ret_pos= (uchar*) page;
+  *ret_pos= page;
   t_buff[0]=0;                                  /* Avoid bugs */
 
   tmp_key.data= t_buff;
@@ -438,7 +438,7 @@ int _ma_prefix_search(const MARIA_KEY *k
     uint packed= *page & 128;
     uint key_flag;
 
-    vseg= (uchar*) page;
+    vseg= page;
     if (keyinfo->seg->length >= 127)
     {
       suffix_len=mi_uint2korr(vseg) & 32767;
@@ -509,7 +509,7 @@ int _ma_prefix_search(const MARIA_KEY *k
         from+= transid_packed_length(from);
         key_flag= SEARCH_PAGE_KEY_HAS_TRANSID;
       }
-      page= (uchar*) from+nod_flag;
+      page= from + nod_flag;
       length= (uint) (from-vseg);
     }
 
@@ -651,7 +651,7 @@ int _ma_prefix_search(const MARIA_KEY *k
     saved_length=length;
   }
   if (saved_length)
-    memcpy(saved_to, (uchar*) saved_from, saved_length);
+    memcpy(saved_to, saved_from, saved_length);
 
   *last_key= page == end;
 
@@ -1092,7 +1092,7 @@ uint _ma_get_pack_key(MARIA_KEY *int_key
       else
         length=keyseg->length;
     }
-    memcpy((uchar*) key,(uchar*) page,(size_t) length);
+    memcpy(key, page,(size_t) length);
     key+=length;
     page+=length;
   }
@@ -1280,7 +1280,7 @@ uint _ma_get_binary_pack_key(MARIA_KEY *
     DBUG_ASSERT((int) length >= 0);
     DBUG_PRINT("info",("key: 0x%lx  from: 0x%lx  length: %u",
 		       (long) key, (long) from, length));
-    memmove((uchar*) key, (uchar*) from, (size_t) length);
+    memmove(key, from, (size_t) length);
     key+=length;
     from+=length;
   }

=== modified file 'storage/maria/ma_sort.c'
--- a/storage/maria/ma_sort.c	2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_sort.c	2009-01-09 04:23:25 +0000
@@ -166,7 +166,7 @@ int _ma_create_index_by_sort(MARIA_SORT_
       if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer,
 			     maxbuffer/2))
       {
-	my_free((uchar*) sort_keys,MYF(0));
+	my_free(sort_keys,MYF(0));
         sort_keys= 0;
       }
       else
@@ -252,8 +252,7 @@ int _ma_create_index_by_sort(MARIA_SORT_
   error =0;
 
 err:
-  if (sort_keys)
-    my_free((uchar*) sort_keys,MYF(0));
+  my_free(sort_keys, MYF(MY_ALLOW_ZERO_PTR));
   delete_dynamic(&buffpek);
   close_cached_file(&tempfile);
   close_cached_file(&tempfile_for_exceptions);
@@ -265,9 +264,9 @@ err:
 /* Search after all keys and place them in a temp. file */
 
 static ha_rows find_all_keys(MARIA_SORT_PARAM *info, uint keys,
-				    uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
-				    int *maxbuffer, IO_CACHE *tempfile,
-				    IO_CACHE *tempfile_for_exceptions)
+                             uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
+                             int *maxbuffer, IO_CACHE *tempfile,
+                             IO_CACHE *tempfile_for_exceptions)
 {
   int error;
   uint idx;
@@ -392,7 +391,7 @@ pthread_handler_t _ma_thr_find_all_keys(
         if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
                                   maxbuffer, maxbuffer/2))
         {
-          my_free((uchar*) sort_keys,MYF(0));
+          my_free(sort_keys, MYF(0));
           sort_keys= (uchar **) NULL;            /* for err: label */
         }
         else
@@ -464,7 +463,7 @@ pthread_handler_t _ma_thr_find_all_keys(
 err:
     DBUG_PRINT("error", ("got some error"));
     sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
-    my_free((uchar*) sort_keys,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(sort_keys,MYF(MY_ALLOW_ZERO_PTR));
     sort_param->sort_keys=0;
     delete_dynamic(& sort_param->buffpek);
     close_cached_file(&sort_param->tempfile);
@@ -542,7 +541,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM 
                                sinfo->notnull : NULL,
                                (ulonglong) share->state.state.records);
     }
-    my_free((uchar*) sinfo->sort_keys,MYF(0));
+    my_free(sinfo->sort_keys,MYF(0));
     my_free(sinfo->rec_buff, MYF(MY_ALLOW_ZERO_PTR));
     sinfo->sort_keys=0;
   }
@@ -655,11 +654,12 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM 
       }
     }
   }
-  my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(mergebuf,MYF(MY_ALLOW_ZERO_PTR));
   DBUG_RETURN(got_error);
 }
 #endif /* THREAD */
 
+
 /* Write all keys in memory to file for later merge */
 
 static int write_keys(MARIA_SORT_PARAM *info, register uchar **sort_keys,
@@ -835,7 +835,7 @@ static uint read_to_buffer(IO_CACHE *fro
 
   if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
   {
-    if (my_pread(fromfile->file,(uchar*) buffpek->base,
+    if (my_pread(fromfile->file, buffpek->base,
                  (length= sort_length*count),buffpek->file_pos,MYF_RW))
       return((uint) -1);                        /* purecov: inspected */
     buffpek->key=buffpek->base;
@@ -864,7 +864,7 @@ static uint read_to_buffer_varlen(IO_CAC
                    buffpek->file_pos,MYF_RW))
         return((uint) -1);
       buffpek->file_pos+=sizeof(length_of_key);
-      if (my_pread(fromfile->file,(uchar*) buffp,length_of_key,
+      if (my_pread(fromfile->file, buffp, length_of_key,
                    buffpek->file_pos,MYF_RW))
         return((uint) -1);
       buffpek->file_pos+=length_of_key;
@@ -960,7 +960,7 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
       buffpek=(BUFFPEK*) queue_top(&queue);
       if (to_file)
       {
-        if (info->write_key(info,to_file,(uchar*) buffpek->key,
+        if (info->write_key(info,to_file, buffpek->key,
                             (uint) sort_length,1))
         {
           error=1; goto err; /* purecov: inspected */
@@ -1016,7 +1016,7 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
   {
     if (to_file)
     {
-      if (info->write_key(info,to_file,(uchar*) buffpek->key,
+      if (info->write_key(info, to_file, buffpek->key,
                          sort_length,buffpek->mem_count))
       {
         error=1; goto err; /* purecov: inspected */
@@ -1030,7 +1030,7 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
            strpos != end ;
            strpos+=sort_length)
       {
-        if ((*info->key_write)(info, (uchar*) strpos))
+        if ((*info->key_write)(info, strpos))
         {
           error=1; goto err; /* purecov: inspected */
         }
@@ -1069,7 +1069,7 @@ static int flush_maria_ft_buf(MARIA_SORT
   if (info->sort_info->ft_buf)
   {
     err=_ma_sort_ft_buf_flush(info);
-    my_free((uchar*)info->sort_info->ft_buf, MYF(0));
+    my_free(info->sort_info->ft_buf, MYF(0));
     info->sort_info->ft_buf=0;
   }
   return err;

=== modified file 'storage/maria/ma_statrec.c'
--- a/storage/maria/ma_statrec.c	2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_statrec.c	2009-01-09 04:23:25 +0000
@@ -155,7 +155,7 @@ my_bool _ma_cmp_static_unique(MARIA_HA *
   if (info->s->file_read(info, info->rec_buff, info->s->base.reclength,
 	       pos, MYF(MY_NABP)))
     DBUG_RETURN(1);
-  DBUG_RETURN(_ma_unique_comp(def, record, (uchar*) info->rec_buff,
+  DBUG_RETURN(_ma_unique_comp(def, record, info->rec_buff,
                               def->null_are_equal));
 }
 
@@ -276,11 +276,11 @@ int _ma_read_rnd_static_record(MARIA_HA 
   }
 
 	/* Read record with cacheing */
-  error=my_b_read(&info->rec_cache,(uchar*) buf,share->base.reclength);
+  error=my_b_read(&info->rec_cache, buf, share->base.reclength);
   if (info->s->base.pack_reclength != info->s->base.reclength && !error)
   {
-    char tmp[8];				/* Skill fill bytes */
-    error=my_b_read(&info->rec_cache,(uchar*) tmp,
+    uchar tmp[8];				/* Skill fill bytes */
+    error=my_b_read(&info->rec_cache, tmp,
 		    info->s->base.pack_reclength - info->s->base.reclength);
   }
   if (locked)

=== modified file 'storage/maria/ma_test2.c'
--- a/storage/maria/ma_test2.c	2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_test2.c	2009-01-09 04:23:25 +0000
@@ -518,8 +518,8 @@ int main(int argc, char *argv[])
       bcmp(read_record2,read_record3,reclength))
   {
     printf("Can't find last record\n");
-    DBUG_DUMP("record2",(uchar*) read_record2,reclength);
-    DBUG_DUMP("record3",(uchar*) read_record3,reclength);
+    DBUG_DUMP("record2", read_record2, reclength);
+    DBUG_DUMP("record3", read_record3, reclength);
     goto err;
   }
   ant=1;
@@ -705,8 +705,8 @@ int main(int argc, char *argv[])
     if (maria_rfirst(file,read_record,(int) i) ||
 	maria_rlast(file,read_record2,(int) i))
       goto err;
-    copy_key(file,(uint) i,(uchar*) read_record,(uchar*) key);
-    copy_key(file,(uint) i,(uchar*) read_record2,(uchar*) key2);
+    copy_key(file,(uint) i, read_record,  key);
+    copy_key(file,(uint) i, read_record2, key2);
     min_key.key= key;
     min_key.keypart_map= HA_WHOLE_KEY;
     min_key.flag= HA_READ_KEY_EXACT;

=== modified file 'storage/maria/ma_write.c'
--- a/storage/maria/ma_write.c	2008-09-01 17:31:40 +0000
+++ b/storage/maria/ma_write.c	2009-01-09 04:23:25 +0000
@@ -367,7 +367,7 @@ static my_bool _ma_ck_write_btree(MARIA_
     if (!error)
       error= _ma_ft_convert_to_ft2(info, key);
     delete_dynamic(info->ft1_to_ft2);
-    my_free((uchar*)info->ft1_to_ft2, MYF(0));
+    my_free(info->ft1_to_ft2, MYF(0));
     info->ft1_to_ft2=0;
   }
   DBUG_RETURN(error != 0);
@@ -683,7 +683,7 @@ int _ma_insert(register MARIA_HA *info, 
 #ifndef DBUG_OFF
   if (prev_key && (keyinfo->flag & (HA_BINARY_PACK_KEY | HA_PACK_KEY)))
   {
-    DBUG_DUMP("prev_key",(uchar*) prev_key, _ma_keylength(keyinfo,prev_key));
+    DBUG_DUMP("prev_key", prev_key, _ma_keylength(keyinfo,prev_key));
   }
   if (keyinfo->flag & HA_PACK_KEY)
   {
@@ -700,8 +700,7 @@ int _ma_insert(register MARIA_HA *info, 
       my_errno=HA_ERR_CRASHED;
       DBUG_RETURN(-1);
     }
-    bmove_upp((uchar*) endpos+t_length,(uchar*) endpos,
-              (uint) (endpos-key_pos));
+    bmove_upp(endpos+t_length, endpos, (uint) (endpos-key_pos));
   }
   else
   {
@@ -894,8 +893,7 @@ int _ma_split_page(MARIA_HA *info, MARIA
   {
     DBUG_PRINT("test",("Splitting nod"));
     pos=key_pos-nod_flag;
-    memcpy((uchar*) new_page.buff + share->keypage_header, (uchar*) pos,
-           (size_t) nod_flag);
+    memcpy(new_page.buff + share->keypage_header, pos, (size_t) nod_flag);
   }
 
   /* Move middle item to key and pointer to new page */
@@ -913,7 +911,7 @@ int _ma_split_page(MARIA_HA *info, MARIA
   t_length=(*keyinfo->pack_key)(&tmp_key, nod_flag, (uchar *) 0,
 				(uchar*) 0, (uchar*) 0, &s_temp);
   length=(uint) ((split_page->buff + a_length) - key_pos);
-  memcpy((uchar*) new_page.buff+key_ref_length+t_length,(uchar*) key_pos,
+  memcpy(new_page.buff + key_ref_length + t_length, key_pos,
 	 (size_t) length);
   (*keyinfo->store_key)(keyinfo,new_page.buff+key_ref_length,&s_temp);
   page_length= length + t_length + key_ref_length;
@@ -1340,10 +1338,9 @@ static int _ma_balance_page(MARIA_HA *in
   extra_buff= info->buff+share->base.max_key_block_length;
   new_left_length= new_right_length= (share->keypage_header + nod_flag +
                                       (keys+1) / 3 * curr_keylength);
-  extra_page.info= info;
+  extra_page.info=    info;
   extra_page.keyinfo= keyinfo;
-  extra_page.buff= extra_buff;
-  extra_page.flag= 0;
+  extra_page.buff=    extra_buff;
 
   /*
     5 is the minum number of keys we can have here. This comes from
@@ -1368,11 +1365,11 @@ static int _ma_balance_page(MARIA_HA *in
   bzero(extra_buff, share->keypage_header);
   extra_page.flag= nod_flag ? KEYPAGE_FLAG_ISNOD : 0;
   extra_page.size= extra_buff_length;
+  page_store_info(share, &extra_page);
 
   /* Copy key number */
   extra_buff[share->keypage_header - KEYPAGE_USED_SIZE - KEYPAGE_KEYID_SIZE -
              KEYPAGE_FLAG_SIZE]= keyinfo->key_nr;
-  page_store_info(share, &extra_page);
 
   /* move first largest keys to new page  */
   pos= right_page->buff + right_length-extra_length;

=== modified file 'storage/maria/maria_chk.c'
--- a/storage/maria/maria_chk.c	2008-09-01 17:31:40 +0000
+++ b/storage/maria/maria_chk.c	2009-01-09 04:23:25 +0000
@@ -1825,7 +1825,7 @@ err:
   }
   if (temp_buff)
   {
-    my_afree((uchar*) temp_buff);
+    my_afree(temp_buff);
   }
   my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
   info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -1928,11 +1928,11 @@ static int sort_record_index(MARIA_SORT_
     goto err;
   }
   if (temp_buff)
-    my_afree((uchar*) temp_buff);
+    my_afree(temp_buff);
   DBUG_RETURN(0);
 err:
   if (temp_buff)
-    my_afree((uchar*) temp_buff);
+    my_afree(temp_buff);
   DBUG_RETURN(1);
 } /* sort_record_index */
 

=== modified file 'storage/maria/maria_pack.c'
--- a/storage/maria/maria_pack.c	2008-08-25 11:49:47 +0000
+++ b/storage/maria/maria_pack.c	2009-01-09 04:23:25 +0000
@@ -482,7 +482,7 @@ static my_bool open_maria_files(PACK_MRG
  error:
   while (i--)
     maria_close(mrg->file[i]);
-  my_free((uchar*) mrg->file,MYF(0));
+  my_free(mrg->file, MYF(0));
   return 1;
 }
 
@@ -828,11 +828,11 @@ static void free_counts_and_tree_and_que
     for (i=0 ; i < trees ; i++)
     {
       if (huff_trees[i].element_buffer)
-	my_free((uchar*) huff_trees[i].element_buffer,MYF(0));
+	my_free(huff_trees[i].element_buffer,MYF(0));
       if (huff_trees[i].code)
-	my_free((uchar*) huff_trees[i].code,MYF(0));
+	my_free(huff_trees[i].code,MYF(0));
     }
-    my_free((uchar*) huff_trees,MYF(0));
+    my_free(huff_trees,MYF(0));
   }
   if (huff_counts)
   {
@@ -840,11 +840,11 @@ static void free_counts_and_tree_and_que
     {
       if (huff_counts[i].tree_buff)
       {
-	my_free((uchar*) huff_counts[i].tree_buff,MYF(0));
+	my_free(huff_counts[i].tree_buff,MYF(0));
 	delete_tree(&huff_counts[i].int_tree);
       }
     }
-    my_free((uchar*) huff_counts,MYF(0));
+    my_free(huff_counts, MYF(0));
   }
   delete_queue(&queue);		/* This is safe to free */
   return;
@@ -1041,7 +1041,7 @@ static int get_statistic(PACK_MRG_INFO *
 	{
 	  uint i;
           /* Zero fields are just counted. Go to the next record. */
-	  if (!memcmp((uchar*) start_pos,zero_string,count->field_length))
+	  if (!memcmp(start_pos, zero_string, count->field_length))
 	  {
 	    count->zero_fields++;
 	    continue;
@@ -1150,7 +1150,7 @@ static int get_statistic(PACK_MRG_INFO *
 
   mrg->records=record_count;
   mrg->max_blob_length=max_blob_length;
-  my_afree((uchar*) record);
+  my_afree(record);
   DBUG_RETURN(error != HA_ERR_END_OF_FILE);
 }
 
@@ -1337,12 +1337,12 @@ static void check_counts(HUFF_COUNTS *hu
       }
       else
       {
-	my_free((uchar*) huff_counts->tree_buff,MYF(0));
+	my_free(huff_counts->tree_buff,MYF(0));
 	delete_tree(&huff_counts->int_tree);
 	huff_counts->tree_buff=0;
       }
       if (tree.element_buffer)
-	my_free((uchar*) tree.element_buffer,MYF(0));
+	my_free(tree.element_buffer,MYF(0));
     }
     if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS)
       space_fields++;
@@ -1460,8 +1460,8 @@ static HUFF_TREE* make_huff_trees(HUFF_C
     if (make_huff_tree(huff_tree+tree,huff_counts+tree))
     {
       while (tree--)
-	my_free((uchar*) huff_tree[tree].element_buffer,MYF(0));
-      my_free((uchar*) huff_tree,MYF(0));
+	my_free(huff_tree[tree].element_buffer,MYF(0));
+      my_free(huff_tree,MYF(0));
       DBUG_RETURN(0);
     }
   }
@@ -2169,7 +2169,7 @@ static my_off_t write_huff_tree(HUFF_TRE
     {				/* This should be impossible */
       VOID(fprintf(stderr, "Tree offset got too big: %d, aborted\n",
                    huff_tree->max_offset));
-      my_afree((uchar*) packed_tree);
+      my_afree(packed_tree);
       return 0;
     }
 
@@ -2341,7 +2341,7 @@ static my_off_t write_huff_tree(HUFF_TRE
   DBUG_PRINT("info", (" "));
   if (verbose >= 2)
     VOID(printf("\n"));
-  my_afree((uchar*) packed_tree);
+  my_afree(packed_tree);
   if (errors)
   {
     VOID(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n"));
@@ -2484,7 +2484,7 @@ static int compress_maria_file(PACK_MRG_
       if (flush_buffer((ulong) max_calc_length + (ulong) max_pack_length +
                        null_bytes))
 	break;
-      record_pos= (uchar*) file_buffer.pos;
+      record_pos= file_buffer.pos;
       file_buffer.pos+= max_pack_length;
       if (null_bytes)
       {
@@ -2529,7 +2529,7 @@ static int compress_maria_file(PACK_MRG_
 
 	switch (count->field_type) {
 	case FIELD_SKIP_ZERO:
-	  if (!memcmp((uchar*) start_pos,zero_string,field_length))
+	  if (!memcmp(start_pos, zero_string, field_length))
 	  {
             DBUG_PRINT("fields", ("FIELD_SKIP_ZERO zeroes only, bits:  1"));
 	    write_bits(1,1);
@@ -2754,7 +2754,7 @@ static int compress_maria_file(PACK_MRG_
         DBUG_PRINT("fields", ("---"));
       }
       flush_bits();
-      length=(ulong) ((uchar*) file_buffer.pos - record_pos) - max_pack_length;
+      length=(ulong) (file_buffer.pos - record_pos) - max_pack_length;
       pack_length= _ma_save_pack_length(pack_version, record_pos, length);
       if (pack_blob_length)
 	pack_length+= _ma_save_pack_length(pack_version,
@@ -2795,7 +2795,7 @@ static int compress_maria_file(PACK_MRG_
   if (verbose >= 2)
     VOID(printf("wrote %s records.\n", llstr((longlong) record_count, llbuf)));
 
-  my_afree((uchar*) record);
+  my_afree(record);
   mrg->ref_length=max_pack_length;
   mrg->min_pack_length=max_record_length ? min_record_length : 0;
   mrg->max_pack_length=max_record_length;
@@ -2873,15 +2873,14 @@ static int flush_buffer(ulong neaded_len
   if (neaded_length != ~(ulong) 0 &&
       (ulong) (file_buffer.end-file_buffer.buffer) < neaded_length)
   {
-    char *tmp;
+    uchar *tmp;
     neaded_length+=256;				/* some margin */
-    tmp= my_realloc((char*) file_buffer.buffer, neaded_length,MYF(MY_WME));
+    tmp= (uchar*) my_realloc(file_buffer.buffer, neaded_length,MYF(MY_WME));
     if (!tmp)
       return 1;
-    file_buffer.pos= ((uchar*) tmp +
-                      (ulong) (file_buffer.pos - file_buffer.buffer));
-    file_buffer.buffer= (uchar*) tmp;
-    file_buffer.end= (uchar*) (tmp+neaded_length-8);
+    file_buffer.pos=    (tmp + (ulong) (file_buffer.pos - file_buffer.buffer));
+    file_buffer.buffer= tmp;
+    file_buffer.end=    (tmp+neaded_length-8);
   }
   return 0;
 }
@@ -2889,7 +2888,7 @@ static int flush_buffer(ulong neaded_len
 
 static void end_file_buffer(void)
 {
-  my_free((uchar*) file_buffer.buffer,MYF(0));
+  my_free(file_buffer.buffer, MYF(0));
 }
 
 	/* output `bits` low bits of `value' */
@@ -3108,7 +3107,7 @@ static int mrg_close(PACK_MRG_INFO *mrg)
   for (i=0 ; i < mrg->count ; i++)
     error|=maria_close(mrg->file[i]);
   if (mrg->free_file)
-    my_free((uchar*) mrg->file,MYF(0));
+    my_free(mrg->file, MYF(0));
   DBUG_RETURN(error);
 }
 
@@ -3171,7 +3170,7 @@ static void fakebigcodes(HUFF_COUNTS *hu
     */
     if (huff_counts->tree_buff)
     {
-      my_free((uchar*) huff_counts->tree_buff, MYF(0));
+      my_free(huff_counts->tree_buff, MYF(0));
       delete_tree(&huff_counts->int_tree);
       huff_counts->tree_buff= NULL;
       DBUG_PRINT("fakebigcodes", ("freed distinct column values"));

Thread
bzr commit into MySQL/Maria:mysql-maria branch (monty:2668) Michael Widenius9 Jan