mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge mysql.com:/home/my/mysql-5.0
into mysql.com:/home/my/mysql-5.1 Merge of 'remove compiler warnings when using -Wshadow'
This commit is contained in:
@ -607,27 +607,26 @@ skip:
|
||||
}
|
||||
|
||||
/*
|
||||
** replace substring with string
|
||||
** If wrong parameter or not enough memory, do nothing
|
||||
Replace substring with string
|
||||
If wrong parameter or not enough memory, do nothing
|
||||
*/
|
||||
|
||||
|
||||
bool String::replace(uint32 offset,uint32 arg_length,const String &to)
|
||||
{
|
||||
return replace(offset,arg_length,to.ptr(),to.length());
|
||||
}
|
||||
|
||||
bool String::replace(uint32 offset,uint32 arg_length,
|
||||
const char *to,uint32 length)
|
||||
const char *to, uint32 to_length)
|
||||
{
|
||||
long diff = (long) length-(long) arg_length;
|
||||
long diff = (long) to_length-(long) arg_length;
|
||||
if (offset+arg_length <= str_length)
|
||||
{
|
||||
if (diff < 0)
|
||||
{
|
||||
if (length)
|
||||
memcpy(Ptr+offset,to,length);
|
||||
bmove(Ptr+offset+length,Ptr+offset+arg_length,
|
||||
if (to_length)
|
||||
memcpy(Ptr+offset,to,to_length);
|
||||
bmove(Ptr+offset+to_length,Ptr+offset+arg_length,
|
||||
str_length-offset-arg_length);
|
||||
}
|
||||
else
|
||||
@ -639,8 +638,8 @@ bool String::replace(uint32 offset,uint32 arg_length,
|
||||
bmove_upp(Ptr+str_length+diff,Ptr+str_length,
|
||||
str_length-offset-arg_length);
|
||||
}
|
||||
if (length)
|
||||
memcpy(Ptr+offset,to,length);
|
||||
if (to_length)
|
||||
memcpy(Ptr+offset,to,to_length);
|
||||
}
|
||||
str_length+=(uint32) diff;
|
||||
}
|
||||
|
Reference in New Issue
Block a user