List:Commits« Previous MessageNext Message »
From:monty Date:November 30 2006 4:25pm
Subject:bk commit into 5.0 tree (monty:1.2327)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of monty. When monty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-11-30 18:25:05+02:00, monty@stripped +45 -0
  Fixed portability issue in my_thr_init.c (was added in my last push)
  
  Fixed compiler warnings (detected by VC++):
  - Removed not used variables
  - Added casts
  - Fixed wrong assignments to bool
  - Fixed wrong calls with bool arguments
  - Added missing argument to store(longlong), which caused wrong store method to be called.
  

  client/mysqldump.c@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +1 -1
    Removed compiler warning

  heap/hp_clear.c@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +2 -1
    Removed compiler warning

  include/my_global.h@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +2 -2
    Removed compiler warning

  include/my_tree.h@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +3 -2
    Changed memory limits from int to ulong
    (Allowed me to get rid of some compiler warnings)

  myisam/mi_create.c@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +2 -2
    Removed compiler warning

  myisam/myisampack.c@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +3 -3
    Removed compiler warning

  mysys/base64.c@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +1 -1
    Removed compiler warning

  mysys/my_thr_init.c@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +20 -9
    Fixed portability issue (detected on windows)
    Added DBUG_ASSERT to detect if we call my_thread_end() too many times
    Don't wait if THR_thread_count == -1 (error condition)

  mysys/tree.c@stripped, 2006-11-30 18:24:52+02:00, monty@stripped +2 -2
    Removed compiler warning

  sql-common/client.c@stripped, 2006-11-30 18:25:02+02:00, monty@stripped +1 -1
    Fixed compiler warning

  sql-common/my_time.c@stripped, 2006-11-30 18:25:02+02:00, monty@stripped +9 -9
    Fixed wrong argument to check_date()
    Added casts to get rid of compiler warnings

  sql/field.cc@stripped, 2006-11-30 18:24:53+02:00, monty@stripped +13 -13
    Removed compiler warning
    Fixed wrong parameter to check_date()
    Added missing argument to store(longlong)

  sql/ha_archive.cc@stripped, 2006-11-30 18:24:53+02:00, monty@stripped +3 -3
    Removed compiler warning

  sql/ha_federated.cc@stripped, 2006-11-30 18:24:53+02:00, monty@stripped +2 -4
    Removed compiler warning

  sql/ha_innodb.cc@stripped, 2006-11-30 18:24:53+02:00, monty@stripped +0 -1
    Removed not used variable

  sql/handler.cc@stripped, 2006-11-30 18:24:53+02:00, monty@stripped +3 -4
    Removed not used variable
    Fixed wrong if (we didn't detect if rollback or commit failed). Not critical as value is not yet used
    

  sql/item.cc@stripped, 2006-11-30 18:24:53+02:00, monty@stripped +1 -3
    Removed compiler warning

  sql/item_func.cc@stripped, 2006-11-30 18:24:54+02:00, monty@stripped +4 -3
    Removed compiler warning

  sql/item_strfunc.cc@stripped, 2006-11-30 18:24:54+02:00, monty@stripped +20 -20
    Removed compiler warning

  sql/item_timefunc.cc@stripped, 2006-11-30 18:24:54+02:00, monty@stripped +1 -2
    Removed compiler warning

  sql/log.cc@stripped, 2006-11-30 18:24:55+02:00, monty@stripped +4 -4
    Removed compiler warning

  sql/mysql_priv.h@stripped, 2006-11-30 18:24:55+02:00, monty@stripped +1 -1
    Removed compiler warning

  sql/opt_range.cc@stripped, 2006-11-30 18:24:55+02:00, monty@stripped +2 -2
    Removed compiler warning

  sql/password.c@stripped, 2006-11-30 18:24:56+02:00, monty@stripped +2 -2
    Removed compiler warning

  sql/set_var.cc@stripped, 2006-11-30 18:24:56+02:00, monty@stripped +1 -1
    Removed compiler warning

  sql/slave.cc@stripped, 2006-11-30 18:24:56+02:00, monty@stripped +1 -1
    Removed compiler warning

  sql/sp.cc@stripped, 2006-11-30 18:24:56+02:00, monty@stripped +7 -8
    Removed compiler warning

  sql/sp_cache.cc@stripped, 2006-11-30 18:24:57+02:00, monty@stripped +0 -1
    Removed compiler warning

  sql/sp_head.cc@stripped, 2006-11-30 18:24:57+02:00, monty@stripped +6 -3
    Removed compiler warning
    Adjusted argument to reserve() to not use up too much memory that we are probably not going to need

  sql/sql_acl.cc@stripped, 2006-11-30 18:24:57+02:00, monty@stripped +1 -1
    Added missing argument to store(longlong)

  sql/sql_base.cc@stripped, 2006-11-30 18:24:58+02:00, monty@stripped +1 -1
    Removed compiler warning

  sql/sql_db.cc@stripped, 2006-11-30 18:24:58+02:00, monty@stripped +1 -1
    Removed compiler warning

  sql/sql_delete.cc@stripped, 2006-11-30 18:24:58+02:00, monty@stripped +1 -1
    Removed compiler warning

  sql/sql_handler.cc@stripped, 2006-11-30 18:24:58+02:00, monty@stripped +0 -1
    Removed not used variable

  sql/sql_lex.h@stripped, 2006-11-30 18:24:58+02:00, monty@stripped +1 -1
    Removed not used variable

  sql/sql_prepare.cc@stripped, 2006-11-30 18:24:59+02:00, monty@stripped +0 -1
    Removed not used variable

  sql/sql_rename.cc@stripped, 2006-11-30 18:25:00+02:00, monty@stripped +1 -1
    Removed not used variable

  sql/sql_select.cc@stripped, 2006-11-30 18:25:00+02:00, monty@stripped +13 -15
    Fixed that select_options are not 'cut'
    Removed some not used variables
    Removed compiler warnings by adding cast

  sql/sql_show.cc@stripped, 2006-11-30 18:25:01+02:00, monty@stripped +2 -4
    Removed not used variables
    Added missing argument to store(longlong)
    Removed compiler warnings

  sql/sql_trigger.cc@stripped, 2006-11-30 18:25:01+02:00, monty@stripped +4 -5
    Removed not used variables
    Added cast to remove compiler warnings

  sql/sql_update.cc@stripped, 2006-11-30 18:25:01+02:00, monty@stripped +1 -1
    Fixed wrong set of bool variable

  sql/sql_view.cc@stripped, 2006-11-30 18:25:01+02:00, monty@stripped +1 -2
    Removed not used variables
    Added cast to get rid of compiler warnings

  sql/sql_yacc.yy@stripped, 2006-11-30 18:25:02+02:00, monty@stripped +0 -1
    Removed not used variable

  sql/uniques.cc@stripped, 2006-11-30 18:25:02+02:00, monty@stripped +22 -16
    Changes memory size from uint to ulong
    Added casts to get rid of compiler warnings

  strings/ctype-simple.c@stripped, 2006-11-30 18:25:02+02:00, monty@stripped +2 -2
    Fixed cast to get rid of compiler warnings

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	monty
# Host:	narttu.mysql.fi
# Root:	/home/my/mysql-5.0

--- 1.250/client/mysqldump.c	2006-11-30 18:25:26 +02:00
+++ 1.251/client/mysqldump.c	2006-11-30 18:25:26 +02:00
@@ -2001,7 +2001,7 @@
     write_footer(sql_file);
     my_fclose(sql_file, MYF(MY_WME));
   }
-  DBUG_RETURN(num_fields);
+  DBUG_RETURN((uint) num_fields);
 } /* get_table_structure */
 
 

