List:Commits« Previous MessageNext Message »
From:Joerg Bruehe Date:January 10 2006 9:35am
Subject:bk commit into 5.1 tree (joerg:1.2031)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of joerg. When joerg 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
  1.2031 06/01/10 10:35:43 joerg@stripped +3 -0
  Some casts and simple fixes to fix compile errors in Visual 2005,
  cleaned up some of the casts as a result of Mats' review.
  (transferred from "2005/12/10 22:31:58-06:00 reggie@fedora.(none)"
  and from "2006/01/03 22:37:24-06:00 reggie@fedora.(none)")

  sql/sql_class.cc
    1.233 06/01/10 10:35:37 joerg@stripped +5 -5
    Some casts to make Visual 2005 happy.
    (transferred from "2005/12/10 22:31:58-06:00 reggie@fedora.(none)"
    and from "2006/01/03 22:37:24-06:00 reggie@fedora.(none)")

  sql/log_event.h
    1.127 06/01/10 10:35:37 joerg@stripped +1 -1
    Actually return a bool expression instead of assuming a pointer expression is boolean.
    (transferred from "2005/12/10 22:31:58-06:00 reggie@fedora.(none)")

  sql/log_event.cc
    1.194 06/01/10 10:35:37 joerg@stripped +45 -32
    Some casts to make Visual 2005 happy;
    cleaned up some of the casts as a result of Mats' review.
    (transferred from "2005/12/10 22:31:58-06:00 reggie@fedora.(none)"
    and from "2006/01/03 22:37:24-06:00 reggie@fedora.(none)")

# 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:	joerg
# Host:	trift2.
# Root:	/M51/reggie-5.1

--- 1.193/sql/log_event.cc	2006-01-06 19:42:54 +01:00
+++ 1.194/sql/log_event.cc	2006-01-10 10:35:37 +01:00
@@ -5043,7 +5043,8 @@
     m_table(tbl_arg),
     m_table_id(tid),
     m_width(tbl_arg->s->fields),
-    m_rows_buf(my_malloc(opt_binlog_rows_event_max_size * sizeof(*m_rows_buf), MYF(MY_WME))),
+    m_rows_buf((byte*)my_malloc(opt_binlog_rows_event_max_size * 
+      sizeof(*m_rows_buf), MYF(MY_WME))),
     m_rows_cur(m_rows_buf),
     m_rows_end(m_rows_buf + opt_binlog_rows_event_max_size),
     m_flags(0)
@@ -5100,18 +5101,19 @@
 
   m_flags= uint2korr(post_start);
 
-  byte const *const var_start= buf + common_header_len + post_header_len;
+  byte const *const var_start= (const byte *)buf + common_header_len + 
+    post_header_len;
   byte const *const ptr_width= var_start;
   byte const *const ptr_after_width= my_vle_decode(&m_width, ptr_width);
 
   const uint byte_count= (m_width + 7) / 8;
-  const char* const ptr_rows_data= var_start + byte_count + 1;
+  const byte* const ptr_rows_data= var_start + byte_count + 1;
 
   my_size_t const data_size= event_len - (ptr_rows_data - buf);
   DBUG_PRINT("info",("m_table_id=%lu, m_flags=%d, m_width=%u, data_size=%lu",
                      m_table_id, m_flags, m_width, data_size));
 
-  m_rows_buf= my_malloc(data_size, MYF(MY_WME));
+  m_rows_buf= (byte*)my_malloc(data_size, MYF(MY_WME));
   if (likely((bool)m_rows_buf))
   {
     /* if bitmap_init fails, catched in is_valid() */
@@ -5135,7 +5137,7 @@
   if (m_cols.bitmap == m_bitbuf) // no my_malloc happened
     m_cols.bitmap= 0; // so no my_free in bitmap_free
   bitmap_free(&m_cols); // To pair with bitmap_init().
-  my_free(m_rows_buf, MYF(MY_ALLOW_ZERO_PTR));
+  my_free((gptr)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR));
 }
 
 #ifndef MYSQL_CLIENT
