summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-09 09:28:51 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-09 09:28:51 -0300
commit1c924a165259dc8ffb9c1cdcdb1f0d43876bcb20 (patch)
tree8edee282fc8a225a291cd9be2e44e38709e31b1a /sql
parent024dba64b64f395151f6b95650e8ee69a1591428 (diff)
parent11fae04527098cb6c266eae41188504bd22a5b52 (diff)
downloadmariadb-git-1c924a165259dc8ffb9c1cdcdb1f0d43876bcb20.tar.gz
Merge of mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc2
-rw-r--r--sql/item_timefunc.cc24
-rw-r--r--sql/log_event.cc29
-rw-r--r--sql/my_decimal.cc8
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/partition_info.cc6
-rw-r--r--sql/protocol.cc24
-rw-r--r--sql/rpl_mi.cc13
-rw-r--r--sql/slave.cc8
-rw-r--r--sql/sql_acl.cc10
-rw-r--r--sql/sql_analyse.cc10
-rw-r--r--sql/sql_yacc.yy6
12 files changed, 61 insertions, 81 deletions
diff --git a/sql/field.cc b/sql/field.cc
index fa258ce9479..56d60ff5b28 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -10141,7 +10141,7 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
{
/* DBL_DIG is enough to print '-[digits].E+###' */
char str_nr[DBL_DIG + 8];
- uint str_len= my_sprintf(str_nr, (str_nr, "%g", nr));
+ uint str_len= sprintf(str_nr, "%g", nr);
make_truncated_value_warning(thd, level, str_nr, str_len, ts_type,
field_name);
}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index feff03e704a..1c2c1cfe512 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -775,13 +775,11 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
str->append(hours_i < 12 ? "AM" : "PM",2);
break;
case 'r':
- length= my_sprintf(intbuff,
- (intbuff,
- ((l_time->hour % 24) < 12) ?
- "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM",
- (l_time->hour+11)%12+1,
- l_time->minute,
- l_time->second));
+ length= sprintf(intbuff, ((l_time->hour % 24) < 12) ?
+ "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM",
+ (l_time->hour+11)%12+1,
+ l_time->minute,
+ l_time->second);
str->append(intbuff, length);
break;
case 'S':
@@ -790,12 +788,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'T':
- length= my_sprintf(intbuff,
- (intbuff,
- "%02d:%02d:%02d",
- l_time->hour,
- l_time->minute,
- l_time->second));
+ length= sprintf(intbuff, "%02d:%02d:%02d",
+ l_time->hour, l_time->minute, l_time->second);
str->append(intbuff, length);
break;
case 'U':
@@ -3057,12 +3051,12 @@ String *Item_func_maketime::val_str(String *str)
char buf[28];
char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10);
int len = (int)(ptr - buf) +
- my_sprintf(ptr, (ptr, ":%02u:%02u", (uint)minute, (uint)second));
+ sprintf(ptr, ":%02u:%02u", (uint) minute, (uint) second);
make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
buf, len, MYSQL_TIMESTAMP_TIME,
NullS);
}
-
+
if (make_time_with_warn((DATE_TIME_FORMAT *) 0, &ltime, str))
{
null_value= 1;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 3bfa0403e91..90ec9eabcd1 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1653,17 +1653,17 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
int i, end;
char buff[512], *pos;
pos= buff;
- pos+= my_sprintf(buff, (buff, "%s", dec.sign() ? "-" : ""));
+ pos+= sprintf(buff, "%s", dec.sign() ? "-" : "");
end= ROUND_UP(dec.frac) + ROUND_UP(dec.intg)-1;
for (i=0; i < end; i++)
- pos+= my_sprintf(pos, (pos, "%09d.", dec.buf[i]));
- pos+= my_sprintf(pos, (pos, "%09d", dec.buf[i]));
+ pos+= sprintf(pos, "%09d.", dec.buf[i]);
+ pos+= sprintf(pos, "%09d", dec.buf[i]);
my_b_printf(file, "%s", buff);
my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)",
precision, decimals);
return bin_size;
}
-
+
case MYSQL_TYPE_FLOAT:
{
float fl;
@@ -5788,7 +5788,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
double real_val;
char real_buf[FMT_G_BUFSIZE(14)];
float8get(real_val, val);
- my_sprintf(real_buf, (real_buf, "%.14g", real_val));
+ sprintf(real_buf, "%.14g", real_val);
my_b_printf(&cache, ":=%s%s\n", real_buf, print_event_info->delimiter);
break;
case INT_RESULT:
@@ -6547,10 +6547,9 @@ void Append_block_log_event::print(FILE* file,
void Append_block_log_event::pack_info(Protocol *protocol)
{
char buf[256];
- uint length;
- length= (uint) my_sprintf(buf,
- (buf, ";file_id=%u;block_len=%u", file_id,
- block_len));
+ size_t length;
+ length= my_snprintf(buf, sizeof(buf), ";file_id=%u;block_len=%u",
+ file_id, block_len);
protocol->store(buf, length, &my_charset_bin);
}
@@ -6705,9 +6704,9 @@ void Delete_file_log_event::print(FILE* file,
void Delete_file_log_event::pack_info(Protocol *protocol)
{
char buf[64];
- uint length;
- length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
- protocol->store(buf, (int32) length, &my_charset_bin);
+ size_t length;
+ length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id);
+ protocol->store(buf, length, &my_charset_bin);
}
#endif
@@ -6803,9 +6802,9 @@ void Execute_load_log_event::print(FILE* file,
void Execute_load_log_event::pack_info(Protocol *protocol)
{
char buf[64];
- uint length;
- length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
- protocol->store(buf, (int32) length, &my_charset_bin);
+ size_t length;
+ length= my_snprintf(buf, sizeof(buf), ";file_id=%u", (uint) file_id);
+ protocol->store(buf, length, &my_charset_bin);
}
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 68f9b582dd2..8a31cec6721 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -305,12 +305,12 @@ print_decimal(const my_decimal *dec)
int i, end;
char buff[512], *pos;
pos= buff;
- pos+= my_sprintf(buff, (buff, "Decimal: sign: %d intg: %d frac: %d { ",
- dec->sign(), dec->intg, dec->frac));
+ pos+= sprintf(buff, "Decimal: sign: %d intg: %d frac: %d { ",
+ dec->sign(), dec->intg, dec->frac);
end= ROUND_UP(dec->frac)+ROUND_UP(dec->intg)-1;
for (i=0; i < end; i++)
- pos+= my_sprintf(pos, (pos, "%09d, ", dec->buf[i]));
- pos+= my_sprintf(pos, (pos, "%09d }\n", dec->buf[i]));
+ pos+= sprintf(pos, "%09d, ", dec->buf[i]);
+ pos+= sprintf(pos, "%09d }\n", dec->buf[i]);
fputs(buff, DBUG_FILE);
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index d1bf387cc5f..1e5c3f43f5e 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -6439,7 +6439,7 @@ static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_CHAR;
var->value= buff;
- my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period));
+ sprintf(buff, "%.3f", active_mi->heartbeat_period);
}
else
var->type= SHOW_UNDEF;
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 5b0b681c3a6..43934551016 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -109,8 +109,8 @@ char *partition_info::create_default_partition_names(uint part_no,
{
do
{
- my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i)));
- move_ptr+=MAX_PART_NAME_SIZE;
+ sprintf(move_ptr, "p%u", (start_no + i));
+ move_ptr+= MAX_PART_NAME_SIZE;
} while (++i < num_parts_arg);
}
else
@@ -177,7 +177,7 @@ char *partition_info::create_subpartition_name(uint subpart_no,
if (likely(ptr != NULL))
{
- my_sprintf(ptr, (ptr, "%ssp%u", part_name, subpart_no));
+ my_snprintf(ptr, size_alloc, "%ssp%u", part_name, subpart_no);
}
else
{
diff --git a/sql/protocol.cc b/sql/protocol.cc
index ac78ac88ec6..3f957dcc2de 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1166,16 +1166,12 @@ bool Protocol_text::store(MYSQL_TIME *tm)
#endif
char buff[40];
uint length;
- length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d",
- (int) tm->year,
- (int) tm->month,
- (int) tm->day,
- (int) tm->hour,
- (int) tm->minute,
- (int) tm->second));
+ length= sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d",
+ (int) tm->year, (int) tm->month,
+ (int) tm->day, (int) tm->hour,
+ (int) tm->minute, (int) tm->second);
if (tm->second_part)
- length+= my_sprintf(buff+length,(buff+length, ".%06d",
- (int)tm->second_part));
+ length+= sprintf(buff+length, ".%06d", (int) tm->second_part);
return net_store_data((uchar*) buff, length);
}
@@ -1209,13 +1205,11 @@ bool Protocol_text::store_time(MYSQL_TIME *tm)
char buff[40];
uint length;
uint day= (tm->year || tm->month) ? 0 : tm->day;
- length= my_sprintf(buff,(buff, "%s%02ld:%02d:%02d",
- tm->neg ? "-" : "",
- (long) day*24L+(long) tm->hour,
- (int) tm->minute,
- (int) tm->second));
+ length= sprintf(buff, "%s%02ld:%02d:%02d", tm->neg ? "-" : "",
+ (long) day*24L+(long) tm->hour, (int) tm->minute,
+ (int) tm->second);
if (tm->second_part)
- length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
+ length+= sprintf(buff+length, ".%06d", (int) tm->second_part);
return net_store_data((uchar*) buff, length);
}
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 9b0450b3f02..a775d3485c9 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -457,16 +457,13 @@ int flush_master_info(Master_info* mi,
(1 + mi->ignore_server_ids.elements), MYF(MY_WME));
if (!ignore_server_ids_buf)
DBUG_RETURN(1);
- for (ulong i= 0, cur_len= my_sprintf(ignore_server_ids_buf,
- (ignore_server_ids_buf, "%u",
- mi->ignore_server_ids.elements));
- i < mi->ignore_server_ids.elements; i++)
+ ulong cur_len= sprintf(ignore_server_ids_buf, "%u",
+ mi->ignore_server_ids.elements);
+ for (ulong i= 0; i < mi->ignore_server_ids.elements; i++)
{
ulong s_id;
get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i);
- cur_len +=my_sprintf(ignore_server_ids_buf + cur_len,
- (ignore_server_ids_buf + cur_len,
- " %lu", s_id));
+ cur_len+= sprintf(ignore_server_ids_buf + cur_len, " %lu", s_id);
}
}
@@ -487,7 +484,7 @@ int flush_master_info(Master_info* mi,
of file we don't care about this garbage.
*/
char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always
- my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period));
+ sprintf(heartbeat_buf, "%.3f", mi->heartbeat_period);
my_b_seek(file, 0L);
my_b_printf(file,
"%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n",
diff --git a/sql/slave.cc b/sql/slave.cc
index ba77eb482b6..383627a7fd1 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1528,7 +1528,7 @@ when it try to get the value of TIME_ZONE global variable from master.";
the period is an ulonglong of nano-secs.
*/
llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf);
- my_sprintf(query, (query, query_format, llbuf));
+ sprintf(query, query_format, llbuf);
if (mysql_real_query(mysql, query, strlen(query))
&& !check_io_slave_killed(mi->io_thd, mi, NULL))
@@ -1934,17 +1934,17 @@ bool show_master_info(THD* thd, Master_info* mi)
ulong s_id, slen;
char sbuff[FN_REFLEN];
get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i);
- slen= my_sprintf(sbuff, (sbuff, (i==0? "%lu" : ", %lu"), s_id));
+ slen= sprintf(sbuff, (i==0? "%lu" : ", %lu"), s_id);
if (cur_len + slen + 4 > FN_REFLEN)
{
/*
break the loop whenever remained space could not fit
ellipses on the next cycle
*/
- my_sprintf(buff + cur_len, (buff + cur_len, "..."));
+ sprintf(buff + cur_len, "...");
break;
}
- cur_len += my_sprintf(buff + cur_len, (buff + cur_len, "%s", sbuff));
+ cur_len += sprintf(buff + cur_len, "%s", sbuff);
}
protocol->store(buff, &my_charset_bin);
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 8c241d8d7ba..074f1047d67 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1644,12 +1644,10 @@ bool change_password(THD *thd, const char *host, const char *user,
result= 0;
if (mysql_bin_log.is_open())
{
- query_length=
- my_sprintf(buff,
- (buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
- acl_user->user ? acl_user->user : "",
- acl_user->host.hostname ? acl_user->host.hostname : "",
- new_password));
+ query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
+ acl_user->user ? acl_user->user : "",
+ acl_user->host.hostname ? acl_user->host.hostname : "",
+ new_password);
thd->clear_error();
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
FALSE, FALSE, FALSE, 0);
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 0b3e5117c97..4b6756188dd 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -408,7 +408,7 @@ void field_real::add()
if ((decs = decimals()) == NOT_FIXED_DEC)
{
- length= my_sprintf(buff, (buff, "%g", num));
+ length= sprintf(buff, "%g", num);
if (rint(num) != num)
max_notzero_dec_len = 1;
}
@@ -419,7 +419,7 @@ void field_real::add()
snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num);
length = (uint) strlen(buff);
#else
- length= my_sprintf(buff, (buff, "%-.*f", (int) decs, num));
+ length= sprintf(buff, "%-.*f", (int) decs, num);
#endif
// We never need to check further than this
@@ -1006,9 +1006,9 @@ void field_decimal::get_opt_type(String *answer,
my_decimal_set_zero(&zero);
my_bool is_unsigned= (my_decimal_cmp(&zero, &min_arg) >= 0);
- length= my_sprintf(buff, (buff, "DECIMAL(%d, %d)",
- (int) (max_length - (item->decimals ? 1 : 0)),
- item->decimals));
+ length= my_snprintf(buff, sizeof(buff), "DECIMAL(%d, %d)",
+ (int) (max_length - (item->decimals ? 1 : 0)),
+ item->decimals);
if (is_unsigned)
length= (uint) (strmov(buff+length, " UNSIGNED")- buff);
answer->append(buff, length);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 1c673f4ca42..3ba67368565 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1932,11 +1932,9 @@ master_def:
{
const char format[]= "%d seconds";
char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)];
- my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD));
+ sprintf(buf, format, SLAVE_MAX_HEARTBEAT_PERIOD);
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
- MYF(0),
- " is negative or exceeds the maximum ",
- buf);
+ MYF(0), " is negative or exceeds the maximum ", buf);
MYSQL_YYABORT;
}
if (Lex->mi.heartbeat_period > slave_net_timeout)