[Commits] [PATCH 2/3] Fix some compilation warnings by more use of size_t.

Marko Mäkelä marko.makela at mariadb.com
Mon Mar 13 19:14:09 EET 2017


---
 include/m_ctype.h                  |  9 +++++----
 include/my_bitmap.h                | 10 +++++-----
 include/my_time.h                  |  4 ++--
 mysys/hash.c                       |  2 +-
 sql/field.h                        |  2 +-
 sql/log_event.h                    | 16 ++++++++--------
 sql/my_decimal.cc                  |  3 ++-
 sql/my_decimal.h                   |  6 +++---
 sql/sql_class.cc                   | 14 +++++++-------
 sql/sql_class.h                    | 38 ++++++++++++++++++++------------------
 sql/sql_string.cc                  |  8 ++++----
 sql/sql_string.h                   | 12 ++++++------
 sql/table.h                        |  9 +++++----
 sql/temporary_tables.cc            | 14 +++++++-------
 storage/heap/hp_block.c            |  2 +-
 storage/innobase/include/os0file.h |  4 ++--
 storage/myisam/ha_myisam.cc        | 10 +++++-----
 storage/sequence/sequence.cc       | 14 ++++++++++----
 strings/ctype.c                    | 20 ++++++++++----------
 19 files changed, 104 insertions(+), 93 deletions(-)

diff --git a/include/m_ctype.h b/include/m_ctype.h
index 04a82953f0a..99c0656ca2c 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -1,4 +1,5 @@
 /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+   Copyright (c) 2017, MariaDB Corporation.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -944,8 +945,8 @@ extern size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
   Bad byte sequences as well as characters that cannot be
   encoded in the destination character set are replaced to '?'.
 */
-uint32 my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
-                  const char *from, uint32 from_length,
+size_t my_convert(char *to, size_t to_length, CHARSET_INFO *to_cs,
+                  const char *from, size_t from_length,
                   CHARSET_INFO *from_cs, uint *errors);
 
 /**
@@ -954,9 +955,9 @@ uint32 my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
   Protocol::store_warning() uses this to escape control
   and non-convertable characters.
 */