@@ -5149,7 +5151,7 @@
   */
   DBUG_ENTER("Rows_log_event::do_add_row_data(byte *data, my_size_t length)");
   DBUG_PRINT("enter", ("row_data= %p, length= %lu", row_data, length));
-  DBUG_DUMP("row_data", row_data, min(length, 32));
+  DBUG_DUMP("row_data", (const char*)row_data, min(length, 32));
 
   DBUG_ASSERT(m_rows_buf <= m_rows_cur);
   DBUG_ASSERT(m_rows_buf <  m_rows_end);
@@ -5164,7 +5166,8 @@
         old_alloc + block_size * (length / block_size + block_size - 1);
     my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf;
 
-    byte* const new_buf= my_realloc(m_rows_buf, new_alloc, MYF(MY_WME));
+    byte* const new_buf= 
+      (byte*)my_realloc((gptr)m_rows_buf, new_alloc, MYF(MY_WME));
     if (unlikely(!new_buf))
       DBUG_RETURN(HA_ERR_OUT_OF_MEM);
 
@@ -5196,7 +5199,7 @@
   record are left alone.
  */
 static char const *unpack_row(TABLE *table,
-                              char *record, char const *row,
+                              byte *record, char const *row,
                               MY_BITMAP const *cols)
 {
   DBUG_ASSERT(record && row);
@@ -5230,7 +5233,7 @@
   DBUG_ENTER("Rows_log_event::exec_event(st_relay_log_info*)");
   DBUG_ASSERT(m_table_id != ULONG_MAX);
   int error= 0;
-  char const *row_start= m_rows_buf;
+  char const *row_start= (char const *)m_rows_buf;
   TABLE* table= rli->m_table_map.get_table(m_table_id);
 
   /*
@@ -5368,10 +5371,10 @@
     DBUG_ASSERT(sizeof(thd->options) == sizeof(OPTION_RELAXED_UNIQUE_CHECKS));
 
     error= do_before_row_operations(table);
-    while (error == 0 && row_start < m_rows_end) {
+    while (error == 0 && row_start < (const char*)m_rows_end) {
       char const *row_end= do_prepare_row(thd, table, row_start);
       DBUG_ASSERT(row_end != NULL); // cannot happen
-      DBUG_ASSERT(row_end <= m_rows_end);
+      DBUG_ASSERT(row_end <= (const char*)m_rows_end);
 
       /* in_use can have been set to NULL in close_tables_for_reopen */
       THD* old_thd= table->in_use;
@@ -5567,10 +5570,10 @@
   byte sbuf[my_vle_sizeof(m_width)];
   my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf;
 
-  char *const sbuf_end= my_vle_encode(sbuf, sizeof(sbuf), m_width);
-  DBUG_ASSERT(static_cast<my_size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
+  char *const sbuf_end= (char *const)my_vle_encode(sbuf, sizeof(sbuf), m_width);
+  DBUG_ASSERT(static_cast<my_size_t>(sbuf_end - (char *const)sbuf) <= sizeof(sbuf));
 
-  return (my_b_safe_write(file, sbuf, sbuf_end - sbuf) ||
+  return (my_b_safe_write(file, sbuf, sbuf_end - (char *const)sbuf) ||
           my_b_safe_write(file, reinterpret_cast<byte*>(m_cols.bitmap),
                           no_bytes_in_map(&m_cols)) ||
           my_b_safe_write(file, m_rows_buf, data_size));
@@ -5688,7 +5691,7 @@
   const char *const vpart= buf + common_header_len + post_header_len;
 
   /* Extract the length of the various parts from the buffer */
-  byte const* const ptr_dblen= vpart + 0;
+  byte const* const ptr_dblen= (byte const*)vpart + 0;
   m_dblen= *(unsigned char*) ptr_dblen;
 
   /* Length of database name + counter + terminating null */
@@ -5700,8 +5703,9 @@
   byte const* const ptr_after_colcnt= my_vle_decode(&m_colcnt, ptr_colcnt);
 
   DBUG_PRINT("info",("m_dblen=%d off=%d m_tbllen=%d off=%d m_colcnt=%d off=%d",
-                     m_dblen, ptr_dblen-vpart, m_tbllen, ptr_tbllen-vpart,
-                     m_colcnt, ptr_colcnt-vpart));
+                     m_dblen, ptr_dblen-(const byte*)vpart, 
+                     m_tbllen, ptr_tbllen-(const byte*)vpart,
+                     m_colcnt, ptr_colcnt-(const byte*)vpart));
 
   /* Allocate mem for all fields in one go. If fails, catched in is_valid() */
   m_memory= my_multi_malloc(MYF(MY_WME),
@@ -5713,8 +5717,8 @@
   if (m_memory)
   {
     /* Copy the different parts into their memory */
-    strncpy(const_cast<char*>(m_dbnam),  ptr_dblen  + 1, m_dblen + 1);
-    strncpy(const_cast<char*>(m_tblnam), ptr_tbllen + 1, m_tbllen + 1);
+    strncpy(const_cast<char*>(m_dbnam), (const char*)ptr_dblen  + 1, m_dblen + 1);
+    strncpy(const_cast<char*>(m_tblnam), (const char*)ptr_tbllen + 1, m_tbllen + 1);
     memcpy(m_coltype, ptr_after_colcnt, m_colcnt);
   }
 
@@ -6015,9 +6019,9 @@
   return (my_b_safe_write(file, dbuf,      sizeof(dbuf)) ||
           my_b_safe_write(file, m_dbnam,   m_dblen+1) ||
           my_b_safe_write(file, tbuf,      sizeof(tbuf)) ||
-          my_b_safe_write(file, m_tblnam,  m_tbllen+1) ||
+          my_b_safe_write(file, (const byte*)m_tblnam,  m_tbllen+1) ||
           my_b_safe_write(file, cbuf,      cbuf_end - cbuf) ||
-          my_b_safe_write(file, reinterpret_cast<char*>(m_coltype), m_colcnt));
+          my_b_safe_write(file, reinterpret_cast<byte*>(m_coltype), m_colcnt));
  }
 #endif
 
