[Commits] 5f260cb8394: Fix some more compilation warnings by using size_t.

marko.makela at mariadb.com marko.makela at mariadb.com
Thu Mar 30 14:40:52 EEST 2017


revision-id: 5f260cb8394f5e7fa5d845a551c3dd25513d4d59 (mariadb-10.2.4-112-g5f260cb8394)
parent(s): 9b3707d4b372c286e185d72dcca243045fe02565
author: Marko Mäkelä
committer: Marko Mäkelä
timestamp: 2017-03-30 14:40:52 +0300
message:

Fix some more compilation warnings by using size_t.

---
 sql/field.cc        | 54 +++++++++++++++++++++++-----------------------
 sql/field.h         | 62 ++++++++++++++++++++++++++---------------------------
 sql/item.cc         | 16 +++++++-------
 sql/item.h          | 15 +++++++------
 sql/item_create.cc  |  4 ++--
 sql/item_create.h   |  4 ++--
 sql/item_strfunc.cc | 14 ++++++------
 sql/item_strfunc.h  |  2 +-
 sql/item_sum.cc     |  6 +++---
 sql/sql_class.h     |  4 ++--
 sql/sql_error.cc    |  5 +++--
 sql/sql_error.h     |  4 ++--
 12 files changed, 96 insertions(+), 94 deletions(-)

diff --git a/sql/field.cc b/sql/field.cc
index a458a42f282..4609cbd9b3a 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1,6 +1,6 @@
 /*
    Copyright (c) 2000, 2013, Oracle and/or its affiliates.
-   Copyright (c) 2008, 2013, Monty Program Ab.
+   Copyright (c) 2008, 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
@@ -1323,7 +1323,7 @@ bool Field::can_optimize_range(const Item_bool_func *cond,
 }
 
 
-int Field::store_hex_hybrid(const char *str, uint length)
+int Field::store_hex_hybrid(const char *str, size_t length)
 {
   DBUG_ASSERT(result_type() != STRING_RESULT);
   ulonglong nr;
@@ -1795,7 +1795,7 @@ bool Field::compatible_field_size(uint field_metadata,
 }
 
 
-int Field::store(const char *to, uint length, CHARSET_INFO *cs,
+int Field::store(const char *to, size_t length, CHARSET_INFO *cs,
                  enum_check_fields check_level)
 {
   int res;
@@ -2389,7 +2389,7 @@ void Field_decimal::overflow(bool negative)
 }
 
 
-int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
+int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   char buff[STRING_BUFFER_USUAL_SIZE];
@@ -3133,7 +3133,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
 }
 
 
-int Field_new_decimal::store(const char *from, uint length,
+int Field_new_decimal::store(const char *from, size_t length,
                              CHARSET_INFO *charset_arg)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
@@ -3523,7 +3523,7 @@ int Field_num::store_time_dec(MYSQL_TIME *ltime, uint dec_arg)
 ** tiny int
 ****************************************************************************/
 
-int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_tiny::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   int error;
@@ -3699,7 +3699,7 @@ void Field_tiny::sql_type(String &res) const
  Field type short int (2 byte)
 ****************************************************************************/
 
-int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_short::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   int store_tmp;
@@ -3888,7 +3888,7 @@ void Field_short::sql_type(String &res) const
   Field type medium int (3 byte)
 ****************************************************************************/
 
-int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_medium::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   int store_tmp;
@@ -4079,7 +4079,7 @@ void Field_medium::sql_type(String &res) const
 ** long int
 ****************************************************************************/
 
-int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_long::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   long store_tmp;
@@ -4266,7 +4266,7 @@ void Field_long::sql_type(String &res) const
  Field type longlong int (8 bytes)
 ****************************************************************************/
 
-int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_longlong::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   int error= 0;
@@ -4422,7 +4422,7 @@ void Field_longlong::sql_type(String &res) const
   single precision float
 ****************************************************************************/
 
-int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_float::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   int error;
   Field_float::store(get_double(from, len, cs, &error));
@@ -4601,7 +4601,7 @@ void Field_float::sql_type(String &res) const
   double precision floating point numbers
 ****************************************************************************/
 