--- 1.8/heap/hp_clear.c	2006-11-30 18:25:26 +02:00
+++ 1.9/heap/hp_clear.c	2006-11-30 18:25:26 +02:00
@@ -36,7 +36,8 @@
 			(byte*) 0));
   info->block.levels=0;
   hp_clear_keys(info);
-  info->records=info->deleted=info->data_length=0;
+  info->records= info->deleted= 0;
+  info->data_length= 0;
   info->blength=1;
   info->changed=0;
   info->del_link=0;

--- 1.18/include/my_tree.h	2006-11-30 18:25:26 +02:00
+++ 1.19/include/my_tree.h	2006-11-30 18:25:26 +02:00
@@ -59,7 +59,8 @@
 typedef struct st_tree {
   TREE_ELEMENT *root,null_element;
   TREE_ELEMENT **parents[MAX_TREE_HEIGHT];
-  uint offset_to_key,elements_in_tree,size_of_element,memory_limit,allocated;
+  uint offset_to_key,elements_in_tree,size_of_element;
+  ulong memory_limit, allocated;
   qsort_cmp2 compare;
   void *custom_arg;
   MEM_ROOT mem_root;
@@ -69,7 +70,7 @@
 } TREE;
 
 	/* Functions on whole tree */
-void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
+void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
                int size, qsort_cmp2 compare, my_bool with_delete,
 	       tree_element_free free_element, void *custom_arg);
 void delete_tree(TREE*);

--- 1.56/myisam/mi_create.c	2006-11-30 18:25:26 +02:00
+++ 1.57/myisam/mi_create.c	2006-11-30 18:25:26 +02:00
@@ -428,8 +428,8 @@
 	key_segs)
       share.state.rec_per_key_part[key_segs-1]=1L;
     length+=key_length;
-    keydef->block_length= MI_BLOCK_SIZE(length-real_length_diff,
-                                        pointer,MI_MAX_KEYPTR_SIZE);
+    keydef->block_length= (uint16) MI_BLOCK_SIZE(length-real_length_diff,
+                                                 pointer,MI_MAX_KEYPTR_SIZE);
     if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
         length >= MI_MAX_KEY_BUFF)
     {

--- 1.53/myisam/myisampack.c	2006-11-30 18:25:26 +02:00
+++ 1.54/myisam/myisampack.c	2006-11-30 18:25:26 +02:00
@@ -1965,7 +1965,7 @@
 
   DBUG_ASSERT(idx < sizeof(digits));
   while (idx)
-    *(ptr++)= '0' + ((value >> (--idx)) & 1);
+    *(ptr++)= '0' + ((char) (value >> (--idx)) & (char) 1);
   *ptr= '\0';
   return digits;
 }
@@ -1995,7 +1995,7 @@
   DBUG_ASSERT(idx < sizeof(digits));
   while (idx)
   {
-    if ((*(ptr++)= '0' + ((value >> (4 * (--idx))) & 0xf)) > '9')
+    if ((*(ptr++)= '0' + ((char) (value >> (4 * (--idx))) & (char) 0xf)) > '9')
       *(ptr - 1)+= 'a' - '9' - 1;
   }
   *ptr= '\0';
@@ -2284,7 +2284,7 @@
           errors++;
           break;
         }
-        idx+= code & 1;
+        idx+= (uint) code & 1;
         if (idx >= length)
         {
           VOID(fflush(stdout));

--- 1.32/mysys/my_thr_init.c	2006-11-30 18:25:26 +02:00
+++ 1.33/mysys/my_thr_init.c	2006-11-30 18:25:26 +02:00
@@ -120,20 +120,21 @@
 void my_thread_global_end(void)
 {
   struct timespec abstime;
-  set_timespec(abstime, my_thread_end_wait_time);
   my_bool all_threads_killed= 1;
 
+  set_timespec(abstime, my_thread_end_wait_time);
   pthread_mutex_lock(&THR_LOCK_threads);
-  while (THR_thread_count)
+  while (THR_thread_count > 0)
   {
     int error= pthread_cond_timedwait(&THR_COND_threads, &THR_LOCK_threads,
                                       &abstime);
     if (error == ETIMEDOUT || error == ETIME)
     {
       if (THR_thread_count)
-        fprintf(stderr,"error in my_thread_global_end(): %d threads didn't exit\n",
+        fprintf(stderr,"Error in my_thread_global_end(): %d threads didn't exit\n",
                 THR_thread_count);
       all_threads_killed= 0;
+      break;
     }
   }
   pthread_mutex_unlock(&THR_LOCK_threads);
@@ -228,10 +229,11 @@
 {
   struct st_my_thread_var *tmp;
   tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
+  DBUG_ASSERT(tmp);
 
 #ifdef EXTRA_DEBUG_THREADS
-  fprintf(stderr,"my_thread_end(): tmp=%p,thread_id=%ld\n",
-	  tmp,pthread_self());
+  fprintf(stderr,"my_thread_end(): tmp: 0x%lx  thread_id=%ld\n",
+	  (long) tmp, pthread_self());
 #endif  
   if (tmp && tmp->init)
   {
@@ -253,15 +255,24 @@
 #else
     tmp->init= 0;
 #endif
+
+    /*
+      Decrement counter for number of running threads. We are using this
+      in my_thread_global_end() to wait until all threads have called
+      my_thread_end and thus freed all memory they have allocated in
+      my_thread_init() and DBUG_xxxx
+    */
+    pthread_mutex_lock(&THR_LOCK_threads);
+    DBUG_ASSERT(THR_thread_count != 0);
+    if (--THR_thread_count == 0)
+      pthread_cond_signal(&THR_COND_threads);
+   pthread_mutex_unlock(&THR_LOCK_threads);
   }
   /* The following free has to be done, even if my_thread_var() is 0 */
 #if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
   pthread_setspecific(THR_KEY_mysys,0);
 #endif
-  pthread_mutex_lock(&THR_LOCK_threads);
-  if (--THR_thread_count == 0)
-    pthread_cond_signal(&THR_COND_threads);
-  pthread_mutex_unlock(&THR_LOCK_threads);
+
 }
 
 struct st_my_thread_var *_my_thread_var(void)

--- 1.30/mysys/tree.c	2006-11-30 18:25:26 +02:00
+++ 1.31/mysys/tree.c	2006-11-30 18:25:26 +02:00
@@ -84,7 +84,7 @@
 static int test_rb_tree(TREE_ELEMENT *element);
 #endif
 
-void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
+void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
                int size, qsort_cmp2 compare, my_bool with_delete,
 	       tree_element_free free_element, void *custom_arg)
 {
@@ -128,7 +128,7 @@
   }
   if (!(tree->with_delete=with_delete))
   {
-    init_alloc_root(&tree->mem_root, default_alloc_size,0);
+    init_alloc_root(&tree->mem_root, (uint) default_alloc_size, 0);
     tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element);
   }
   DBUG_VOID_RETURN;

--- 1.331/sql/field.cc	2006-11-30 18:25:26 +02:00
+++ 1.332/sql/field.cc	2006-11-30 18:25:26 +02:00
@@ -4813,7 +4813,7 @@
             (ltime->minute * 100 + ltime->second);
   if (ltime->neg)
     tmp= -tmp;
-  return Field_time::store((longlong) tmp);
+  return Field_time::store((longlong) tmp, FALSE);
 }
 
 