@@ -6145,7 +6149,7 @@
   */
   DBUG_ASSERT(table->s->fields >= m_width);
   DBUG_ASSERT(ptr);
-  ptr= unpack_row(table, table->record[0], ptr, &m_cols);
+  ptr= unpack_row(table, (char*)table->record[0], ptr, &m_cols);
   return ptr;
 }
 
@@ -6252,8 +6256,9 @@
           return ENOMEM;
       }
 
-      key_copy(key.get(), table->record[0], table->key_info + keynum, 0);
-      error= table->file->index_read_idx(table->record[1], keynum, key.get(),
+      key_copy((byte*)key.get(), table->record[0], table->key_info + keynum, 0);
+      error= table->file->index_read_idx(table->record[1], keynum, 
+                                         (const byte*)key.get(),
                                          table->key_info[keynum].key_length,
                                          HA_READ_KEY_EXACT);
       if (error)
@@ -6321,12 +6326,13 @@
 **************************************************************************/
 
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-static int record_compare(TABLE *table, byte const *a, byte const *b)
+static int record_compare(TABLE *table, char const *a, char const *b)
 {
   for (my_size_t i= 0 ; i < table->s->fields ; ++i)
   {
     uint const off= table->field[i]->offset();
-    uint const res= table->field[i]->cmp_binary(a + off, b + off);
+    uint const res= table->field[i]->cmp_binary(a + off, 
+                                                b + off);
     if (res != 0) {
       return res;
     }
@@ -6395,7 +6401,7 @@
     if (table->key_info->flags & HA_NOSAME)
       DBUG_RETURN(0);
 
-    while (record_compare(table, table->record[0], record_buf) != 0)
+    while (record_compare(table, (const char*)table->record[0], (const char*)record_buf) != 0)
     {
       int error;
       if ((error= table->file->index_next(record_buf)))
@@ -6430,7 +6436,8 @@
       }
     }
     while (restart_count < 2 &&
-           record_compare(table, table->record[0], record_buf) != 0);
+           record_compare(table, (const char*)table->record[0], 
+                          (const char*)record_buf) != 0);
 
     DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0);
     DBUG_RETURN(error);
