diff options
author | unknown <monty@donna.mysql.com> | 2000-10-20 17:39:23 +0300 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-10-20 17:39:23 +0300 |
commit | 982260d2cb5ec6b3864a34a4cb355160986f807f (patch) | |
tree | c1fdd2f498afdf46ca3d76edce587eb117986b03 /client/sql_string.cc | |
parent | ae687f81506b4021fe6f0b6743d749be1bf43456 (diff) | |
download | mariadb-git-982260d2cb5ec6b3864a34a4cb355160986f807f.tar.gz |
Bug fixes + defines for INNOBASE
Docs/manual.texi:
Cleanups
client/sql_string.cc:
Fixes for AIX
mit-pthreads/Changes-mysql:
Changelog
mit-pthreads/config/configure.in:
Fixes for NETBSD
mit-pthreads/config/configure:
Fixes for NETBSD
mit-pthreads/gen/ctime.c:
Fixes for NETBSD
mysys/my_pthread.c:
Changed assert to dbug_assert
scripts/make_binary_distribution.sh:
Removed mysql-test
scripts/safe_mysqld.sh:
Forced --defaults-extra-file to be first argument to mysqld
sql/handler.h:
Added INNOBASE database type
sql/item_func.h:
Fixed core dump when using MATCH
sql/lex.h:
Added INNOBASE database type
sql/mysqld.cc:
Fix for future
sql/sql_yacc.yy:
Added INNOBASE database type
Diffstat (limited to 'client/sql_string.cc')
-rw-r--r-- | client/sql_string.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/client/sql_string.cc b/client/sql_string.cc index 67ce0f6ff54..7ca2d3c419e 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -81,7 +81,8 @@ bool String::realloc(uint32 alloc_length) } else if ((new_ptr= (char*) my_malloc(len,MYF(MY_WME)))) { - memcpy(new_ptr,Ptr,str_length); + if (str_length) // Avoid bugs in memcpy on AIX + memcpy(new_ptr,Ptr,str_length); new_ptr[str_length]=0; Ptr=new_ptr; Alloced_length=len; @@ -221,8 +222,8 @@ bool String::copy(const char *str,uint32 arg_length) { if (alloc(arg_length)) return TRUE; - str_length=arg_length; - memcpy(Ptr,str,arg_length); + if ((str_length=arg_length)) + memcpy(Ptr,str,arg_length); Ptr[arg_length]=0; return FALSE; } @@ -251,17 +252,21 @@ void String::strip_sp() bool String::append(const String &s) { - if (realloc(str_length+s.length())) - return TRUE; - memcpy(Ptr+str_length,s.ptr(),s.length()); - str_length+=s.length(); + if (s.length()) + { + if (realloc(str_length+s.length())) + return TRUE; + memcpy(Ptr+str_length,s.ptr(),s.length()); + str_length+=s.length(); + } return FALSE; } bool String::append(const char *s,uint32 arg_length) { if (!arg_length) // Default argument - arg_length= (uint32) strlen(s); + if (!(arg_length= (uint32) strlen(s))) + return FALSE; if (realloc(str_length+arg_length)) return TRUE; memcpy(Ptr+str_length,s,arg_length); @@ -398,7 +403,8 @@ bool String::replace(uint32 offset,uint32 arg_length,const String &to) { if (diff < 0) { - memcpy(Ptr+offset,to.ptr(),to.length()); + if (to.length()) + memcpy(Ptr+offset,to.ptr(),to.length()); bmove(Ptr+offset+to.length(),Ptr+offset+arg_length, str_length-offset-arg_length); } @@ -411,7 +417,8 @@ bool String::replace(uint32 offset,uint32 arg_length,const String &to) bmove_upp(Ptr+str_length+diff,Ptr+str_length, str_length-offset-arg_length); } - memcpy(Ptr+offset,to.ptr(),to.length()); + if (to.length()) + memcpy(Ptr+offset,to.ptr(),to.length()); } str_length+=(uint32) diff; } @@ -502,8 +509,8 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length) } if (to->realloc(from_length)) return from; // Actually an error - to->str_length=min(from->str_length,from_length); - memcpy(to->Ptr,from->Ptr,to->str_length); + if ((to->str_length=min(from->str_length,from_length))) + memcpy(to->Ptr,from->Ptr,to->str_length); return to; } |