@@ -5409,11 +5409,11 @@
   if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
   {
     tmp=ltime->year*16*32+ltime->month*32+ltime->day;
-    if ((my_bool)check_date(ltime, tmp,
-                            (TIME_FUZZY_DATE |
-                             (current_thd->variables.sql_mode &
-                              (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
-                               MODE_INVALID_DATES))), &error))
+    if (check_date(ltime, tmp != 0,
+                   (TIME_FUZZY_DATE |
+                    (current_thd->variables.sql_mode &
+                     (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
+                      MODE_INVALID_DATES))), &error))
     {
       char buff[12];
       String str(buff, sizeof(buff), &my_charset_latin1);
@@ -5633,11 +5633,11 @@
   {
     tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
 	 (ltime->hour*10000L+ltime->minute*100+ltime->second));
-    if ((my_bool)check_date(ltime, tmp,
-                            (TIME_FUZZY_DATE |
-                             (current_thd->variables.sql_mode &
-                              (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
-                               MODE_INVALID_DATES))), &error))
+    if (check_date(ltime, tmp != 0,
+                   (TIME_FUZZY_DATE |
+                    (current_thd->variables.sql_mode &
+                     (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
+                      MODE_INVALID_DATES))), &error))
     {
       char buff[19];
       String str(buff, sizeof(buff), &my_charset_latin1);
@@ -8076,7 +8076,7 @@
 {
   int err= 0;
   longlong i= convert_decimal2longlong(val, 1, &err);
-  return test(err | store(i));
+  return test(err | store(i, TRUE));
 }
 
 
@@ -8229,7 +8229,7 @@
 int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
 {
   int delta;
-  uchar bits= field_length & 7;
+  uchar bits= (uchar) (field_length & 7);
 
   for (; length && !*from; from++, length--);          // skip left 0's
   delta= bytes_in_rec - length;

--- 1.223/sql/handler.cc	2006-11-30 18:25:26 +02:00
+++ 1.224/sql/handler.cc	2006-11-30 18:25:26 +02:00
@@ -474,7 +474,6 @@
 {
   int error= 0;
   handlerton **types;
-  show_table_alias_st *table_alias;
   total_ha= savepoint_alloc_size= 0;
 
   if (ha_init_errors())
@@ -885,8 +884,8 @@
     if ((*types)->state == SHOW_OPTION_YES && (*types)->recover)
     {
       if ((*(commit ? (*types)->commit_by_xid :
-             (*types)->rollback_by_xid))(xid));
-      res= 0;
+             (*types)->rollback_by_xid))(xid))
+        res= 0;
     }
   }
   return res;
@@ -1779,7 +1778,7 @@
       {
 	/* Key is unknown */
 	str.copy("", 0, system_charset_info);
-	key_nr= -1;
+	key_nr= (uint) -1;
       }
       else
       {

--- 1.242/sql/item.cc	2006-11-30 18:25:26 +02:00
+++ 1.243/sql/item.cc	2006-11-30 18:25:26 +02:00
@@ -276,7 +276,6 @@
 {
   DBUG_ASSERT(fixed == 1);
   TIME ltime;
-  longlong date;
   if (get_date(&ltime, TIME_FUZZY_DATE))
   {
     my_decimal_set_zero(decimal_value);
@@ -290,7 +289,6 @@
 {
   DBUG_ASSERT(fixed == 1);
   TIME ltime;
-  longlong date;
   if (get_time(&ltime))
   {
     my_decimal_set_zero(decimal_value);
@@ -5646,7 +5644,7 @@
 }
 
 
-bool Item_trigger_field::set_value(THD *thd, sp_rcontext */*ctx*/, Item **it)
+bool Item_trigger_field::set_value(THD *thd, sp_rcontext * /*ctx*/, Item **it)
 {
   Item *item= sp_prepare_func_item(thd, it);
 

--- 1.313/sql/item_func.cc	2006-11-30 18:25:26 +02:00
+++ 1.314/sql/item_func.cc	2006-11-30 18:25:26 +02:00
@@ -2333,7 +2333,7 @@
       return 0;
 
     /* start is now sufficiently valid to pass to charpos function */
-    start= a->charpos(start);
+    start= a->charpos((int) start);
 
     if (start + b->length() > a->length())
       return 0;
@@ -2343,7 +2343,8 @@
     return start + 1;
   
   if (!cmp_collation.collation->coll->instr(cmp_collation.collation,
-                                            a->ptr()+start, a->length()-start,
+                                            a->ptr()+start,
+                                            (uint) (a->length()-start),
                                             b->ptr(), b->length(),
                                             &match, 1))
     return 0;
@@ -4288,7 +4289,7 @@
 
 
 bool Item_func_get_user_var::set_value(THD *thd,
-                                       sp_rcontext */*ctx*/, Item **it)
+                                       sp_rcontext * /*ctx*/, Item **it)
 {
   Item_func_set_user_var *suv= new Item_func_set_user_var(get_name(), *it);
   /*

--- 1.288/sql/item_strfunc.cc	2006-11-30 18:25:26 +02:00
+++ 1.289/sql/item_strfunc.cc	2006-11-30 18:25:26 +02:00
@@ -969,8 +969,8 @@
     length= res->length() + 1;
 
   /* start and length are now sufficiently valid to pass to charpos function */
-  start= res->charpos(start);
-  length= res->charpos(length, start);
+  start= res->charpos((int) start);
+  length= res->charpos((int) length, (uint32) start);
 
   /* Re-testing with corrected params */
   if (start > res->length() + 1)
@@ -978,8 +978,8 @@
   if (length > res->length() - start)
     length= res->length() - start;
 
-  if (res->length() - length + res2->length() >
-      current_thd->variables.max_allowed_packet)
+  if ((ulonglong) (res->length() - length + res2->length()) >
+      (ulonglong) current_thd->variables.max_allowed_packet)
   {
     push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 			ER_WARN_ALLOWED_PACKET_OVERFLOWED,
@@ -988,7 +988,7 @@
     goto null;
   }
   res=copy_if_not_alloced(str,res,res->length());
-  res->replace(start,length,*res2);
+  res->replace((uint32) start,(uint32) length,*res2);
   return res;
 null:
   null_value=1;
@@ -1064,7 +1064,7 @@
     return &my_empty_string;
 
   if ((res->length() <= (ulonglong) length) ||
-      (res->length() <= (char_pos= res->charpos(length))))
+      (res->length() <= (char_pos= res->charpos((int) length))))
     return res;
 
   tmp_value.set(*res, 0, char_pos);
@@ -1156,17 +1156,17 @@
     return &my_empty_string;
 
   start= ((start < 0) ? res->numchars() + start : start - 1);
-  start= res->charpos(start);
+  start= res->charpos((int) start);
   if ((start < 0) || ((uint) start + 1 > res->length()))
     return &my_empty_string;
 
-  length= res->charpos(length, start);
+  length= res->charpos((int) length, (uint32) start);
   tmp_length= res->length() - start;
   length= min(length, tmp_length);
 
-  if (!start && res->length() == (ulonglong) length)
+  if (!start && (longlong) res->length() == length)
     return res;
-  tmp_value.set(*res, (ulonglong) start, (ulonglong) length);
+  tmp_value.set(*res, (uint32) start, (uint32) length);
   return &tmp_value;
 }
 
@@ -2214,7 +2214,7 @@
   char *to;
   /* must be longlong to avoid truncation */
   longlong tmp_count= args[1]->val_int();
-  long count= tmp_count;
+  long count= (long) tmp_count;
   String *res= args[0]->val_str(str);
 
   /* Assumes that the maximum length of a String is < INT_MAX32. */
@@ -2316,7 +2316,7 @@
 
   if (count <= (res_char_length= res->numchars()))
   {						// String to pad is big enough
-    res->length(res->charpos(count));		// Shorten result if longer
+    res->length(res->charpos((int) count));     // Shorten result if longer
     return (res);
   }
   pad_char_length= rpad->numchars();
@@ -2333,7 +2333,7 @@
   if (args[2]->null_value || !pad_char_length)
     goto err;
   res_byte_length= res->length();	/* Must be done before alloc_buffer */
-  if (!(res= alloc_buffer(res,str,&tmp_value,byte_count)))
+  if (!(res= alloc_buffer(res,str,&tmp_value, (ulong) byte_count)))
     goto err;
 
   to= (char*) res->ptr()+res_byte_length;
@@ -2347,7 +2347,7 @@
   }
   if (count)
   {
-    pad_byte_length= rpad->charpos(count);
+    pad_byte_length= rpad->charpos((int) count);
     memcpy(to,ptr_pad,(size_t) pad_byte_length);
     to+= pad_byte_length;
   }
@@ -2419,14 +2419,14 @@
 
   if (count <= res_char_length)
   {
-    res->length(res->charpos(count));
+    res->length(res->charpos((int) count));
     return res;
   }
   
   pad_char_length= pad->numchars();
   byte_count= count * collation.collation->mbmaxlen;
   
-  if (byte_count > current_thd->variables.max_allowed_packet)
+  if ((ulonglong) byte_count > current_thd->variables.max_allowed_packet)
   {
     push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 			ER_WARN_ALLOWED_PACKET_OVERFLOWED,
@@ -2435,7 +2435,8 @@
     goto err;
   }
 
-  if (args[2]->null_value || !pad_char_length || str->alloc(byte_count))
+  if (args[2]->null_value || !pad_char_length ||
+      str->alloc((uint32) byte_count))
     goto err;
   
   str->length(0);
@@ -2447,7 +2448,7 @@
     count-= pad_char_length;
   }
   if (count > 0)
-    str->append(pad->ptr(), pad->charpos(count), collation.collation);
+    str->append(pad->ptr(), pad->charpos((int) count), collation.collation);
 
   str->append(*res);
   null_value= 0;
@@ -2777,7 +2778,7 @@
   tmp_value.length(stat_info.st_size);
   my_close(file, MYF(0));
   null_value = 0;
-  return &tmp_value;
+  DBUG_RETURN(&tmp_value);
 
 err:
   null_value = 1;
@@ -3267,4 +3268,3 @@
   strmov(s+18, clock_seq_and_node_str);
   return str;
 }
-

--- 1.134/sql/item_timefunc.cc	2006-11-30 18:25:26 +02:00
+++ 1.135/sql/item_timefunc.cc	2006-11-30 18:25:26 +02:00
@@ -110,7 +110,6 @@
                                     String *str)
 {
   int warning= 0;
-  bool rc;
 
   if (make_datetime(format, ltime, str))
     return 1;
@@ -1645,7 +1644,7 @@
 {
   DBUG_ASSERT(fixed == 1);
   store_now_in_TIME(&ltime);
-  return (longlong) TIME_to_ulonglong_datetime(&ltime);
+  return (double) TIME_to_ulonglong_datetime(&ltime);
 }
 
 

--- 1.197/sql/log.cc	2006-11-30 18:25:26 +02:00
+++ 1.198/sql/log.cc	2006-11-30 18:25:26 +02:00
@@ -1676,14 +1676,14 @@
           }
           trans_log->end_of_file= max_binlog_cache_size;
           trans_register_ha(thd,
-                            thd->options & (OPTION_NOT_AUTOCOMMIT |
-                                            OPTION_BEGIN),
+                            test(thd->options & (OPTION_NOT_AUTOCOMMIT |
+                                                 OPTION_BEGIN)),
                             &binlog_hton);
         }
         else if (!my_b_tell(trans_log))
           trans_register_ha(thd,
-                            thd->options & (OPTION_NOT_AUTOCOMMIT |
-                                            OPTION_BEGIN),
+                            test(thd->options & (OPTION_NOT_AUTOCOMMIT |
+                                                 OPTION_BEGIN)),
                             &binlog_hton);
         file= trans_log;
       }