-int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_double::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   int error;
   Field_double::store(get_double(from, len, cs, &error));
@@ -5045,7 +5045,7 @@ int Field_timestamp::store_time_dec(MYSQL_TIME *ltime, uint dec)
 }
 
 
-int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_timestamp::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   MYSQL_TIME l_time;
   MYSQL_TIME_STATUS status;
@@ -5567,7 +5567,7 @@ int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME *ltime,
 }
 
 
-int Field_temporal_with_date::store(const char *from, uint len, CHARSET_INFO *cs)
+int Field_temporal_with_date::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   MYSQL_TIME ltime;
   MYSQL_TIME_STATUS status;
@@ -5759,7 +5759,7 @@ void Field_time::store_TIME(MYSQL_TIME *ltime)
   int3store(ptr,tmp);
 }
 
-int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
+int Field_time::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   MYSQL_TIME ltime;
   MYSQL_TIME_STATUS status;
@@ -6162,7 +6162,7 @@ bool Field_timef::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
 ** Can handle 2 byte or 4 byte years!
 ****************************************************************************/
 
-int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
+int Field_year::store(const char *from, size_t len, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   char *end;
@@ -6911,7 +6911,7 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end,
 
 	/* Copy a string and fill with space */
 
-int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
+int Field_string::store(const char *from, size_t length, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   uint copy_length;
@@ -7455,7 +7455,7 @@ int Field_varstring::do_save_field_metadata(uchar *metadata_ptr)
   return 2;
 }
 
-int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
+int Field_varstring::store(const char *from, size_t length, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   uint copy_length;
@@ -7920,7 +7920,7 @@ int Field_blob::copy_value(Field_blob *from)
 }
 
 
-int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
+int Field_blob::store(const char *from, size_t length, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   uint copy_length, new_length;
@@ -8013,7 +8013,7 @@ int Field_blob::store(double nr)
 {
   CHARSET_INFO *cs=charset();
   value.set_real(nr, NOT_FIXED_DEC, cs);
-  return Field_blob::store(value.ptr(),(uint) value.length(), cs);
+  return Field_blob::store(value.ptr(), value.length(), cs);
 }
 
 
@@ -8021,7 +8021,7 @@ int Field_blob::store(longlong nr, bool unsigned_val)
 {
   CHARSET_INFO *cs=charset();
   value.set_int(nr, unsigned_val, cs);
-  return Field_blob::store(value.ptr(), (uint) value.length(), cs);
+  return Field_blob::store(value.ptr(), value.length(), cs);
 }
 
 
@@ -8550,7 +8550,7 @@ int Field_geom::store_decimal(const my_decimal *)
 }
 
 
-int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
+int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
 {
   if (!length)
     bzero(ptr, Field_blob::pack_length());
@@ -8659,7 +8659,7 @@ void Field_enum::store_type(ulonglong value)
     (if there isn't a empty value in the enum)
 */
 
-int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
+int Field_enum::store(const char *from, size_t length, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   int err= 0;
@@ -8838,7 +8838,7 @@ Field *Field_enum::make_new_field(MEM_ROOT *root, TABLE *new_table,
 */
 
 
-int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
+int Field_set::store(const char *from, size_t length, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   bool got_warning= 0;
@@ -9249,8 +9249,8 @@ uint Field_bit::is_equal(Create_field *new_field)
           new_field->length == max_display_length());
 }
 
-                       
-int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
+
+int Field_bit::store(const char *from, size_t length, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   int delta;
@@ -9686,7 +9686,7 @@ Field_bit_as_char::Field_bit_as_char(uchar *ptr_arg, uint32 len_arg,
 }
 
 
-int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
+int Field_bit_as_char::store(const char *from, size_t length, CHARSET_INFO *cs)
 {
   ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
   int delta;
diff --git a/sql/field.h b/sql/field.h
index 020cabe31c5..649139a6240 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -309,7 +309,7 @@ class Value_source
     return decimal_value;
   }
 
-  longlong longlong_from_hex_hybrid(const char *str, uint32 length)
+  longlong longlong_from_hex_hybrid(const char *str, size_t length)
   {
     const char *end= str + length;
     const char *ptr= end - MY_MIN(length, sizeof(longlong));
@@ -814,15 +814,15 @@ class Field: public Value_source
     @retval false - conversion is needed
   */
   virtual bool memcpy_field_possible(const Field *from) const= 0;
-  virtual int  store(const char *to, uint length,CHARSET_INFO *cs)=0;
-  virtual int  store_hex_hybrid(const char *str, uint length);
+  virtual int  store(const char *to, size_t length,CHARSET_INFO *cs)=0;
+  virtual int  store_hex_hybrid(const char *str, size_t length);
   virtual int  store(double nr)=0;
   virtual int  store(longlong nr, bool unsigned_val)=0;
   virtual int  store_decimal(const my_decimal *d)=0;
   virtual int  store_time_dec(MYSQL_TIME *ltime, uint dec);
   int store_time(MYSQL_TIME *ltime)
   { return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); }
-  int store(const char *to, uint length, CHARSET_INFO *cs,
+  int store(const char *to, size_t length, CHARSET_INFO *cs,
             enum_check_fields check_level);
   int store(const LEX_STRING *ls, CHARSET_INFO *cs)
   { return store(ls->str, ls->length, cs); }
@@ -1062,7 +1062,7 @@ class Field: public Value_source
     }
     return update_fl;
   }
-  virtual void store_field_value(uchar *val, uint len)
+  virtual void store_field_value(uchar *val, size_t len)
   {
      memcpy(ptr, val, len);
   }
@@ -1661,8 +1661,8 @@ class Field_str :public Field {
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val)=0;
   int  store_decimal(const my_decimal *);
-  int  store(const char *to,uint length,CHARSET_INFO *cs)=0;
-  int  store_hex_hybrid(const char *str, uint length)
+  int  store(const char *to, size_t length,CHARSET_INFO *cs)=0;
+  int  store_hex_hybrid(const char *str, size_t length)
   {
     return store(str, length, &my_charset_bin);
   }
@@ -1802,7 +1802,7 @@ class Field_decimal :public Field_real {
     return eq_def(from) ? get_identical_copy_func() : do_field_string;
   }
   int reset(void);
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length,CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   double val_real(void);
@@ -1864,7 +1864,7 @@ class Field_new_decimal :public Field_num {
   bool store_value(const my_decimal *decimal_value);
   bool store_value(const my_decimal *decimal_value, int *native_error);
   void set_value_on_overflow(my_decimal *decimal_value, bool sign);
-  int  store(const char *to, uint length, CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
   int  store_time_dec(MYSQL_TIME *ltime, uint dec);
@@ -1911,7 +1911,7 @@ class Field_tiny :public Field_num {
   enum_field_types type() const { return MYSQL_TYPE_TINY;}
   enum ha_base_keytype key_type() const
     { return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   int reset(void) { ptr[0]=0; return 0; }
@@ -1960,7 +1960,7 @@ class Field_short :public Field_num {
   enum_field_types type() const { return MYSQL_TYPE_SHORT;}
   enum ha_base_keytype key_type() const
     { return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   int reset(void) { ptr[0]=ptr[1]=0; return 0; }
@@ -1995,7 +1995,7 @@ class Field_medium :public Field_num {
   enum_field_types type() const { return MYSQL_TYPE_INT24;}
   enum ha_base_keytype key_type() const
     { return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
@@ -2034,7 +2034,7 @@ class Field_long :public Field_num {
   enum_field_types type() const { return MYSQL_TYPE_LONG;}
   enum ha_base_keytype key_type() const
     { return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
@@ -2080,7 +2080,7 @@ class Field_longlong :public Field_num {
   enum_field_types type() const { return MYSQL_TYPE_LONGLONG;}
   enum ha_base_keytype key_type() const
     { return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   int reset(void)
@@ -2133,7 +2133,7 @@ class Field_float :public Field_real {
     }
   enum_field_types type() const { return MYSQL_TYPE_FLOAT;}
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; }
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   int reset(void) { bzero(ptr,sizeof(float)); return 0; }
@@ -2183,7 +2183,7 @@ class Field_double :public Field_real {
     }
   enum_field_types type() const { return MYSQL_TYPE_DOUBLE;}
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
-  int  store(const char *to,uint length,CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
   int reset(void) { bzero(ptr,sizeof(double)); return 0; }
@@ -2223,7 +2223,7 @@ class Field_null :public Field_str {
   {
     return do_field_string;
   }
-  int  store(const char *to, uint length, CHARSET_INFO *cs)
+  int  store(const char *, size_t, CHARSET_INFO *)
   { null[0]=1; return 0; }
   int store(double nr)   { null[0]=1; return 0; }
   int store(longlong nr, bool unsigned_val) { null[0]=1; return 0; }
@@ -2269,7 +2269,7 @@ class Field_temporal: public Field {
                field_name_arg)
     { flags|= BINARY_FLAG; }
   Item_result result_type () const { return STRING_RESULT; }   
-  int  store_hex_hybrid(const char *str, uint length)
+  int  store_hex_hybrid(const char *str, size_t length)
   {
     return store(str, length, &my_charset_bin);
   }
@@ -2347,7 +2347,7 @@ class Field_temporal_with_date: public Field_temporal {
     :Field_temporal(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
                     unireg_check_arg, field_name_arg)
     {}
-  int  store(const char *to, uint length, CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
   int  store_time_dec(MYSQL_TIME *ltime, uint dec);
@@ -2367,7 +2367,7 @@ class Field_timestamp :public Field_temporal {
 		  TABLE_SHARE *share);
   enum_field_types type() const { return MYSQL_TYPE_TIMESTAMP;}
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
-  int  store(const char *to,uint length,CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
   int  store_time_dec(MYSQL_TIME *ltime, uint dec);
@@ -2553,7 +2553,7 @@ class Field_year :public Field_tiny {
     }
     return do_field_int;
   }
-  int  store(const char *to,uint length,CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
   int  store_time_dec(MYSQL_TIME *ltime, uint dec);
@@ -2666,7 +2666,7 @@ class Field_time :public Field_temporal {
            decimals() == from->decimals();
   }
   int store_time_dec(MYSQL_TIME *ltime, uint dec);
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   int  store_decimal(const my_decimal *);
@@ -3030,7 +3030,7 @@ class Field_string :public Field_longstr {
                           (has_charset() ? ' ' : 0));
     return 0;
   }
-  int store(const char *to,uint length,CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(longlong nr, bool unsigned_val);
   int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
   double val_real(void);
@@ -3126,7 +3126,7 @@ class Field_varstring :public Field_longstr {
     return Field_str::memcpy_field_possible(from) &&
            length_bytes == ((Field_varstring*) from)->length_bytes;
   }
-  int  store(const char *to,uint length,CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(longlong nr, bool unsigned_val);
   int  store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
   double val_real(void);
@@ -3246,7 +3246,7 @@ class Field_blob :public Field_longstr {
     return Field_str::memcpy_field_possible(from) &&
            !table->copy_blobs;
   }
-  int  store(const char *to,uint length,CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
   double val_real(void);
@@ -3413,7 +3413,7 @@ class Field_geom :public Field_blob {
                                   bool is_eq_func) const;
   void sql_type(String &str) const;
   uint is_equal(Create_field *new_field);
-  int  store(const char *to, uint length, CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
   int  store_decimal(const my_decimal *);
@@ -3494,7 +3494,7 @@ class Field_enum :public Field_str {
     return save_in_field_str(to);
   }
   bool memcpy_field_possible(const Field *from) const { return false; }
-  int  store(const char *to,uint length,CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
   double val_real(void);
@@ -3558,7 +3558,7 @@ class Field_set :public Field_enum {
       flags=(flags & ~ENUM_FLAG) | SET_FLAG;
     }
   int  store_field(Field *from) { return from->save_in_field(this); }
-  int  store(const char *to,uint length,CHARSET_INFO *charset);
+  int  store(const char *to, size_t length, CHARSET_INFO *charset);
   int  store(double nr) { return Field_set::store((longlong) nr, FALSE); }
   int  store(longlong nr, bool unsigned_val);
 
@@ -3615,7 +3615,7 @@ class Field_bit :public Field {
   }
   int save_in_field(Field *to) { return to->store(val_int(), true); }
   bool memcpy_field_possible(const Field *from) const { return false; }
-  int store(const char *to, uint length, CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
   int store_decimal(const my_decimal *);
@@ -3662,7 +3662,7 @@ class Field_bit :public Field {
     }
     return update_fl;
   }
-  void store_field_value(uchar *val, uint len)
+  void store_field_value(uchar *val, size_t len)
   {
     store(*((longlong *)val), TRUE);
   }
@@ -3734,7 +3734,7 @@ class Field_bit_as_char: public Field_bit {
                     enum utype unireg_check_arg, const char *field_name_arg);
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
   uint size_of() const { return sizeof(*this); }
-  int store(const char *to, uint length, CHARSET_INFO *charset);
+  int store(const char *to, size_t length, CHARSET_INFO *charset);
   int store(double nr) { return Field_bit::store(nr); }
   int store(longlong nr, bool unsigned_val)
   { return Field_bit::store(nr, unsigned_val); }
diff --git a/sql/item.cc b/sql/item.cc
index 8f2b3615f6d..e4809b63bec 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1043,7 +1043,7 @@ bool Item::check_cols(uint c)
 }
 
 
-void Item::set_name(THD *thd, const char *str, uint length, CHARSET_INFO *cs)
+void Item::set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs)
 {
   if (!length)
   {
@@ -10172,13 +10172,13 @@ enum_field_types Item_type_holder::get_real_type(Item *item)
 
 bool Item_type_holder::join_types(THD *thd, Item *item)
 {
-  uint max_length_orig= max_length;
+  size_t max_length_orig= max_length;
   uint decimals_orig= decimals;
   DBUG_ENTER("Item_type_holder::join_types");
-  DBUG_PRINT("info:", ("was type %d len %d, dec %d name %s",
+  DBUG_PRINT("info:", ("was type %d len %zu, dec %u name %s",
                        real_field_type(), max_length, decimals,
                        (name ? name : "<NULL>")));
-  DBUG_PRINT("info:", ("in type %d len %d, dec %d",
+  DBUG_PRINT("info:", ("in type %d len %zu, dec %u",
                        get_real_type(item),
                        item->max_length, item->decimals));
   set_handler_by_real_type(Field::field_type_merge(real_field_type(),
@@ -10251,8 +10251,8 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
       if (item->max_length != max_length_orig ||
           item->decimals != decimals_orig)
       {
-        int delta1= max_length_orig - decimals_orig;
-        int delta2= item->max_length - item->decimals;
+        ssize_t delta1= max_length_orig - decimals_orig;
+        ssize_t delta2= item->max_length - item->decimals;
         max_length= MY_MAX(delta1, delta2) + decimals;
         if (Item_type_holder::real_field_type() == MYSQL_TYPE_FLOAT &&
             max_length > FLT_DIG + 2)
@@ -10281,8 +10281,8 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
 
   /* Remember decimal integer part to be used in DECIMAL_RESULT handleng */
   prev_decimal_int_part= decimal_int_part();
-  DBUG_PRINT("info", ("become type: %d  len: %u  dec: %u",
-                      (int) real_field_type(), max_length, (uint) decimals));
+  DBUG_PRINT("info", ("become type: %d  len: %zu  dec: %u",
+                      (int) real_field_type(), max_length, decimals));
   DBUG_RETURN(FALSE);
 }
 
diff --git a/sql/item.h b/sql/item.h
index 6d69e3b60de..54c1da05bee 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -615,7 +615,7 @@ class Type_std_attributes
     The maximum value length in characters multiplied by collation->mbmaxlen.
     Almost always it's the maximum value length in bytes.
   */
-  uint32 max_length;
+  size_t max_length;
   bool unsigned_flag;
   Type_std_attributes()
    :collation(&my_charset_bin, DERIVATION_COERCIBLE),
@@ -762,7 +762,7 @@ class Item: public Value_source,
     name=0;
 #endif
   }		/*lint -e1509 */
-  void set_name(THD *thd, const char *str, uint length, CHARSET_INFO *cs);
+  void set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs);
   void set_name_no_truncate(THD *thd, const char *str, uint length,
                             CHARSET_INFO *cs);
   void set_name_for_rollback(THD *thd, const char *str, uint length,
@@ -1827,7 +1827,7 @@ class Item: public Value_source,
   String *check_well_formed_result(String *str, bool send_error= 0);
   bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs); 
   uint32 max_char_length() const
-  { return max_length / collation.collation->mbmaxlen; }
+  { return static_cast<uint32>(max_length / collation.collation->mbmaxlen); }
   bool too_big_for_varchar() const
   { return max_char_length() > CONVERT_IF_BIGGER_TO_BLOB; }
   void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs)
@@ -2132,9 +2132,9 @@ inline void Item_sp_variable::make_field(THD *thd, Send_field *field)
   Item *it= this_item();
 
   if (name)
-    it->set_name(thd, name, (uint) strlen(name), system_charset_info);
+    it->set_name(thd, name, strlen(name), system_charset_info);
   else
-    it->set_name(thd, m_name.str, (uint) m_name.length, system_charset_info);
+    it->set_name(thd, m_name.str, m_name.length, system_charset_info);
   it->make_field(thd, field);
 }
 
@@ -3225,7 +3225,8 @@ class Item_string :public Item_basic_constant
     fixed= 1;
   }
 public:
-  Item_string(THD *thd, CHARSET_INFO *csi, const char *str_arg, uint length_arg):
+  Item_string(THD *thd, CHARSET_INFO *csi,
+              const char *str_arg, size_t length_arg):
     Item_basic_constant(thd)
   {
     collation.set(csi, DERIVATION_COERCIBLE);
@@ -3481,7 +3482,7 @@ class Item_return_date_time :public Item_partition_func_safe_string
 class Item_blob :public Item_partition_func_safe_string
 {
 public:
-  Item_blob(THD *thd, const char *name_arg, uint length):
+  Item_blob(THD *thd, const char *name_arg, size_t length):
     Item_partition_func_safe_string(thd, name_arg, strlen(name_arg), &my_charset_bin)
   { max_length= length; }
   enum Type type() const { return TYPE_HOLDER; }
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 4730e187ebe..7c0e9eab1bd 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -1,6 +1,6 @@
 /*
    Copyright (c) 2000, 2011, Oracle and/or its affiliates.
-   Copyright (c) 2008-2011 Monty Program Ab
+   Copyright (c) 2008, 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
@@ -7257,7 +7257,7 @@ have_important_literal_warnings(const MYSQL_TIME_STATUS *status)
 */
 
 Item *create_temporal_literal(THD *thd,
-                              const char *str, uint length,
+                              const char *str, size_t length,
                               CHARSET_INFO *cs,
                               enum_field_types type,
                               bool send_error)
diff --git a/sql/item_create.h b/sql/item_create.h
index 05fe48f656a..41349cf3ab9 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -1,5 +1,5 @@
 /* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
-   Copyright (c) 2008-2011 Monty Program Ab
+   Copyright (c) 2008, 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
@@ -169,7 +169,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
                  CHARSET_INFO *cs);
 
 Item *create_temporal_literal(THD *thd,
-                              const char *str, uint length,
+                              const char *str, size_t length,
                               CHARSET_INFO *cs,
                               enum_field_types type,
                               bool send_error);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index b34f9fd1b58..242246831bc 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1471,9 +1471,9 @@ String *Item_func_insert::val_str(String *str)
       args[3]->null_value)
     goto null; /* purecov: inspected */
 
-  if ((start < 0) || (start > res->length()))
+  if ((start < 0) || (start > (longlong) res->length()))
     return res;                                 // Wrong param; skip insert
-  if ((length < 0) || (length > res->length()))
+  if ((length < 0) || (length > (longlong) res->length()))
     length= res->length();
 
   /*
@@ -1491,13 +1491,13 @@ String *Item_func_insert::val_str(String *str)
   }
 
   /* start and length are now sufficiently valid to pass to charpos function */
-   start= res->charpos((int) start);
-   length= res->charpos((int) length, (uint32) start);
+   start= res->charpos(start);
+   length= res->charpos(length, (uint32) start);
 
   /* Re-testing with corrected params */
-  if (start + 1 > res->length()) // remember, start = args[1].val_int() - 1
+  if ((size_t) start >= res->length()) // remember, start = args[1].val_int()-1
     return res; /* purecov: inspected */        // Wrong param; skip insert
-  if (length > res->length() - start)
+  if ((size_t) length > res->length() - start)
     length= res->length() - start;
 
   {
@@ -1513,7 +1513,7 @@ String *Item_func_insert::val_str(String *str)
     }
   }
   res=copy_if_not_alloced(str,res,res->length());
-  res->replace((uint32) start,(uint32) length,*res2);
+  res->replace((size_t) start, (size_t) length,*res2);
   return res;
 null:
   null_value=1;
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 65c6dacbc73..54293184979 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -469,7 +469,7 @@ class Item_func_trim :public Item_str_func
 protected:
   String tmp_value;
   String remove;
-  String *trimmed_value(String *res, uint32 offset, uint32 length)
+  String *trimmed_value(String *res, size_t offset, size_t length)
   {
     tmp_value.set(*res, offset, length);
     /*
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index d5296074ce3..ca0ff716c36 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1335,13 +1335,13 @@ void Item_sum_sum::fix_length_and_dec()
   case ROW_RESULT:
     DBUG_ASSERT(0);
   }
-  DBUG_PRINT("info", ("Type: %s (%d, %d)",
+  DBUG_PRINT("info", ("Type: %s (%zu, %u)",
                       (result_type() == REAL_RESULT ? "REAL_RESULT" :
                        result_type() == DECIMAL_RESULT ? "DECIMAL_RESULT" :
                        result_type() == INT_RESULT ? "INT_RESULT" :
                        "--ILLEGAL!!!--"),
                       max_length,
-                      (int)decimals));
+                      decimals));
   DBUG_VOID_RETURN;
 }
 
@@ -1896,7 +1896,7 @@ void Item_sum_variance::fix_length_and_dec()
   case TIME_RESULT:
     DBUG_ASSERT(0);
   }
-  DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals));
+  DBUG_PRINT("info", ("Type: REAL_RESULT (%zu, %u)", max_length, decimals));
   DBUG_VOID_RETURN;
 }
 
diff --git a/sql/sql_class.h b/sql/sql_class.h
index f44b2ec051f..af606c913be 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3768,7 +3768,7 @@ class THD :public Statement,
     mysql_mutex_unlock(&LOCK_thd_data);
 #ifdef HAVE_PSI_THREAD_INTERFACE
     if (result)
-      PSI_THREAD_CALL(set_thread_db)(new_db, new_db_len);
+      PSI_THREAD_CALL(set_thread_db)(new_db, static_cast<int>(new_db_len));
 #endif
     return result;
   }
@@ -3793,7 +3793,7 @@ class THD :public Statement,
       db_length= new_db_len;
       mysql_mutex_unlock(&LOCK_thd_data);
 #ifdef HAVE_PSI_THREAD_INTERFACE
-      PSI_THREAD_CALL(set_thread_db)(new_db, new_db_len);
+      PSI_THREAD_CALL(set_thread_db)(new_db, static_cast<int>(new_db_len));
 #endif
     }
   }
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index d14c7b83b77..23e596ff24c 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -1,4 +1,5 @@
 /* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+   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
@@ -899,8 +900,8 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
    result string
 */
 
-char *err_conv(char *buff, uint to_length, const char *from,
-               uint from_length, CHARSET_INFO *from_cs)
+char *err_conv(char *buff, size_t to_length, const char *from,
+               size_t from_length, CHARSET_INFO *from_cs)
 {
   char *to= buff;
   const char *from_start= from;
diff --git a/sql/sql_error.h b/sql/sql_error.h
index 3aef5d38368..ed1385bc2c4 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -545,8 +545,8 @@ class Warning_info
 };
 
 
-extern char *err_conv(char *buff, uint to_length, const char *from,
-                      uint from_length, CHARSET_INFO *from_cs);
+extern char *err_conv(char *buff, size_t to_length, const char *from,
+                      size_t from_length, CHARSET_INFO *from_cs);
 
 class ErrConv
 {


More information about the commits mailing list