@@ -6500,7 +6507,8 @@
   }
   else
   {
-    m_memory= m_search_record= my_malloc(table->s->reclength, MYF(MY_WME));
+    m_search_record= (byte*)my_malloc(table->s->reclength, MYF(MY_WME));
+    m_memory= (gptr)m_search_record;
     m_key= NULL;
   }
   if (!m_memory)
@@ -6526,7 +6534,9 @@
   /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
   table->file->ha_index_or_rnd_end();
   my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc
-  m_memory= m_search_record= m_key= NULL;
+  m_memory= NULL;
+  m_search_record= NULL;
+  m_key= NULL;
 
   return error;
 }
@@ -6657,7 +6667,8 @@
   }
   else
   {
-    m_memory= m_search_record= my_malloc(table->s->reclength, MYF(MY_WME));
+    m_search_record= (byte*)my_malloc(table->s->reclength, MYF(MY_WME));
+    m_memory= (gptr)m_search_record;
     m_key= NULL;
   }
   if (!m_memory)
@@ -6684,7 +6695,9 @@
   /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
   table->file->ha_index_or_rnd_end();
   my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR));
-  m_memory= m_search_record= m_key= NULL;
+  m_memory= NULL;
+  m_search_record= NULL;
+  m_key= NULL;
 
   return error;
 }

--- 1.126/sql/log_event.h	2006-01-09 22:16:37 +01:00
+++ 1.127/sql/log_event.h	2006-01-10 10:35:37 +01:00
@@ -1704,7 +1704,7 @@
   ~Table_map_log_event();
 
   virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; }
-  virtual bool is_valid() const { return m_memory; /* we check malloc */ }
+  virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
 
   virtual int get_data_size() { return m_data_size; } 
 #ifndef MYSQL_CLIENT

--- 1.232/sql/sql_class.cc	2006-01-09 15:59:30 +01:00
+++ 1.233/sql/sql_class.cc	2006-01-10 10:35:37 +01:00
@@ -2345,7 +2345,7 @@
   for (int i= 0 ; field ; i++, p_field++, field= *p_field)
   {
     if (bitmap_is_set(cols,i))
-      ptr= field->pack(ptr, field->ptr + offset);
+      ptr= (byte*)field->pack(ptr, field->ptr + offset);
   }
 
   /*
@@ -2422,7 +2422,7 @@
   }
   else
   {
-    if (unlikely(!(row_data= my_multi_malloc(MYF(MY_WME),
+    if (unlikely(!(row_data= (byte*)my_multi_malloc(MYF(MY_WME),
                                              &before_row, before_maxlen,
                                              &after_row, after_maxlen,
                                              NULL))))
@@ -2445,7 +2445,7 @@
   if (!table->write_row_record)
   {
     /* add_row_data copies row_data to internal buffer */
-    my_free(row_data, MYF(MY_WME));
+    my_free((gptr)row_data, MYF(MY_WME));
   }
   
   return error;
@@ -2464,7 +2464,7 @@
   bool error= 0;
   my_size_t const max_len= max_row_length(table, record);
   byte *row_data= table->write_row_record;
-  if (!row_data && unlikely(!(row_data= my_malloc(max_len, MYF(MY_WME)))))
+  if (!row_data && unlikely(!(row_data= (byte*)my_malloc(max_len, MYF(MY_WME)))))
     return HA_ERR_OUT_OF_MEM;
   my_size_t const len= pack_row(table, cols, row_data, record);
 
@@ -2477,7 +2477,7 @@
 
   /* add_row_data copies row_data */
   if (table->write_row_record == 0)
-    my_free(row_data, MYF(MY_WME));
+    my_free((gptr)row_data, MYF(MY_WME));
 
   return error;
 }
Thread
bk commit into 5.1 tree (joerg:1.2031)Joerg Bruehe10 Jan