--- 1.423/sql/mysql_priv.h	2006-11-30 18:25:26 +02:00
+++ 1.424/sql/mysql_priv.h	2006-11-30 18:25:26 +02:00
@@ -745,7 +745,7 @@
 bool mysql_select(THD *thd, Item ***rref_pointer_array,
                   TABLE_LIST *tables, uint wild_num,  List<Item> &list,
                   COND *conds, uint og_num, ORDER *order, ORDER *group,
-                  Item *having, ORDER *proc_param, ulong select_type, 
+                  Item *having, ORDER *proc_param, ulonglong select_type, 
                   select_result *result, SELECT_LEX_UNIT *unit, 
                   SELECT_LEX *select_lex);
 void free_underlaid_joins(THD *thd, SELECT_LEX *select);

--- 1.232/sql/opt_range.cc	2006-11-30 18:25:26 +02:00
+++ 1.233/sql/opt_range.cc	2006-11-30 18:25:26 +02:00
@@ -1924,7 +1924,7 @@
 	key_parts->null_bit=	 key_part_info->null_bit;
         key_parts->image_type =
           (key_info->flags & HA_SPATIAL) ? Field::itMBR : Field::itRAW;
-        key_parts->flag=         key_part_info->key_part_flag;
+        key_parts->flag=         (uint8) key_part_info->key_part_flag;
       }
       param.real_keynr[param.keys++]=idx;
     }
@@ -6240,7 +6240,7 @@
     key_part->length=  	    key_info->key_part[part].length;
     key_part->store_length= key_info->key_part[part].store_length;
     key_part->null_bit=     key_info->key_part[part].null_bit;
-    key_part->flag=         key_info->key_part[part].key_part_flag;
+    key_part->flag=         (uint8) key_info->key_part[part].key_part_flag;
   }
   if (insert_dynamic(&quick->ranges,(gptr)&range))
     goto err;

--- 1.39/sql/password.c	2006-11-30 18:25:26 +02:00
+++ 1.40/sql/password.c	2006-11-30 18:25:26 +02:00
@@ -406,7 +406,7 @@
   mysql_sha1_result(&sha1_context, hash_stage2);
   /* convert hash_stage2 to hex string */
   *to++= PVERSION41_CHAR;
-  octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
+  octet2hex(to, (char*) hash_stage2, SHA1_HASH_SIZE);
 }
   
 
@@ -520,5 +520,5 @@
 void make_password_from_salt(char *to, const uint8 *hash_stage2)
 {
   *to++= PVERSION41_CHAR;
-  octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
+  octet2hex(to, (char*) hash_stage2, SHA1_HASH_SIZE);
 }

--- 1.285/sql/slave.cc	2006-11-30 18:25:26 +02:00
+++ 1.286/sql/slave.cc	2006-11-30 18:25:26 +02:00
@@ -1513,7 +1513,7 @@
   TABLE_LIST tables;
   int error= 1;
   handler *file;
-  ulong save_options;
+  ulonglong save_options;
   NET *net= &mysql->net;
   DBUG_ENTER("create_table_from_dump");  
 

--- 1.213/sql/sql_acl.cc	2006-11-30 18:25:27 +02:00
+++ 1.214/sql/sql_acl.cc	2006-11-30 18:25:27 +02:00
@@ -1898,7 +1898,7 @@
       table->field[next_field+2]->store((longlong) mqh.conn_per_hour, TRUE);
     if (table->s->fields >= 36 &&
         (mqh.specified_limits & USER_RESOURCES::USER_CONNECTIONS))
-      table->field[next_field+3]->store((longlong) mqh.user_conn);
+      table->field[next_field+3]->store((longlong) mqh.user_conn, TRUE);
     mqh_used= mqh_used || mqh.questions || mqh.updates || mqh.conn_per_hour;
   }
   if (old_row_exists)

