List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:May 25 2010 1:05pm
Subject:bzr commit into mysql-trunk-bugfixing branch (tor.didriksen:3059)
View as plain text  
#At file:///export/home/didrik/repo/trunk-bugfixing-cflags/ based on revid:mattias.jonsson@stripped

 3059 Tor Didriksen	2010-05-25
      Add -Wall to gcc/g++
      Fix (almost) all warnings reported in dbg and opt mode.
     @ cmd-line-utils/libedit/filecomplete.c
        Remove unused auto variables.
     @ configure.cmake
        Add -Wall to gcc.
     @ extra/comp_err.c
        Cast to correct type.
     @ extra/perror.c
        Fix segfault (but warnings about deprecated features remain)
     @ extra/yassl/taocrypt/include/runtime.hpp
        Comparing two literals was reported as undefined behaviour.
     @ mysys/lf_alloc-pin.c
        Initialize pointer.
     @ sql/mysqld.cc
        Use UNINIT_VAR rather than LINT_INIT.
     @ sql/partition_info.cc
        Use UNINIT_VAR rather than LINT_INIT.
     @ sql/rpl_handler.cc
        Use char[] rather than unsigned long[] array for placement buffer.
     @ sql/spatial.cc
        Use char[] rather than unsigned void*[] array for placement buffer.
     @ sql/spatial.h
        Use char[] rather than unsigned void*[] array for placement buffer.
     @ sql/sql_partition.cc
        Initialize auto variable.
     @ sql/sql_table.cc
        Initialize auto variables.
        Add parens around assignment within if()
     @ sql/sys_vars.cc
        Use UNINIT_VAR.
     @ storage/innobase/os/os0file.c
        Init first slot in auto variable.
     @ storage/myisam/mi_create.c
        Use UNINIT_VAR rather than LINT_INIT.
     @ storage/myisam/mi_open.c
        Remove (wrong) casting.
     @ storage/myisam/mi_page.c
        Remove (wrong) casting.
     @ storage/myisam/mi_search.c
        Cast to uchar* rather than char*.
     @ strings/ctype-ucs2.c
        Use UNINIT_VAR rather than LINT_INIT.
        Add (uchar*) casting.
     @ strings/dtoa.c
        Perform operations on union variables rather than on doubles.

    modified:
      cmd-line-utils/libedit/filecomplete.c
      configure.cmake
      extra/comp_err.c
      extra/perror.c
      extra/yassl/taocrypt/include/runtime.hpp
      mysys/lf_alloc-pin.c
      sql/ha_partition.cc
      sql/mysqld.cc
      sql/partition_info.cc
      sql/rpl_handler.cc
      sql/spatial.cc
      sql/spatial.h
      sql/sql_partition.cc
      sql/sql_table.cc
      sql/sys_vars.cc
      storage/innobase/os/os0file.c
      storage/myisam/mi_create.c
      storage/myisam/mi_open.c
      storage/myisam/mi_page.c
      storage/myisam/mi_search.c
      strings/ctype-ucs2.c
      strings/dtoa.c
