1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/home/my/mysql-5.0
This commit is contained in:
monty@mysql.com/narttu.mysql.fi
2007-01-22 14:04:40 +02:00
229 changed files with 3267 additions and 3076 deletions

View File

@ -617,27 +617,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
@ -649,8 +648,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;
}