--- 1.356/sql/sql_base.cc	2006-11-30 18:25:27 +02:00
+++ 1.357/sql/sql_base.cc	2006-11-30 18:25:27 +02:00
@@ -686,7 +686,7 @@
 
   /* We always quote db,table names though it is slight overkill */
   if (found_user_tables &&
-      !(was_quote_show= (thd->options & OPTION_QUOTE_SHOW_CREATE)))
+      !(was_quote_show= test(thd->options & OPTION_QUOTE_SHOW_CREATE)))
   {
     thd->options |= OPTION_QUOTE_SHOW_CREATE;
   }

--- 1.132/sql/sql_db.cc	2006-11-30 18:25:28 +02:00
+++ 1.133/sql/sql_db.cc	2006-11-30 18:25:28 +02:00
@@ -1172,7 +1172,7 @@
 
 bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
 {
-  int path_length, db_length;
+  int db_length;
   char *db_name;
   bool system_db= 0;
 #ifndef NO_EMBEDDED_ACCESS_CHECKS

--- 1.186/sql/sql_delete.cc	2006-11-30 18:25:28 +02:00
+++ 1.187/sql/sql_delete.cc	2006-11-30 18:25:28 +02:00
@@ -902,7 +902,7 @@
 
  trunc_by_del:
   /* Probably InnoDB table */
-  ulong save_options= thd->options;
+  ulonglong save_options= thd->options;
   table_list->lock_type= TL_WRITE;
   thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
   ha_enable_transaction(thd, FALSE);

--- 1.232/sql/sql_lex.h	2006-11-30 18:25:28 +02:00
+++ 1.233/sql/sql_lex.h	2006-11-30 18:25:28 +02:00
@@ -397,7 +397,7 @@
   TABLE *table; /* temporary table using for appending UNION results */
 
   select_result *result;
-  ulong found_rows_for_union;
+  ulonglong found_rows_for_union;
   bool res;
 public:
   bool  prepared, // prepare phase already performed for UNION (unit)

--- 1.477/sql/sql_select.cc	2006-11-30 18:25:28 +02:00
+++ 1.478/sql/sql_select.cc	2006-11-30 18:25:28 +02:00
@@ -82,7 +82,7 @@
 static bool make_simple_join(JOIN *join,TABLE *tmp_table);
 static void make_outerjoin_info(JOIN *join);
 static bool make_join_select(JOIN *join,SQL_SELECT *select,COND *item);
-static void make_join_readinfo(JOIN *join,uint options);
+static void make_join_readinfo(JOIN *join, ulonglong options);
 static bool only_eq_ref_tables(JOIN *join, ORDER *order, table_map tables);
 static void update_depend_map(JOIN *join);
 static void update_depend_map(JOIN *join, ORDER *order);
@@ -90,7 +90,7 @@
 			   bool change_list, bool *simple_order);
 static int return_zero_rows(JOIN *join, select_result *res,TABLE_LIST *tables,
                             List<Item> &fields, bool send_row,
-                            uint select_options, const char *info,
+                            ulonglong select_options, const char *info,
                             Item *having);
 static COND *build_equal_items(THD *thd, COND *cond,
                                COND_EQUAL *inherited,
@@ -114,7 +114,7 @@
 static bool const_expression_in_where(COND *conds,Item *item, Item **comp_item);
 static bool open_tmp_table(TABLE *table);
 static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
-				    ulong options);
+				    ulonglong options);
 static int do_select(JOIN *join,List<Item> *fields,TABLE *tmp_table,
 		     Procedure *proc);
 