-uint32 my_convert_using_func(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+size_t my_convert_using_func(char *to, size_t to_length, CHARSET_INFO *to_cs,
                              my_charset_conv_wc_mb mb_wc,
-                             const char *from, uint32 from_length,
+                             const char *from, size_t from_length,
                              CHARSET_INFO *from_cs,
                              my_charset_conv_mb_wc wc_mb,
                              uint *errors);
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index 3e242280be4..7917da5ce6f 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -1,5 +1,5 @@
 /* Copyright (c) 2001, 2011, Oracle and/or its affiliates.
-   Copyright (c) 2009-2011, Monty Program Ab
+   Copyright (c) 2009, 2017, MariaDB Corporation.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -88,13 +88,13 @@ extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit);
 #define no_words_in_map(map) (((map)->n_bits + 31)/32)
 #define bytes_word_aligned(bytes) (4*((bytes + 3)/4))
 #define _bitmap_set_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \
-                                  |= (1 << ((BIT) & 7)))
+                                   |= (uchar) (1 << ((BIT) & 7)))
 #define _bitmap_flip_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \
-                                  ^= (1 << ((BIT) & 7)))
+                                    ^= (uchar) (1 << ((BIT) & 7)))
 #define _bitmap_clear_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \
-                                  &= ~ (1 << ((BIT) & 7)))
+                                     &= (uchar) ~(1 << ((BIT) & 7)))
 #define _bitmap_is_set(MAP, BIT) (uint) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \
-                                         & (1 << ((BIT) & 7)))
+                                         & (uchar) (1 << ((BIT) & 7)))
 /*
   WARNING!
 
diff --git a/include/my_time.h b/include/my_time.h
index 90d19c8861a..3649bbea977 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -120,8 +120,8 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
 static inline
 longlong double_to_datetime(double nr, MYSQL_TIME *ltime, uint flags, int *cut)
 {
-  if (nr < 0 || nr > LONGLONG_MAX)
-    nr= (double)LONGLONG_MAX;
+  if (nr < 0 || nr > (double) LONGLONG_MAX)
+    nr= (double) LONGLONG_MAX;
   return number_to_datetime((longlong) floor(nr),
                             (ulong)((nr-floor(nr))*TIME_SECOND_PART_FACTOR),
                             ltime, flags, cut);
diff --git a/mysys/hash.c b/mysys/hash.c
index 1d6b3d5daaa..24aa8377594 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -796,7 +796,7 @@ my_bool my_hash_iterate(HASH *hash, my_hash_walk_action action, void *argument)
 
 my_bool my_hash_check(HASH *hash)
 {
-  int error;
+  my_bool error;
   uint i,rec_link,found,max_links,seek,links,idx;
   uint records;
   size_t blength;
diff --git a/sql/field.h b/sql/field.h
index 50dcb397616..020cabe31c5 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1127,7 +1127,7 @@ class Field: public Value_source
 
   uint null_offset() const
   { return null_offset(table->record[0]); }
-  void set_null_ptr(uchar *p_null_ptr, uint p_null_bit)
+  void set_null_ptr(uchar *p_null_ptr, uchar p_null_bit)
   {
     null_ptr= p_null_ptr;
     null_bit= p_null_bit;
diff --git a/sql/log_event.h b/sql/log_event.h
index 5689d36aea8..1892968b87d 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -419,7 +419,7 @@ class String;
    a backward-compatible behaviour.
 */
 
-#define LOG_EVENT_BINLOG_IN_USE_F       0x1
+#define LOG_EVENT_BINLOG_IN_USE_F       0x1U
 
 /**
   @def LOG_EVENT_THREAD_SPECIFIC_F
@@ -429,7 +429,7 @@ class String;
   SET @@PSEUDO_THREAD_ID=xx; before the query (it would not hurt to print it
   for every query but this would be slow).
 */
-#define LOG_EVENT_THREAD_SPECIFIC_F 0x4
+#define LOG_EVENT_THREAD_SPECIFIC_F 0x4U
 
 /**
   @def LOG_EVENT_SUPPRESS_USE_F
@@ -444,7 +444,7 @@ class String;
   replication logic together with the flags --binlog-do-db and
   --replicated-do-db.
  */
-#define LOG_EVENT_SUPPRESS_USE_F    0x8
+#define LOG_EVENT_SUPPRESS_USE_F    0x8U
 
 /*
   Note: this is a place holder for the flag
@@ -461,7 +461,7 @@ class String;
    These events should not update the master log position when slave
    SQL thread executes them.
 */
-#define LOG_EVENT_ARTIFICIAL_F 0x20
+#define LOG_EVENT_ARTIFICIAL_F 0x20U
 
 /**
    @def LOG_EVENT_RELAY_LOG_F
@@ -469,7 +469,7 @@ class String;
    Events with this flag set are created by slave IO thread and written
    to relay log
 */
-#define LOG_EVENT_RELAY_LOG_F 0x40
+#define LOG_EVENT_RELAY_LOG_F 0x40U
 
 /**
    @def LOG_EVENT_IGNORABLE_F
@@ -480,7 +480,7 @@ class String;
    is ignored. Otherwise, 's' acknowledges that it has
    found an unknown event in the relay log.
 */
-#define LOG_EVENT_IGNORABLE_F 0x80
+#define LOG_EVENT_IGNORABLE_F 0x80U
 
 /**
    @def LOG_EVENT_SKIP_REPLICATION_F
@@ -492,7 +492,7 @@ class String;
    This is a MariaDB flag; we allocate it from the end of the available
    values to reduce risk of conflict with new MySQL flags.
 */
-#define LOG_EVENT_SKIP_REPLICATION_F 0x8000
+#define LOG_EVENT_SKIP_REPLICATION_F 0x8000U
 
 
 /**
@@ -4394,7 +4394,7 @@ class Rows_log_event : public Log_event
   virtual ~Rows_log_event();
 
   void set_flags(flag_set flags_arg) { m_flags |= flags_arg; }
-  void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; }
+  void clear_flags(flag_set flags_arg) { m_flags &= (flag_set) ~flags_arg; }
   flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
 
   Log_event_type get_type_code() { return m_type; } /* Specific type (_V1 etc) */
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index be732d4a927..647ff976ac3 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -1,5 +1,6 @@
 /*
    Copyright (c) 2005, 2010, Oracle and/or its affiliates.
+   Copyright (c) 2017, MariaDB Corporation.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -238,7 +239,7 @@ int my_decimal2binary(uint mask, const my_decimal *d, uchar *bin, int prec,
     E_DEC_OOM
 */
 
-int str2my_decimal(uint mask, const char *from, uint length,
+int str2my_decimal(uint mask, const char *from, size_t length,
                    CHARSET_INFO *charset, my_decimal *decimal_value,
                    const char **end_ptr)
 {
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index 265b370a154..12f3026c336 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -1,5 +1,5 @@
 /* Copyright (c) 2005, 2013, Oracle and/or its affiliates.
-   Copyright (c) 2011, 2014, SkySQL Ab.
+   Copyright (c) 2011, 2017, MariaDB Corporation.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -365,11 +365,11 @@ int str2my_decimal(uint mask, const char *str, my_decimal *d, char **end)
 }
 
 
-int str2my_decimal(uint mask, const char *from, uint length,
+int str2my_decimal(uint mask, const char *from, size_t length,
                    CHARSET_INFO *charset, my_decimal *decimal_value,
                    const char **end);
 
-inline int str2my_decimal(uint mask, const char *from, uint length,
+inline int str2my_decimal(uint mask, const char *from, size_t length,
                           CHARSET_INFO *charset, my_decimal *decimal_value)
 {
   const char *end;
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index d07f4f85e4b..e44af299e30 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2188,7 +2188,7 @@ void THD::cleanup_after_query()
 */
 
 bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
-			 const char *from, uint from_length,
+			 const char *from, size_t from_length,
 			 CHARSET_INFO *from_cs)
 {
   DBUG_ENTER("THD::convert_string");
@@ -2215,7 +2215,7 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
   dstcs and srccs cannot be &my_charset_bin.
 */
 bool THD::convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
-                      CHARSET_INFO *srccs, const char *src, uint src_length,
+                      CHARSET_INFO *srccs, const char *src, size_t src_length,
                       String_copier *status)
 {
   DBUG_ENTER("THD::convert_fix");
@@ -2233,7 +2233,7 @@ bool THD::convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
   Copy or convert a string.
 */
 bool THD::copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
-                   CHARSET_INFO *srccs, const char *src, uint src_length,
+                   CHARSET_INFO *srccs, const char *src, size_t src_length,
                    String_copier *status)
 {
   DBUG_ENTER("THD::copy_fix");
@@ -2250,7 +2250,7 @@ bool THD::copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
 class String_copier_with_error: public String_copier
 {
 public:
-  bool check_errors(CHARSET_INFO *srccs, const char *src, uint src_length)
+  bool check_errors(CHARSET_INFO *srccs, const char *src, size_t src_length)
   {
     if (most_important_error_pos())
     {
@@ -2265,7 +2265,7 @@ class String_copier_with_error: public String_copier
 
 bool THD::convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
                              CHARSET_INFO *srccs,
-                             const char *src, uint src_length)
+                             const char *src, size_t src_length)
 {
   String_copier_with_error status;
   return convert_fix(dstcs, dst, srccs, src, src_length, &status) ||
@@ -2275,7 +2275,7 @@ bool THD::convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
 
 bool THD::copy_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
                           CHARSET_INFO *srccs,
-                          const char *src, uint src_length)
+                          const char *src, size_t src_length)
 {
   String_copier_with_error status;
   return copy_fix(dstcs, dst, srccs, src, src_length, &status) ||
@@ -5179,7 +5179,7 @@ void THD::set_status_no_good_index_used()
 
 /** Assign a new value to thd->query and thd->query_id.  */
 
-void THD::set_query_and_id(char *query_arg, uint32 query_length_arg,
+void THD::set_query_and_id(char *query_arg, size_t query_length_arg,
                            CHARSET_INFO *cs,
                            query_id_t new_query_id)
 {
diff --git a/sql/sql_class.h b/sql/sql_class.h
index e3a6595e142..c492808f1f2 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1077,7 +1077,7 @@ class Statement: public ilink, public Query_arena
   {
     query_string= string_arg;
   }
-  void set_query_inner(char *query_arg, uint32 query_length_arg,
+  void set_query_inner(char *query_arg, size_t query_length_arg,
                        CHARSET_INFO *cs_arg)
   {
     set_query_inner(CSET_STRING(query_arg, query_length_arg, cs_arg));
@@ -3343,7 +3343,8 @@ class THD :public Statement,
     return alloc_root(&transaction.mem_root,size);
   }
 
-  LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str, uint length)
+  LEX_STRING *make_lex_string(LEX_STRING *lex_str,
+                              const char* str, size_t length)
   {
     if (!(lex_str->str= strmake_root(mem_root, str, length)))
       return 0;
@@ -3351,7 +3352,7 @@ class THD :public Statement,
     return lex_str;
   }
 
-  LEX_STRING *make_lex_string(const char* str, uint length)
+  LEX_STRING *make_lex_string(const char* str, size_t length)
   {
     LEX_STRING *lex_str;
     if (!(lex_str= (LEX_STRING *)alloc_root(mem_root, sizeof(LEX_STRING))))
@@ -3360,7 +3361,7 @@ class THD :public Statement,
   }
 
   // Allocate LEX_STRING for character set conversion
-  bool alloc_lex_string(LEX_STRING *dst, uint length)
+  bool alloc_lex_string(LEX_STRING *dst, size_t length)
   {
     if ((dst->str= (char*) alloc(length)))
       return false;
@@ -3368,7 +3369,7 @@ class THD :public Statement,
     return true;     // EOM
   }
   bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
-		      const char *from, uint from_length,
+		      const char *from, size_t from_length,
 		      CHARSET_INFO *from_cs);
   /*
     Convert a strings between character sets.
@@ -3376,7 +3377,7 @@ class THD :public Statement,
     dstcs and srccs cannot be &my_charset_bin.
   */
   bool convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
-                   CHARSET_INFO *srccs, const char *src, uint src_length,
+                   CHARSET_INFO *srccs, const char *src, size_t src_length,
                    String_copier *status);
 
   /*
@@ -3385,7 +3386,7 @@ class THD :public Statement,
   */
   bool convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
                           CHARSET_INFO *srccs,
-                          const char *src, uint src_length);
+                          const char *src, size_t src_length);
 
   /*
     If either "dstcs" or "srccs" is &my_charset_bin,
@@ -3393,7 +3394,7 @@ class THD :public Statement,
     Otherwise, performs Unicode conversion using convert_fix().
   */
   bool copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
-                CHARSET_INFO *srccs, const char *src, uint src_length,
+                CHARSET_INFO *srccs, const char *src, size_t src_length,
                 String_copier *status);
 
   /*
@@ -3401,7 +3402,8 @@ class THD :public Statement,
     in case of bad byte sequences or Unicode conversion problems.
   */
   bool copy_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
-                       CHARSET_INFO *srccs, const char *src, uint src_length);
+                       CHARSET_INFO *srccs, const char *src,
+                       size_t src_length);
 
   bool convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs);
 
