diff options
author | monty@mysql.com/narttu.mysql.fi <> | 2006-12-15 00:51:37 +0200 |
---|---|---|
committer | monty@mysql.com/narttu.mysql.fi <> | 2006-12-15 00:51:37 +0200 |
commit | 88dd873de0d5dc6e8f262268f925596a60b58704 (patch) | |
tree | 142bd488523fec48817d9fb2194f1a608eec00fc /sql/sql_string.cc | |
parent | 601e6f4b2a78921304bc1d779991c615ee229f89 (diff) | |
download | mariadb-git-88dd873de0d5dc6e8f262268f925596a60b58704.tar.gz |
Fixed compiler warnings detected by option -Wshadow and -Wunused:
- Removed not used variables and functions
- Added #ifdef around code that is not used
- Renamed variables and functions to avoid conflicts
- Removed some not used arguments
Fixed some class/struct warnings in ndb
Added define IS_LONGDATA() to simplify code in libmysql.c
I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r-- | sql/sql_string.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 85ff1fddc45..ca90e7b1976 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -618,27 +618,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 @@ -650,8 +649,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; } |