@@ -1974,7 +1974,7 @@
 mysql_select(THD *thd, Item ***rref_pointer_array,
 	     TABLE_LIST *tables, uint wild_num, List<Item> &fields,
 	     COND *conds, uint og_num,  ORDER *order, ORDER *group,
-	     Item *having, ORDER *proc_param, ulong select_options,
+	     Item *having, ORDER *proc_param, ulonglong select_options,
 	     select_result *result, SELECT_LEX_UNIT *unit,
 	     SELECT_LEX *select_lex)
 {
@@ -4123,7 +4123,7 @@
 {
   uint search_depth= join->thd->variables.optimizer_search_depth;
   uint prune_level=  join->thd->variables.optimizer_prune_level;
-  bool straight_join= join->select_options & SELECT_STRAIGHT_JOIN;
+  bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN);
   DBUG_ENTER("choose_plan");
 
   join->cur_embedding_map= 0;
@@ -4725,8 +4725,6 @@
 find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
 	  double read_time)
 {
-  ha_rows rec;
-  double tmp;
   THD *thd= join->thd;
   if (!rest_tables)
   {
@@ -5780,7 +5778,7 @@
 }
 
 static void
-make_join_readinfo(JOIN *join, uint options)
+make_join_readinfo(JOIN *join, ulonglong options)
 {
   uint i;
 
@@ -6435,7 +6433,7 @@
 
 static int
 return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
-		 List<Item> &fields, bool send_row, uint select_options,
+		 List<Item> &fields, bool send_row, ulonglong select_options,
 		 const char *info, Item *having)
 {
   DBUG_ENTER("return_zero_rows");
@@ -6986,7 +6984,6 @@
   Item_equal *item_equal;
   uint members;
   COND_EQUAL cond_equal;
-  COND *new_cond;
   cond_equal.upper_levels= inherited;
 
   if (cond->type() == Item::COND_ITEM)
@@ -9323,10 +9320,11 @@
   if (thd->variables.tmp_table_size == ~ (ulonglong) 0)		// No limit
     table->s->max_rows= ~(ha_rows) 0;
   else
-    table->s->max_rows= (((table->s->db_type == DB_TYPE_HEAP) ?
-                          min(thd->variables.tmp_table_size,
-                              thd->variables.max_heap_table_size) :
-                          thd->variables.tmp_table_size)/ table->s->reclength);
+    table->s->max_rows= (ha_rows) (((table->s->db_type == DB_TYPE_HEAP) ?
+                                    min(thd->variables.tmp_table_size,
+                                        thd->variables.max_heap_table_size) :
+                                    thd->variables.tmp_table_size)/
+                                   table->s->reclength);
   set_if_bigger(table->s->max_rows,1);		// For dummy start options
   /*
     Push the LIMIT clause to the temporary table creation, so that we
@@ -9628,7 +9626,7 @@
 
 
 static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
-				    ulong options)
+				    ulonglong options)
 {
   int error;
   MI_KEYDEF keydef;

--- 1.332/sql/sql_show.cc	2006-11-30 18:25:28 +02:00
+++ 1.333/sql/sql_show.cc	2006-11-30 18:25:28 +02:00
@@ -464,7 +464,6 @@
                            HA_CREATE_INFO *create_info)
 {
   Security_context *sctx= thd->security_ctx;
-  int length;
   char buff[2048];
   String buffer(buff, sizeof(buff), system_charset_info);
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -2367,7 +2366,6 @@
   INDEX_FIELD_VALUES idx_field_vals;
   List<char> files;
   char *file_name;
-  uint length;
   bool with_i_schema;
   HA_CREATE_INFO create;
   TABLE *table= tables->table;
@@ -2939,7 +2937,7 @@
     restore_record(table, s->default_values);
     if (!wild || !wild[0] || !wild_compare(sp_name.ptr(), wild, 0))
     {
-      int enum_idx= proc_table->field[5]->val_int();
+      int enum_idx= (int) proc_table->field[5]->val_int();
       table->field[3]->store(sp_name.ptr(), sp_name.length(), cs);
       get_field(thd->mem_root, proc_table->field[3], &tmp_string);
       table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs);
@@ -3105,7 +3103,7 @@
              show_table->field[key_part->fieldnr-1]->key_length()))
         {
           table->field[10]->store((longlong) key_part->length /
-                                  key_part->field->charset()->mbmaxlen);
+                                  key_part->field->charset()->mbmaxlen, 1);
           table->field[10]->set_notnull();
         }
         uint flags= key_part->field ? key_part->field->flags : 0;

--- 1.204/sql/sql_update.cc	2006-11-30 18:25:28 +02:00
+++ 1.205/sql/sql_update.cc	2006-11-30 18:25:28 +02:00
@@ -118,7 +118,7 @@
 		 enum enum_duplicates handle_duplicates, bool ignore)
 {
   bool		using_limit= limit != HA_POS_ERROR;
-  bool		safe_update= thd->options & OPTION_SAFE_UPDATES;
+  bool		safe_update= test(thd->options & OPTION_SAFE_UPDATES);
   bool		used_key_is_modified, transactional_table;
   bool		can_compare_record;
   int           res;

--- 1.495/sql/sql_yacc.yy	2006-11-30 18:25:28 +02:00
+++ 1.496/sql/sql_yacc.yy	2006-11-30 18:25:28 +02:00
@@ -1626,7 +1626,6 @@
             uint num_vars= pctx->context_var_count();
             enum enum_field_types var_type= (enum enum_field_types) $4;
             Item *dflt_value_item= $5;
-            create_field *create_field_op;
             
             if (!dflt_value_item)
             {

--- 1.78/strings/ctype-simple.c	2006-11-30 18:25:28 +02:00
+++ 1.79/strings/ctype-simple.c	2006-11-30 18:25:28 +02:00
@@ -1503,7 +1503,7 @@
       else
       {
         *error= 0;
-        return (ulonglong) (longlong) (long) -ul;
+        return (ulonglong) (longlong) -(long) ul;
       }
     }
     else
@@ -1654,7 +1654,7 @@
         return (ulonglong) LONGLONG_MIN;
       }
       *error= 0;
-      return (ulonglong) -ull;
+      return (ulonglong) -(longlong) ull;
     }
     else
     {

--- 1.99/sql/sql_view.cc	2006-11-30 18:25:28 +02:00
+++ 1.100/sql/sql_view.cc	2006-11-30 18:25:28 +02:00
@@ -197,7 +197,7 @@
     lex->definer= &view->definer;
   }
   if (lex->create_view_algorithm == VIEW_ALGORITHM_UNDEFINED)
-    lex->create_view_algorithm= decoy.algorithm;
+    lex->create_view_algorithm= (uint8) decoy.algorithm;
   if (lex->create_view_suid == VIEW_SUID_DEFAULT)
     lex->create_view_suid= decoy.view_suid ? 
       VIEW_SUID_DEFINER : VIEW_SUID_INVOKER;
@@ -1477,7 +1477,6 @@
   TABLE *table;
   Field_translator *trans, *end_of_trans;
   KEY *key_info, *key_info_end;
-  uint i;
   DBUG_ENTER("check_key_in_view");
 
   /*

--- 1.76/sql/ha_archive.cc	2006-11-30 18:25:28 +02:00
+++ 1.77/sql/ha_archive.cc	2006-11-30 18:25:28 +02:00
@@ -211,7 +211,7 @@
       max_zfile_size= INT_MAX16;
       break;
     case 8:
-      max_zfile_size= LONGLONG_MAX;
+      max_zfile_size= (z_off_t) LONGLONG_MAX;
       break;
     case 4:
     default:
@@ -495,7 +495,7 @@
   }
   share->archive_write_open= TRUE;
   info(HA_STATUS_TIME);
-  share->approx_file_size= data_file_length;
+  share->approx_file_size= (ulong) data_file_length;
   DBUG_RETURN(0);
 }
 
@@ -676,7 +676,7 @@
   if (share->approx_file_size > max_zfile_size - total_row_length)
   {
     info(HA_STATUS_TIME);
-    share->approx_file_size= data_file_length;
+    share->approx_file_size= (ulong) data_file_length;
     if (share->approx_file_size > max_zfile_size - total_row_length)
       DBUG_RETURN(HA_ERR_RECORD_FILE_FULL);
   }

--- 1.58/sql/sql_trigger.cc	2006-11-30 18:25:28 +02:00
+++ 1.59/sql/sql_trigger.cc	2006-11-30 18:25:28 +02:00
@@ -326,7 +326,7 @@
   char dir_buff[FN_REFLEN], file_buff[FN_REFLEN], trigname_buff[FN_REFLEN],
        trigname_path[FN_REFLEN];
   LEX_STRING dir, file, trigname_file;
-  LEX_STRING *trg_def, *name;
+  LEX_STRING *trg_def;
   LEX_STRING definer_user;
   LEX_STRING definer_host;
   ulonglong *trg_sql_mode;
@@ -849,7 +849,7 @@
         DBUG_RETURN(1);
 
       List_iterator_fast<LEX_STRING> it(triggers->definitions_list);
-      LEX_STRING *trg_create_str, *trg_name_str;
+      LEX_STRING *trg_create_str;
       ulonglong *trg_sql_mode;
 
       if (triggers->definition_modes_list.is_empty() &&
@@ -966,7 +966,7 @@
           goto err_with_lex_cleanup;
         }
 
-        lex.sphead->set_info(0, 0, &lex.sp_chistics, *trg_sql_mode);
+        lex.sphead->set_info(0, 0, &lex.sp_chistics, (ulong) *trg_sql_mode);
 
         triggers->bodies[lex.trg_chistics.event]
                              [lex.trg_chistics.action_time]= lex.sphead;
@@ -1287,7 +1287,6 @@
 {
   char path_buff[FN_REFLEN];
   LEX_STRING *def, *on_table_name, new_def;
-  ulonglong *sql_mode;
   ulong save_sql_mode= thd->variables.sql_mode;
   List_iterator_fast<LEX_STRING> it_def(definitions_list);
   List_iterator_fast<LEX_STRING> it_on_table_name(on_table_names_list);
@@ -1301,7 +1300,7 @@
   while ((def= it_def++))
   {
     on_table_name= it_on_table_name++;
-    thd->variables.sql_mode= *(it_mode++);
+    thd->variables.sql_mode= (ulong) *(it_mode++);
 
     /* Construct CREATE TRIGGER statement with new table name. */
     buff.length(0);

--- 1.105/sql-common/client.c	2006-11-30 18:25:28 +02:00
+++ 1.106/sql-common/client.c	2006-11-30 18:25:28 +02:00
@@ -1217,7 +1217,7 @@
     {
       uchar *pos;
       /* fields count may be wrong */
-      DBUG_ASSERT ((field - result) < fields);
+      DBUG_ASSERT((uint) (field - result) < fields);
       cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
       field->catalog  = strdup_root(alloc,(char*) row->data[0]);
       field->db       = strdup_root(alloc,(char*) row->data[1]);

--- 1.27/sql-common/my_time.c	2006-11-30 18:25:28 +02:00
+++ 1.28/sql-common/my_time.c	2006-11-30 18:25:28 +02:00
@@ -429,7 +429,7 @@
     goto err;
   }
 
-  if (check_date(l_time, not_zero_date, flags, was_cut))
+  if (check_date(l_time, not_zero_date != 0, flags, was_cut))
     goto err;
 
   l_time->time_type= (number_of_fields <= 3 ?
@@ -530,15 +530,15 @@
   if ((uint) (end-str) > 1 && str != end_of_days &&
       my_isdigit(&my_charset_latin1, *str))
   {                                             /* Found days part */
-    date[0]= value;
+    date[0]= (ulong) value;
     state= 1;                                   /* Assume next is hours */
     found_days= 1;
   }
   else if ((end-str) > 1 &&  *str == time_separator &&
            my_isdigit(&my_charset_latin1, str[1]))
   {
-    date[0]=0;                                  /* Assume we found hours */
-    date[1]=value;
+    date[0]= 0;                                 /* Assume we found hours */
+    date[1]= (ulong) value;
     state=2;
     found_hours=1;
     str++;                                      /* skip ':' */
@@ -547,9 +547,9 @@
   {
     /* String given as one number; assume HHMMSS format */
     date[0]= 0;
-    date[1]= value/10000;
-    date[2]= value/100 % 100;
-    date[3]= value % 100;
+    date[1]= (ulong) (value/10000);
+    date[2]= (ulong) (value/100 % 100);
+    date[3]= (ulong) (value % 100);
     state=4;
     goto fractional;
   }
@@ -559,7 +559,7 @@
   {
     for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++)
       value=value*10L + (long) (*str - '0');
-    date[state++]=value;
+    date[state++]= (ulong) value;
     if (state == 4 || (end-str) < 2 || *str != time_separator ||
         !my_isdigit(&my_charset_latin1,str[1]))
       break;
@@ -594,7 +594,7 @@
       value*= (long) log_10_int[field_length];
     else if (field_length < 0)
       *warning|= MYSQL_TIME_WARN_TRUNCATED;
-    date[4]=value;
+    date[4]= (ulong) value;
   }
   else
     date[4]=0;

--- 1.12/mysys/base64.c	2006-11-30 18:25:28 +02:00
+++ 1.13/mysys/base64.c	2006-11-30 18:25:28 +02:00
@@ -40,7 +40,7 @@
 int
 base64_needed_decoded_length(int length_of_encoded_data)
 {
-  return ceil(length_of_encoded_data * 3 / 4);
+  return (int) ceil(length_of_encoded_data * 3 / 4);
 }
 
 

--- 1.303/sql/ha_innodb.cc	2006-11-30 18:25:29 +02:00
+++ 1.304/sql/ha_innodb.cc	2006-11-30 18:25:29 +02:00
@@ -2739,7 +2739,6 @@
 
 			CHARSET_INFO*	cs;
 			ulint		key_len;
-			ulint		len;
 			ulint		true_len;
 			int		error=0;
 			ulint		blob_len;

--- 1.34/sql/sql_rename.cc	2006-11-30 18:25:29 +02:00
+++ 1.35/sql/sql_rename.cc	2006-11-30 18:25:29 +02:00
@@ -257,7 +257,7 @@
 static TABLE_LIST *
 rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
 {
-  TABLE_LIST *ren_table,*new_table, *tmp_table;
+  TABLE_LIST *ren_table, *new_table;
 
   DBUG_ENTER("rename_tables");
 

--- 1.25/sql/uniques.cc	2006-11-30 18:25:29 +02:00
+++ 1.26/sql/uniques.cc	2006-11-30 18:25:29 +02:00
@@ -59,14 +59,15 @@
   :max_in_memory_size(max_in_memory_size_arg), size(size_arg), elements(0)
 {
   my_b_clear(&file);
-  init_tree(&tree, max_in_memory_size / 16, 0, size, comp_func, 0, NULL,
-	    comp_func_fixed_arg);
+  init_tree(&tree, (ulong) (max_in_memory_size / 16), 0, size, comp_func, 0,
+            NULL, comp_func_fixed_arg);
   /* If the following fail's the next add will also fail */
   my_init_dynamic_array(&file_ptrs, sizeof(BUFFPEK), 16, 16);
   /*
     If you change the following, change it in get_max_elements function, too.
   */
-  max_elements= max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+size);
+  max_elements= (ulong) (max_in_memory_size /
+                         ALIGN_SIZE(sizeof(TREE_ELEMENT)+size));
   VOID(open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE,
 		   MYF(MY_WME)));
 }
@@ -267,8 +268,8 @@
   int   n_full_trees; /* number of trees in unique - 1 */
   double result;
 
-  max_elements_in_tree=
-    max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size);
+  max_elements_in_tree= ((ulong) max_in_memory_size /
+                         ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
 
   n_full_trees=    nkeys / max_elements_in_tree;
   last_tree_elems= nkeys % max_elements_in_tree;
@@ -386,9 +387,11 @@
 
 /*
   DESCRIPTION
+
     Function is very similar to merge_buffers, but instead of writing sorted
     unique keys to the output file, it invokes walk_action for each key.
     This saves I/O if you need to pass through all unique keys only once.
+
   SYNOPSIS
     merge_walk()
   All params are 'IN' (but see comment for begin, end):
@@ -416,7 +419,7 @@
     <> 0  error
 */
 
-static bool merge_walk(uchar *merge_buffer, uint merge_buffer_size,
+static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
                        uint key_length, BUFFPEK *begin, BUFFPEK *end,
                        tree_walk_action walk_action, void *walk_action_arg,
                        qsort_cmp2 compare, void *compare_arg,
@@ -432,7 +435,8 @@
   /* we need space for one key when a piece of merge buffer is re-read */
   merge_buffer_size-= key_length;
   uchar *save_key_buff= merge_buffer + merge_buffer_size;
-  uint max_key_count_per_piece= merge_buffer_size/(end-begin)/key_length;
+  uint max_key_count_per_piece= (uint) (merge_buffer_size/(end-begin) /
+                                        key_length);
   /* if piece_size is aligned reuse_freed_buffer will always hit */
   uint piece_size= max_key_count_per_piece * key_length;
   uint bytes_read;               /* to hold return value of read_to_buffer */
@@ -548,6 +552,9 @@
 
 bool Unique::walk(tree_walk_action action, void *walk_action_arg)
 {
+  int res;
+  uchar *merge_buffer;
+
   if (elements == 0)                       /* the whole tree is in memory */
     return tree_walk(&tree, action, walk_action_arg, left_root_right);
 
@@ -556,15 +563,14 @@
     return 1;
   if (flush_io_cache(&file) || reinit_io_cache(&file, READ_CACHE, 0L, 0, 0))
     return 1;
-  uchar *merge_buffer= (uchar *) my_malloc(max_in_memory_size, MYF(0));
-  if (merge_buffer == 0)
+  if (!(merge_buffer= (uchar *) my_malloc((ulong) max_in_memory_size, MYF(0))))
     return 1;
-  int res= merge_walk(merge_buffer, max_in_memory_size, size,
-                      (BUFFPEK *) file_ptrs.buffer,
-                      (BUFFPEK *) file_ptrs.buffer + file_ptrs.elements,
-                      action, walk_action_arg,
-                      tree.compare, tree.custom_arg, &file);
-  x_free(merge_buffer);
+  res= merge_walk(merge_buffer, (ulong) max_in_memory_size, size,
+                  (BUFFPEK *) file_ptrs.buffer,
+                  (BUFFPEK *) file_ptrs.buffer + file_ptrs.elements,
+                  action, walk_action_arg,
+                  tree.compare, tree.custom_arg, &file);
+  my_free((char*) merge_buffer, MYF(0));
   return res;
 }
 
@@ -615,7 +621,7 @@
   sort_param.sort_form=table;
   sort_param.rec_length= sort_param.sort_length= sort_param.ref_length=
     size;
-  sort_param.keys= max_in_memory_size / sort_param.sort_length;
+  sort_param.keys= (uint) (max_in_memory_size / sort_param.sort_length);
   sort_param.not_killable=1;
 
   if (!(sort_buffer=(uchar*) my_malloc((sort_param.keys+1) *

--- 1.128/include/my_global.h	2006-11-30 18:25:29 +02:00
+++ 1.129/include/my_global.h	2006-11-30 18:25:29 +02:00
@@ -1040,8 +1040,8 @@
 #define set_timespec_nsec(ABSTIME,NSEC) \
 {\
   ulonglong now= my_getsystime() + (NSEC/100); \
-  (ABSTIME).tv_sec=  (now / ULL(10000000)); \
-  (ABSTIME).tv_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100));    \
+  (ABSTIME).tv_sec=  (time_t) (now / ULL(10000000));                  \
+  (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
 }
 #endif /* !set_timespec_nsec */
 #endif /* HAVE_TIMESPEC_TS_SEC */

--- 1.172/sql/set_var.cc	2006-11-30 18:25:29 +02:00
+++ 1.173/sql/set_var.cc	2006-11-30 18:25:29 +02:00
@@ -2836,7 +2836,7 @@
 {
   /* The test is negative as the flag we use is NOT autocommit */
 
-  ulong org_options=thd->options;
+  ulonglong org_options= thd->options;
 
   if (var->save_result.ulong_value != 0)
     thd->options&= ~((sys_var_thd_bit*) var->var)->bit_flag;

--- 1.70/sql/ha_federated.cc	2006-11-30 18:25:29 +02:00
+++ 1.71/sql/ha_federated.cc	2006-11-30 18:25:29 +02:00
@@ -1249,7 +1249,6 @@
       if (tmp.append(FEDERATED_CLOSEPAREN))
         DBUG_RETURN(1);
 
-next_loop:
       if (store_length >= length)
         break;
       DBUG_PRINT("info", ("remainder %d", remainder));
@@ -1914,8 +1913,8 @@
   {
     DBUG_RETURN(stash_remote_error());
   }
-  deleted+= mysql->affected_rows;
-  records-= mysql->affected_rows;
+  deleted+= (ha_rows) mysql->affected_rows;
+  records-= (ha_rows) mysql->affected_rows;
   DBUG_PRINT("info",
              ("rows deleted %ld  rows deleted for all time %ld",
               (long) mysql->affected_rows, (long) deleted));
@@ -2270,7 +2269,6 @@
 int ha_federated::read_next(byte *buf, MYSQL_RES *result)
 {
   int retval;
-  my_ulonglong num_rows;
   MYSQL_ROW row;
   DBUG_ENTER("ha_federated::read_next");
 

--- 1.122/sql/sp.cc	2006-11-30 18:25:29 +02:00
+++ 1.123/sql/sp.cc	2006-11-30 18:25:29 +02:00
@@ -539,17 +539,17 @@
     table->field[MYSQL_PROC_FIELD_NAME]->
       store(sp->m_name.str, sp->m_name.length, system_charset_info);
     table->field[MYSQL_PROC_FIELD_TYPE]->
-      store((longlong)type);
+      store((longlong)type, 1);
     table->field[MYSQL_PROC_FIELD_SPECIFIC_NAME]->
       store(sp->m_name.str, sp->m_name.length, system_charset_info);
     if (sp->m_chistics->daccess != SP_DEFAULT_ACCESS)
       table->field[MYSQL_PROC_FIELD_ACCESS]->
-	store((longlong)sp->m_chistics->daccess);
+	store((longlong)sp->m_chistics->daccess, 1);
     table->field[MYSQL_PROC_FIELD_DETERMINISTIC]->
-      store((longlong)(sp->m_chistics->detistic ? 1 : 2));
+      store((longlong)(sp->m_chistics->detistic ? 1 : 2), 1);
     if (sp->m_chistics->suid != SP_IS_DEFAULT_SUID)
       table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->
-	store((longlong)sp->m_chistics->suid);
+	store((longlong)sp->m_chistics->suid, 1);
     table->field[MYSQL_PROC_FIELD_PARAM_LIST]->
       store(sp->m_params.str, sp->m_params.length, system_charset_info);
     if (sp->m_type == TYPE_ENUM_FUNCTION)
@@ -566,7 +566,7 @@
     ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_CREATED])->set_time();
     ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_MODIFIED])->set_time();
     table->field[MYSQL_PROC_FIELD_SQL_MODE]->
-      store((longlong)thd->variables.sql_mode);
+      store((longlong)thd->variables.sql_mode, 1);
     if (sp->m_chistics->comment.str)
       table->field[MYSQL_PROC_FIELD_COMMENT]->
 	store(sp->m_chistics->comment.str, sp->m_chistics->comment.length,
@@ -672,7 +672,6 @@
 {
   TABLE *table;
   int ret;
-  bool opened;
   DBUG_ENTER("db_update_routine");
   DBUG_PRINT("enter", ("type: %d name: %.*s",
 		       type, name->m_name.length, name->m_name.str));
@@ -686,10 +685,10 @@
     ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_MODIFIED])->set_time();
     if (chistics->suid != SP_IS_DEFAULT_SUID)
       table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->
-	store((longlong)chistics->suid);
+	store((longlong)chistics->suid, 1);
     if (chistics->daccess != SP_DEFAULT_ACCESS)
       table->field[MYSQL_PROC_FIELD_ACCESS]->
-	store((longlong)chistics->daccess);
+	store((longlong)chistics->daccess, 1);
     if (chistics->comment.str)
       table->field[MYSQL_PROC_FIELD_COMMENT]->store(chistics->comment.str,
 						    chistics->comment.length,

--- 1.15/sql/sp_cache.cc	2006-11-30 18:25:29 +02:00
+++ 1.16/sql/sp_cache.cc	2006-11-30 18:25:29 +02:00
@@ -124,7 +124,6 @@
 void sp_cache_insert(sp_cache **cp, sp_head *sp)
 {
   sp_cache *c;
-  ulong v;
 
   if (!(c= *cp))
   {

--- 1.225/sql/sp_head.cc	2006-11-30 18:25:29 +02:00
+++ 1.226/sql/sp_head.cc	2006-11-30 18:25:29 +02:00
@@ -444,9 +444,12 @@
 sp_head::sp_head()
   :Query_arena(&main_mem_root, INITIALIZED_FOR_SP),
    m_flags(0), m_recursion_level(0), m_next_cached_sp(0),
-   m_first_instance(this), m_first_free_instance(this), m_last_cached_sp(this),
    m_cont_level(0)
 {
+  m_first_instance= this;
+  m_first_free_instance= this;
+  m_last_cached_sp= this;
+
   m_return_field_def.charset = NULL;
 
   extern byte *
@@ -1648,7 +1651,7 @@
         Item_null *null_item= new Item_null();
 
         if (!null_item ||
-            nctx->set_variable(thd, i, (struct Item **)&null_item))
+            nctx->set_variable(thd, i, (Item **)&null_item))
         {
           err_status= TRUE;
           break;
@@ -2789,7 +2792,7 @@
 sp_instr_freturn::print(String *str)
 {
   /* freturn type expr... */
-  if (str->reserve(UINT_MAX+8+32)) // Add some for the expr. too
+  if (str->reserve(1024+8+32)) // Add some for the expr. too
     return;
   str->qs_append(STRING_WITH_LEN("freturn "));
   str->qs_append((uint)m_type);

--- 1.83/sql/sql_handler.cc	2006-11-30 18:25:29 +02:00
+++ 1.84/sql/sql_handler.cc	2006-11-30 18:25:29 +02:00
@@ -338,7 +338,6 @@
                    ha_rows select_limit_cnt, ha_rows offset_limit_cnt)
 {
   TABLE_LIST    *hash_tables;
-  TABLE         **table_ptr;
   TABLE         *table;
   MYSQL_LOCK    *lock;
   List<Item>	list;

--- 1.186/sql/sql_prepare.cc	2006-11-30 18:25:29 +02:00
+++ 1.187/sql/sql_prepare.cc	2006-11-30 18:25:29 +02:00
@@ -2879,7 +2879,6 @@
 {
   Statement stmt_backup;
   Query_arena *old_stmt_arena;
-  Item *old_free_list;
   bool error= TRUE;
 
   statistic_increment(thd->status_var.com_stmt_execute, &LOCK_status);
Thread
bk commit into 5.0 tree (monty:1.2327)monty30 Nov