@@ -3920,12 +3922,12 @@ class THD :public Statement,
     Assign a new value to thd->query and thd->query_id and mysys_var.
     Protected with LOCK_thd_data mutex.
   */
-  void set_query(char *query_arg, uint32 query_length_arg,
+  void set_query(char *query_arg, size_t query_length_arg,
                  CHARSET_INFO *cs_arg)
   {
     set_query(CSET_STRING(query_arg, query_length_arg, cs_arg));
   }
-  void set_query(char *query_arg, uint32 query_length_arg) /*Mutex protected*/
+  void set_query(char *query_arg, size_t query_length_arg) /*Mutex protected*/
   {
     set_query(CSET_STRING(query_arg, query_length_arg, charset()));
   }
@@ -3941,7 +3943,7 @@ class THD :public Statement,
   }
   void reset_query()               /* Mutex protected */
   { set_query(CSET_STRING()); }
-  void set_query_and_id(char *query_arg, uint32 query_length_arg,
+  void set_query_and_id(char *query_arg, size_t query_length_arg,
                         CHARSET_INFO *cs, query_id_t new_query_id);
   void set_query_id(query_id_t new_query_id)
   {
@@ -4128,11 +4130,11 @@ class THD :public Statement,
   TABLE *find_temporary_table(const TABLE_LIST *tl);
 
   TMP_TABLE_SHARE *find_tmp_table_share_w_base_key(const char *key,
-                                                   uint key_length);
+                                                   size_t key_length);
   TMP_TABLE_SHARE *find_tmp_table_share(const char *db,
                                         const char *table_name);
   TMP_TABLE_SHARE *find_tmp_table_share(const TABLE_LIST *tl);
-  TMP_TABLE_SHARE *find_tmp_table_share(const char *key, uint key_length);
+  TMP_TABLE_SHARE *find_tmp_table_share(const char *key, size_t key_length);
 
   bool open_temporary_table(TABLE_LIST *tl);
   bool open_temporary_tables(TABLE_LIST *tl);
@@ -4160,12 +4162,12 @@ class THD :public Statement,
   };
 
   bool has_temporary_tables();