=== modified file 'cmd-line-utils/libedit/filecomplete.c'
--- a/cmd-line-utils/libedit/filecomplete.c	2009-04-30 11:53:30 +0000
+++ b/cmd-line-utils/libedit/filecomplete.c	2010-05-25 13:05:27 +0000
@@ -95,10 +95,9 @@ static char break_chars[] = { ' ', '\t',
 char *
 fn_tilde_expand(const char *txt)
 {
-	struct passwd pwres, *pass;
+	struct passwd *pass;
 	char *temp;
 	size_t len = 0;
-	char pwbuf[1024];
 
 	if (txt[0] != '~')
 		return (strdup(txt));

=== modified file 'configure.cmake'
--- a/configure.cmake	2010-05-21 13:17:01 +0000
+++ b/configure.cmake	2010-05-25 13:05:27 +0000
@@ -54,6 +54,15 @@ IF(NOT SYSTEM_TYPE)
 ENDIF()
 
 
+# Always enable -Wall for gnu C/C++
+IF(CMAKE_COMPILER_IS_GNUCXX)
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+ENDIF()
+IF(CMAKE_COMPILER_IS_GNUCC)
+  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+ENDIF()
+
+
 IF(CMAKE_COMPILER_IS_GNUCXX)
   # MySQL "canonical" GCC flags. At least -fno-rtti flag affects
   # ABI and cannot be simply removed. 

=== modified file 'extra/comp_err.c'
--- a/extra/comp_err.c	2010-03-01 09:45:36 +0000
+++ b/extra/comp_err.c	2010-05-25 13:05:27 +0000
@@ -686,7 +686,7 @@ static ha_checksum checksum_format_speci
       case 'u':
       case 'x':
       case 's':
-        chksum= my_checksum(chksum, start, (uint) (p + 1 - start));
+        chksum= my_checksum(chksum, (uchar*) start, (uint) (p + 1 - start));
         start= 0; /* Not in format specifier anymore */
         break;
 

=== modified file 'extra/perror.c'
--- a/extra/perror.c	2010-02-24 00:45:49 +0000
+++ b/extra/perror.c	2010-05-25 13:05:27 +0000
@@ -269,7 +269,7 @@ int main(int argc,char *argv[])
     HA_ERRORS *ha_err_ptr;
     for (code=1 ; code < sys_nerr ; code++)
     {
-      if (sys_errlist[code][0])
+      if (sys_errlist[code] && sys_errlist[code][0])
       {						/* Skip if no error-text */
 	printf("%3d = %s\n",code,sys_errlist[code]);
       }

=== modified file 'extra/yassl/taocrypt/include/runtime.hpp'
--- a/extra/yassl/taocrypt/include/runtime.hpp	2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/include/runtime.hpp	2010-05-25 13:05:27 +0000
@@ -60,7 +60,7 @@ static int __cxa_pure_virtual() __attrib
 static int __cxa_pure_virtual()
 {
     // oops, pure virtual called!
-    assert("Pure virtual method called." == "Aborted");
+    assert(!"Pure virtual method called. Aborted");
     return 0;
 }
 

=== modified file 'mysys/lf_alloc-pin.c'
--- a/mysys/lf_alloc-pin.c	2009-11-18 02:31:40 +0000
+++ b/mysys/lf_alloc-pin.c	2010-05-25 13:05:27 +0000
@@ -329,10 +329,9 @@ static void _lf_pinbox_real_free(LF_PINS
 {
   int npins, alloca_size;
   void *list, **addr;
-  void *first, *last= NULL;
+  void *first= NULL, *last= NULL;
   LF_PINBOX *pinbox= pins->pinbox;
 
-  LINT_INIT(first);
   npins= pinbox->pins_in_array+1;
 
 #ifdef HAVE_ALLOCA

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2010-05-24 12:51:59 +0000
+++ b/sql/ha_partition.cc	2010-05-25 13:05:27 +0000
@@ -4181,10 +4181,9 @@ int ha_partition::index_read_map(uchar *
 int ha_partition::common_index_read(uchar *buf, bool have_start_key)
 {
   int error;
-  uint key_len;
+  uint UNINIT_VAR(key_len); /* used if have_start_key==TRUE */
   bool reverse_order= FALSE;
   DBUG_ENTER("ha_partition::common_index_read");
-  LINT_INIT(key_len); /* used if have_start_key==TRUE */
 
   DBUG_PRINT("info", ("m_ordered %u m_ordered_scan_ong %u have_start_key %u",
                       m_ordered, m_ordered_scan_ongoing, have_start_key));

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-05-24 12:51:59 +0000
+++ b/sql/mysqld.cc	2010-05-25 13:05:27 +0000
@@ -5343,11 +5343,11 @@ inline void kill_broken_server()
 
 void handle_connections_sockets()
 {
-  my_socket sock,new_sock;
+  my_socket UNINIT_VAR(sock), UNINIT_VAR(new_sock);
   uint error_count=0;
   THD *thd;
   struct sockaddr_storage cAddr;
-  int ip_flags=0,socket_flags=0,flags,retval;
+  int ip_flags=0,socket_flags=0,flags=0,retval;
   st_vio *vio_tmp;
 #ifdef HAVE_POLL
   int socket_count= 0;
@@ -5359,8 +5359,6 @@ void handle_connections_sockets()
 
   DBUG_ENTER("handle_connections_sockets");
 
-  LINT_INIT(new_sock);
-
 #ifndef HAVE_POLL
   FD_ZERO(&clientFDs);
 #endif

=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc	2010-03-31 14:05:33 +0000
+++ b/sql/partition_info.cc	2010-05-25 13:05:27 +0000
@@ -701,12 +701,11 @@ bool partition_info::check_range_constan
   if (column_list)
   {
     part_column_list_val *loc_range_col_array;
-    part_column_list_val *current_largest_col_val;
+    part_column_list_val *UNINIT_VAR(current_largest_col_val);
     uint num_column_values= part_field_list.elements;
     uint size_entries= sizeof(part_column_list_val) * num_column_values;
     range_col_array= (part_column_list_val*)sql_calloc(num_parts *
                                                        size_entries);
-    LINT_INIT(current_largest_col_val);
     if (unlikely(range_col_array == NULL))
     {
       mem_alloc_error(num_parts * size_entries);
@@ -739,12 +738,10 @@ bool partition_info::check_range_constan
   }
   else
   {
-    longlong current_largest;
+    longlong UNINIT_VAR(current_largest);
     longlong part_range_value;
     bool signed_flag= !part_expr->unsigned_flag;
 
-    LINT_INIT(current_largest);
-
     part_result_type= INT_RESULT;
     range_int_array= (longlong*)sql_alloc(num_parts * sizeof(longlong));
     if (unlikely(range_int_array == NULL))
@@ -894,7 +891,8 @@ bool partition_info::check_list_constant
   part_elem_value *list_value;
   bool result= TRUE;
   longlong type_add, calc_value;
-  void *curr_value, *prev_value;
+  void *curr_value;
+  void *UNINIT_VAR(prev_value);
   partition_element* part_def;
   bool found_null= FALSE;
   int (*compare_func)(const void *, const void*);
@@ -1009,7 +1007,6 @@ bool partition_info::check_list_constant
              compare_func);
 
     i= 0;
-    LINT_INIT(prev_value);
     do
     {
       DBUG_ASSERT(i < num_list_values);

=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc	2010-03-31 14:05:33 +0000
+++ b/sql/rpl_handler.cc	2010-05-25 13:05:27 +0000
@@ -89,11 +89,11 @@ int get_user_var_str(const char *name, c
 
 int delegates_init()
 {
-  static unsigned long trans_mem[sizeof(Trans_delegate) / sizeof(unsigned long) + 1];
-  static unsigned long storage_mem[sizeof(Binlog_storage_delegate) / sizeof(unsigned long) + 1];
+  static char trans_mem[sizeof(Trans_delegate)];
+  static char storage_mem[sizeof(Binlog_storage_delegate)];
 #ifdef HAVE_REPLICATION
-  static unsigned long transmit_mem[sizeof(Binlog_transmit_delegate) / sizeof(unsigned long) + 1];
-  static unsigned long relay_io_mem[sizeof(Binlog_relay_IO_delegate)/ sizeof(unsigned long) + 1];
+  static char transmit_mem[sizeof(Binlog_transmit_delegate)];
+  static char relay_io_mem[sizeof(Binlog_relay_IO_delegate)];
 #endif
   
   if (!(transaction_delegate= new (trans_mem) Trans_delegate)

=== modified file 'sql/spatial.cc'
--- a/sql/spatial.cc	2010-03-31 14:05:33 +0000
+++ b/sql/spatial.cc	2010-05-25 13:05:27 +0000
@@ -128,6 +128,15 @@ Geometry::Class_info *Geometry::find_cla
 }
 
 
+Geometry *Geometry::create_by_typeid(Geometry_buffer *buffer, int type_id)
+{
+  Class_info *ci;
+  if (!(ci= find_class((int) type_id)))
+    return NULL;
+  (*ci->m_create_func)((void *)buffer->arr);
+  return my_reinterpret_cast(Geometry *)(buffer->arr);
+}
+
 Geometry *Geometry::construct(Geometry_buffer *buffer,
                               const char *data, uint32 data_len)
 {

=== modified file 'sql/spatial.h'
--- a/sql/spatial.h	2010-03-31 14:05:33 +0000
+++ b/sql/spatial.h	2010-05-25 13:05:27 +0000
@@ -267,14 +267,7 @@ public:
   virtual int geometry_n(uint32 num, String *result) const { return -1; }
 
 public:
-  static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id)
-  {
-    Class_info *ci;
-    if (!(ci= find_class((int) type_id)))
-      return NULL;
-    (*ci->m_create_func)((void *)buffer);
-    return my_reinterpret_cast(Geometry *)(buffer);
-  }
+  static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id);
 
   static Geometry *construct(Geometry_buffer *buffer,
                              const char *data, uint32 data_len);
@@ -535,7 +528,7 @@ public:
 const int geometry_buffer_size= sizeof(Gis_point);
 struct Geometry_buffer
 {
-  void *arr[(geometry_buffer_size - 1)/sizeof(void *) + 1];
+  char arr[geometry_buffer_size];
 };
 
 #endif /*HAVE_SPATAIAL*/

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2010-05-25 06:35:48 +0000
+++ b/sql/sql_partition.cc	2010-05-25 13:05:27 +0000
@@ -4584,7 +4584,7 @@ uint prep_alter_part_table(THD *thd, TAB
     partition_info *tab_part_info= table->part_info;
     partition_info *alt_part_info= thd->work_part_info;
     uint flags= 0;
-    bool is_last_partition_reorged;
+    bool is_last_partition_reorged= FALSE;
     part_elem_value *tab_max_elem_val= NULL;
     part_elem_value *alt_max_elem_val= NULL;
     longlong tab_max_range= 0, alt_max_range= 0;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-05-24 12:51:59 +0000
+++ b/sql/sql_table.cc	2010-05-25 13:05:27 +0000
@@ -1899,8 +1899,8 @@ int mysql_rm_table_part2(THD *thd, TABLE
 			 bool dont_log_query)
 {
   TABLE_LIST *table;
-  char path[FN_REFLEN + 1], *alias;
-  uint path_length;
+  char path[FN_REFLEN + 1], *alias= NULL;
+  uint path_length= 0;
   String wrong_tables;
   int error= 0;
   int non_temp_tables_count= 0;
@@ -1909,9 +1909,6 @@ int mysql_rm_table_part2(THD *thd, TABLE
   String built_tmp_query;
   DBUG_ENTER("mysql_rm_table_part2");
 
-  LINT_INIT(alias);
-  LINT_INIT(path_length);
-
   if (thd->is_current_stmt_binlog_format_row() && !dont_log_query)
   {
     built_query.set_charset(system_charset_info);

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-05-05 22:02:08 +0000
+++ b/sql/sys_vars.cc	2010-05-25 13:05:27 +0000
@@ -2723,8 +2723,8 @@ static Sys_var_mybool Sys_log_slow(
 static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type)
 {
   bool res;
-  my_bool *newvalptr, newval, oldval;
-  uint log_type;
+  my_bool *UNINIT_VAR(newvalptr), newval, UNINIT_VAR(oldval);
+  uint UNINIT_VAR(log_type);
 
   if (self == &Sys_general_log || self == &Sys_log)
   {

=== modified file 'storage/innobase/os/os0file.c'
--- a/storage/innobase/os/os0file.c	2009-12-02 14:00:50 +0000
+++ b/storage/innobase/os/os0file.c	2010-05-25 13:05:27 +0000
@@ -3923,6 +3923,7 @@ os_aio_simulated_handle(
 	ulint		n;
 	ulint		i;
 
+        consecutive_ios[0]= NULL;
 	segment = os_aio_get_array_and_local_segment(&array, global_segment);
 
 restart:

=== modified file 'storage/myisam/mi_create.c'
--- a/storage/myisam/mi_create.c	2009-12-05 01:26:15 +0000
+++ b/storage/myisam/mi_create.c	2010-05-25 13:05:27 +0000
@@ -38,7 +38,7 @@ int mi_create(const char *name,uint keys
 	      MI_CREATE_INFO *ci,uint flags)
 {
   register uint i,j;
-  File UNINIT_VAR(dfile),file;
+  File UNINIT_VAR(dfile), UNINIT_VAR(file);
   int errpos,save_errno, create_mode= O_RDWR | O_TRUNC;
   myf create_flag;
   uint fields,length,max_key_length,packed,pointer,real_length_diff,
@@ -73,8 +73,7 @@ int mi_create(const char *name,uint keys
   {
     DBUG_RETURN(my_errno=HA_WRONG_CREATE_OPTION);
   }
-  LINT_INIT(dfile);
-  LINT_INIT(file);
+
   errpos=0;
   options=0;
   bzero((uchar*) &share,sizeof(share));

=== modified file 'storage/myisam/mi_open.c'
--- a/storage/myisam/mi_open.c	2009-12-05 01:26:15 +0000
+++ b/storage/myisam/mi_open.c	2010-05-25 13:05:27 +0000
@@ -143,7 +143,7 @@ MI_INFO *mi_open(const char *name, int m
 	       (uchar*) myisam_file_magic, 4))
     {
       DBUG_PRINT("error",("Wrong header in %s",name_buff));
-      DBUG_DUMP("error_dump",(char*) share->state.header.file_version,
+      DBUG_DUMP("error_dump", share->state.header.file_version,
 		head_length);
       my_errno=HA_ERR_NOT_A_TABLE;
       goto err;

=== modified file 'storage/myisam/mi_page.c'
--- a/storage/myisam/mi_page.c	2008-03-29 08:02:54 +0000
+++ b/storage/myisam/mi_page.c	2010-05-25 13:05:27 +0000
@@ -49,7 +49,7 @@ uchar *_mi_fetch_keypage(register MI_INF
   {
     DBUG_PRINT("error",("page %lu had wrong page length: %u",
 			(ulong) page, page_size));
-    DBUG_DUMP("page", (char*) tmp, keyinfo->block_length);
+    DBUG_DUMP("page", tmp, keyinfo->block_length);
     info->last_keypage = HA_OFFSET_ERROR;
     mi_print_error(info->s, HA_ERR_CRASHED);
     my_errno = HA_ERR_CRASHED;

=== modified file 'storage/myisam/mi_search.c'
--- a/storage/myisam/mi_search.c	2009-09-17 15:25:52 +0000
+++ b/storage/myisam/mi_search.c	2010-05-25 13:05:27 +0000
@@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF
 	    DBUG_PRINT("error",
                        ("Found too long null packed key: %u of %u at 0x%lx",
                         length, keyseg->length, (long) *page_pos));
-	    DBUG_DUMP("key",(char*) *page_pos,16);
+	    DBUG_DUMP("key",(uchar*) *page_pos,16);
             mi_print_error(keyinfo->share, HA_ERR_CRASHED);
 	    my_errno=HA_ERR_CRASHED;
 	    return 0;
@@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF
       {
         DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx",
                             length, keyseg->length, (long) *page_pos));
-        DBUG_DUMP("key",(char*) *page_pos,16);
+        DBUG_DUMP("key",(uchar*) *page_pos,16);
         mi_print_error(keyinfo->share, HA_ERR_CRASHED);
         my_errno=HA_ERR_CRASHED;
         return 0;                               /* Error */
@@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI
       DBUG_PRINT("error",
                  ("Found too long binary packed key: %u of %u at 0x%lx",
                   length, keyinfo->maxlength, (long) *page_pos));
-      DBUG_DUMP("key",(char*) *page_pos,16);
+      DBUG_DUMP("key",(uchar*) *page_pos,16);
       mi_print_error(keyinfo->share, HA_ERR_CRASHED);
       my_errno=HA_ERR_CRASHED;
       DBUG_RETURN(0);                                 /* Wrong key */

=== modified file 'strings/ctype-ucs2.c'
--- a/strings/ctype-ucs2.c	2010-03-04 15:39:32 +0000
+++ b/strings/ctype-ucs2.c	2010-05-25 13:05:27 +0000
@@ -1961,12 +1961,10 @@ my_strnncoll_utf32(CHARSET_INFO *cs, 
                    const uchar *t, size_t tlen,
                    my_bool t_is_prefix)
 {
-  my_wc_t s_wc,t_wc;
+  my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc);
   const uchar *se= s + slen;
   const uchar *te= t + tlen;
   MY_UNICASE_INFO **uni_plane= cs->caseinfo;
-  LINT_INIT(s_wc);
-  LINT_INIT(t_wc);
 
   while (s < se && t < te)
   {
@@ -2028,11 +2026,9 @@ my_strnncollsp_utf32(CHARSET_INFO *cs,
                      my_bool diff_if_only_endspace_difference)
 {
   int res;
-  my_wc_t s_wc, t_wc;
+  my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
   const uchar *se= s + slen, *te= t + tlen;
   MY_UNICASE_INFO **uni_plane= cs->caseinfo;
-  LINT_INIT(s_wc);
-  LINT_INIT(t_wc);
 
   DBUG_ASSERT((slen % 4) == 0);
   DBUG_ASSERT((tlen % 4) == 0);
@@ -2498,11 +2494,9 @@ my_strnncoll_utf32_bin(CHARSET_INFO *cs,
                        const uchar *t, size_t tlen,
                        my_bool t_is_prefix)
 {
-  my_wc_t s_wc, t_wc;
+  my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc);
   const uchar *se= s + slen;
   const uchar *te= t + tlen;
-  LINT_INIT(s_wc);
-  LINT_INIT(t_wc);
 
   while (s < se && t < te)
   {
@@ -2624,7 +2618,7 @@ my_like_range_utf32(CHARSET_INFO *cs,
   {
     my_wc_t wc;
     int res;
-    if ((res= my_utf32_uni(cs, &wc, ptr, end)) < 0)
+    if ((res= my_utf32_uni(cs, &wc, (uchar*) ptr, (uchar*) end)) < 0)
     {
       my_fill_utf32(cs, min_str, min_end - min_str, cs->min_sort_char);
       my_fill_utf32(cs, max_str, min_end - min_str, cs->max_sort_char);
@@ -2635,15 +2629,15 @@ my_like_range_utf32(CHARSET_INFO *cs,
     if (wc == (my_wc_t) escape)
     {
       ptr+= 4;                                  /* Skip escape */
-      if ((res= my_utf32_uni(cs, &wc, ptr, end)) < 0)
+      if ((res= my_utf32_uni(cs, &wc, (uchar*) ptr, (uchar*) end)) < 0)
       {
         my_fill_utf32(cs, min_str, min_end - min_str, cs->min_sort_char);
         my_fill_utf32(cs, max_str, max_end - min_str, cs->max_sort_char);
         /* min_length and max_length are not important */
         return TRUE;
       }
-      if (my_uni_utf32(cs, wc, min_str, min_end) != 4 ||
-          my_uni_utf32(cs, wc, max_str, max_end) != 4)
+      if (my_uni_utf32(cs, wc, (uchar*) min_str, (uchar*) min_end) != 4 ||
+          my_uni_utf32(cs, wc, (uchar*) max_str, (uchar*) max_end) != 4)
         goto pad_set_lengths;
       *min_str++= 4;
       *max_str++= 4;
@@ -2652,8 +2646,8 @@ my_like_range_utf32(CHARSET_INFO *cs,
     
     if (wc == (my_wc_t) w_one)
     {
-      if (my_uni_utf32(cs, cs->min_sort_char, min_str, min_end) != 4 ||
-          my_uni_utf32(cs, cs->max_sort_char, max_str, max_end) != 4)
+      if (my_uni_utf32(cs, cs->min_sort_char, (uchar*) min_str, (uchar*) min_end) != 4 ||
+          my_uni_utf32(cs, cs->max_sort_char, (uchar*) max_str, (uchar*) max_end) != 4)
         goto pad_set_lengths;
       min_str+= 4;
       max_str+= 4;
@@ -2675,8 +2669,8 @@ my_like_range_utf32(CHARSET_INFO *cs,
     }
     
     /* Normal character */
-    if (my_uni_utf32(cs, wc, min_str, min_end) != 4 ||
-        my_uni_utf32(cs, wc, max_str, max_end) != 4)
+    if (my_uni_utf32(cs, wc, (uchar*) min_str, (uchar*) min_end) != 4 ||
+        my_uni_utf32(cs, wc, (uchar*) max_str, (uchar*) max_end) != 4)
       goto pad_set_lengths;
     min_str+= 4;
     max_str+= 4;
@@ -2704,7 +2698,7 @@ my_scan_utf32(CHARSET_INFO *cs,
     for ( ; str < end; )
     {
       my_wc_t wc;
-      int res= my_utf32_uni(cs, &wc, str, end);
+      int res= my_utf32_uni(cs, &wc, (uchar*) str, (uchar*) end);
       if (res < 0 || wc != ' ')
         break;
       str+= res;
@@ -3008,7 +3002,7 @@ static int my_strnncoll_ucs2(CHARSET_INF
                              my_bool t_is_prefix)
 {
   int s_res,t_res;
-  my_wc_t UNINIT_VAR(s_wc),t_wc;
+  my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc);
   const uchar *se=s+slen;
   const uchar *te=t+tlen;
   MY_UNICASE_INFO **uni_plane= cs->caseinfo;
@@ -3195,7 +3189,7 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *
                           my_bool t_is_prefix)
 {
   int s_res,t_res;
-  my_wc_t UNINIT_VAR(s_wc),t_wc;
+  my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc);
   const uchar *se=s+slen;
   const uchar *te=t+tlen;
 

=== modified file 'strings/dtoa.c'
--- a/strings/dtoa.c	2010-04-11 06:52:42 +0000
+++ b/strings/dtoa.c	2010-05-25 13:05:27 +0000
@@ -547,18 +547,18 @@ typedef uint32 ULong;
 typedef int64 LLong;
 typedef uint64 ULLong;
 
-typedef union { double d; ULong L[2]; } U;
+typedef union { double d; ULong L[2]; } U_double;
 
 #if defined(WORDS_BIGENDIAN) || (defined(__FLOAT_WORD_ORDER) &&        \
                                  (__FLOAT_WORD_ORDER == __BIG_ENDIAN))
-#define word0(x) ((U*)&x)->L[0]
-#define word1(x) ((U*)&x)->L[1]
+#define word0(x) ((U_double*)&x)->L[0]
+#define word1(x) ((U_double*)&x)->L[1]
 #else
-#define word0(x) ((U*)&x)->L[1]
-#define word1(x) ((U*)&x)->L[0]
+#define word0(x) ((U_double*)&x)->L[1]
+#define word1(x) ((U_double*)&x)->L[0]
 #endif
 
-#define dval(x) ((U*)&x)->d
+#define dval(x) ((U_double*)&x)->d
 
 /* #define P DBL_MANT_DIG */
 /* Ten_pmax= floor(P*log(2)/log(5)) */
@@ -1162,7 +1162,7 @@ static Bigint *diff(Bigint *a, Bigint *b
 static double ulp(double x)
 {
   register Long L;
-  double a;
+  U_double a;
 
   L= (word0(x) & Exp_mask) - (P - 1)*Exp_msk1;
   word0(a) = L;
@@ -1175,7 +1175,7 @@ static double b2d(Bigint *a, int *e)
 {
   ULong *xa, *xa0, w, y, z;
   int k;
-  double d;
+  U_double d;
 #define d0 word0(d)
 #define d1 word1(d)
 
@@ -1210,12 +1210,14 @@ static double b2d(Bigint *a, int *e)
 }
 
 
-static Bigint *d2b(double d, int *e, int *bits, Stack_alloc *alloc)
+static Bigint *d2b(double d_arg, int *e, int *bits, Stack_alloc *alloc)
 {
   Bigint *b;
   int de, k;
   ULong *x, y, z;
   int i;
+  U_double d;
+  dval(d)= d_arg;
 #define d0 word0(d)
 #define d1 word1(d)
 
@@ -1262,7 +1264,7 @@ static Bigint *d2b(double d, int *e, int
 
 static double ratio(Bigint *a, Bigint *b)
 {
-  double da, db;
+  U_double da, db;
   int k, ka, kb;
 
   dval(da)= b2d(a, &ka);
@@ -1329,10 +1331,11 @@ static const double tinytens[]=
 static double my_strtod_int(const char *s00, char **se, int *error, char *buf, size_t buf_size)
 {
   int scale;
-  int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
+  int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, UNINIT_VAR(c), dsign,
      e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
   const char *s, *s0, *s1, *end = *se;
-  double aadj, aadj1, adj, rv, rv0;
+  double aadj, adj;
+  U_double rv, rv0, aadj1;
   Long L;
   ULong y, z;
   Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
@@ -1343,7 +1346,6 @@ static double my_strtod_int(const char *
   int rounding;
 #endif
   Stack_alloc alloc;
-  LINT_INIT(c);
 
   *error= 0;
 
@@ -1892,13 +1894,13 @@ static double my_strtod_int(const char *
     if ((aadj= ratio(delta, bs)) <= 2.)
     {
       if (dsign)
-        aadj= aadj1= 1.;
+        aadj= dval(aadj1)= 1.;
       else if (word1(rv) || word0(rv) & Bndry_mask)
       {
         if (word1(rv) == Tiny1 && !word0(rv))
           goto undfl;
         aadj= 1.;
-        aadj1= -1.;
+        dval(aadj1)= -1.;
       }
       else
       {
@@ -1907,26 +1909,26 @@ static double my_strtod_int(const char *
           aadj= 1. / FLT_RADIX;
         else
           aadj*= 0.5;
-        aadj1= -aadj;
+        dval(aadj1)= -aadj;
       }
     }
     else
     {
       aadj*= 0.5;
-      aadj1= dsign ? aadj : -aadj;
+      dval(aadj1)= dsign ? aadj : -aadj;
 #ifdef Check_FLT_ROUNDS
       switch (Rounding)
       {
       case 2: /* towards +infinity */
-        aadj1-= 0.5;
+        dval(aadj1)-= 0.5;
         break;
       case 0: /* towards 0 */
       case 3: /* towards -infinity */
-        aadj1+= 0.5;
+        dval(aadj1)+= 0.5;
       }
 #else
       if (Flt_Rounds == 0)
-        aadj1+= 0.5;
+        dval(aadj1)+= 0.5;
 #endif /*Check_FLT_ROUNDS*/
     }
     y= word0(rv) & Exp_mask;
@@ -1937,7 +1939,7 @@ static double my_strtod_int(const char *
     {
       dval(rv0)= dval(rv);
       word0(rv)-= P * Exp_msk1;
-      adj= aadj1 * ulp(dval(rv));
+      adj= dval(aadj1) * ulp(dval(rv));
       dval(rv)+= adj;
       if ((word0(rv) & Exp_mask) >= Exp_msk1 * (DBL_MAX_EXP + Bias - P))
       {
@@ -1959,11 +1961,11 @@ static double my_strtod_int(const char *
           if ((z= (ULong) aadj) <= 0)
             z= 1;
           aadj= z;
-          aadj1= dsign ? aadj : -aadj;
+          dval(aadj1)= dsign ? aadj : -aadj;
         }
         word0(aadj1)+= (2 * P + 1) * Exp_msk1 - y;
       }
-      adj = aadj1 * ulp(dval(rv));
+      adj = dval(aadj1) * ulp(dval(rv));
       dval(rv) += adj;
     }
     z= word0(rv) & Exp_mask;
@@ -2128,7 +2130,7 @@ static int quorem(Bigint *b, Bigint *S)
            calculation.
  */
 
-static char *dtoa(double d, int mode, int ndigits, int *decpt, int *sign,
+static char *dtoa(double d_arg, int mode, int ndigits, int *decpt, int *sign,
                   char **rve, char *buf, size_t buf_size)
 {
   /*
@@ -2173,13 +2175,16 @@ static char *dtoa(double d, int mode, in
   int denorm;
   ULong x;
   Bigint *b, *b1, *delta, *mlo, *mhi, *S;
-  double d2, ds, eps;
+  double ds;
+  U_double d, d2, eps;
   char *s, *s0;
 #ifdef Honor_FLT_ROUNDS
   int rounding;
 #endif
   Stack_alloc alloc;
   
+  dval(d)= d_arg;
+
   alloc.begin= alloc.free= buf;
   alloc.end= buf + buf_size;
   memset(alloc.freelist, 0, sizeof(alloc.freelist));


Attachment: [text/bzr-bundle] bzr/tor.didriksen@sun.com-20100525130527-kbyktlyjeaefq6fo.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (tor.didriksen:3059) Tor Didriksen25 May