summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/narttu.mysql.fi>2006-11-30 03:40:42 +0200
committerunknown <monty@mysql.com/narttu.mysql.fi>2006-11-30 03:40:42 +0200
commit1e87cfee19303a3ee3de027c27fef90c153ad4bf (patch)
tree7cc1a3e7f00427d01d2117c9b3c41231a827afd3 /sql/item_strfunc.cc
parentc0c013e5b75b88081b6a8a693a777aaf6a574a66 (diff)
downloadmariadb-git-1e87cfee19303a3ee3de027c27fef90c153ad4bf.tar.gz
Fixed compiler warnings (Mostly VC++):
- Removed not used variables - Changed some ulong parameters/variables to ulonglong (possible serious bug) - Added casts to get rid of safe assignment from longlong to long (and similar) - Added casts to function parameters - Fixed signed/unsigned compares - Added some constructores to structures - Removed some not portable constructs Better fix for bug Bug #21428 "skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown" (Added new parameter to net_clear() to define when we want the communication buffer to be emptied) client/mysql.cc: Removed not used variable client/mysqldump.c: Fixed compiler warning client/mysqlslap.c: Fixed compiler warning client/mysqltest.c: Fixed compiler warning extra/replace.c: Fixed compiler warning include/my_global.h: Fixed compiler warning include/mysql_com.h: Changed prototype for net_clear() libmysql/libmysql.c: Changed prototype for net_clear() mysys/base64.c: Fixed compiler warning (function definition and prototype didn't match) mysys/my_thr_init.c: AFter merge fixes mysys/my_vle.c: Fixed compiler warning sql/event_data_objects.cc: Fixed compiler warning sql/event_scheduler.cc: Removed not used variable sql/field.cc: Removed not used variables Fixed compiler warning sql/gen_lex_hash.cc: Fixed compiler warning sql/ha_partition.h: Fixed compiler warning sql/handler.cc: Fixed compiler warning sql/item.cc: Fixed compiler warning sql/item_create.cc: Fixed compiler warning sql/item_func.cc: Fixed compiler warning sql/item_strfunc.cc: Fixed compiler warning sql/item_timefunc.cc: Fixed compiler warning sql/item_xmlfunc.cc: Fixed compiler warning sql/log.cc: Fixed compiler warning sql/log_event.cc: Fixed compiler warning sql/log_event.h: Fixed compiler warning sql/mysql_priv.h: Fixed too short 'select_type' sql/net_serv.cc: Added argument to net_clear() if we should empty the communication buffer. sql/opt_range.cc: Fixed compiler warning sql/partition_info.cc: Fixed compiler warning sql/rpl_injector.h: Fixed compiler warning sql/set_var.cc: Fixed compiler warning sql/slave.cc: Fixed compiler warning sql/sp_head.cc: Fixed compiler warning sql/sql_base.cc: Fixed compiler warning sql/sql_db.cc: Fixed compiler warning sql/sql_delete.cc: Fixed compiler warning sql/sql_insert.cc: Fixed compiler warning sql/sql_lex.h: Fixed compiler warning sql/sql_parse.cc: Fixed compiler warning sql/sql_partition.cc: Fixed compiler warning sql/sql_plugin.cc: Fixed compiler warning sql/sql_prepare.cc: Fixed compiler warning sql/sql_rename.cc: Fixed compiler warning sql/sql_select.cc: Fixed compiler warning sql/sql_show.cc: Fixed compiler warning sql/sql_table.cc: Fixed compiler warning sql/sql_trigger.cc: Fixed compiler warning sql-common/client.c: Better fix for bug Bug #21428 "skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown" sql-common/my_time.c: Fixed compiler warning sql/sql_union.cc: Fixed compiler warning sql/sql_update.cc: Fixed compiler warning sql/sql_view.cc: Fixed compiler warning sql/sql_yacc.yy: Fixed compiler warning sql/table.cc: Fixed compiler warning storage/archive/azio.c: Fixed compiler warning storage/csv/ha_tina.cc: Removed not used code storage/myisam/mi_unique.c: Fixed compiler warning storage/ndb/include/util/OutputStream.hpp: Fixed compiler warning storage/ndb/include/util/SocketAuthenticator.hpp: Fixed compiler warning storage/ndb/src/kernel/vm/Pool.hpp: Fixed compiler warning strings/ctype-simple.c: Fixed compiler warning strings/my_strchr.c: Fixed compiler warning
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc31
1 files changed, 16 insertions, 15 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 2a022d4af71..70037879646 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -969,8 +969,8 @@ String *Item_func_insert::val_str(String *str)
length= res->length() + 1;
/* start and length are now sufficiently valid to pass to charpos function */
- start= res->charpos(start);
- length= res->charpos(length, start);
+ start= res->charpos((int) start);
+ length= res->charpos((int) length, (uint32) start);
/* Re-testing with corrected params */
if (start > res->length() + 1)
@@ -988,7 +988,7 @@ String *Item_func_insert::val_str(String *str)
goto null;
}
res=copy_if_not_alloced(str,res,res->length());
- res->replace(start,length,*res2);
+ res->replace((uint32) start,(uint32) length,*res2);
return res;
null:
null_value=1;
@@ -1064,7 +1064,7 @@ String *Item_func_left::val_str(String *str)
return &my_empty_string;
if ((res->length() <= (ulonglong) length) ||
- (res->length() <= (char_pos= res->charpos(length))))
+ (res->length() <= (char_pos= res->charpos((int) length))))
return res;
tmp_value.set(*res, 0, char_pos);
@@ -1156,17 +1156,17 @@ String *Item_func_substr::val_str(String *str)
return &my_empty_string;
start= ((start < 0) ? res->numchars() + start : start - 1);
- start= res->charpos(start);
+ start= res->charpos((int) start);
if ((start < 0) || ((uint) start + 1 > res->length()))
return &my_empty_string;
- length= res->charpos(length, start);
+ length= res->charpos((int) length, (uint32) start);
tmp_length= res->length() - start;
length= min(length, tmp_length);
- if (!start && res->length() == (ulonglong) length)
+ if (!start && (longlong) res->length() == length)
return res;
- tmp_value.set(*res, (ulonglong) start, (ulonglong) length);
+ tmp_value.set(*res, (uint32) start, (uint32) length);
return &tmp_value;
}
@@ -2214,7 +2214,7 @@ String *Item_func_repeat::val_str(String *str)
char *to;
/* must be longlong to avoid truncation */
longlong tmp_count= args[1]->val_int();
- long count= tmp_count;
+ long count= (long) tmp_count;
String *res= args[0]->val_str(str);
/* Assumes that the maximum length of a String is < INT_MAX32. */
@@ -2316,7 +2316,7 @@ String *Item_func_rpad::val_str(String *str)
if (count <= (res_char_length= res->numchars()))
{ // String to pad is big enough
- res->length(res->charpos(count)); // Shorten result if longer
+ res->length(res->charpos((int) count)); // Shorten result if longer
return (res);
}
pad_char_length= rpad->numchars();
@@ -2333,7 +2333,7 @@ String *Item_func_rpad::val_str(String *str)
if (args[2]->null_value || !pad_char_length)
goto err;
res_byte_length= res->length(); /* Must be done before alloc_buffer */
- if (!(res= alloc_buffer(res,str,&tmp_value,byte_count)))
+ if (!(res= alloc_buffer(res,str,&tmp_value, (ulong) byte_count)))
goto err;
to= (char*) res->ptr()+res_byte_length;
@@ -2347,7 +2347,7 @@ String *Item_func_rpad::val_str(String *str)
}
if (count)
{
- pad_byte_length= rpad->charpos(count);
+ pad_byte_length= rpad->charpos((int) count);
memcpy(to,ptr_pad,(size_t) pad_byte_length);
to+= pad_byte_length;
}
@@ -2419,7 +2419,7 @@ String *Item_func_lpad::val_str(String *str)
if (count <= res_char_length)
{
- res->length(res->charpos(count));
+ res->length(res->charpos((int) count));
return res;
}
@@ -2435,7 +2435,8 @@ String *Item_func_lpad::val_str(String *str)
goto err;
}
- if (args[2]->null_value || !pad_char_length || str->alloc(byte_count))
+ if (args[2]->null_value || !pad_char_length ||
+ str->alloc((uint32) byte_count))
goto err;
str->length(0);
@@ -2447,7 +2448,7 @@ String *Item_func_lpad::val_str(String *str)
count-= pad_char_length;
}
if (count > 0)
- str->append(pad->ptr(), pad->charpos(count), collation.collation);
+ str->append(pad->ptr(), pad->charpos((int) count), collation.collation);
str->append(*res);
null_value= 0;