diff options
author | unknown <monty@mysql.com/narttu.mysql.fi> | 2006-12-15 00:51:37 +0200 |
---|---|---|
committer | unknown <monty@mysql.com/narttu.mysql.fi> | 2006-12-15 00:51:37 +0200 |
commit | f00257ddd0a2f392f9b80c9cd5c405017e3a9d63 (patch) | |
tree | 142bd488523fec48817d9fb2194f1a608eec00fc /strings | |
parent | 25226de9ea52d06667c2c7fbd99f5cd014764241 (diff) | |
download | mariadb-git-f00257ddd0a2f392f9b80c9cd5c405017e3a9d63.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
BUILD/SETUP.sh:
Added printing of unused functions and variables.
Made it easy to test compiling with -Wshadow
BUILD/compile-pentium-gcov:
Added warnings
Mark binary with -gcov
client/mysql.cc:
Fixed warnings found with gcc -Wshadow
client/mysql_upgrade.c:
Fixed warnings found with gcc -Wshadow
client/mysqlbinlog.cc:
Fixed warnings found with gcc -Wshadow
client/mysqldump.c:
Fixed warnings found with gcc -Wshadow
client/mysqltest.c:
Fixed warnings found with gcc -Wshadow
client/sql_string.cc:
Fixed warnings found with gcc -Wshadow
Merged with sql/sql_string.cc
client/sql_string.h:
Fixed warnings found with gcc -Wshadow
Merged with sql/sql_string.h
cmd-line-utils/readline/display.c:
Fixed compiler warning
cmd-line-utils/readline/histexpand.c:
Fixed warnings found with gcc -Wshadow
cmd-line-utils/readline/input.c:
Fixed warnings found with gcc -Wshadow
cmd-line-utils/readline/text.c:
Fixed warnings found with gcc -Wshadow
cmd-line-utils/readline/vi_mode.c:
Fixed warnings found with gcc -Wshadow
dbug/dbug_analyze.c:
Fixed warnings found with gcc -Wshadow
extra/my_print_defaults.c:
Prefixed defaults_extra_file and defaults_group_suffix with 'my' to avoid conflicts with similar named local variables
extra/yassl/include/buffer.hpp:
Fixed compiler warnings
extra/yassl/include/crypto_wrapper.hpp:
Fixed compiler warnings
extra/yassl/include/yassl_imp.hpp:
Fixed compiler warnings
extra/yassl/include/yassl_int.hpp:
Fixed compiler warnings
extra/yassl/src/crypto_wrapper.cpp:
Fixed compiler warnings
extra/yassl/taocrypt/benchmark/benchmark.cpp:
Fixed warnings found with gcc -Wshadow
extra/yassl/taocrypt/include/algebra.hpp:
Fixed compiler warnings
extra/yassl/taocrypt/include/des.hpp:
Fixed compiler warnings
extra/yassl/taocrypt/include/hash.hpp:
Fixed compiler warnings
extra/yassl/taocrypt/include/hmac.hpp:
Fixed compiler warnings
extra/yassl/taocrypt/include/modarith.hpp:
Fixed compiler warnings
extra/yassl/taocrypt/include/modes.hpp:
Fixed compiler warnings
extra/yassl/taocrypt/include/rsa.hpp:
Fixed compiler warnings
extra/yassl/taocrypt/mySTL/list.hpp:
Fixed compiler warnings
extra/yassl/taocrypt/src/aes.cpp:
Fixed compiler warnings
extra/yassl/taocrypt/src/algebra.cpp:
Fixed compiler warnings
extra/yassl/taocrypt/src/asn.cpp:
Fixed compiler warnings
extra/yassl/taocrypt/test/test.cpp:
Fixed compiler warnings
extra/yassl/testsuite/testsuite.cpp:
Fixed compiler warnings
include/m_ctype.h:
Fixed warnings found with gcc -Wshadow
include/my_pthread.h:
Fixed warnings found with gcc -Wshadow
include/my_sys.h:
Fixed warnings found with gcc -Wshadow
include/my_time.h:
Fixed warnings found with gcc -Wshadow
include/mysql.h:
Fixed warnings found with gcc -Wshadow
Added define IS_LONGDATA() to simplify code in libmysql.c
libmysql/libmysql.c:
Fixed warnings found with gcc -Wshadow
(Mostly replaced bind -> my_bind and time -> my_time)
libmysqld/lib_sql.cc:
Removed not used variables and labels
myisam/ft_boolean_search.c:
Fixed warnings found with gcc -Wshadow
myisam/mi_open.c:
Fixed warnings found with gcc -Wshadow
myisam/mi_search.c:
Fixed warnings found with gcc -Wshadow
myisam/mi_unique.c:
Fixed compiler warning
myisam/myisampack.c:
Fixed warnings found with gcc -Wshadow
myisam/rt_index.c:
Remove not used variables
myisam/sort.c:
Fixed warnings found with gcc -Wshadow
mysql-test/r/mysqlcheck.result:
Remove databases and tables possible left by previous test
mysql-test/r/mysqltest.result:
New test results
mysql-test/t/mysql.test:
Coverage tests
mysql-test/t/mysqlbinlog.test:
Coverage tests
mysql-test/t/mysqlcheck.test:
Remove databases and tables possible left by previous test
mysql-test/t/mysqltest.test:
Coverage tests
mysys/default.c:
Prefixed defaults_file, defaults_group_suffix and defaults_extra_file with 'my' to avoid conflicts with local variables in some functions
mysys/mf_iocache2.c:
Fixed warnings found with gcc -Wshadow
mysys/mf_keycache.c:
Fixed warnings found with gcc -Wshadow
mysys/my_bitmap.c:
Fixed warnings found with gcc -Wshadow
mysys/sha1.c:
Fixed warnings found with gcc -Wshadow
ndb/include/kernel/signaldata/ArbitSignalData.hpp:
Fixed compiler warning
ndb/include/kernel/signaldata/DictTabInfo.hpp:
Fixed compiler warnings
ndb/include/ndbapi/NdbReceiver.hpp:
Fixed warnings found with gcc -Wshadow
ndb/include/transporter/TransporterDefinitions.hpp:
Fixed compiler warning
ndb/include/util/InputStream.hpp:
Fixed compiler warning
ndb/include/util/OutputStream.hpp:
Fixed compiler warning
ndb/include/util/SimpleProperties.hpp:
Fixed compiler warning
ndb/include/util/SocketAuthenticator.hpp:
Fixed compiler warning
ndb/include/util/SocketServer.hpp:
Fixed compiler warning
ndb/src/common/mgmcommon/ConfigRetriever.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/common/portlib/NdbTick.c:
Fixed warnings found with gcc -Wshadow
ndb/src/common/transporter/SHM_Transporter.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/common/transporter/TCP_Transporter.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/common/transporter/TCP_Transporter.hpp:
Fixed compiler warning
ndb/src/common/transporter/Transporter.cpp:
Removed not used variable
ndb/src/common/transporter/TransporterRegistry.cpp:
Removed not used variable
ndb/src/common/util/Bitmask.cpp:
Moved function to avoid warnings of not used function
ndb/src/common/util/ConfigValues.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/common/util/File.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/common/util/Properties.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/common/util/SocketClient.cpp:
Fixed wrong return value
ndb/src/common/util/random.c:
Fixed warnings found with gcc -Wshadow
ndb/src/common/util/socket_io.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/cw/cpcd/APIService.cpp:
Removed not used variable
ndb/src/cw/cpcd/main.cpp:
Removed not used variables
ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
Fixed compiler warnings
ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Removed not used variables
ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Fixed compiler warnings
ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
Fixed compiler warnings
ndb/src/kernel/blocks/dblqh/Dblqh.hpp:
Fixed compiler warnings
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
Removed not used variables
ndb/src/kernel/blocks/dbtc/Dbtc.hpp:
Fixed compiler warnings
ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
Fixed compiler warnings
ndb/src/kernel/blocks/dbtup/DbtupScan.cpp:
Removed not used variable
ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp:
Removed not used variables
ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp:
Removed not used variables
ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp:
Removed not used variables
ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp:
Fixed compiler warnings
ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp:
Removed not used variables
ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp:
Fixed compiler warnings
ndb/src/kernel/blocks/qmgr/Qmgr.hpp:
Fixed compiler warnings
ndb/src/kernel/blocks/qmgr/QmgrMain.cpp:
Removed not used variables
ndb/src/kernel/blocks/suma/Suma.cpp:
Removed not used variables
ndb/src/kernel/blocks/suma/Suma.hpp:
Fixed compiler warnings
ndb/src/kernel/vm/MetaData.hpp:
Fixed compiler warnings
ndb/src/mgmapi/LocalConfig.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/mgmapi/mgmapi.cpp:
Fixed warnings found with gcc -Wshadow
ndb/src/mgmclient/CommandInterpreter.cpp:
Removed not used variables
ndb/src/mgmsrv/ConfigInfo.cpp:
Fixed warnings found with gcc -Wshadow
Removed not used variables
ndb/src/mgmsrv/ConfigInfo.hpp:
Fixed warnings found with gcc -Wshadow
ndb/src/mgmsrv/InitConfigFileParser.cpp:
Prefixed defaults_file, defaults_group_suffix and defaults_extra_file with 'my' to avoid conflicts with local variables in some functions
ndb/src/mgmsrv/MgmtSrvr.cpp:
Removed not used variables and functions
ndb/src/mgmsrv/MgmtSrvr.hpp:
Fixed compiler warnings
ndb/src/mgmsrv/Services.cpp:
Removed not used variables and functions
ndb/src/mgmsrv/main.cpp:
Removed not used variable
ndb/src/ndbapi/ClusterMgr.hpp:
Fixed compiler warnings
ndb/src/ndbapi/Ndb.cpp:
Removed not used variables
ndb/src/ndbapi/NdbBlob.cpp:
Removed not used variables
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Removed not used variables
ndb/src/ndbapi/NdbIndexOperation.cpp:
Removed not used variables
ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variables
ndb/src/ndbapi/NdbOperationExec.cpp:
Removed not used variables
ndb/src/ndbapi/NdbOperationSearch.cpp:
Removed not used variables
ndb/src/ndbapi/NdbScanFilter.cpp:
Fixed compiler warning
ndb/src/ndbapi/NdbScanOperation.cpp:
Removed not used variables
ndb/src/ndbapi/SignalSender.cpp:
Removed not used variables
ndb/src/ndbapi/ndb_cluster_connection.cpp:
Removed not used variable
ndb/tools/delete_all.cpp:
Removed not used variable
ndb/tools/desc.cpp:
Removed not used variable
ndb/tools/drop_index.cpp:
Removed not used variable
ndb/tools/drop_tab.cpp:
Removed not used variable
ndb/tools/listTables.cpp:
Removed not used variable
ndb/tools/ndb_config.cpp:
Fixed warnings found with gcc -Wshadow
Added missing puts(desc)
ndb/tools/restore/Restore.hpp:
Changed delimiter to define instead of static variable, as the static variable caused a LOT of compiler warnings
Fixed compiler warning
ndb/tools/restore/consumer.hpp:
Fixed compiler warning
ndb/tools/restore/restore_main.cpp:
Fixed compiler warnings
ndb/tools/select_all.cpp:
Removed not used variables
ndb/tools/select_count.cpp:
Removed not used variable
server-tools/instance-manager/commands.h:
Fixed compiler warnings
server-tools/instance-manager/guardian.cc:
Fixed compiler warnings
server-tools/instance-manager/instance_options.cc:
Removed not used variables
server-tools/instance-manager/mysql_connection.cc:
Fixed compiler warnings
server-tools/instance-manager/options.cc:
Fixed compiler warnings
server-tools/instance-manager/options.h:
Fixed compiler warnings
server-tools/instance-manager/parse.cc:
Removed not used variable
server-tools/instance-manager/user_map.cc:
Fixed compiler warnings
server-tools/instance-manager/user_map.h:
Fixed compiler warnings
sql/field.cc:
Fixed compiler warnings
sql/field.h:
Fixed compiler warnings
sql/filesort.cc:
Fixed compiler warnings
sql/ha_archive.cc:
Removed table and share arguments from get_share() / free_share() to get rid of compiler warnings
sql/ha_archive.h:
Removed table and share arguments from get_share() / free_share() to get rid of compiler warnings
sql/ha_federated.cc:
Fixed compiler warnings
sql/ha_heap.cc:
Fixed compiler warnings
sql/ha_myisam.cc:
Fixed compiler warnings
sql/ha_myisammrg.cc:
Fixed compiler warnings
sql/ha_ndbcluster.cc:
Fixed compiler warnings
sql/handler.cc:
Fixed compiler warnings
sql/item.cc:
Fixed compiler warnings
sql/item.h:
Fixed compiler warnings
new_item() -> clone_item(), to avoid a lot of warnings with variable 'new_item'
el() -> element_index()
sql/item_cmpfunc.cc:
Fixed compiler warnings
sql/item_cmpfunc.h:
Fixed compiler warnings
sql/item_func.cc:
Fixed compiler warnings
sql/item_geofunc.cc:
Fixed compiler warnings
sql/item_row.h:
Fixed compiler warnings
sql/item_strfunc.cc:
Fixed compiler warnings
sql/item_subselect.cc:
Fixed compiler warnings
sql/item_subselect.h:
Fixed compiler warnings
sql/item_sum.cc:
Fixed compiler warnings
sql/item_timefunc.cc:
Fixed compiler warnings
sql/log.cc:
Fixed compiler warnings
More comments
Added #ifdef HAVE_REPLICATION
sql/log_event.cc:
Fixed compiler warnings
sql/log_event.h:
Fixed compiler warnings
sql/mysql_priv.h:
query_id -> global_query_id, to avoid a lot of clashes with function and class variables
start_time -> server_start_time
sql/mysqld.cc:
Fixed compiler warnings:
- Removed not used variables
- Added #ifndef EMBEDDED_LIBRARY
- Fixed shadow warnings
sql/net_serv.cc:
Fixed compiler warnings
sql/opt_range.cc:
range -> last_range to avoid shadow warnings
Removed not used function print_rowid()
sql/opt_range.h:
range -> last_range to avoid shadow warnings
sql/password.c:
Fixed compiler warnings
sql/protocol.cc:
Fixed compiler warnings
sql/repl_failsafe.cc:
Fixed compiler warnings
sql/set_var.cc:
Fixed compiler warnings
sql/set_var.h:
type() -> show_type()
Fixed compiler warnings
sql/slave.cc:
Fixed compiler warnings
sql/sp_head.cc:
Fixed compiler warnings
sql/sp_head.h:
Fixed compiler warnings
sql/spatial.cc:
Fixed compiler warnings
sql/spatial.h:
length() -> geom_length() to avoid compiler warnings
wkb_end -> wkb_last to avoid compiler warnings with local variables named 'wkb_end'
sql/sql_cache.h:
Fixed compiler warnings
sql/sql_class.cc:
Fixed compiler warnings
sql/sql_class.h:
log -> log_xid() to avoid compiler warnings
Fixed shadow compiler warnings
sql/sql_derived.cc:
Removed not used variable
sql/sql_insert.cc:
Fixed compiler warnings
sql/sql_lex.cc:
Fixed compiler warnings
sql/sql_lex.h:
res -> saved_error to make the meaning of the variable clear and avoid shadow warnings
sql/sql_load.cc:
Fixed compiler warnings
sql/sql_parse.cc:
Fixed compiler warnings
sql/sql_prepare.cc:
Fixed compiler warnings
sql/sql_select.cc:
Fixed compiler warnings
sql/sql_show.cc:
Fixed compiler warnings
sql/sql_string.cc:
Fixed compiler warnings
sql/sql_string.h:
Fixed compiler warnings
sql/sql_table.cc:
Fixed compiler warnings
sql/sql_trigger.cc:
Fixed compiler warnings
sql/sql_trigger.h:
table -> trigger_table to avoid warnings from local variables
sql/sql_union.cc:
Fixed compiler warnings
(mainly res -> saved_error)
sql-common/client.c:
Removed not used variable
sql-common/my_time.c:
Removed not used variable
time -> my_time
sql/sql_update.cc:
Removed not used variable
sql/sql_view.cc:
Removed not used variable
sql/sql_yacc.yy:
Removed not used variable
sql/table.cc:
Removed not used variable
sql/tztime.cc:
Removed not used variable
sql/unireg.cc:
Removed not used variable
strings/ctype-bin.c:
mblen -> mb_len to avoid compiler warnings with local variable mblen
strings/ctype-cp932.c:
Fixed compiler warnings
strings/ctype-eucjpms.c:
Fixed compiler warnings
strings/ctype-mb.c:
mblen -> mb_len to avoid compiler warnings with local variable mblen
strings/ctype-simple.c:
mblen -> mb_len to avoid compiler warnings with local variable mblen
exp -> exponent
strings/ctype-sjis.c:
Fixed compiler warnings
strings/ctype-uca.c:
mblen -> mb_len to avoid compiler warnings with local variable mblen
strings/ctype-ujis.c:
Fixed compiler warnings
strings/ctype-utf8.c:
Fixed compiler warnings
strings/decimal.c:
Fixed compiler warnings
strings/my_vsnprintf.c:
Added comment
strings/strtod.c:
Fixed compiler warnings
tests/mysql_client_test.c:
Fixed compiler warnings
(Biggest part of patch is to not get a conflict with global function 'bind')
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-bin.c | 6 | ||||
-rw-r--r-- | strings/ctype-cp932.c | 4 | ||||
-rw-r--r-- | strings/ctype-eucjpms.c | 4 | ||||
-rw-r--r-- | strings/ctype-mb.c | 64 | ||||
-rw-r--r-- | strings/ctype-simple.c | 14 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 4 | ||||
-rw-r--r-- | strings/ctype-uca.c | 26 | ||||
-rw-r--r-- | strings/ctype-ujis.c | 4 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 4 | ||||
-rw-r--r-- | strings/decimal.c | 27 | ||||
-rw-r--r-- | strings/my_vsnprintf.c | 7 | ||||
-rw-r--r-- | strings/strtod.c | 27 |
12 files changed, 100 insertions, 91 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 3e8b05580f6..83e71ea47a7 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -415,7 +415,7 @@ uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)), { match->beg= 0; match->end= 0; - match->mblen= 0; + match->mb_len= 0; } return 1; /* Empty string is always found */ } @@ -443,13 +443,13 @@ skip: { match[0].beg= 0; match[0].end= (uint) (str- (const uchar*)b-1); - match[0].mblen= match[0].end; + match[0].mb_len= match[0].end; if (nmatch > 1) { match[1].beg= match[0].end; match[1].end= match[0].end+s_length; - match[1].mblen= match[1].end-match[1].beg; + match[1].mb_len= match[1].end-match[1].beg; } } return 2; diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index b4e9ba16d92..25025ceaa26 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -5380,11 +5380,11 @@ my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)), static uint my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *strend) + const char *str, const char *str_end) { uint clen= 0; const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) strend; + const unsigned char *e= (const unsigned char *) str_end; for (clen= 0; b < e; ) { diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index 65fef2dfc4c..06b0bdc70eb 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -8435,11 +8435,11 @@ uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), static uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *strend) + const char *str, const char *str_end) { uint clen= 0; const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) strend; + const unsigned char *e= (const unsigned char *) str_end; for (clen= 0; b < e; ) { diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 3ef245015d7..01defaed0c7 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -186,7 +186,7 @@ int my_wildcmp_mb(CHARSET_INFO *cs, { /* Found w_many */ uchar cmp; const char* mb = wildstr; - int mblen=0; + int mb_len=0; wildstr++; /* Remove any '%' and '_' from the wild search string */ @@ -212,7 +212,7 @@ int my_wildcmp_mb(CHARSET_INFO *cs, cmp= *++wildstr; mb=wildstr; - mblen= my_ismbchar(cs, wildstr, wildend); + mb_len= my_ismbchar(cs, wildstr, wildend); INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */ cmp=likeconv(cs,cmp); do @@ -221,11 +221,11 @@ int my_wildcmp_mb(CHARSET_INFO *cs, { if (str >= str_end) return -1; - if (mblen) + if (mb_len) { - if (str+mblen <= str_end && memcmp(str, mb, mblen) == 0) + if (str+mb_len <= str_end && memcmp(str, mb, mb_len) == 0) { - str += mblen; + str += mb_len; break; } } @@ -257,8 +257,8 @@ uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), register uint32 count=0; while (pos < end) { - uint mblen; - pos+= (mblen= my_ismbchar(cs,pos,end)) ? mblen : 1; + uint mb_len; + pos+= (mb_len= my_ismbchar(cs,pos,end)) ? mb_len : 1; count++; } return count; @@ -272,8 +272,8 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), while (length && pos < end) { - uint mblen; - pos+= (mblen= my_ismbchar(cs, pos, end)) ? mblen : 1; + uint mb_len; + pos+= (mb_len= my_ismbchar(cs, pos, end)) ? mb_len : 1; length--; } return (uint) (length ? end+2-start : pos-start); @@ -288,14 +288,14 @@ uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, while (pos) { my_wc_t wc; - int mblen; + int mb_len; - if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) + if ((mb_len= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) { *error= b < e ? 1 : 0; break; } - b+= mblen; + b+= mb_len; pos--; } return (uint) (b - b_start); @@ -319,7 +319,7 @@ uint my_instr_mb(CHARSET_INFO *cs, { match->beg= 0; match->end= 0; - match->mblen= 0; + match->mb_len= 0; } return 1; /* Empty string is always found */ } @@ -329,7 +329,7 @@ uint my_instr_mb(CHARSET_INFO *cs, while (b < end) { - int mblen; + int mb_len; if (!cs->coll->strnncoll(cs, (unsigned char*) b, s_length, (unsigned char*) s, s_length, 0)) @@ -338,19 +338,19 @@ uint my_instr_mb(CHARSET_INFO *cs, { match[0].beg= 0; match[0].end= (uint) (b-b0); - match[0].mblen= res; + match[0].mb_len= res; if (nmatch > 1) { match[1].beg= match[0].end; match[1].end= match[0].end+s_length; - match[1].mblen= 0; /* Not computed */ + match[1].mb_len= 0; /* Not computed */ } } return 2; } - mblen= (mblen= my_ismbchar(cs, b, end)) ? mblen : 1; - b+= mblen; - b_length-= mblen; + mb_len= (mb_len= my_ismbchar(cs, b, end)) ? mb_len : 1; + b+= mb_len; + b_length-= mb_len; res++; } } @@ -551,7 +551,7 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, char *min_str,char *max_str, uint *min_length,uint *max_length) { - uint mblen; + uint mb_len; const char *end= ptr + ptr_length; char *min_org= min_str; char *min_end= min_str + res_length; @@ -588,11 +588,11 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, pad_max_char(cs, max_str, max_end); return 0; } - if ((mblen= my_ismbchar(cs, ptr, end)) > 1) + if ((mb_len= my_ismbchar(cs, ptr, end)) > 1) { - if (ptr+mblen > end || min_str+mblen > min_end) + if (ptr+mb_len > end || min_str+mb_len > min_end) break; - while (mblen--) + while (mb_len--) *min_str++= *max_str++= *ptr++; } else @@ -650,7 +650,7 @@ static int my_wildcmp_mb_bin(CHARSET_INFO *cs, { /* Found w_many */ uchar cmp; const char* mb = wildstr; - int mblen=0; + int mb_len=0; wildstr++; /* Remove any '%' and '_' from the wild search string */ @@ -676,7 +676,7 @@ static int my_wildcmp_mb_bin(CHARSET_INFO *cs, cmp= *++wildstr; mb=wildstr; - mblen= my_ismbchar(cs, wildstr, wildend); + mb_len= my_ismbchar(cs, wildstr, wildend); INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */ do { @@ -684,11 +684,11 @@ static int my_wildcmp_mb_bin(CHARSET_INFO *cs, { if (str >= str_end) return -1; - if (mblen) + if (mb_len) { - if (str+mblen <= str_end && memcmp(str, mb, mblen) == 0) + if (str+mb_len <= str_end && memcmp(str, mb, mb_len) == 0) { - str += mblen; + str += mb_len; break; } } @@ -927,15 +927,15 @@ uint my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) while (b < e) { - int mblen; + int mb_len; uint pg; - if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) + if ((mb_len= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) { - mblen= 1; /* Let's think a wrong sequence takes 1 dysplay cell */ + mb_len= 1; /* Let's think a wrong sequence takes 1 dysplay cell */ b++; continue; } - b+= mblen; + b+= mb_len; pg= (wc >> 8) & 0xFF; clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page; clen++; diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index fc9cbfc9d21..eb8f2b41be4 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -1174,7 +1174,7 @@ uint my_instr_simple(CHARSET_INFO *cs, { match->beg= 0; match->end= 0; - match->mblen= 0; + match->mb_len= 0; } return 1; /* Empty string is always found */ } @@ -1202,13 +1202,13 @@ skip: { match[0].beg= 0; match[0].end= (uint) (str- (const uchar*)b-1); - match[0].mblen= match[0].end; + match[0].mb_len= match[0].end; if (nmatch > 1) { match[1].beg= match[0].end; match[1].end= match[0].end+s_length; - match[1].mblen= match[1].end-match[1].beg; + match[1].mb_len= match[1].end-match[1].beg; } } return 2; @@ -1586,19 +1586,19 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */ str++; if (str < end) { - int negative_exp, exp; + int negative_exp, exponent; if ((negative_exp= (*str == '-')) || *str=='+') { if (++str == end) goto ret_sign; } - for (exp= 0 ; + for (exponent= 0 ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++) { - exp= exp * 10 + ch; + exponent= exponent * 10 + ch; } - shift+= negative_exp ? -exp : exp; + shift+= negative_exp ? -exponent : exponent; } } diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 3854837e09a..e27201eccbf 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4555,11 +4555,11 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), static uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *strend) + const char *str, const char *str_end) { uint clen= 0; const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) strend; + const unsigned char *e= (const unsigned char *) str_end; for (clen= 0; b < e; ) { diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index b18e5ee59d2..a51f358965a 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -6929,23 +6929,23 @@ static int my_uca_scanner_next_any(my_uca_scanner *scanner) uint16 **ucaw= scanner->uca_weight; uchar *ucal= scanner->uca_length; my_wc_t wc; - int mblen; + int mb_len; - if (((mblen= scanner->cs->cset->mb_wc(scanner->cs, &wc, + if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc, scanner->sbeg, scanner->send)) <= 0)) return -1; scanner->page= wc >> 8; scanner->code= wc & 0xFF; - scanner->sbeg+= mblen; + scanner->sbeg+= mb_len; if (scanner->contractions && !scanner->page && (scanner->code > 0x40) && (scanner->code < 0x80)) { uint page1, code1, cweight; - if (((mblen= scanner->cs->cset->mb_wc(scanner->cs, &wc, + if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc, scanner->sbeg, scanner->send)) >=0) && (!(page1= (wc >> 8))) && @@ -6955,7 +6955,7 @@ static int my_uca_scanner_next_any(my_uca_scanner *scanner) { scanner->implicit[0]= 0; scanner->wbeg= scanner->implicit; - scanner->sbeg+= mblen; + scanner->sbeg+= mb_len; return cweight; } } @@ -7314,8 +7314,8 @@ int my_wildcmp_uca(CHARSET_INFO *cs, int result= -1; /* Not found, using wildcards */ my_wc_t s_wc, w_wc; int scan; - int (*mb_wc)(struct charset_info_st *cs, my_wc_t *wc, - const unsigned char *s,const unsigned char *e); + int (*mb_wc)(struct charset_info_st *, my_wc_t *, + const unsigned char *, const unsigned char *); mb_wc= cs->cset->mb_wc; while (wildstr != wildend) @@ -7508,7 +7508,7 @@ typedef struct my_coll_lexem_st my_coll_lexem_init lexem Lex analizer to init str Const string to parse - strend End of the string + str_end End of the string USAGE RETURN VALUES @@ -7516,11 +7516,11 @@ typedef struct my_coll_lexem_st */ static void my_coll_lexem_init(MY_COLL_LEXEM *lexem, - const char *str, const char *strend) + const char *str, const char *str_end) { lexem->beg= str; lexem->prev= str; - lexem->end= strend; + lexem->end= str_end; lexem->diff= 0; lexem->code= 0; } @@ -7677,7 +7677,7 @@ typedef struct my_coll_rule_item_st my_coll_rule_parse rule Collation rule list to load to. str A string containin collation language expression. - strend End of the string. + str_end End of the string. USAGE RETURN VALUES @@ -7686,7 +7686,7 @@ typedef struct my_coll_rule_item_st */ static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems, - const char *str, const char *strend, + const char *str, const char *str_end, char *errstr, size_t errsize) { MY_COLL_LEXEM lexem; @@ -7699,7 +7699,7 @@ static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems, /* Init all variables */ errstr[0]= '\0'; bzero(&item, sizeof(item)); - my_coll_lexem_init(&lexem, str, strend); + my_coll_lexem_init(&lexem, str, str_end); while ((lexnum= my_coll_lexem_next(&lexem))) { diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 675ac918e2c..06a9358da35 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8303,11 +8303,11 @@ uint my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), static uint my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), - const char *str, const char *strend) + const char *str, const char *str_end) { uint clen= 0; const unsigned char *b= (const unsigned char *) str; - const unsigned char *e= (const unsigned char *) strend; + const unsigned char *e= (const unsigned char *) str_end; for (clen= 0; b < e; ) { diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index a21fe4961ec..7fa2eb2d960 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1719,8 +1719,8 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, int result= -1; /* Not found, using wildcards */ my_wc_t s_wc, w_wc; int scan, plane; - int (*mb_wc)(struct charset_info_st *cs, my_wc_t *wc, - const unsigned char *s,const unsigned char *e); + int (*mb_wc)(struct charset_info_st *, my_wc_t *, + const unsigned char *, const unsigned char *); mb_wc= cs->cset->mb_wc; while (wildstr != wildend) diff --git a/strings/decimal.c b/strings/decimal.c index 6b7a2266194..2c0efc8ec92 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -371,16 +371,16 @@ int decimal2string(decimal_t *from, char *to, int *to_len, } else if (unlikely(len > --*to_len)) /* reserve one byte for \0 */ { - int i=len-*to_len; - error= (frac && i <= frac + 1) ? E_DEC_TRUNCATED : E_DEC_OVERFLOW; - if (frac && i >= frac + 1) i--; - if (i > frac) + int j= len-*to_len; + error= (frac && j <= frac + 1) ? E_DEC_TRUNCATED : E_DEC_OVERFLOW; + if (frac && j >= frac + 1) j--; + if (j > frac) { - intg-= i-frac; + intg-= j-frac; frac= 0; } else - frac-=i; + frac-=j; len= from->sign + intg_len + test(frac) + frac_len; } *to_len=len; @@ -900,7 +900,8 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed) if (endp+1 < end_of_string && (*endp == 'e' || *endp == 'E')) { int str_error; - longlong exp= my_strtoll10(endp+1, (char**) &end_of_string, &str_error); + longlong exponent= my_strtoll10(endp+1, (char**) &end_of_string, + &str_error); if (end_of_string != endp +1) /* If at least one digit */ { @@ -910,18 +911,18 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed) error= E_DEC_BAD_NUM; goto fatal_error; } - if (exp > INT_MAX/2 || (str_error == 0 && exp < 0)) + if (exponent > INT_MAX/2 || (str_error == 0 && exponent < 0)) { error= E_DEC_OVERFLOW; goto fatal_error; } - if (exp < INT_MIN/2 && error != E_DEC_OVERFLOW) + if (exponent < INT_MIN/2 && error != E_DEC_OVERFLOW) { error= E_DEC_TRUNCATED; goto fatal_error; } if (error != E_DEC_OVERFLOW) - error= decimal_shift(to, (int) exp); + error= decimal_shift(to, (int) exponent); } } return error; @@ -2063,7 +2064,7 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, { int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1, frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2, - error, i, intg0, frac0, len1, len2, dintg, div=(!mod); + error, i, intg0, frac0, len1, len2, dintg, div_mod=(!mod); dec1 *buf0, *buf1=from1->buf, *buf2=from2->buf, *tmp1, *start2, *stop2, *stop1, *stop0, norm2, carry, *start1, dcarry; dec2 norm_factor, x, guess, y; @@ -2146,7 +2147,7 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, } buf0=to->buf; stop0=buf0+intg0+frac0; - if (likely(div)) + if (likely(div_mod)) while (dintg++ < 0) *buf0++=0; @@ -2237,7 +2238,7 @@ static int do_div_mod(decimal_t *from1, decimal_t *from2, } } } - if (likely(div)) + if (likely(div_mod)) *buf0=(dec1)guess; dcarry= *start1; start1++; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index e4302f50c58..2635a0461b0 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -22,6 +22,13 @@ /* Limited snprintf() implementations + SYNOPSIS + my_vsnprintf() + to Store result here + n Store up to n-1 characters, followed by an end 0 + fmt printf format + ap Arguments + IMPLEMENTION: Supports following formats: %#[l]d diff --git a/strings/strtod.c b/strings/strtod.c index ddb570718a0..f651959d4ee 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -58,7 +58,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) { double result= 0.0; uint negative= 0, ndigits, dec_digits= 0, neg_exp= 0; - int exp= 0, digits_after_dec_point= 0, tmp_exp; + int exponent= 0, digits_after_dec_point= 0, tmp_exp; const char *old_str, *end= *end_ptr, *start_of_number; char next_char; my_bool overflow=0; @@ -131,24 +131,25 @@ double my_strtod(const char *str, char **end_ptr, int *error) if ((next_char == 'e' || next_char == 'E') && dec_digits + ndigits != 0 && str < end-1) { - const char *old_str= str++; + const char *old_str2= str++; if ((neg_exp= (*str == '-')) || *str == '+') str++; if (str == end || !my_isdigit(&my_charset_latin1, *str)) - str= old_str; + str= old_str2; else { do { - if (exp < 9999) /* prot. against exp overfl. */ - exp= exp*10 + (*str - '0'); + if (exponent < 9999) /* prot. against exp overfl. */ + exponent= exponent*10 + (*str - '0'); str++; } while (str < end && my_isdigit(&my_charset_latin1, *str)); } } - tmp_exp= neg_exp ? exp + digits_after_dec_point : exp - digits_after_dec_point; + tmp_exp= (neg_exp ? exponent + digits_after_dec_point : + exponent - digits_after_dec_point); if (tmp_exp) { int order; @@ -158,7 +159,7 @@ double my_strtod(const char *str, char **end_ptr, int *error) where f is the resulting floating point number and 1 <= C < 10. Here we compute the modulus */ - order= exp + (neg_exp ? -1 : 1) * (ndigits - 1); + order= exponent + (neg_exp ? -1 : 1) * (ndigits - 1); if (order < 0) order= -order; if (order >= MAX_DBL_EXP && result) @@ -184,18 +185,18 @@ double my_strtod(const char *str, char **end_ptr, int *error) } } - exp= tmp_exp; - if (exp < 0) + exponent= tmp_exp; + if (exponent < 0) { - exp= -exp; + exponent= -exponent; neg_exp= 1; /* neg_exp was 0 before */ } - while (exp >= 100) + while (exponent >= 100) { result= neg_exp ? result/1.0e100 : result*1.0e100; - exp-= 100; + exponent-= 100; } - scaler= scaler10[exp/10]*scaler1[exp%10]; + scaler= scaler10[exponent/10]*scaler1[exponent%10]; if (neg_exp) result/= scaler; else |