-  uint create_tmp_table_def_key(char *key, const char *db,
-                                const char *table_name);
+  size_t create_tmp_table_def_key(char *key, const char *db,
+                                  const char *table_name);
   TMP_TABLE_SHARE *create_temporary_table(handlerton *hton, LEX_CUSTRING *frm,
                                           const char *path, const char *db,
                                           const char *table_name);
-  TABLE *find_temporary_table(const char *key, uint key_length,
+  TABLE *find_temporary_table(const char *key, size_t key_length,
                               Temporary_table_state state);
   TABLE *open_temporary_table(TMP_TABLE_SHARE *share, const char *alias,
                               bool open_in_engine);
@@ -5261,7 +5263,7 @@ class Table_ident :public Sql_alloc
   bool is_derived_table() const { return MY_TEST(sel); }
   inline void change_db(char *db_name)
   {
-    db.str= db_name; db.length= (uint) strlen(db_name);
+    db.str= db_name; db.length= strlen(db_name);
   }
 };
 
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 354e5dcb9c8..b5debca3511 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -1004,12 +1004,12 @@ my_copy_with_hex_escaping(CHARSET_INFO *cs,
 
   @returns                   number of bytes that were written to 'to'
 */
-uint
+size_t
 String_copier::well_formed_copy(CHARSET_INFO *to_cs,
-                                char *to, uint to_length,
+                                char *to, size_t to_length,
                                 CHARSET_INFO *from_cs,
-                                const char *from, uint from_length,
-                                uint nchars)
+                                const char *from, size_t from_length,
+                                size_t nchars)
 {
   if ((to_cs == &my_charset_bin) || 
       (from_cs == &my_charset_bin) ||
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 8248f6d3554..77b4b7e5a2f 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -107,13 +107,13 @@ class String_copier: public String_copy_status,
   /*
      Copy a string. Fix bad bytes/characters to '?'.
   */
-  uint well_formed_copy(CHARSET_INFO *to_cs, char *to, uint to_length,
-                        CHARSET_INFO *from_cs, const char *from,
-                        uint from_length, uint nchars);
+  size_t well_formed_copy(CHARSET_INFO *to_cs, char *to, size_t to_length,
+                          CHARSET_INFO *from_cs, const char *from,
+                          size_t from_length, size_t nchars);
   // Same as above, but without the "nchars" limit.
-  uint well_formed_copy(CHARSET_INFO *to_cs, char *to, uint to_length,
-                        CHARSET_INFO *from_cs, const char *from,
-                        uint from_length)
+  size_t well_formed_copy(CHARSET_INFO *to_cs, char *to, size_t to_length,
+                          CHARSET_INFO *from_cs, const char *from,
+                          size_t from_length)
   {
     return well_formed_copy(to_cs, to, to_length,
                             from_cs, from, from_length,
diff --git a/sql/table.h b/sql/table.h
index f9b6ac4ae22..a0377cae6a7 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2313,8 +2313,8 @@ struct TABLE_LIST
   inline void set_merged_derived()
   {
     DBUG_ENTER("set_merged_derived");
-    derived_type= ((derived_type & DTYPE_MASK) |
-                   DTYPE_TABLE | DTYPE_MERGE);
+    derived_type= static_cast<uint8>((derived_type & DTYPE_MASK) |
+                                     DTYPE_TABLE | DTYPE_MERGE);
     set_check_merged();
     DBUG_VOID_RETURN;
   }
@@ -2325,8 +2325,9 @@ struct TABLE_LIST
   void set_materialized_derived()
   {
     DBUG_ENTER("set_materialized_derived");
-    derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) |
-                   DTYPE_TABLE | DTYPE_MATERIALIZE);
+    derived_type= static_cast<uint8>((derived_type &
+                                      (derived ? DTYPE_MASK : DTYPE_VIEW)) |
+                                     DTYPE_TABLE | DTYPE_MATERIALIZE);
     set_check_materialized();
     DBUG_VOID_RETURN;
   }
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index c05fc632a94..9348e644eb6 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2016 MariaDB Corporation
+  Copyright (c) 2016, 2017, MariaDB Corporation.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -166,7 +166,7 @@ TABLE *THD::find_temporary_table(const TABLE_LIST *tl)
           Failure                     NULL
 */
 TMP_TABLE_SHARE *THD::find_tmp_table_share_w_base_key(const char *key,
-                                                      uint key_length)
+                                                      size_t key_length)
 {
   DBUG_ENTER("THD::find_tmp_table_share_w_base_key");
 
@@ -250,7 +250,7 @@ TMP_TABLE_SHARE *THD::find_tmp_table_share(const TABLE_LIST *tl)
   @return Success                     A pointer to table share object
           Failure                     NULL
 */
-TMP_TABLE_SHARE *THD::find_tmp_table_share(const char *key, uint key_length)
+TMP_TABLE_SHARE *THD::find_tmp_table_share(const char *key, size_t key_length)
 {
   DBUG_ENTER("THD::find_tmp_table_share");
 
@@ -551,7 +551,7 @@ bool THD::rename_temporary_table(TABLE *table,
   DBUG_ENTER("THD::rename_temporary_table");
 
   char *key;
-  uint key_length;
+  size_t key_length;
 
   TABLE_SHARE *share= table->s;
 
@@ -891,8 +891,8 @@ inline bool THD::has_temporary_tables()
     4 bytes of master thread id
     4 bytes of pseudo thread id
 */
-uint THD::create_tmp_table_def_key(char *key, const char *db,
-                                    const char *table_name)
+size_t THD::create_tmp_table_def_key(char *key, const char *db,
+                                     const char *table_name)
 {
   DBUG_ENTER("THD::create_tmp_table_def_key");
 
@@ -1027,7 +1027,7 @@ TMP_TABLE_SHARE *THD::create_temporary_table(handlerton *hton,
   @return Success                     Pointer to the table instance.
           Failure                     NULL
 */
-TABLE *THD::find_temporary_table(const char *key, uint key_length,
+TABLE *THD::find_temporary_table(const char *key, size_t key_length,
                                  Temporary_table_state state)
 {
   DBUG_ENTER("THD::find_temporary_table");
diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c
index aa5343a0717..4893b638c3e 100644
--- a/storage/heap/hp_block.c
+++ b/storage/heap/hp_block.c
@@ -77,7 +77,7 @@ int hp_get_new_block(HP_SHARE *info, HP_BLOCK *block, size_t *alloc_length)
     + X rows at level 0.
    */
   *alloc_length= (sizeof(HP_PTRS) * ((i == block->levels) ? i : i - 1) +
-                  (ulonglong)block->records_in_block * block->recbuffer);
+                  (size_t) block->records_in_block * block->recbuffer);
   if (!(root=(HP_PTRS*) my_malloc(*alloc_length,
                                   MYF(MY_WME |
                                       (info->internal ?
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index ec42dd3d771..9bb6edc1b4f 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -305,7 +305,7 @@ class IORequest {
 	/** Clear the punch hole flag */
 	void clear_punch_hole()
 	{
-		m_type &= ~PUNCH_HOLE;
+		m_type &= uint16_t(~PUNCH_HOLE);
 	}
 
 	/** @return true if partial read warning disabled */
@@ -354,7 +354,7 @@ class IORequest {
 	/** Clear the do not wake flag */
 	void clear_do_not_wake()
 	{
-		m_type &= ~DO_NOT_WAKE;
+		m_type &= uint16_t(~DO_NOT_WAKE);
 	}
 
 	/** Set the pointer to file node for IO
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 46a7734ef22..dd584a3512d 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1,6 +1,6 @@
 /*
    Copyright (c) 2000, 2012, Oracle and/or its affiliates.
-   Copyright (c) 2009, 2014, SkySQL Ab.
+   Copyright (c) 2009, 2017, MariaDB Corporation.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -306,8 +306,8 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
       {
         keydef[i].seg[j].bit_length= ((Field_bit *) field)->bit_len;
         keydef[i].seg[j].bit_start= ((Field_bit *) field)->bit_ofs;
-        keydef[i].seg[j].bit_pos= (uint) (((Field_bit *) field)->bit_ptr -
-                                          (uchar*) table_arg->record[0]);
+        keydef[i].seg[j].bit_pos= (uint16) (((Field_bit *) field)->bit_ptr -
+                                            (uchar*) table_arg->record[0]);
       }
     }
     keyseg+= pos->user_defined_key_parts;
@@ -384,8 +384,8 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
     if (found->null_ptr)
     {
       recinfo_pos->null_bit= found->null_bit;
-      recinfo_pos->null_pos= (uint) (found->null_ptr -
-                                     (uchar*) table_arg->record[0]);
+      recinfo_pos->null_pos= (uint16) (found->null_ptr -
+                                       (uchar*) table_arg->record[0]);
     }
     else
     {
diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc
index 8d9465f08c5..c8d4dd0df3b 100644
--- a/storage/sequence/sequence.cc
+++ b/storage/sequence/sequence.cc
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2013 Monty Program Ab
+   Copyright (c) 2013, 2017, MariaDB Corporation.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -95,9 +95,15 @@ class ha_seq: public handler
   ha_rows records_in_range(uint inx, key_range *min_key,
                                    key_range *max_key);
 
-  double scan_time() { return nvalues(); }
-  double read_time(uint index, uint ranges, ha_rows rows) { return rows; }
-  double keyread_time(uint index, uint ranges, ha_rows rows) { return rows; }
+  double scan_time() { return static_cast<double>(nvalues()); }
+  double read_time(uint, uint, ha_rows rows)
+  {
+    return static_cast<double>(rows);
+  }
+  double keyread_time(uint, uint, ha_rows rows)
+  {
+    return static_cast<double>(rows);
+  }
 
 private:
   void set(uchar *buf);
diff --git a/strings/ctype.c b/strings/ctype.c
index 12d511162d7..7cea82bcb31 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -1,5 +1,5 @@
 /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
-   Copyright (c) 2009, 2014, SkySQL Ab.
+   Copyright (c) 2009, 2017, MariaDB Corporation.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1000,10 +1000,10 @@ my_charset_is_ascii_based(CHARSET_INFO *cs)
   @return Number of bytes copied to 'to' string
 */
 
-uint32
-my_convert_using_func(char *to, uint32 to_length,
+size_t
+my_convert_using_func(char *to, size_t to_length,
                       CHARSET_INFO *to_cs, my_charset_conv_wc_mb wc_mb,
-                      const char *from, uint32 from_length,
+                      const char *from, size_t from_length,
                       CHARSET_INFO *from_cs, my_charset_conv_mb_wc mb_wc,
                       uint *errors)
 {
@@ -1057,7 +1057,7 @@ my_convert_using_func(char *to, uint32 to_length,
       break;
   }
   *errors= error_count;
-  return (uint32) (to - to_start);
+  return (size_t) (to - to_start);
 }
 
 
@@ -1077,12 +1077,12 @@ my_convert_using_func(char *to, uint32 to_length,
   @return Number of bytes copied to 'to' string
 */
 
-uint32
-my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
-           const char *from, uint32 from_length,
+size_t
+my_convert(char *to, size_t to_length, CHARSET_INFO *to_cs,
+           const char *from, size_t from_length,
            CHARSET_INFO *from_cs, uint *errors)
 {
-  uint32 length, length2;
+  size_t length, length2;
   /*
     If any of the character sets is not ASCII compatible,
     immediately switch to slow mb_wc->wc_mb method.
@@ -1121,7 +1121,7 @@ my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
     }
     if (*((unsigned char*) from) > 0x7F) /* A non-ASCII character */
     {
-      uint32 copied_length= length2 - length;
+      size_t copied_length= length2 - length;
       to_length-= copied_length;
       from_length-= copied_length;
       return copied_length + my_convert_using_func(to, to_length, to_cs,
-- 
2.11.0



More information about the commits mailing list