developers
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
November 2009
- 22 participants
- 180 discussions
Hi!
I have been removing warnings (found by buildbot) from the MariaDB 5.1 tree.
(Will be pushed later today).
Here is some comments, suggestions of what we still to do to make the
buildbot part 'more clean:
------
We get a lot of warnings of the type:
ctype-ucs2.c:206: warning: ‘s_wc’ may be used uninitialized in this function
This are false warnings (The compiler is not smart enough to figure
this out). The variables are also protected with the LINT_INIT() macro.
Suggestion (for Kristian):
- If you compile with -Wuninitialized, also use the -DFORCE_INIT_OF_VARS
When compiling for valgrind, we should not use
-Wuninitialized or -DFORCE_INIT_OF_VARS
-------
For Percona:
We get the following warnings from xtradb:
../../storage/xtradb/include/dict0dict.ic:729: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../storage/xtradb/include/dict0dict.ic:788: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../storage/xtradb/include/dict0dict.ic:729: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../storage/xtradb/include/dict0dict.ic:788: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../include/../storage/xtradb/include/dict0dict.ic:729: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
../../include/../storage/xtradb/include/dict0dict.ic:788: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
Can you fix these ?
----------
I don't know if the following warning comes from us or from the
include files:
/usr/include/bits/string3.h:82: warning: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters
Need suggestions/help to solve this one.
Either we need to find the code in MariaDB that generates the warning
or disable warnings in buildbot from /usr/include
---------
Regards,
Monty
2
1
Hi!
I noticed that although 5.1.39 release is done and published, it's not on
launchpad: when one goes to https://launchpad.net/maria/, one
- sees 5.1.38 binaries offered for download on the right of the page
- "Series and milestones" chart doesn't list either 5.1.38 or 5.1.39.
This may cause some confusion. Is there any reason that we don't put releases
on Launchpad?
BR
Sergey
--
Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog
5
6
Bo suggested me to publish my last WL#40 status report on the dev list.
Meaning to get a feedback (critical notes, tips, suggestions, etc) I
rewrote the report to make it more readable and included some thoughts
for discussion.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WL40. Add a mysqlbinlog option to filter updates to certain tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Selected option : "2.5 Extend Query Events With Tables Info".
1. Extending Query Events With Tables Info
2. Example of the Extended Query Event Binary Format
3. Adding binlog-with-tables-info Option
4. How Tables Info is Formed
4.1. CREATE TABLE statement
4.2. RENAME TABLE Statement
5. TODO: Is Tables Info Enough?
6. TODO: How Renames are to be filtered?
7. Other TODO's
1. Extending Query Events With Tables Info
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reason: to do filtering based on "*-table" options we need to have a
list of all tables refered to by the query described by Query event.
The Query event binary format is extended with a tables info, i.e. the list of
tables involved in the query execution. More precisely, two following fields are
added to the Query event header:
* Query length (2 bytes). (Reason: in usual format, Query event doesn't include
this field because the query is considered to extent to the end of the event
what is not the case for the extended format).
* Tables info length (2 bytes). Length of tables info contained in the data
part of the event.
and the following data is added to the Query event data part:
* Tables info (tables_info_len bytes). List of 4-tuples
(db_len, db, table_name_len, table_name) for each table involved in the
execution of the query described by this event.
db_len may be zero meaning that this is the default db.
Note. In the extended format the default db is written without trailing zero
which is redundant since its length is already known from the event header.
2. Example of the Extended Query Event Binary Format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
************************
QUERY_EVENT [2]
************************
00000294 | 2F A1 00 4B | time_when = 1258332463
00000298 | 02 | event_type = 2
00000299 | 64 00 00 00 | server_id = 100
0000029D | 75 00 00 00 | event_len = 117
000002A1 | 09 03 00 00 | log_pos = 00000309
000002A5 | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
000002A7 | 01 00 00 00 | proxy_id = 1
000002AB | C9 00 00 00 | exec_time = 201
000002AF | 04 | dbase_len = 4
000002B0 | 00 00 | error_code = 0
000002B2 | 1A 00 | status_vars_len = 26
000002B4 | 2B 00 | query_len = 43 (*)
000002B6 | 08 00 | tables_info_len = 8 (*)
------------------------
Status Variables
------------------------
000002B8 | 00 | FLAGS2:
000002B9 | 00 40 00 00 | 0x00004000
000002BD | 01 | SQL_MODE:
000002BE | 00 00 00 00 | 0x0000000000000000
000002C2 | 00 00 00 00 |
000002C6 | 06 | CATALOG_NZ:
000002C7 | 03 | catalog_len = 3
000002C8 | 73 74 64 | catalog = "std"
000002CB | 04 | CHARSET_CODE:
000002CC | 08 00 | charset_client = 8
000002CE | 08 00 | collation_connect = 8
000002D0 | 08 00 | collation_server = 8
------------------------
000002D2 | 74 65 73 74 | dbase = "test" (**)
000002D6 | 52 45 4E 41 | query = "RENAME TABLE t1 TO tmp, t2 TO t1, tmp TO t2"
000002DA | 4D 45 20 54 |
000002DE | 41 42 4C 45 |
000002E2 | 20 74 31 20 |
000002E6 | 54 4F 20 74 |
000002EA | 6D 70 2C 20 |
000002EE | 74 32 20 54 |
000002F2 | 4F 20 74 31 |
000002F6 | 2C 20 74 6D |
000002FA | 70 20 54 4F |
000002FE | 20 74 32 |
------------------------
Tables info (*)
------------------------
00000301 | 00 | dbase_len = 0 (***)
00000302 | 02 | table_len = 2
00000303 | 74 31 | table_str = "t1"
00000305 | 00 | dbase_len = 0 (***)
00000306 | 02 | table_len = 2
00000307 | 74 32 | table_str = "t2"
************************
(*) - Added to the new Query event binary format.
(**) - Modified: in the new Query event binary format database name does
not contain trailing zero.
(***) - Database length = 0 means that it is the default database.
3. Adding binlog-with-tables-info Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New --binlog-with-tables-info option is added. When set, all Query events are
to be written to the extended format (with tables info). Reasons for adding
the option:
* Adding tables info leads binary log to grow in size what is superfluous
if filtering within mysqlbinlog is not supposed to be used.
* If the current implementation of the extended format will appear to have
bugs switching off this option will guarantee that replication will work
as before that.
The option is defined as GLOBAL and read-only. Reason:
* The Query events format used in the binary log can be recognized only
by its length contained in the Format description event at the beginning
of the binary log. Because of that, two different Query event formats
can not be mixed within one binary log.
4. How Tables Info is Formed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Forming tables info for some types of statement is not quite straightforward.
Below is two examples of those "not-straightforward" cases.
4.1. CREATE TABLE statement
~~~~~~~~~~~~~~~~~~~~~~~~~~~
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] t (...)
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] t LIKE t1
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] t SELECT (t1, ..., tn)
Implementation of forming tables info in this case is based on the following
rules of binlogging CREATE TABLE statements:
SBR. The original CREATE TABLE statement is always binlogged as is.
In this case
tables_info = { t }, { t, t1 }, or { t, t1, ..., tn }
respectively.
RBR. In case of RBR we have the following specifics of binlogging CREATE
TABLE statement:
* temporary tables are not binlogged;
* CREATE TABLE t LIKE t1 with temporary t1 is transformed to the
ordinary CREATE TABLE (...);
* CREATE TABLE SELECT is always transformed to the ordinary
CREATE TABLE (...) (with possible subsequent INSERT statements).
So for RBR tables info is formed as follows:
IF t is temporary
// the statement will not be binlogged
tables_info = empty
IF CREATE TABLE t (...)
// the statement will be binlogged as is
tables_ info = {t}
IF CREATE TABLE t LIKE t1
IF t1 is temporary
// the statement will be binlogged as CREATE TABLE t (...)
tables_info = {t}
ELSE
// the statement will be binlogged as is
tables_info = {t, t1}
IF CREATE TABLE t SELECT (t1, ..., tn)
// the statement will be binlogged as CREATE TABLE (...)
tables_info = {t}
Note. In case of RBR, CREATE TABLE SELECT is binlogged as the following
sequence of events:
BEGIN: Query event
CREATE TABLE: Query event
INSERT's: Write row events
COMMIT Query event
BEGIN and COMMIT in this case are supplied with the same tables_info = {t}
as the CREATE TABLE statement. Also INSERT's are preceded by the Table map
event refering to the same table t. So filtering of all this events
(including BEGIN and COMMIT) will be based on the same tables info and
either all of them will pass the filter or all of them will be filtered out.
4.2. RENAME TABLE Statement
~~~~~~~~~~~~~~~~~~~~~~~~~~~
RENAME TABLE tl TO s1, ..., tn TO sn
For this type of statements tables info is formed, roughly speaking, of tables
standing left to "TO", i.e. t1, ..., tn. But including all t1, ..., tn is not
always correct. Consider renaming t1 <-> t2:
RENAME TABLE t1 TO tmp, t2 TO t1, tmp TO t2
Setting tables_info = ( t1, t2, tmp } is not good: mysqlbinlog being executed
with do-tables = { t1, t2 } will filter this statement away because tmp does
not belong to do-tables. So before adding ti to the tables_info we have to
check that ti != sj for all j < i. See tables_info in the example of Section 2.
5. TODO: Is Tables Info Enough?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assume we run mysqlbinlog with ignore_tables = { t1 } for the following
sequence of statements:
(1) CREATE TABLE t1 (...);
...
(2) CREATE TABLE t2 LIKE t1;
...
(3) INSERT INTO t2 VALUES ...;
...
In this case:
(1) will be filtered away - directly stated by the ignore rules;
(2) will be filtered away - can not be executed because refers to t1
(3) will be left - though can not be executed
It is not good to have erroneous statements in mysqlbinlog output.
We can overcome this in two ways:
1. To explain to the user that in those cases, to avoid erroneous
statements, he/she should add t2 to the ignore_tables list as well.
2. To make the filtering bit clever. E.g., additionally to tables info,
we may extend the Query event format with a Statement type field
(BTW, see also WL#41 "Add a mysqlbinlog option to filter certain kinds
of statements"). In this case, when filtering, if we reject a "CREATE
TABLE t ..." statement because its LIKE or SELECT part refers to an
ignored table, we add table t to the ignore_tables list ourself.
6. TODO: How Renames are to be filtered?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the RENAME TABLE statement. If we have do_tables = { t } and
t is renamed to s:
(1) RENAME TABLE t TO s;
<smth for s>
what the filter should do? Should we consider t and s to be the same
table with different names so that <smth for s> is not to be filtered
away (in this case during filtering process we should add s to the
do_tables list - like we do it in the case of CREATE TABLE)? Or should
we treat do- ignore-table rules as talking about *table names* so that
--do-table=t means "do only table with name t" - then we filter
<smth for s> away because it refers to the table with another name s?
Note that in the last case if we rename s back to t:
(2) RENAME TABLE s TO t;
<smth for t>
the RENAME statement will be filtered away (it renames a table which
does not belong to the do_tables list) while <smth for t> will pass
the filter and its subsequent execution will result with error (we
can resolve this by creating a rename_list during the filtering process
to trace all renamings specified by the processed events - similar
to what is described in Section 4.2).
Note. With the second treatment of renaming, we can do the following
(looks like attractive but not sure is usefull :)
<smth for t>
RENAME TABLE t TO s
<smth for s that can be filtered away>
RENAME TABLE s TO t
<smth for t>
7. Other TODO's
~~~~~~~~~~~~~~~
* Continue with forming tables_info for different types of query.
* Filtering algorithm and *-table options for mysqlbinlog.
Should it be "clever" or "stupid" (see Sections 5 & 6) ?
* Add Statement type field to the Query event format (?)
Needed for "clever' filtering and for WL#41
* Other stuff (testing, documenting, etc)
2
1
01 Dec '09
Hi all,
after reviewing some MariaDB related bugs on bugs.launchpad.net/maria
it occurred to me, that there is no link between the bug state "Fix
Committed"
and the corresponding patch, which fixed the issue.
Is there a way to link a bzr patch/push to a launchpad bug report?
If not, where can I do a feature request about it?
Best regards,
Hakan
--
Hakan Küçükyılmaz, QA/Benchmark Engineer, Stuttgart/Germany
Monty Program Ab, http://askmonty.org/
Skype: hakank_ Phone: +49 171 1919839
5
5
Wouldn't it be nice to run .sql -scripts just like:
mysql> @script.sql
I have found many Oracle/MySQL dbas have a tendency to use '@' to run a script.
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2770)
by Michael Widenius 30 Nov '09
by Michael Widenius 30 Nov '09
30 Nov '09
#At lp:maria based on revid:monty@askmonty.org-20091126201933-dgoynszp2z90gknl
2770 Michael Widenius 2009-11-30
Remove compiler warnings (Including some warnings from -Wstrict-aliasing)
Don't use static link by default (in compile-pentium) as some new systems doesn't have all static libraries available
Change type for functions in plugin.h:str_mysql_ftparser_param() to const unsigned char and string lengths to size_t.
One effect of the above change is that one needs to include mysql_global.h or define size_t before including plugin.h
This fixes a case where mysql_client_test failed with newer gcc that enables strict-aliasing by default
modified:
BUILD/compile-pentium
client/mysql_upgrade.c
cmd-line-utils/readline/config_readline.h
cmd-line-utils/readline/display.c
cmd-line-utils/readline/history.c
cmd-line-utils/readline/rlmbutil.h
cmd-line-utils/readline/text.c
cmd-line-utils/readline/xmalloc.c
configure.in
include/mysql/plugin.h
include/mysql/plugin.h.pp
libmysql/libmysql.c
mysql-test/t/information_schema.test
mysql-test/t/not_partition.test
mysys/lf_hash.c
mysys/my_redel.c
regex/engine.c
regex/engine.ih
sql/sp_head.cc
sql/sql_base.cc
sql/sql_builtin.cc.in
sql/sql_parse.cc
sql/sql_select.cc
sql/sql_show.cc
sql/table.cc
storage/maria/ha_maria.cc
storage/maria/lockman.c
storage/maria/ma_check.c
storage/maria/ma_check_standalone.h
storage/maria/ma_ft_boolean_search.c
storage/maria/ma_ft_nlq_search.c
storage/maria/ma_ft_parser.c
storage/maria/ma_ftdefs.h
storage/maria/ma_sort.c
storage/maria/ma_state.c
storage/maria/maria_def.h
storage/maria/maria_ftdump.c
storage/maria/trnman.c
storage/myisam/ft_boolean_search.c
storage/myisam/ft_nlq_search.c
storage/myisam/ft_parser.c
storage/myisam/ft_stopwords.c
storage/myisam/ftdefs.h
storage/myisam/ha_myisam.cc
storage/myisam/mi_check.c
storage/myisam/myisam_ftdump.c
storage/myisam/myisamchk.c
storage/myisam/myisamdef.h
storage/myisam/myisamlog.c
storage/myisam/sort.c
storage/xtradb/fil/fil0fil.c
storage/xtradb/trx/trx0i_s.c
per-file messages:
BUILD/compile-pentium
Don't use static link by default as some new systems doesn't have all static libraries available
client/mysql_upgrade.c
Remove not used variable
cmd-line-utils/readline/config_readline.h
Define some constants to get rid of compiler warnings on Linux
cmd-line-utils/readline/display.c
Get rid of compiler warnings
cmd-line-utils/readline/history.c
Got rid of compiler warnings:
- Defining some strings as const
- Added cast
cmd-line-utils/readline/rlmbutil.h
Added cast to get rid of compiler warnings
cmd-line-utils/readline/text.c
Remove not needed initialization to get rid of compiler warnings
cmd-line-utils/readline/xmalloc.c
Changed types to 'const char* to get rid of compiler warnings
configure.in
Ensure that we use MariaDB as suffix
include/mysql/plugin.h
Changed types to 'const unsigned char* to get rid of compiler warnings (in other parts of the code)
Change length for not \0 terminated string to size_t
include/mysql/plugin.h.pp
Update related to plugin.h
libmysql/libmysql.c
Fixed bug that caused core dump with newer gcc when strict aliasing is not turned off
mysql-test/t/information_schema.test
Test is depending on innodb
mysql-test/t/not_partition.test
Fixed wrong directory name
(Not noticed before as we don't ususally run this test)
mysys/lf_hash.c
Got rid of compiler warnings from -Wstrict-aliasing
mysys/my_redel.c
Removed not used variable
regex/engine.c
Changed types to 'const char* to get rid of compiler warnings
regex/engine.ih
Changed types to 'const char* to get rid of compiler warnings
sql/sp_head.cc
Got rid of compiler warning from -Wstrict-aliasing
sql/sql_base.cc
Got rid of compiler warnings from -Wstrict-aliasing
(The original code was probably wrong as nj_col->table_field was
sql/sql_builtin.cc.in
plugin.h needs to have size_t defined
sql/sql_parse.cc
Remove used variable
sql/sql_select.cc
Got rid of compiler warnings from -Wstrict-aliasing
sql/sql_show.cc
Added #ifdef to get rid of compiler warning when not using partition engine
sql/table.cc
Got rid of compiler warning from -Wstrict-aliasing
storage/maria/ha_maria.cc
Got rid of compiler warnings from -Wstrict-aliasing:
- Use the thd_killed() API function
storage/maria/lockman.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/ma_check.c
Got rid of compiler warnings from -Wstrict-aliasing
Change to use new version of _ma_killed_ptr; Don't call it as often as before
storage/maria/ma_check_standalone.h
Update to compatible _ma_killed_ptr() from ha_maria.cc
storage/maria/ma_ft_boolean_search.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_ft_nlq_search.c
Got rid of compiler warnings from -Wstrict-aliasing
Ensure that 'subkeys' is 32 bit
storage/maria/ma_ft_parser.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_ftdefs.h
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_sort.c
Change to use new version of _ma_killed_ptr; Don't call it as often as before
storage/maria/ma_state.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/maria_def.h
Redefine ma_killed_ptr()
storage/maria/maria_ftdump.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/trnman.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/ft_boolean_search.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ft_nlq_search.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/ft_parser.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ft_stopwords.c
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ftdefs.h
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ha_myisam.cc
Got rid of compiler warnings from -Wstrict-aliasing:
- Use the thd_killed() API function
storage/myisam/mi_check.c
Use new killed_ptr() function
storage/myisam/myisam_ftdump.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/myisamchk.c
Update to compatible killed_ptr() from ha_myisam.cc
storage/myisam/myisamdef.h
Redefine killed_ptr()
storage/myisam/myisamlog.c
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/sort.c
Change to use new version of killed_ptr; Don't call it as often as before
storage/xtradb/fil/fil0fil.c
Fixedc ompiler warning
storage/xtradb/trx/trx0i_s.c
Include mysql_plugin.h later to ensure that size_t is defined
=== modified file 'BUILD/compile-pentium'
--- a/BUILD/compile-pentium 2007-04-11 12:12:00 +0000
+++ b/BUILD/compile-pentium 2009-11-29 23:08:56 +0000
@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $fast_cflags"
-extra_configs="$pentium_configs $static_link"
+extra_configs="$pentium_configs"
strip=yes
. "$path/FINISH.sh"
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c 2009-11-06 17:22:32 +0000
+++ b/client/mysql_upgrade.c 2009-11-29 23:08:56 +0000
@@ -552,7 +552,6 @@ static int upgrade_already_done(void)
FILE *in;
char upgrade_info_file[FN_REFLEN]= {0};
char buf[sizeof(MYSQL_SERVER_VERSION)+1];
- char *res;
if (get_upgrade_info_file_name(upgrade_info_file))
return 0; /* Could not get filename => not sure */
=== modified file 'cmd-line-utils/readline/config_readline.h'
--- a/cmd-line-utils/readline/config_readline.h 2005-04-20 10:02:07 +0000
+++ b/cmd-line-utils/readline/config_readline.h 2009-11-29 23:08:56 +0000
@@ -7,6 +7,11 @@
# include <config.h>
#endif
+/* to get wcwidth() defined */
+#define _XOPEN_SOURCE 600
+#define _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_
+
/*
Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3
=== modified file 'cmd-line-utils/readline/display.c'
--- a/cmd-line-utils/readline/display.c 2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/display.c 2009-11-29 23:08:56 +0000
@@ -461,12 +461,12 @@ rl_redisplay ()
register char *line;
int inv_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, modmark;
- char *prompt_this_line;
+ const char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
- int num, n0;
+ int num, n0= 0;
wchar_t wc;
size_t wc_bytes;
- int wc_width;
+ int wc_width= 0;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
#endif
@@ -824,7 +824,7 @@ rl_redisplay ()
cpos_buffer_position = out;
lb_linenum = newlines;
}
- for (i = in; i < in+wc_bytes; i++)
+ for (i = in; (size_t) i < in+wc_bytes; i++)
line[out++] = rl_line_buffer[i];
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
=== modified file 'cmd-line-utils/readline/history.c'
--- a/cmd-line-utils/readline/history.c 2008-04-28 16:24:05 +0000
+++ b/cmd-line-utils/readline/history.c 2009-11-29 23:08:56 +0000
@@ -211,14 +211,14 @@ history_get (offset)
HIST_ENTRY *
alloc_history_entry (string, ts)
- char *string;
+ const char *string;
char *ts;
{
HIST_ENTRY *temp;
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
- temp->line = string ? savestring (string) : string;
+ temp->line = string ? savestring ((char*) string) : (char*) string;
temp->data = (char *)NULL;
temp->timestamp = ts;
=== modified file 'cmd-line-utils/readline/rlmbutil.h'
--- a/cmd-line-utils/readline/rlmbutil.h 2007-11-19 13:38:08 +0000
+++ b/cmd-line-utils/readline/rlmbutil.h 2009-11-29 23:08:56 +0000
@@ -109,8 +109,8 @@ extern int _rl_is_mbchar_matched PARAMS(
extern wchar_t _rl_char_value PARAMS((char *, int));
extern int _rl_walphabetic PARAMS((wchar_t));
-#define _rl_to_wupper(wc) (iswlower (wc) ? towupper (wc) : (wc))
-#define _rl_to_wlower(wc) (iswupper (wc) ? towlower (wc) : (wc))
+#define _rl_to_wupper(wc) (iswlower (wc) ? (wchar_t) towupper (wc) : (wc))
+#define _rl_to_wlower(wc) (iswupper (wc) ? (wchar_t) towlower (wc) : (wc))
#define MB_NEXTCHAR(b,s,c,f) \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) \
=== modified file 'cmd-line-utils/readline/text.c'
--- a/cmd-line-utils/readline/text.c 2009-09-07 20:50:10 +0000
+++ b/cmd-line-utils/readline/text.c 2009-11-29 23:08:56 +0000
@@ -614,7 +614,7 @@ rl_arrow_keys (count, c)
#ifdef HANDLE_MULTIBYTE
static char pending_bytes[MB_LEN_MAX];
static int pending_bytes_length = 0;
-static mbstate_t ps = {0};
+static mbstate_t ps;
#endif
/* Insert the character C at the current location, moving point forward.
=== modified file 'cmd-line-utils/readline/xmalloc.c'
--- a/cmd-line-utils/readline/xmalloc.c 2008-01-23 16:43:46 +0000
+++ b/cmd-line-utils/readline/xmalloc.c 2009-11-29 23:08:56 +0000
@@ -42,7 +42,7 @@
static void
memory_error_and_abort (fname)
- char *fname;
+ const char *fname;
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
=== modified file 'configure.in'
--- a/configure.in 2009-11-07 15:56:51 +0000
+++ b/configure.in 2009-11-29 23:08:56 +0000
@@ -15,7 +15,7 @@ AC_CANONICAL_SYSTEM
# MySQL version number.
#
# Note: the following line must be parseable by win/configure.js:GetVersion()
-AM_INIT_AUTOMAKE(mysql, 5.1.39-maria-beta)
+AM_INIT_AUTOMAKE(mysql, 5.1.39-MariaDB-beta)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h 2009-09-07 20:50:10 +0000
+++ b/include/mysql/plugin.h 2009-11-29 23:08:56 +0000
@@ -567,9 +567,9 @@ typedef struct st_mysql_ftparser_boolean
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- char *doc, int doc_len);
+ const unsigned char *doc, size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- char *word, int word_len,
+ const unsigned char *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp 2008-10-10 15:28:41 +0000
+++ b/include/mysql/plugin.h.pp 2009-11-29 23:08:56 +0000
@@ -73,9 +73,9 @@ typedef struct st_mysql_ftparser_boolean
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- char *doc, int doc_len);
+ const unsigned char *doc, size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- char *word, int word_len,
+ const unsigned char *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c 2009-11-06 17:22:32 +0000
+++ b/libmysql/libmysql.c 2009-11-29 23:08:56 +0000
@@ -2284,7 +2284,7 @@ mysql_stmt_param_metadata(MYSQL_STMT *st
/* Store type of parameter in network buffer. */
-static void store_param_type(char **pos, MYSQL_BIND *param)
+static void store_param_type(uchar **pos, MYSQL_BIND *param)
{
uint typecode= param->buffer_type | (param->is_unsigned ? 32768 : 0);
int2store(*pos, typecode);
@@ -2564,7 +2564,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
that is sent to the server.
*/
for (param= stmt->params; param < param_end ; param++)
- store_param_type((char**) &net->write_pos, param);
+ store_param_type(&net->write_pos, param);
}
for (param= stmt->params; param < param_end; param++)
=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test 2009-09-29 20:19:43 +0000
+++ b/mysql-test/t/information_schema.test 2009-11-29 23:08:56 +0000
@@ -5,6 +5,9 @@
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
+# Check that innodb/xtradb is incompiled in as result depends on it
+-- source include/have_innodb.inc
+
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
=== modified file 'mysql-test/t/not_partition.test'
--- a/mysql-test/t/not_partition.test 2009-01-08 14:16:44 +0000
+++ b/mysql-test/t/not_partition.test 2009-11-29 23:08:56 +0000
@@ -15,7 +15,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
# Bug#39893: Crash if select on a partitioned table,
# when partitioning is disabled
FLUSH TABLES;
---copy_file $MYSQLTEST_VARDIR/std_data_ln/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
SELECT * FROM t1;
TRUNCATE TABLE t1;
ANALYZE TABLE t1;
=== modified file 'mysys/lf_hash.c'
--- a/mysys/lf_hash.c 2009-01-15 21:27:36 +0000
+++ b/mysys/lf_hash.c 2009-11-29 23:08:56 +0000
@@ -124,8 +124,8 @@ retry:
we found a deleted node - be nice, help the other thread
and remove this deleted node
*/
- if (my_atomic_casptr((void **)cursor->prev,
- (void **)&cursor->curr, cursor->next))
+ if (my_atomic_casptr((void **) cursor->prev,
+ (void **)(char*) &cursor->curr, cursor->next))
_lf_alloc_free(pins, cursor->curr);
else
{
@@ -171,7 +171,8 @@ static LF_SLIST *linsert(LF_SLIST * vola
node->link= (intptr)cursor.curr;
DBUG_ASSERT(node->link != (intptr)node); /* no circular references */
DBUG_ASSERT(cursor.prev != &node->link); /* no circular references */
- if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+ if (my_atomic_casptr((void **) cursor.prev,
+ (void **)(char*) &cursor.curr, node))
{
res= 1; /* inserted ok */
break;
@@ -218,13 +219,13 @@ static int ldelete(LF_SLIST * volatile *
else
{
/* mark the node deleted */
- if (my_atomic_casptr((void **)&(cursor.curr->link),
- (void **)&cursor.next,
+ if (my_atomic_casptr((void **) (char*) &(cursor.curr->link),
+ (void **) (char*) &cursor.next,
(void *)(((intptr)cursor.next) | 1)))
{
/* and remove it from the list */
if (my_atomic_casptr((void **)cursor.prev,
- (void **)&cursor.curr, cursor.next))
+ (void **)(char*)&cursor.curr, cursor.next))
_lf_alloc_free(pins, cursor.curr);
else
{
@@ -493,7 +494,7 @@ static int initialize_bucket(LF_HASH *ha
my_free((void *)dummy, MYF(0));
dummy= cur;
}
- my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+ my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
/*
note that if the CAS above failed (after linsert() succeeded),
it would mean that some other thread has executed linsert() for
=== modified file 'mysys/my_redel.c'
--- a/mysys/my_redel.c 2009-11-06 17:22:32 +0000
+++ b/mysys/my_redel.c 2009-11-29 23:08:56 +0000
@@ -77,9 +77,6 @@ end:
int my_copystat(const char *from, const char *to, int MyFlags)
{
struct stat statbuf;
-#if !defined(__WIN__) && !defined(__NETWARE__)
- int res;
-#endif
if (stat((char*) from, &statbuf))
{
=== modified file 'regex/engine.c'
--- a/regex/engine.c 2005-09-29 01:20:31 +0000
+++ b/regex/engine.c 2009-11-29 23:08:56 +0000
@@ -33,11 +33,11 @@ struct match {
struct re_guts *g;
int eflags;
my_regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
+ const char *offp; /* offsets work from here */
+ const char *beginp; /* start of string -- virtual NUL precedes */
+ const char *endp; /* end of string -- virtual NUL here */
+ const char *coldp; /* can be no match starting before here */
+ const char **lastpos; /* [nplus+1] */
STATEVARS;
states st; /* current states */
states fresh; /* states for a fresh start */
@@ -66,20 +66,20 @@ static int /* 0 success, REG_NOMATCH f
matcher(charset,g, str, nmatch, pmatch, eflags)
CHARSET_INFO *charset;
register struct re_guts *g;
-char *str;
+const char *str;
size_t nmatch;
my_regmatch_t pmatch[];
int eflags;
{
- register char *endp;
+ register const char *endp;
register uint i;
struct match mv;
register struct match *m = &mv;
- register char *dp;
+ register const char *dp;
register const sopno gf = g->firststate+1; /* +1 for OEND */
register const sopno gl = g->laststate;
- char *start;
- char *stop;
+ const char *start;
+ const char *stop;
/* simplify the situation where possible */
if (g->cflags®_NOSUB)
@@ -163,7 +163,7 @@ int eflags;
dp = dissect(charset, m, m->coldp, endp, gf, gl);
} else {
if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
+ m->lastpos = (const char **)malloc((g->nplus+1) *
sizeof(char *));
if (g->nplus > 0 && m->lastpos == NULL) {
free(m->pmatch);
@@ -235,28 +235,28 @@ int eflags;
== static char *dissect(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* == stop (success) always */
+static const char * /* == stop (success) always */
dissect(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register uint i;
register sopno ss; /* start sop of current subRE */
register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
+ register const char *sp; /* start of string matched by it */
+ register const char *stp; /* string matched by it cannot pass here */
+ register const char *rest; /* start of rest of string */
+ register const char *tail; /* string unmatched by rest of RE */
register sopno ssub; /* start sop of subsubRE */
register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp; /* used in debug mode to check asserts */
+ register const char *ssp; /* start of string matched by subsubRE */
+ register const char *sep; /* end of string matched by subsubRE */
+ register const char *oldssp; /* previous ssp */
+ register const char *dp; /* used in debug mode to check asserts */
AT("diss", start, stop, startst, stopst);
sp = start;
@@ -424,23 +424,23 @@ sopno stopst;
== static char *backref(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst, sopno lev);
*/
-static char * /* == stop (success) or NULL (failure) */
+static const char * /* == stop (success) or NULL (failure) */
backref(charset,m, start, stop, startst, stopst, lev)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
sopno lev; /* PLUS nesting level */
{
register uint i;
register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
+ register const char *sp; /* start of string matched by it */
register sopno ssub; /* start sop of subsubRE */
register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
+ register const char *ssp; /* start of string matched by subsubRE */
+ register const char *dp;
register size_t len;
register int hard;
register sop s;
@@ -630,24 +630,24 @@ sopno lev; /* PLUS nesting level */
== static char *fast(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* where tentative match ended, or NULL */
+static const char * /* where tentative match ended, or NULL */
fast(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register states st = m->st;
register states fresh = m->fresh;
register states tmp = m->tmp;
- register char *p = start;
+ register const char *p = start;
register int c = (start == m->beginp) ? OUT : *(start-1);
register int lastc; /* previous c */
register int flagch;
register int i;
- register char *coldp; /* last p after which no match was underway */
+ register const char *coldp; /* last p after which no match was underway */
CLEAR(st);
SET1(st, startst);
@@ -722,24 +722,24 @@ sopno stopst;
== static char *slow(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* where it ended */
+static const char * /* where it ended */
slow(charset, m, start, stop, startst, stopst)
CHARSET_INFO *charset;
register struct match *m;
-char *start;
-char *stop;
+const char *start;
+const char *stop;
sopno startst;
sopno stopst;
{
register states st = m->st;
register states empty = m->empty;
register states tmp = m->tmp;
- register char *p = start;
+ register const char *p = start;
register int c = (start == m->beginp) ? OUT : *(start-1);
register int lastc; /* previous c */
register int flagch;
register int i;
- register char *matchp; /* last p at which a match ended */
+ register const char *matchp; /* last p at which a match ended */
AT("slow", start, stop, startst, stopst);
CLEAR(st);
=== modified file 'regex/engine.ih'
--- a/regex/engine.ih 2005-09-29 00:08:24 +0000
+++ b/regex/engine.ih 2009-11-29 23:08:56 +0000
@@ -4,11 +4,11 @@ extern "C" {
#endif
/* === engine.c === */
-static int matcher(CHARSET_INFO *charset,register struct re_guts *g, char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
-static char *dissect(CHARSET_INFO *charset,register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static int matcher(CHARSET_INFO *charset,register struct re_guts *g, const char *string, size_t nmatch, my_regmatch_t pmatch[], int eflags);
+static const char *dissect(CHARSET_INFO *charset,register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *backref(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev);
+static const char *fast(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *slow(CHARSET_INFO *charset, register struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
#define BOL (OUT+1)
#define EOL (BOL+1)
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2009-09-15 10:46:35 +0000
+++ b/sql/sp_head.cc 2009-11-29 23:08:56 +0000
@@ -1924,9 +1924,10 @@ sp_head::execute_procedure(THD *thd, Lis
if (spvar->mode == sp_param_out)
{
Item_null *null_item= new Item_null();
+ Item *tmp_item= (Item*) null_item;
if (!null_item ||
- nctx->set_variable(thd, i, (Item **)&null_item))
+ nctx->set_variable(thd, i, &tmp_item))
{
err_status= TRUE;
break;
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-10-15 21:38:29 +0000
+++ b/sql/sql_base.cc 2009-11-29 23:08:56 +0000
@@ -5823,6 +5823,7 @@ find_field_in_natural_join(THD *thd, TAB
{
/* This is a base table. */
DBUG_ASSERT(nj_col->view_field == NULL);
+ Item *ref= 0;
/*
This fix_fields is not necessary (initially this item is fixed by
the Item_field constructor; after reopen_tables the Item_func_eq
@@ -5830,12 +5831,13 @@ find_field_in_natural_join(THD *thd, TAB
reopening for columns that was dropped by the concurrent connection.
*/
if (!nj_col->table_field->fixed &&
- nj_col->table_field->fix_fields(thd, (Item **)&nj_col->table_field))
+ nj_col->table_field->fix_fields(thd, &ref))
{
DBUG_PRINT("info", ("column '%s' was dropped by the concurrent connection",
nj_col->table_field->name));
DBUG_RETURN(NULL);
}
+ DBUG_ASSERT(ref == 0); // Should not have changed
DBUG_ASSERT(nj_col->table_ref->table == nj_col->table_field->field->table);
found_field= nj_col->table_field->field;
update_field_dependencies(thd, found_field, nj_col->table_ref->table);
=== modified file 'sql/sql_builtin.cc.in'
--- a/sql/sql_builtin.cc.in 2006-12-31 01:29:11 +0000
+++ b/sql/sql_builtin.cc.in 2009-11-29 23:08:56 +0000
@@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include <my_global.h>
#include <mysql/plugin.h>
typedef struct st_mysql_plugin builtin_plugin[];
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2009-11-06 17:22:32 +0000
+++ b/sql/sql_parse.cc 2009-11-29 23:08:56 +0000
@@ -464,7 +464,7 @@ pthread_handler_t handle_bootstrap(void
thd->init_for_queries();
while (fgets(buff, thd->net.max_packet, file))
{
- char *query, *res;
+ char *query;
/* strlen() can't be deleted because fgets() doesn't return length */
ulong length= (ulong) strlen(buff);
while (buff[length-1] != '\n' && !feof(file))
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-06 17:22:32 +0000
+++ b/sql/sql_select.cc 2009-11-29 23:08:56 +0000
@@ -3586,8 +3586,9 @@ add_key_fields(JOIN *join, KEY_FIELD **k
{
if (!field->eq(item->field))
{
+ Item *tmp_item= (Item*) item;
add_key_field(key_fields, *and_level, cond_func, field,
- TRUE, (Item **) &item, 1, usable_tables,
+ TRUE, &tmp_item, 1, usable_tables,
sargables);
}
}
@@ -15748,7 +15749,11 @@ static bool add_ref_to_table_cond(THD *t
DBUG_RETURN(TRUE);
if (!cond->fixed)
- cond->fix_fields(thd, (Item**)&cond);
+ {
+ Item *tmp_item= (Item*) cond;
+ cond->fix_fields(thd, &tmp_item);
+ DBUG_ASSERT(cond == tmp_item);
+ }
if (join_tab->select)
{
error=(int) cond->add(join_tab->select->cond);
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2009-11-26 20:19:33 +0000
+++ b/sql/sql_show.cc 2009-11-29 23:08:56 +0000
@@ -3551,7 +3551,9 @@ static int get_schema_tables_record(THD
TABLE_SHARE *share= show_table->s;
handler *file= show_table->file;
handlerton *tmp_db_type= share->db_type();
+#ifdef WITH_PARTITION_STORAGE_ENGINE
bool is_partitioned= FALSE;
+#endif
if (share->tmp_table == SYSTEM_TMP_TABLE)
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
else if (share->tmp_table)
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2009-10-15 21:38:29 +0000
+++ b/sql/table.cc 2009-11-29 23:08:56 +0000
@@ -2077,8 +2077,9 @@ ulong get_form_pos(File file, uchar *hea
else
{
char *str;
+ const char **tmp = (const char**) (char*) buf;
str=(char *) (buf+a_length);
- fix_type_pointers((const char ***) &buf,save_names,1,&str);
+ fix_type_pointers(&tmp, save_names, 1, &str);
}
DBUG_RETURN(ret_value);
}
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc 2009-11-07 10:34:19 +0000
+++ b/storage/maria/ha_maria.cc 2009-11-29 23:08:56 +0000
@@ -665,10 +665,9 @@ int maria_check_definition(MARIA_KEYDEF
extern "C" {
-volatile int *_ma_killed_ptr(HA_CHECK *param)
+int _ma_killed_ptr(HA_CHECK *param)
{
- /* In theory Unsafe conversion, but should be ok for now */
- return (int*) &(((THD *) (param->thd))->killed);
+ return thd_killed((THD*)param->thd);
}
=== modified file 'storage/maria/lockman.c'
--- a/storage/maria/lockman.c 2008-02-21 00:51:51 +0000
+++ b/storage/maria/lockman.c 2009-11-29 23:08:56 +0000
@@ -360,7 +360,7 @@ retry:
else
{
if (my_atomic_casptr((void **)cursor->prev,
- (void **)&cursor->curr, cursor->next))
+ (void **)(char*) &cursor->curr, cursor->next))
_lf_alloc_free(pins, cursor->curr);
else
{
@@ -421,7 +421,8 @@ static int lockinsert(LOCK * volatile *h
node->link= (intptr)cursor.curr;
DBUG_ASSERT(node->link != (intptr)node);
DBUG_ASSERT(cursor.prev != &node->link);
- if (!my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+ if (!my_atomic_casptr((void **)cursor.prev,
+ (void **)(char*) &cursor.curr, node))
{
res= REPEAT_ONCE_MORE;
node->flags&= ~ACTIVE;
@@ -498,11 +499,11 @@ static int lockdelete(LOCK * volatile *h
then we can delete. Good news is - this is only required when rolling
back a savepoint.
*/
- if (my_atomic_casptr((void **)&(cursor.curr->link),
- (void **)&cursor.next, 1+(char *)cursor.next))
+ if (my_atomic_casptr((void **)(char*)&(cursor.curr->link),
+ (void **)(char*)&cursor.next, 1+(char *)cursor.next))
{
if (my_atomic_casptr((void **)cursor.prev,
- (void **)&cursor.curr, cursor.next))
+ (void **)(char*)&cursor.curr, cursor.next))
_lf_alloc_free(pins, cursor.curr);
else
lockfind(head, node, &cursor, pins);
@@ -573,7 +574,7 @@ static void initialize_bucket(LOCKMAN *l
my_free((void *)dummy, MYF(0));
dummy= cur;
}
- my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+ my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
}
static inline uint calc_hash(uint64 resource)
=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c 2009-05-06 12:03:24 +0000
+++ b/storage/maria/ma_check.c 2009-11-29 23:08:56 +0000
@@ -215,7 +215,7 @@ int maria_chk_del(HA_CHECK *param, regis
empty=0;
for (i= share->state.state.del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
if (test_flag & T_VERBOSE)
printf(" %9s",llstr(next_link,buff));
@@ -310,7 +310,7 @@ static int check_k_link(HA_CHECK *param,
records= (ha_rows) (share->state.state.key_file_length / block_size);
while (next_link != HA_OFFSET_ERROR && records > 0)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
if (param->testflag & T_VERBOSE)
printf("%16s",llstr(next_link,llbuff));
@@ -876,10 +876,10 @@ static int chk_index(HA_CHECK *param, MA
tmp_key.data= tmp_key_buff;
for ( ;; )
{
- if (*_ma_killed_ptr(param))
- goto err;
if (nod_flag)
{
+ if (_ma_killed_ptr(param))
+ goto err;
next_page= _ma_kpos(nod_flag,keypos);
if (chk_index_down(param,info,keyinfo,next_page,
temp_buff,keys,key_checksum,level+1))
@@ -1180,7 +1180,7 @@ static int check_static_record(HA_CHECK
pos= 0;
while (pos < share->state.state.data_file_length)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
return -1;
if (my_b_read(¶m->read_cache, record,
share->base.pack_reclength))
@@ -1230,7 +1230,7 @@ static int check_dynamic_record(HA_CHECK
{
my_bool got_error= 0;
int flag;
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(-1);
flag= block_info.second_read=0;
@@ -1451,7 +1451,7 @@ static int check_compressed_record(HA_CH
pos= share->pack.header_length; /* Skip header */
while (pos < share->state.state.data_file_length)
{
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(-1);
if (_ma_read_cache(¶m->read_cache, block_info.header, pos,
@@ -1815,7 +1815,7 @@ static int check_block_record(HA_CHECK *
LINT_INIT(row_count);
LINT_INIT(empty_space);
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
{
_ma_scan_end_block_record(info);
return -1;
@@ -4631,7 +4631,7 @@ static int sort_get_next_record(MARIA_SO
char llbuff[22],llbuff2[22];
DBUG_ENTER("sort_get_next_record");
- if (*_ma_killed_ptr(param))
+ if (_ma_killed_ptr(param))
DBUG_RETURN(1);
switch (sort_info->org_data_file_type) {
=== modified file 'storage/maria/ma_check_standalone.h'
--- a/storage/maria/ma_check_standalone.h 2007-10-03 16:10:32 +0000
+++ b/storage/maria/ma_check_standalone.h 2009-11-29 23:08:56 +0000
@@ -30,11 +30,9 @@
Check if check/repair operation was killed by a signal
*/
-static int not_killed= 0;
-
-volatile int *_ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
+int _ma_killed_ptr(HA_CHECK *param __attribute__((unused)))
{
- return ¬_killed; /* always NULL */
+ return 0;
}
/* print warnings and errors */
=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- a/storage/maria/ma_ft_boolean_search.c 2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_ft_boolean_search.c 2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- char *query, int len)
+ const uchar *query, size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- uchar **start= (uchar**) &query;
- uchar *end= (uchar*) query + len;
+ const uchar **start= &query;
+ const uchar *end= query + len;
FT_WORD w;
info.prev= ' ';
info.quot= 0;
while (maria_ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, (char *) w.pos, w.len, &info);
+ param->mysql_add_word(param, w.pos, w.len, &info);
return(0);
}
@@ -615,7 +615,7 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -647,15 +647,15 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- char *document, int len)
+ const uchar *document, size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
- const uchar *docend= (uchar*) document + len;
- while (maria_ft_simple_get_word(phrase_param->cs, (uchar**) &document,
+ const uchar *docend= document + len;
+ while (maria_ft_simple_get_word(phrase_param->cs, &document,
docend, &word, FALSE))
{
- param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+ param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match)
break;
}
@@ -872,7 +872,7 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int len,
+ const uchar *word, size_t len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -933,15 +933,14 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- char *doc, int len)
+ const uchar *doc, size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
- uchar *end= (uchar*) doc + len;
+ const uchar *end= doc + len;
FT_WORD w;
- while (maria_ft_simple_get_word(ftb->charset, (uchar**) &doc,
- end, &w, TRUE))
- param->mysql_add_word(param, (char *) w.pos, w.len, 0);
+ while (maria_ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+ param->mysql_add_word(param, w.pos, w.len, 0);
return(0);
}
=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- a/storage/maria/ma_ft_nlq_search.c 2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_ft_nlq_search.c 2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int32 subkeys;
+ int r;
uint doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
@@ -127,7 +128,7 @@ static int walk_and_match(FT_WORD *word,
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*)&subkeys;
+ tmp_weight=*(float*) (char*) &subkeys;
#else
#error
#endif
=== modified file 'storage/maria/ma_ft_parser.c'
--- a/storage/maria/ma_ft_parser.c 2009-02-19 09:01:25 +0000
+++ b/storage/maria/ma_ft_parser.c 2009-11-29 23:08:56 +0000
@@ -109,10 +109,11 @@ my_bool maria_ft_boolean_check_syntax_st
3 - right bracket
4 - stopword found
*/
-uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar maria_ft_get_word(CHARSET_INFO *cs, const uchar **start,
+ const uchar *end,
FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- uchar *doc=*start;
+ const uchar *doc= *start;
int ctype;
uint mwc, length;
int mbl;
@@ -203,11 +204,11 @@ ret:
return param->type;
}
-uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
+uchar maria_ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
const uchar *end, FT_WORD *word,
my_bool skip_stopwords)
{
- uchar *doc= *start;
+ const uchar *doc= *start;
uint mwc, length;
int ctype, mbl;
DBUG_ENTER("maria_ft_simple_get_word");
@@ -259,8 +260,9 @@ void maria_ft_parse_init(TREE *wtree, CH
static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+ __attribute__((unused)))
{
TREE *wtree;
FT_WORD w;
@@ -276,7 +278,7 @@ static int maria_ft_add_word(MYSQL_FTPAR
w.pos= ptr;
}
else
- w.pos= (uchar *) word;
+ w.pos= word;
w.len= word_len;
if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
{
@@ -288,17 +290,17 @@ static int maria_ft_add_word(MYSQL_FTPAR
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc_arg, int doc_len)
+ const uchar *doc_arg, size_t doc_len)
{
- uchar *doc= (uchar*) doc_arg;
- uchar *end= doc + doc_len;
+ const uchar *doc= doc_arg;
+ const uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
DBUG_ENTER("maria_ft_parse_internal");
while (maria_ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
- if (param->mysql_add_word(param, (char *) w.pos, w.len, 0))
+ if (param->mysql_add_word(param, w.pos, w.len, 0))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
@@ -378,7 +380,7 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_cal
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, char *, int,
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
=== modified file 'storage/maria/ma_ftdefs.h'
--- a/storage/maria/ma_ftdefs.h 2009-02-12 17:51:00 +0000
+++ b/storage/maria/ma_ftdefs.h 2009-11-29 23:08:56 +0000
@@ -96,7 +96,7 @@
#define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_maria_ft_word {
- uchar * pos;
+ const uchar * pos;
uint len;
double weight;
} FT_WORD;
@@ -106,9 +106,9 @@ int is_stopword(char *word, uint len);
MARIA_KEY *_ma_ft_make_key(MARIA_HA *, MARIA_KEY *, uint , uchar *, FT_WORD *,
my_off_t);
-uchar maria_ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
- MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar maria_ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar maria_ft_get_word(CHARSET_INFO *, const uchar **, const uchar *,
+ FT_WORD *, MYSQL_FTPARSER_BOOLEAN_INFO *);
+uchar maria_ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
FT_WORD *, my_bool);
typedef struct _st_maria_ft_seg_iterator {
=== modified file 'storage/maria/ma_sort.c'
--- a/storage/maria/ma_sort.c 2009-01-09 04:23:25 +0000
+++ b/storage/maria/ma_sort.c 2009-11-29 23:08:56 +0000
@@ -920,7 +920,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;
- volatile int *killed= _ma_killed_ptr(info->sort_info->param);
DBUG_ENTER("merge_buffers");
count=error=0;
@@ -953,10 +952,6 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
{
for (;;)
{
- if (*killed)
- {
- error=1; goto err;
- }
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
@@ -976,6 +971,12 @@ merge_buffers(MARIA_SORT_PARAM *info, ui
buffpek->key+=sort_length;
if (! --buffpek->mem_count)
{
+ /* It's enough to check for killedptr before a slow operation */
+ if (_ma_killed_ptr(info->sort_info->param))
+ {
+ error=1;
+ goto err;
+ }
if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
{
uchar *base= buffpek->base;
=== modified file 'storage/maria/ma_state.c'
--- a/storage/maria/ma_state.c 2009-10-06 06:57:22 +0000
+++ b/storage/maria/ma_state.c 2009-11-29 23:08:56 +0000
@@ -528,7 +528,7 @@ void _ma_remove_table_from_trnman(MARIA_
safe_mutex_assert_owner(&share->intern_lock);
- for (prev= (MARIA_USED_TABLES**) &trn->used_tables, tables= *prev;
+ for (prev= (MARIA_USED_TABLES**) (char*) &trn->used_tables, tables= *prev;
tables;
tables= *prev)
{
=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h 2009-10-06 06:57:22 +0000
+++ b/storage/maria/maria_def.h 2009-11-29 23:08:56 +0000
@@ -1160,7 +1160,7 @@ int _ma_flush_table_files(MARIA_HA *info
Functions needed by _ma_check (are overridden in MySQL/ha_maria.cc).
See ma_check_standalone.h .
*/
-volatile int *_ma_killed_ptr(HA_CHECK *param);
+int _ma_killed_ptr(HA_CHECK *param);
void _ma_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...))
ATTRIBUTE_FORMAT(printf, 2, 3);
void _ma_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...))
=== modified file 'storage/maria/maria_ftdump.c'
--- a/storage/maria/maria_ftdump.c 2008-08-25 11:49:47 +0000
+++ b/storage/maria/maria_ftdump.c 2009-11-29 23:08:56 +0000
@@ -116,7 +116,7 @@ int main(int argc,char *argv[])
subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
if (subkeys >= 0)
- weight=*(float*)&subkeys;
+ weight=*(float*) (char*) &subkeys;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);
=== modified file 'storage/maria/trnman.c'
--- a/storage/maria/trnman.c 2009-03-05 13:46:45 +0000
+++ b/storage/maria/trnman.c 2009-11-29 23:08:56 +0000
@@ -300,8 +300,8 @@ TRN *trnman_new_trn(WT_THD *wt)
(ABA isn't possible, we're behind a mutex
*/
my_atomic_rwlock_wrlock(&LOCK_pool);
- while (tmp.trn && !my_atomic_casptr((void **)&pool, &tmp.v,
- (void *)tmp.trn->next))
+ while (tmp.trn && !my_atomic_casptr((void **)(char*) &pool, &tmp.v,
+ (void *)tmp.trn->next))
/* no-op */;
my_atomic_rwlock_wrunlock(&LOCK_pool);
@@ -545,7 +545,7 @@ static void trnman_free_trn(TRN *trn)
down after the loop at -O2
*/
*(TRN * volatile *)&(trn->next)= tmp.trn;
- } while (!my_atomic_casptr((void **)&pool, &tmp.v, trn));
+ } while (!my_atomic_casptr((void **)(char*)&pool, &tmp.v, trn));
my_atomic_rwlock_wrunlock(&LOCK_pool);
}
=== modified file 'storage/myisam/ft_boolean_search.c'
--- a/storage/myisam/ft_boolean_search.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/ft_boolean_search.c 2009-11-29 23:08:56 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,19 +282,19 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- char *query, int len)
+ const uchar *query, size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- uchar **start= (uchar**) &query;
- uchar *end= (uchar*) query + len;
+ const uchar **start= &query;
+ const uchar *end= query + len;
FT_WORD w;
info.prev= ' ';
info.quot= 0;
while (ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, (char*) w.pos, w.len, &info);
+ param->mysql_add_word(param, w.pos, w.len, &info);
return(0);
}
@@ -616,7 +616,7 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
+ const uchar *word, size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -648,15 +648,15 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- char *document, int len)
+ const uchar *document, size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
const uchar *docend= (uchar*) document + len;
- while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
+ while (ft_simple_get_word(phrase_param->cs, &document, docend,
&word, FALSE))
{
- param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+ param->mysql_add_word(param, word.pos, word.len, 0);
if (phrase_param->match)
break;
}
@@ -874,7 +874,7 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int len,
+ const uchar *word, size_t len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
@@ -888,8 +888,8 @@ static int ftb_find_relevance_add_word(M
for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2)
{
ftbw= ftb->list[c];
- if (ha_compare_text(ftb->charset, (uchar*)word, len,
- (uchar*)ftbw->word+1, ftbw->len-1,
+ if (ha_compare_text(ftb->charset, word, len,
+ ftbw->word+1, ftbw->len-1,
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
b= c;
else
@@ -915,8 +915,8 @@ static int ftb_find_relevance_add_word(M
for (; c >= 0; c--)
{
ftbw= ftb->list[c];
- if (ha_compare_text(ftb->charset, (uchar*)word, len,
- (uchar*)ftbw->word + 1,ftbw->len - 1,
+ if (ha_compare_text(ftb->charset, word, len,
+ ftbw->word + 1,ftbw->len - 1,
(my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
{
if (ftb->with_scan & FTB_FLAG_TRUNC)
@@ -935,14 +935,14 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- char *doc, int len)
+ const uchar *doc, size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
- uchar *end= (uchar*) doc + len;
+ const uchar *end= doc + len;
FT_WORD w;
- while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
- param->mysql_add_word(param, (char*) w.pos, w.len, 0);
+ while (ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
+ param->mysql_add_word(param, w.pos, w.len, 0);
return(0);
}
=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c 2008-04-28 16:24:05 +0000
+++ b/storage/myisam/ft_nlq_search.c 2009-11-29 23:08:56 +0000
@@ -63,7 +63,8 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int32 subkeys;
+ int r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
@@ -123,7 +124,8 @@ static int walk_and_match(FT_WORD *word,
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*)&subkeys;
+ /* The weight we read was actually a float */
+ tmp_weight=*(float*) (char*) &subkeys;
#else
#error
#endif
=== modified file 'storage/myisam/ft_parser.c'
--- a/storage/myisam/ft_parser.c 2009-02-12 14:08:56 +0000
+++ b/storage/myisam/ft_parser.c 2009-11-29 23:08:56 +0000
@@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(c
3 - right bracket
4 - stopword found
*/
-uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end,
FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- uchar *doc=*start;
+ const uchar *doc= *start;
int ctype;
uint mwc, length;
int mbl;
@@ -201,10 +201,11 @@ ret:
return param->type;
}
-uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
- FT_WORD *word, my_bool skip_stopwords)
+uchar ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
+ const uchar *end, FT_WORD *word,
+ my_bool skip_stopwords)
{
- uchar *doc= *start;
+ const uchar *doc= *start;
uint mwc, length;
int mbl;
int ctype;
@@ -216,7 +217,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
{
if (doc >= end)
DBUG_RETURN(0);
- mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+ mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
break;
}
@@ -225,7 +226,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
for (word->pos= doc; doc < end; length++,
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
{
- mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+ mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
mwc= 0;
else if (!misc_word_char(*doc) || mwc)
@@ -238,7 +239,7 @@ uchar ft_simple_get_word(CHARSET_INFO *c
if (skip_stopwords == FALSE ||
(length >= ft_min_word_len && length < ft_max_word_len &&
- !is_stopword((char*) word->pos, word->len)))
+ !is_stopword(word->pos, word->len)))
{
*start= doc;
DBUG_RETURN(1);
@@ -257,8 +258,9 @@ void ft_parse_init(TREE *wtree, CHARSET_
static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+ __attribute__((unused)))
{
TREE *wtree;
FT_WORD w;
@@ -286,10 +288,10 @@ static int ft_add_word(MYSQL_FTPARSER_PA
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc_arg, int doc_len)
+ const uchar *doc_arg, size_t doc_len)
{
- uchar *doc= (uchar*) doc_arg;
- uchar *end= doc + doc_len;
+ const uchar *doc= doc_arg;
+ const uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
@@ -302,7 +304,7 @@ static int ft_parse_internal(MYSQL_FTPAR
}
-int ft_parse(TREE *wtree, uchar *doc, int doclen,
+int ft_parse(TREE *wtree, const uchar *doc, int doclen,
struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
@@ -377,7 +379,7 @@ MYSQL_FTPARSER_PARAM *ftparser_call_init
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, char *, int,
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
=== modified file 'storage/myisam/ft_stopwords.c'
--- a/storage/myisam/ft_stopwords.c 2008-04-28 16:24:05 +0000
+++ b/storage/myisam/ft_stopwords.c 2009-11-29 23:08:56 +0000
@@ -66,7 +66,8 @@ int ft_init_stopwords()
{
File fd;
uint len;
- uchar *buffer, *start, *end;
+ uchar *buffer;
+ const uchar *start, *end;
FT_WORD w;
int error=-1;
@@ -109,7 +110,7 @@ err0:
}
-int is_stopword(char *word, uint len)
+int is_stopword(const uchar *word, size_t len)
{
FT_STOPWORD sw;
sw.pos=word;
=== modified file 'storage/myisam/ftdefs.h'
--- a/storage/myisam/ftdefs.h 2009-01-26 06:35:15 +0000
+++ b/storage/myisam/ftdefs.h 2009-11-29 23:08:56 +0000
@@ -96,18 +96,18 @@
#define FTB_RQUOT (ft_boolean_syntax[11])
typedef struct st_ft_word {
- uchar * pos;
+ const uchar *pos;
uint len;
double weight;
} FT_WORD;
-int is_stopword(char *word, uint len);
+int is_stopword(const uchar *word, size_t len);
uint _ft_make_key(MI_INFO *, uint , uchar *, FT_WORD *, my_off_t);
-uchar ft_get_word(CHARSET_INFO *, uchar **, uchar *, FT_WORD *,
+uchar ft_get_word(CHARSET_INFO *, const uchar **, const uchar *, FT_WORD *,
MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
+uchar ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
FT_WORD *, my_bool);
typedef struct _st_ft_seg_iterator {
@@ -121,7 +121,7 @@ void _mi_ft_segiterator_dummy_init(const
uint _mi_ft_segiterator(FT_SEG_ITERATOR *);
void ft_parse_init(TREE *, CHARSET_INFO *);
-int ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
+int ft_parse(TREE *, const uchar *, int, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * ft_linearize(TREE *, MEM_ROOT *);
FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, const uchar *, MEM_ROOT *);
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2009-10-06 14:53:46 +0000
+++ b/storage/myisam/ha_myisam.cc 2009-11-29 23:08:56 +0000
@@ -497,10 +497,9 @@ int check_definition(MI_KEYDEF *t1_keyin
extern "C" {
-volatile int *killed_ptr(HA_CHECK *param)
+int killed_ptr(HA_CHECK *param)
{
- /* In theory Unsafe conversion, but should be ok for now */
- return (int*) &(((THD *)(param->thd))->killed);
+ return thd_killed((THD*)param->thd);
}
void mi_check_print_error(HA_CHECK *param, const char *fmt,...)
=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/mi_check.c 2009-11-29 23:08:56 +0000
@@ -166,7 +166,7 @@ int chk_del(HA_CHECK *param, register MI
empty=0;
for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
if (test_flag & T_VERBOSE)
printf(" %9s",llstr(next_link,buff));
@@ -261,7 +261,7 @@ static int check_k_link(HA_CHECK *param,
records= (ha_rows) (info->state->key_file_length / block_size);
while (next_link != HA_OFFSET_ERROR && records > 0)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
if (param->testflag & T_VERBOSE)
printf("%16s",llstr(next_link,llbuff));
@@ -778,7 +778,7 @@ static int chk_index(HA_CHECK *param, MI
}
for ( ;; )
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
goto err;
memcpy((char*) info->lastkey,(char*) key,key_length);
info->lastkey_length=key_length;
@@ -990,7 +990,7 @@ int chk_data_link(HA_CHECK *param, MI_IN
bzero((char*) key_checksum, info->s->base.keys * sizeof(key_checksum[0]));
while (pos < info->state->data_file_length)
{
- if (*killed_ptr(param))
+ if (killed_ptr(param))
goto err2;
switch (info->s->data_file_type) {
case BLOCK_RECORD:
@@ -3247,7 +3247,7 @@ static int sort_get_next_record(MI_SORT_
char llbuff[22],llbuff2[22];
DBUG_ENTER("sort_get_next_record");
- if (*killed_ptr(param))
+ if (killed_ptr(param))
DBUG_RETURN(1);
switch (share->data_file_type) {
=== modified file 'storage/myisam/myisam_ftdump.c'
--- a/storage/myisam/myisam_ftdump.c 2007-05-10 09:59:39 +0000
+++ b/storage/myisam/myisam_ftdump.c 2009-11-29 23:08:56 +0000
@@ -113,7 +113,7 @@ int main(int argc,char *argv[])
subkeys=ft_sintXkorr(info->lastkey+keylen+1);
if (subkeys >= 0)
- weight=*(float*)&subkeys;
+ weight= *(float*) (char*) &subkeys;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c 2009-09-19 21:21:29 +0000
+++ b/storage/myisam/myisamchk.c 2009-11-29 23:08:56 +0000
@@ -1745,11 +1745,9 @@ err:
sorting
*/
-static int not_killed= 0;
-
-volatile int *killed_ptr(HA_CHECK *param __attribute__((unused)))
+int killed_ptr(HA_CHECK *param __attribute__((unused)))
{
- return ¬_killed; /* always NULL */
+ return 0;
}
/* print warnings and errors */
=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h 2009-10-06 06:57:22 +0000
+++ b/storage/myisam/myisamdef.h 2009-11-29 23:08:56 +0000
@@ -725,7 +725,7 @@ my_bool mi_dynmap_file(MI_INFO *info, my
void mi_remap_file(MI_INFO *info, my_off_t size);
/* Functions needed by mi_check */
-volatile int *killed_ptr(HA_CHECK *param);
+int killed_ptr(HA_CHECK *param);
void mi_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...));
void mi_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...));
void mi_check_print_info _VARARGS((HA_CHECK *param, const char *fmt, ...));
=== modified file 'storage/myisam/myisamlog.c'
--- a/storage/myisam/myisamlog.c 2008-02-18 22:35:17 +0000
+++ b/storage/myisam/myisamlog.c 2009-11-29 23:08:56 +0000
@@ -385,7 +385,7 @@ static int examine_log(char * file_name,
file_info.name=0;
file_info.show_name=0;
file_info.record=0;
- if (read_string(&cache,(uchar**) &file_info.name,
+ if (read_string(&cache,(uchar**) (char*) &file_info.name,
(uint) mi_uint2korr(head)))
goto err;
{
=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c 2009-10-15 21:38:29 +0000
+++ b/storage/myisam/sort.c 2009-11-29 23:08:56 +0000
@@ -900,7 +900,6 @@ merge_buffers(MI_SORT_PARAM *info, uint
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;
- volatile int *killed= killed_ptr(info->sort_info->param);
DBUG_ENTER("merge_buffers");
count=error=0;
@@ -933,10 +932,6 @@ merge_buffers(MI_SORT_PARAM *info, uint
{
for (;;)
{
- if (*killed)
- {
- error=1; goto err;
- }
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
@@ -956,6 +951,12 @@ merge_buffers(MI_SORT_PARAM *info, uint
buffpek->key+=sort_length;
if (! --buffpek->mem_count)
{
+ /* It's enough to check for killedptr before a slow operation */
+ if (killed_ptr(info->sort_info->param))
+ {
+ error=1;
+ goto err;
+ }
if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
{
uchar *base= buffpek->base;
=== modified file 'storage/xtradb/fil/fil0fil.c'
--- a/storage/xtradb/fil/fil0fil.c 2009-11-13 21:26:08 +0000
+++ b/storage/xtradb/fil/fil0fil.c 2009-11-29 23:08:56 +0000
@@ -3139,7 +3139,7 @@ skip_info:
if (mach_read_from_4(page + FIL_PAGE_OFFSET) || !offset) {
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
- for (i = 0; i < n_index; i++) {
+ for (i = 0; (ulint) i < n_index; i++) {
if (offset / UNIV_PAGE_SIZE == root_page[i]) {
/* this is index root page */
mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
=== modified file 'storage/xtradb/trx/trx0i_s.c'
--- a/storage/xtradb/trx/trx0i_s.c 2009-09-07 10:22:53 +0000
+++ b/storage/xtradb/trx/trx0i_s.c 2009-11-29 23:08:56 +0000
@@ -28,11 +28,11 @@ table cache" for later retrieval.
Created July 17, 2007 Vasil Dimov
*******************************************************/
-#include <mysql/plugin.h>
#include "mysql_addons.h"
#include "univ.i"
+#include <mysql/plugin.h>
#include "buf0buf.h"
#include "dict0dict.h"
#include "ha0storage.h"
3
5
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2770)
by Michael Widenius 30 Nov '09
by Michael Widenius 30 Nov '09
30 Nov '09
#At lp:maria based on revid:monty@askmonty.org-20091130111302-6zcyj6ucz6rnphdq
2770 Michael Widenius 2009-11-30
Fixes after comments from last push:
- Removed some not needed casts
- Change plugin.h to be 'binary compatible' with old versions
- Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change
- Made some fixes suggested by Kristian to make things more portable and future safe (when it comes to strict aliasing)
modified:
include/ft_global.h
include/mysql/plugin.h
include/mysql/plugin.h.pp
mysql-test/t/information_schema.test
sql/sp_head.cc
sql/sql_select.cc
sql/table.cc
storage/maria/ma_ft_boolean_search.c
storage/maria/ma_ft_nlq_search.c
storage/maria/ma_ft_parser.c
storage/maria/ma_ftdefs.h
storage/maria/maria_ftdump.c
storage/myisam/ft_boolean_search.c
storage/myisam/ft_nlq_search.c
storage/myisam/ft_parser.c
storage/myisam/myisam_ftdump.c
per-file messages:
include/ft_global.h
Introduced FT_WEIGTH, to handle fulltext weights in a slightly more portable manner
include/mysql/plugin.h
Change plugin.h to be 'binary compatible' with old versions
Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change
Changed flags to unsigned (as flags should always be unsigned)
mysql-test/t/information_schema.test
Fixed typo
sql/sp_head.cc
Removed cast
sql/sql_select.cc
Removed cast
sql/table.cc
Removed cast
storage/maria/ma_ft_boolean_search.c
Use mysql_ft_size_t instead of size_t for plugin.h code
Changed some other string lengths to size_t
storage/maria/ma_ft_nlq_search.c
Use FT_WEIGTH to make code more portable
storage/maria/ma_ft_parser.c
Use mysql_ft_size_t instead of size_t for plugin.h code
Changed some other string lengths to size_t
storage/maria/ma_ftdefs.h
Changed some string lengths to size_t
storage/maria/maria_ftdump.c
Use FT_WEIGTH to make code more portable
storage/myisam/ft_boolean_search.c
Use mysql_ft_size_t instead of size_t for plugin.h code
storage/myisam/ft_nlq_search.c
Use FT_WEIGTH to make code more portable
storage/myisam/ft_parser.c
Use mysql_ft_size_t instead of size_t for plugin.h code
storage/myisam/myisam_ftdump.c
Use FT_WEIGTH to make code more portable
=== modified file 'include/ft_global.h'
--- a/include/ft_global.h 2007-06-27 14:49:12 +0000
+++ b/include/ft_global.h 2009-11-30 13:36:06 +0000
@@ -76,6 +76,8 @@ my_bool ft_boolean_check_syntax_string(c
extern const HA_KEYSEG ft_keysegs[FT_SEGS];
+typedef union {int32 i; float f;} FT_WEIGTH;
+
#ifdef __cplusplus
}
#endif
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h 2009-11-29 23:08:56 +0000
+++ b/include/mysql/plugin.h 2009-11-30 13:36:06 +0000
@@ -564,19 +564,22 @@ typedef struct st_mysql_ftparser_boolean
nothing. See enum_ftparser_mode above.
*/
+/* TODO: Change the following int to size_t at next ABI update */
+typedef int mysql_ft_size_t;
+
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- const unsigned char *doc, size_t doc_len);
+ const unsigned char *doc, mysql_ft_size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- const unsigned char *word, size_t word_len,
+ const unsigned char *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
struct charset_info_st *cs;
- char *doc;
- int length;
- int flags;
+ const unsigned char *doc;
+ mysql_ft_size_t length;
+ unsigned int flags;
enum enum_ftparser_mode mode;
} MYSQL_FTPARSER_PARAM;
=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp 2009-11-29 23:08:56 +0000
+++ b/include/mysql/plugin.h.pp 2009-11-30 13:36:06 +0000
@@ -70,19 +70,20 @@ typedef struct st_mysql_ftparser_boolean
char prev;
char *quot;
} MYSQL_FTPARSER_BOOLEAN_INFO;
+typedef int mysql_ft_size_t;
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- const unsigned char *doc, size_t doc_len);
+ const unsigned char *doc, mysql_ft_size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- const unsigned char *word, size_t word_len,
+ const unsigned char *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
struct charset_info_st *cs;
- char *doc;
- int length;
- int flags;
+ const unsigned char *doc;
+ mysql_ft_size_t length;
+ unsigned int flags;
enum enum_ftparser_mode mode;
} MYSQL_FTPARSER_PARAM;
struct st_mysql_ftparser
=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test 2009-11-29 23:08:56 +0000
+++ b/mysql-test/t/information_schema.test 2009-11-30 13:36:06 +0000
@@ -5,7 +5,7 @@
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
-# Check that innodb/xtradb is incompiled in as result depends on it
+# Check that InnoDB/XtraDB was compiled in as result depends on it
-- source include/have_innodb.inc
# Save the initial number of concurrent sessions
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2009-11-29 23:08:56 +0000
+++ b/sql/sp_head.cc 2009-11-30 13:36:06 +0000
@@ -1924,7 +1924,7 @@ sp_head::execute_procedure(THD *thd, Lis
if (spvar->mode == sp_param_out)
{
Item_null *null_item= new Item_null();
- Item *tmp_item= (Item*) null_item;
+ Item *tmp_item= null_item;
if (!null_item ||
nctx->set_variable(thd, i, &tmp_item))
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-29 23:08:56 +0000
+++ b/sql/sql_select.cc 2009-11-30 13:36:06 +0000
@@ -3586,7 +3586,7 @@ add_key_fields(JOIN *join, KEY_FIELD **k
{
if (!field->eq(item->field))
{
- Item *tmp_item= (Item*) item;
+ Item *tmp_item= item;
add_key_field(key_fields, *and_level, cond_func, field,
TRUE, &tmp_item, 1, usable_tables,
sargables);
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2009-11-29 23:08:56 +0000
+++ b/sql/table.cc 2009-11-30 13:36:06 +0000
@@ -2077,7 +2077,7 @@ ulong get_form_pos(File file, uchar *hea
else
{
char *str;
- const char **tmp = (const char**) (char*) buf;
+ const char **tmp = (const char**) buf;
str=(char *) (buf+a_length);
fix_type_pointers(&tmp, save_names, 1, &str);
}
=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- a/storage/maria/ma_ft_boolean_search.c 2009-11-29 23:08:56 +0000
+++ b/storage/maria/ma_ft_boolean_search.c 2009-11-30 13:36:06 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,7 +282,7 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *query, size_t len)
+ const uchar *query, mysql_ft_size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
@@ -299,7 +299,7 @@ static int ftb_parse_query_internal(MYSQ
}
-static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
+static int _ftb_parse_query(FTB *ftb, uchar *query, size_t len,
struct st_mysql_ftparser *parser)
{
MYSQL_FTPARSER_PARAM *param;
@@ -321,7 +321,7 @@ static int _ftb_parse_query(FTB *ftb, uc
param->mysql_add_word= ftb_query_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (char*) query;
+ param->doc= query;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
@@ -539,8 +539,8 @@ static void _ftb_init_index_search(FT_IN
FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr,
- uchar *query,
- uint query_len, CHARSET_INFO *cs)
+ uchar *query, size_t query_len,
+ CHARSET_INFO *cs)
{
FTB *ftb;
FTB_EXPR *ftbe;
@@ -615,8 +615,9 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
FT_WORD *w= (FT_WORD *)phrase_param->document->data;
@@ -647,7 +648,8 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *document, size_t len)
+ const uchar *document,
+ mysql_ft_size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -678,8 +680,8 @@ static int ftb_check_phrase_internal(MYS
-1 is returned if error occurs.
*/
-static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
- FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
+static int _ftb_check_phrase(FTB *ftb, const uchar *document, size_t len,
+ FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
{
MY_FTB_PHRASE_PARAM ftb_param;
MYSQL_FTPARSER_PARAM *param;
@@ -699,7 +701,7 @@ static int _ftb_check_phrase(FTB *ftb, c
param->mysql_add_word= ftb_phrase_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (char *) document;
+ param->doc= document;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
@@ -872,8 +874,9 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -933,7 +936,7 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc, size_t len)
+ const uchar *doc, mysql_ft_size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -997,7 +1000,7 @@ float maria_ft_boolean_find_relevance(FT
{
if (!ftsi.pos)
continue;
- param->doc= (char *)ftsi.pos;
+ param->doc= ftsi.pos;
param->length= ftsi.len;
if (unlikely(parser->parse(param)))
return 0;
=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- a/storage/maria/ma_ft_nlq_search.c 2009-11-29 23:08:56 +0000
+++ b/storage/maria/ma_ft_nlq_search.c 2009-11-30 13:36:06 +0000
@@ -51,6 +51,7 @@ typedef struct st_ft_superdoc
double tmp_weight;
} FT_SUPERDOC;
+
static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)),
FT_SUPERDOC *p1, FT_SUPERDOC *p2)
{
@@ -63,7 +64,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int32 subkeys;
+ FT_WEIGTH subkeys;
int r;
uint doc_cnt;
FT_SUPERDOC sdoc, *sptr;
@@ -91,9 +92,9 @@ static int walk_and_match(FT_WORD *word,
/* Skip rows inserted by current inserted */
for (r= _ma_search(info, &key, SEARCH_FIND, key_root) ;
!r &&
- (subkeys=ft_sintXkorr(info->last_key.data +
- info->last_key.data_length +
- info->last_key.ref_length - extra)) > 0 &&
+ (subkeys.i= ft_sintXkorr(info->last_key.data +
+ info->last_key.data_length +
+ info->last_key.ref_length - extra)) > 0 &&
info->cur_row.lastpos >= info->state->data_file_length ;
r= _ma_search_next(info, &info->last_key, SEARCH_BIGGER, key_root))
;
@@ -112,7 +113,7 @@ static int walk_and_match(FT_WORD *word,
key.data+1, key.data_length-1, 0, 0))
break;
- if (subkeys<0)
+ if (subkeys.i < 0)
{
if (doc_cnt)
DBUG_RETURN(1); /* index is corrupted */
@@ -128,7 +129,8 @@ static int walk_and_match(FT_WORD *word,
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*) (char*) &subkeys;
+ /* The weight we read was actually a float */
+ tmp_weight= subkeys.f;
#else
#error
#endif
@@ -163,9 +165,9 @@ static int walk_and_match(FT_WORD *word,
else
r= _ma_search(info, &info->last_key, SEARCH_BIGGER, key_root);
do_skip:
- while ((subkeys=ft_sintXkorr(info->last_key.data +
- info->last_key.data_length +
- info->last_key.ref_length - extra)) > 0 &&
+ while ((subkeys.i= ft_sintXkorr(info->last_key.data +
+ info->last_key.data_length +
+ info->last_key.ref_length - extra)) > 0 &&
!r && info->cur_row.lastpos >= info->state->data_file_length)
r= _ma_search_next(info, &info->last_key, SEARCH_BIGGER, key_root);
@@ -206,7 +208,7 @@ static int FT_DOC_cmp(void *unused __att
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
- uint query_len, uint flags, uchar *record)
+ size_t query_len, uint flags, uchar *record)
{
TREE wtree;
ALL_IN_ONE aio;
=== modified file 'storage/maria/ma_ft_parser.c'
--- a/storage/maria/ma_ft_parser.c 2009-11-29 23:08:56 +0000
+++ b/storage/maria/ma_ft_parser.c 2009-11-30 13:36:06 +0000
@@ -260,7 +260,7 @@ void maria_ft_parse_init(TREE *wtree, CH
static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
__attribute__((unused)))
{
@@ -290,7 +290,8 @@ static int maria_ft_add_word(MYSQL_FTPAR
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc_arg, size_t doc_len)
+ const uchar *doc_arg,
+ mysql_ft_size_t doc_len)
{
const uchar *doc= doc_arg;
const uchar *end= doc + doc_len;
@@ -306,8 +307,8 @@ static int maria_ft_parse_internal(MYSQL
}
-int maria_ft_parse(TREE *wtree, uchar *doc, int doclen,
- struct st_mysql_ftparser *parser,
+int maria_ft_parse(TREE *wtree, uchar *doc, size_t doclen,
+ struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
MY_FT_PARSER_PARAM my_param;
@@ -320,7 +321,7 @@ int maria_ft_parse(TREE *wtree, uchar *d
param->mysql_add_word= maria_ft_add_word;
param->mysql_ftparam= &my_param;
param->cs= wtree->custom_arg;
- param->doc= (char *) doc;
+ param->doc= doc;
param->length= doclen;
param->mode= MYSQL_FTPARSER_SIMPLE_MODE;
DBUG_RETURN(parser->parse(param));
@@ -380,8 +381,8 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_cal
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
- MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *,
+ mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
=== modified file 'storage/maria/ma_ftdefs.h'
--- a/storage/maria/ma_ftdefs.h 2009-11-29 23:08:56 +0000
+++ b/storage/maria/ma_ftdefs.h 2009-11-30 13:36:06 +0000
@@ -122,15 +122,17 @@ void _ma_ft_segiterator_dummy_init(const
uint _ma_ft_segiterator(FT_SEG_ITERATOR *);
void maria_ft_parse_init(TREE *, CHARSET_INFO *);
-int maria_ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
+int maria_ft_parse(TREE *, uchar *, size_t, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * maria_ft_linearize(TREE *, MEM_ROOT *);
FT_WORD * _ma_ft_parserecord(MARIA_HA *, uint, const uchar *, MEM_ROOT *);
uint _ma_ft_parse(TREE *, MARIA_HA *, uint, const uchar *,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
-FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, uint, uint, uchar *);
-FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, uint, CHARSET_INFO *);
+FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, size_t, uint,
+ uchar *);
+FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, size_t,
+ CHARSET_INFO *);
extern const struct _ft_vft _ma_ft_vft_nlq;
int maria_ft_nlq_read_next(FT_INFO *, char *);
=== modified file 'storage/maria/maria_ftdump.c'
--- a/storage/maria/maria_ftdump.c 2009-11-29 23:08:56 +0000
+++ b/storage/maria/maria_ftdump.c 2009-11-30 13:36:06 +0000
@@ -53,7 +53,7 @@ static struct my_option my_long_options[
int main(int argc,char *argv[])
{
- int error=0, subkeys;
+ int error=0;
uint keylen, keylen2=0, inx, doc_cnt=0;
float weight= 1.0;
double gws, min_gws=0, avg_gws=0;
@@ -112,11 +112,12 @@ int main(int argc,char *argv[])
while (!(error=maria_rnext(info,NULL,inx)))
{
+ FT_WEIGTH subkeys;
keylen=*(info->lastkey_buff);
- subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
- if (subkeys >= 0)
- weight=*(float*) (char*) &subkeys;
+ subkeys.i= ft_sintXkorr(info->lastkey_buff + keylen + 1);
+ if (subkeys.i >= 0)
+ weight= subkeys.f;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);
@@ -153,14 +154,15 @@ int main(int argc,char *argv[])
keylen2=keylen;
doc_cnt=0;
}
- doc_cnt+= (subkeys >= 0 ? 1 : -subkeys);
+ doc_cnt+= (subkeys.i >= 0 ? 1 : -subkeys.i);
}
if (dump)
{
- if (subkeys>=0)
+ if (subkeys.i >= 0)
printf("%9lx %20.7f %s\n", (long) info->cur_row.lastpos,weight,buf);
else
- printf("%9lx => %17d %s\n",(long) info->cur_row.lastpos,-subkeys,buf);
+ printf("%9lx => %17d %s\n",(long) info->cur_row.lastpos,-subkeys.i,
+ buf);
}
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
printf("%10ld\r",total);
=== modified file 'storage/myisam/ft_boolean_search.c'
--- a/storage/myisam/ft_boolean_search.c 2009-11-29 23:08:56 +0000
+++ b/storage/myisam/ft_boolean_search.c 2009-11-30 13:36:06 +0000
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,7 +282,7 @@ static int ftb_query_add_word(MYSQL_FTPA
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *query, size_t len)
+ const uchar *query, mysql_ft_size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
@@ -616,7 +616,7 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -648,7 +648,8 @@ static int ftb_phrase_add_word(MYSQL_FTP
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *document, size_t len)
+ const uchar *document,
+ mysql_ft_size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -874,8 +875,9 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -935,7 +937,7 @@ static int ftb_find_relevance_add_word(M
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc, size_t len)
+ const uchar *doc, mysql_ft_size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c 2009-11-29 23:08:56 +0000
+++ b/storage/myisam/ft_nlq_search.c 2009-11-30 13:36:06 +0000
@@ -63,7 +63,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int32 subkeys;
+ FT_WEIGTH subkeys;
int r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
@@ -91,7 +91,7 @@ static int walk_and_match(FT_WORD *word,
/* Skip rows inserted by current inserted */
for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) ;
!r &&
- (subkeys=ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
+ (subkeys.i= ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
info->lastpos >= info->state->data_file_length ;
r= _mi_search_next(info, keyinfo, info->lastkey,
info->lastkey_length, SEARCH_BIGGER, key_root))
@@ -108,7 +108,7 @@ static int walk_and_match(FT_WORD *word,
info->lastkey_length-extra-1, keybuff+1,keylen-1,0,0))
break;
- if (subkeys<0)
+ if (subkeys.i < 0)
{
if (doc_cnt)
DBUG_RETURN(1); /* index is corrupted */
@@ -125,7 +125,7 @@ static int walk_and_match(FT_WORD *word,
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
/* The weight we read was actually a float */
- tmp_weight=*(float*) (char*) &subkeys;
+ tmp_weight= subkeys.f;
#else
#error
#endif
@@ -162,7 +162,7 @@ static int walk_and_match(FT_WORD *word,
r=_mi_search(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
do_skip:
- while ((subkeys=ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
+ while ((subkeys.i= ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
!r && info->lastpos >= info->state->data_file_length)
r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
=== modified file 'storage/myisam/ft_parser.c'
--- a/storage/myisam/ft_parser.c 2009-11-29 23:08:56 +0000
+++ b/storage/myisam/ft_parser.c 2009-11-30 13:36:06 +0000
@@ -258,7 +258,7 @@ void ft_parse_init(TREE *wtree, CHARSET_
static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
__attribute__((unused)))
{
@@ -288,7 +288,7 @@ static int ft_add_word(MYSQL_FTPARSER_PA
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc_arg, size_t doc_len)
+ const uchar *doc_arg, mysql_ft_size_t doc_len)
{
const uchar *doc= doc_arg;
const uchar *end= doc + doc_len;
@@ -379,8 +379,8 @@ MYSQL_FTPARSER_PARAM *ftparser_call_init
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
- MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *,
+ mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
=== modified file 'storage/myisam/myisam_ftdump.c'
--- a/storage/myisam/myisam_ftdump.c 2009-11-29 23:08:56 +0000
+++ b/storage/myisam/myisam_ftdump.c 2009-11-30 13:36:06 +0000
@@ -53,7 +53,7 @@ static struct my_option my_long_options[
int main(int argc,char *argv[])
{
- int error=0, subkeys;
+ int error=0;
uint keylen, keylen2=0, inx, doc_cnt=0;
float weight= 1.0;
double gws, min_gws=0, avg_gws=0;
@@ -109,11 +109,12 @@ int main(int argc,char *argv[])
while (!(error=mi_rnext(info,NULL,inx)))
{
+ FT_WEIGTH subkeys;
keylen=*(info->lastkey);
- subkeys=ft_sintXkorr(info->lastkey+keylen+1);
- if (subkeys >= 0)
- weight= *(float*) (char*) &subkeys;
+ subkeys.i =ft_sintXkorr(info->lastkey+keylen+1);
+ if (subkeys.i >= 0)
+ weight= subkeys.f;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
@@ -150,14 +151,14 @@ int main(int argc,char *argv[])
keylen2=keylen;
doc_cnt=0;
}
- doc_cnt+= (subkeys >= 0 ? 1 : -subkeys);
+ doc_cnt+= (subkeys.i >= 0 ? 1 : -subkeys.i);
}
if (dump)
{
- if (subkeys>=0)
+ if (subkeys.i >= 0)
printf("%9lx %20.7f %s\n", (long) info->lastpos,weight,buf);
else
- printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys,buf);
+ printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys.i,buf);
}
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
printf("%10ld\r",total);
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2778)
by knielsen@knielsen-hq.org 30 Nov '09
by knielsen@knielsen-hq.org 30 Nov '09
30 Nov '09
#At lp:maria
2778 knielsen(a)knielsen-hq.org 2009-11-30
After-merge fixes for MySQL 5.1.41 merge into MariaDB: Another warning also needed during shutdown.
modified:
mysql-test/mysql-test-run.pl
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-11-27 13:20:59 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-11-30 13:24:30 +0000
@@ -3999,6 +3999,7 @@ sub extract_warning_lines ($) {
qr/Slave I\/O: Get master COLLATION_SERVER failed with error:.*/,
qr/Slave I\/O: Get master TIME_ZONE failed with error:.*/,
qr/Slave I\/O: error reconnecting to master '.*' - retry-time: [1-3] retries/,
+ qr/Error reading packet/,
);
my $match_count= 0;
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2777)
by Michael Widenius 30 Nov '09
by Michael Widenius 30 Nov '09
30 Nov '09
#At lp:maria based on revid:knielsen@knielsen-hq.org-20091127132059-3su1w7xhsbbtpg6f
2777 Michael Widenius 2009-11-30
Added more general support for sorting 2 characters as one (contractions)
Added support for Croatian sorting orders utf8_croatian_ci and ucs2_croatian_ci.
Patch done by Alexander Barkov. See http://www.collation-charts.org/articles/croatian.htm
modified:
include/m_ctype.h
mysql-test/r/ctype_uca.result
mysql-test/t/ctype_uca.test
mysys/charset-def.c
strings/ctype-mb.c
strings/ctype-uca.c
strings/ctype-ucs2.c
per-file messages:
mysql-test/r/ctype_uca.result
Added testing of Croatian sort order
mysql-test/t/ctype_uca.test
Added testing of Croatian sort order
=== modified file 'include/m_ctype.h'
--- a/include/m_ctype.h 2009-09-07 20:50:10 +0000
+++ b/include/m_ctype.h 2009-11-30 12:42:24 +0000
@@ -49,6 +49,24 @@ typedef struct unicase_info_st
extern MY_UNICASE_INFO *my_unicase_default[256];
extern MY_UNICASE_INFO *my_unicase_turkish[256];
+#define MY_UCA_MAX_CONTRACTION 4
+#define MY_UCA_MAX_WEIGHT_SIZE 8
+
+typedef struct my_contraction_t
+{
+ my_wc_t ch[MY_UCA_MAX_CONTRACTION]; /* Character sequence */
+ uint16 weight[MY_UCA_MAX_WEIGHT_SIZE];/* Its weight string, 0-terminated */
+} MY_CONTRACTION;
+
+
+typedef struct my_contraction_list_t
+{
+ size_t nitems; /* Number of items in the list */
+ MY_CONTRACTION *item; /* List of contractions */
+ char *flags; /* Character flags, e.g. "is contraction head") */
+} MY_CONTRACTIONS;
+
+
typedef struct uni_ctype_st
{
uchar pctype;
@@ -262,7 +280,7 @@ typedef struct charset_info_st
uchar *to_lower;
uchar *to_upper;
uchar *sort_order;
- uint16 *contractions;
+ MY_CONTRACTIONS *contractions;
uint16 **sort_order_big;
uint16 *tab_to_uni;
MY_UNI_IDX *tab_from_uni;
@@ -475,6 +493,13 @@ my_bool my_charset_is_ascii_based(CHARSE
my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs);
uint my_charset_repertoire(CHARSET_INFO *cs);
+my_bool my_uca_have_contractions(CHARSET_INFO *cs);
+my_bool my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc);
+my_bool my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc);
+uint16 *my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2);
+
+
+
#define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */
=== modified file 'mysql-test/r/ctype_uca.result'
--- a/mysql-test/r/ctype_uca.result 2008-03-26 09:51:16 +0000
+++ b/mysql-test/r/ctype_uca.result 2009-11-30 12:42:24 +0000
@@ -159,6 +159,7 @@ insert into t1 values (_ucs2 0x01fc),(_u
insert into t1 values ('AA'),('Aa'),('aa'),('aA');
insert into t1 values ('CH'),('Ch'),('ch'),('cH');
insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
+insert into t1 values ('D��'),('D��'),('d��'),('d��');
insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
insert into t1 values ('LL'),('Ll'),('ll'),('lL');
@@ -181,7 +182,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -286,7 +287,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��,��
��
@@ -400,6 +401,7 @@ CH,Ch,cH,ch
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -513,7 +515,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -622,6 +624,7 @@ CH,Ch,cH,ch
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -729,7 +732,7 @@ CH,Ch,cH,ch
��,��
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -840,6 +843,7 @@ CH,Ch,cH,ch
��,��
D,d,��,��
DZ,Dz,dZ,dz
+D��,D��,d��,d��
��,��,��,��,��,��
��,��
��
@@ -951,7 +955,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1056,7 +1060,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1164,7 +1168,7 @@ CH,Ch,cH,ch
��,��
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1275,6 +1279,7 @@ cH
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -1382,7 +1387,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1491,6 +1496,7 @@ cH
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -1599,6 +1605,7 @@ cH
��,��
D,d,��,��
DZ,Dz,dZ,dz,��,��,��,��,��,��
+D��,D��,d��,d��
��,��
��
��
@@ -1707,7 +1714,7 @@ cH
CH,Ch,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1813,7 +1820,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -1921,7 +1928,7 @@ CH,Ch,cH,ch
��,��
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -2030,7 +2037,7 @@ C,c,��,��,��,��,��,��,��,��,��,��
CH,Ch,cH,ch
��,��
D,d,��,��
-DZ,Dz,dZ,dz,��,��,��,��,��,��
+DZ,Dz,D��,D��,dZ,dz,d��,d��,��,��,��,��,��,��
��,��
��
��
@@ -2121,6 +2128,118 @@ Z,z,��,��,��,��,��,��
��
��
��
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_croatian_ci;
+group_concat(c1 order by c1)
+��
+��
+A,a,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+AA,Aa,aA,aa
+��,��,��,��,��,��
+B,b
+��
+��
+��,��
+C,c,��,��,��,��,��,��
+CH,Ch,cH,ch
+��,��
+��,��
+��,��
+D,d,��,��
+DZ,Dz,dZ,dz,��,��,��
+d��
+D��,D��,d��,��,��,��
+��,��
+��
+��
+��,��
+��,��
+E,e,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+��,��
+��
+��
+F,f
+��,��
+G,g,��,��,��,��,��,��,��,��,��,��,��,��
+��,��
+��
+��
+��,��
+H,h,��,��
+��,��
+��,��
+I,i,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+IJ,Ij,iJ,ij,��,��
+��
+��
+��
+J,j,��,��,��
+K,k,��,��,��,��
+��,��
+L,l,��,��,��,��,��,��
+��,��
+lJ
+LL,Ll,lL,ll
+LJ,Lj,lj,��,��,��
+��,��
+��
+��
+M,m
+N,n,��,��,��,��,��,��,��,��,��,��
+nJ
+NJ,Nj,nj,��,��,��
+��
+��
+��,��
+O,o,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+OE,Oe,oE,oe,��,��
+��,��,��,��
+��
+��
+P,p
+��,��
+Q,q
+��
+R,r,��,��,��,��,��,��
+RR,Rr,rR,rr
+��
+S,s,��,��,��,��,��,��,��
+SS,Ss,sS,ss,��
+��,��
+��
+��
+T,t,��,��,��,��
+��
+��,��
+��
+��,��
+��
+U,u,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��,��
+��
+��
+V,v
+��
+W,w,��,��
+X,x
+Y,y,��,��,��,��,��,��
+��,��
+Z,z,��,��,��,��
+��
+��,��
+��,��
+��,��,��
+��,��
+��
+��,��
+��,��
+��
+��,��
+��,��
+��,��
+��
+��
+��
+��
+��
drop table t1;
SET NAMES utf8;
CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_general_ci, INDEX (c));
=== modified file 'mysql-test/t/ctype_uca.test'
--- a/mysql-test/t/ctype_uca.test 2008-02-20 18:49:26 +0000
+++ b/mysql-test/t/ctype_uca.test 2009-11-30 12:42:24 +0000
@@ -186,6 +186,7 @@ insert into t1 values (_ucs2 0x01fc),(_u
insert into t1 values ('AA'),('Aa'),('aa'),('aA');
insert into t1 values ('CH'),('Ch'),('ch'),('cH');
insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
+insert into t1 values ('D��'),('D��'),('d��'),('d��');
insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
insert into t1 values ('LL'),('Ll'),('ll'),('lL');
@@ -213,6 +214,7 @@ select group_concat(c1 order by c1) from
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_esperanto_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_hungarian_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_croatian_ci;
drop table t1;
=== modified file 'mysys/charset-def.c'
--- a/mysys/charset-def.c 2007-06-21 20:10:40 +0000
+++ b/mysys/charset-def.c 2009-11-30 12:42:24 +0000
@@ -42,6 +42,7 @@ extern CHARSET_INFO my_charset_ucs2_roma
extern CHARSET_INFO my_charset_ucs2_persian_uca_ci;
extern CHARSET_INFO my_charset_ucs2_esperanto_uca_ci;
extern CHARSET_INFO my_charset_ucs2_hungarian_uca_ci;
+extern CHARSET_INFO my_charset_ucs2_croatian_uca_ci;
#endif
#ifdef HAVE_CHARSET_utf8
@@ -63,6 +64,7 @@ extern CHARSET_INFO my_charset_utf8_roma
extern CHARSET_INFO my_charset_utf8_persian_uca_ci;
extern CHARSET_INFO my_charset_utf8_esperanto_uca_ci;
extern CHARSET_INFO my_charset_utf8_hungarian_uca_ci;
+extern CHARSET_INFO my_charset_utf8_croatian_uca_ci;
#ifdef HAVE_UTF8_GENERAL_CS
extern CHARSET_INFO my_charset_utf8_general_cs;
#endif
@@ -152,6 +154,7 @@ my_bool init_compiled_charsets(myf flags
add_compiled_collation(&my_charset_ucs2_persian_uca_ci);
add_compiled_collation(&my_charset_ucs2_esperanto_uca_ci);
add_compiled_collation(&my_charset_ucs2_hungarian_uca_ci);
+ add_compiled_collation(&my_charset_ucs2_croatian_uca_ci);
#endif
#endif
@@ -186,6 +189,7 @@ my_bool init_compiled_charsets(myf flags
add_compiled_collation(&my_charset_utf8_persian_uca_ci);
add_compiled_collation(&my_charset_utf8_esperanto_uca_ci);
add_compiled_collation(&my_charset_utf8_hungarian_uca_ci);
+ add_compiled_collation(&my_charset_utf8_croatian_uca_ci);
#endif
#endif
=== modified file 'strings/ctype-mb.c'
--- a/strings/ctype-mb.c 2009-02-13 16:41:47 +0000
+++ b/strings/ctype-mb.c 2009-11-30 12:42:24 +0000
@@ -567,8 +567,7 @@ my_bool my_like_range_mb(CHARSET_INFO *c
char *min_end= min_str + res_length;
char *max_end= max_str + res_length;
size_t maxcharlen= res_length / cs->mbmaxlen;
- const char *contraction_flags= cs->contractions ?
- ((const char*) cs->contractions) + 0x40*0x40 : NULL;
+ my_bool have_contractions= my_uca_have_contractions(cs);
for (; ptr != end && min_str != min_end && maxcharlen ; maxcharlen--)
{
@@ -636,8 +635,8 @@ fill_max_and_min:
'ab\min\min\min\min' and 'ab\max\max\max\max'.
*/
- if (contraction_flags && ptr + 1 < end &&
- contraction_flags[(uchar) *ptr])
+ if (have_contractions && ptr + 1 < end &&
+ my_uca_can_be_contraction_head(cs, (uchar) *ptr))
{
/* Ptr[0] is a contraction head. */
@@ -659,8 +658,8 @@ fill_max_and_min:
is not a contraction, then we put only ptr[0],
and continue with ptr[1] on the next loop.
*/
- if (contraction_flags[(uchar) ptr[1]] &&
- cs->contractions[(*ptr-0x40)*0x40 + ptr[1] - 0x40])
+ if (my_uca_can_be_contraction_tail(cs, (uchar) ptr[1]) &&
+ my_uca_contraction2_weight(cs, (uchar) ptr[0], (uchar) ptr[1]))
{
/* Contraction found */
if (maxcharlen == 1 || min_str + 1 >= min_end)
=== modified file 'strings/ctype-uca.c'
--- a/strings/ctype-uca.c 2009-11-16 20:49:51 +0000
+++ b/strings/ctype-uca.c 2009-11-30 12:42:24 +0000
@@ -6713,6 +6713,16 @@ static const char hungarian[]=
"&U < \\u00FC <<< \\u00DC << \\u0171 <<< \\u0170";
+static const char croatian[]=
+
+"&C < \\u010D <<< \\u010C < \\u0107 <<< \\u0106 "
+"&D < d\\u017E <<< \\u01C6 <<< D\\u017E <<< \\u01C5 <<< D\\u017D <<< \\u01C4 "
+" < \\u0111 <<< \\u0110 "
+"&L < lj <<< \\u01C9 <<< Lj <<< \\u01C8 <<< LJ <<< \\u01C7 "
+"&N < nj <<< \\u01CC <<< Nj <<< \\u01CB <<< NJ <<< \\u01CA "
+"&S < \\u0161 <<< \\u0160 "
+"&Z < \\u017E <<< \\u017D";
+
/*
Unicode Collation Algorithm:
Collation element (weight) scanner,
@@ -6726,7 +6736,7 @@ typedef struct my_uca_scanner_st
const uchar *send; /* End of the input string */
uchar *uca_length;
uint16 **uca_weight;
- uint16 *contractions;
+ MY_CONTRACTIONS *contractions;
uint16 implicit[2];
int page;
int code;
@@ -6747,6 +6757,164 @@ typedef struct my_uca_scanner_handler_st
static uint16 nochar[]= {0,0};
+#define MY_UCA_CNT_FLAG_SIZE 4096
+#define MY_UCA_CNT_FLAG_MASK 4095
+
+#define MY_UCA_CNT_HEAD 1
+#define MY_UCA_CNT_TAIL 2
+
+
+
+
+/********** Helper functions to handle contraction ************/
+
+
+/**
+ Mark a character as a contraction part
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Unicode code point
+ @flag flag: "is contraction head", "is contraction tail"
+*/
+
+static void
+my_uca_add_contraction_flag(CHARSET_INFO *cs, my_wc_t wc, int flag)
+{
+ cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK]|= flag;
+}
+
+
+/**
+ Add a new contraction into contraction list
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Unicode code points of the characters
+ @len Number of characters
+
+ @return New contraction
+ @retval Pointer to a newly added contraction
+*/
+
+static MY_CONTRACTION *
+my_uca_add_contraction(CHARSET_INFO *cs,
+ my_wc_t *wc, int len __attribute__((unused)))
+{
+ MY_CONTRACTIONS *list= cs->contractions;
+ MY_CONTRACTION *next= &list->item[list->nitems];
+ DBUG_ASSERT(len == 2); /* We currently support only contraction2 */
+ next->ch[0]= wc[0];
+ next->ch[1]= wc[1];
+ list->nitems++;
+ return next;
+}
+
+
+/**
+ Allocate and initialize memory for contraction list and flags
+
+ @cs Pointer to CHARSET_INFO data
+ @alloc Memory allocation function (typically points to my_alloc_once)
+ @n Number of contractions
+
+ @return Error code
+ @retval 0 - memory allocated successfully
+ @retval 1 - not enough memory
+*/
+
+static my_bool
+my_uca_alloc_contractions(CHARSET_INFO *cs, void *(*alloc)(size_t), size_t n)
+{
+ uint size= n * sizeof(MY_CONTRACTION);
+ if (!(cs->contractions= (*alloc)(sizeof(MY_CONTRACTIONS))))
+ return 1;
+ bzero(cs->contractions, sizeof(MY_CONTRACTIONS));
+ if (!(cs->contractions->item= (*alloc)(size)) ||
+ !(cs->contractions->flags= (char*) (*alloc)(MY_UCA_CNT_FLAG_SIZE)))
+ return 1;
+ bzero((void*) cs->contractions->item, size);
+ bzero((void*) cs->contractions->flags, MY_UCA_CNT_FLAG_SIZE);
+ return 0;
+}
+
+
+/**
+ Check if UCA data has contractions (public version)
+
+ @cs Pointer to CHARSET_INFO data
+ @retval 0 - no contraction, 1 - have contractions.
+*/
+
+my_bool
+my_uca_have_contractions(CHARSET_INFO *cs)
+{
+ return cs->contractions != NULL;
+}
+
+
+/**
+ Check if a character can be contraction head
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Code point
+
+ @retval 0 - cannot be contraction head
+ @retval 1 - can be contraction head
+*/
+
+my_bool
+my_uca_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_HEAD;
+}
+
+
+/**
+ Check if a character can be contraction tail
+
+ @cs Pointer to CHARSET_INFO data
+ @wc Code point
+
+ @retval 0 - cannot be contraction tail
+ @retval 1 - can be contraction tail
+*/
+
+my_bool
+my_uca_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc)
+{
+ return cs->contractions->flags[wc & MY_UCA_CNT_FLAG_MASK] & MY_UCA_CNT_TAIL;
+}
+
+
+/**
+ Find a contraction and return its weight array
+
+ @cs Pointer to CHARSET data
+ @wc1 First character
+ @wc2 Second character
+
+ @return Weight array
+ @retval NULL - no contraction found
+ @retval ptr - contraction weight array
+*/
+
+uint16 *
+my_uca_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
+{
+ MY_CONTRACTIONS *list= cs->contractions;
+ MY_CONTRACTION *c, *last;
+ for (c= list->item, last= &list->item[list->nitems]; c < last; c++)
+ {
+ if (c->ch[0] == wc1 && c->ch[1] == wc2)
+ {
+ return c->weight;
+ }
+ }
+ return NULL;
+}
+
+
+
+
#ifdef HAVE_CHARSET_ucs2
/*
Initialize collation weight scanner
@@ -6766,7 +6934,7 @@ static uint16 nochar[]= {0,0};
*/
static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner,
- CHARSET_INFO *cs __attribute__((unused)),
+ CHARSET_INFO *cs,
const uchar *str, size_t length)
{
scanner->wbeg= nochar;
@@ -6777,6 +6945,7 @@ static void my_uca_scanner_init_ucs2(my_
scanner->uca_length= cs->sort_order;
scanner->uca_weight= cs->sort_order_big;
scanner->contractions= cs->contractions;
+ scanner->cs= cs;
return;
}
@@ -6865,18 +7034,23 @@ static int my_uca_scanner_next_ucs2(my_u
if (scanner->contractions && (scanner->sbeg <= scanner->send))
{
- int cweight;
+ my_wc_t wc1= ((scanner->page << 8) | scanner->code);
- if (!scanner->page && !scanner->sbeg[0] &&
- (scanner->sbeg[1] > 0x40) && (scanner->sbeg[1] < 0x80) &&
- (scanner->code > 0x40) && (scanner->code < 0x80) &&
- (cweight= scanner->contractions[(scanner->code-0x40)*0x40+scanner->sbeg[1]-0x40]))
+ if (my_uca_can_be_contraction_head(scanner->cs, wc1))
+ {
+ uint16 *cweight;
+ my_wc_t wc2= (((my_wc_t) scanner->sbeg[0]) << 8) | scanner->sbeg[1];
+ if (my_uca_can_be_contraction_tail(scanner->cs, wc2) &&
+ (cweight= my_uca_contraction2_weight(scanner->cs,
+ scanner->code,
+ scanner->sbeg[1])))
{
scanner->implicit[0]= 0;
scanner->wbeg= scanner->implicit;
scanner->sbeg+=2;
- return cweight;
+ return *cweight;
}
+ }
}
if (!ucaw[scanner->page])
@@ -6959,23 +7133,22 @@ static int my_uca_scanner_next_any(my_uc
scanner->code= wc & 0xFF;
scanner->sbeg+= mb_len;
- if (scanner->contractions && !scanner->page &&
- (scanner->code > 0x40) && (scanner->code < 0x80))
+ if (my_uca_have_contractions(scanner->cs) &&
+ my_uca_can_be_contraction_head(scanner->cs, wc))
{
- uint page1, code1, cweight;
+ my_wc_t wc2;
+ uint16 *cweight;
- if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc,
+ if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc2,
scanner->sbeg,
scanner->send)) >=0) &&
- (!(page1= (wc >> 8))) &&
- ((code1= (wc & 0xFF)) > 0x40) &&
- (code1 < 0x80) &&
- (cweight= scanner->contractions[(scanner->code-0x40)*0x40 + code1-0x40]))
+ my_uca_can_be_contraction_tail(scanner->cs, wc2) &&
+ (cweight= my_uca_contraction2_weight(scanner->cs, wc, wc2)))
{
scanner->implicit[0]= 0;
scanner->wbeg= scanner->implicit;
scanner->sbeg+= mb_len;
- return cweight;
+ return *cweight;
}
}
@@ -7012,6 +7185,33 @@ static my_uca_scanner_handler my_any_uca
my_uca_scanner_next_any
};
+
+
+/**
+ Helper function:
+ Find address of weights of the given character.
+
+ @weights UCA weight array
+ @lengths UCA length array
+ @ch character Unicode code point
+
+ @return Weight array
+ @retval pointer to weight array for the given character,
+ or NULL if this page does not have implicit weights.
+*/
+
+static inline uint16 *
+my_char_weight_addr(CHARSET_INFO *cs, uint wc)
+{
+ uint page= (wc >> 8);
+ uint ofst= wc & 0xFF;
+ return cs->sort_order_big[page] ?
+ cs->sort_order_big[page] + ofst * cs->sort_order[page] :
+ NULL;
+}
+
+
+
/*
Compares two strings according to the collation
@@ -7683,8 +7883,8 @@ ex:
typedef struct my_coll_rule_item_st
{
- uint base; /* Base character */
- uint curr[2]; /* Current character */
+ my_wc_t base; /* Base character */
+ my_wc_t curr[2]; /* Current character */
int diff[3]; /* Primary, Secondary and Tertiary difference */
} MY_COLL_RULE;
@@ -7834,6 +8034,7 @@ static int my_coll_rule_parse(MY_COLL_RU
static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t))
{
MY_COLL_RULE rule[MY_MAX_COLL_RULE];
+ MY_COLL_RULE *r, *rfirst, *rlast;
char errstr[128];
uchar *newlengths;
uint16 **newweights;
@@ -7858,6 +8059,9 @@ static my_bool create_tailoring(CHARSET_
return 1;
}
+ rfirst= rule;
+ rlast= rule + rc;
+
if (!cs->caseinfo)
cs->caseinfo= my_unicase_default;
@@ -7941,44 +8145,21 @@ static my_bool create_tailoring(CHARSET_
/* Now process contractions */
if (ncontractions)
{
- /*
- 8K for weights for basic latin letter pairs,
- plus 256 bytes for "is contraction part" flags.
- */
- uint size= 0x40*0x40*sizeof(uint16) + 256;
- char *contraction_flags;
- if (!(cs->contractions= (uint16*) (*alloc)(size)))
- return 1;
- bzero((void*)cs->contractions, size);
- contraction_flags= ((char*) cs->contractions) + 0x40*0x40;
- for (i=0; i < rc; i++)
+ if (my_uca_alloc_contractions(cs, alloc, ncontractions))
+ return 1;
+ for (r= rfirst; r < rlast; r++)
{
- if (rule[i].curr[1])
+ uint16 *to;
+ if (r->curr[1]) /* Contraction */
{
- uint pageb= (rule[i].base >> 8) & 0xFF;
- uint chb= rule[i].base & 0xFF;
- uint16 *offsb= defweights[pageb] + chb*deflengths[pageb];
- uint offsc;
-
- if (offsb[1] ||
- rule[i].curr[0] < 0x40 || rule[i].curr[0] > 0x7f ||
- rule[i].curr[1] < 0x40 || rule[i].curr[1] > 0x7f)
- {
- /*
- TODO: add error reporting;
- We support only basic latin letters contractions at this point.
- Also, We don't support contractions with weight longer than one.
- Otherwise, we'd need much more memory.
- */
- return 1;
- }
- offsc= (rule[i].curr[0]-0x40)*0x40+(rule[i].curr[1]-0x40);
-
- /* Copy base weight applying primary difference */
- cs->contractions[offsc]= offsb[0] + rule[i].diff[0];
- /* Mark both letters as "is contraction part */
- contraction_flags[rule[i].curr[0]]= 1;
- contraction_flags[rule[i].curr[1]]= 1;
+ /* Mark both letters as "is contraction part" */
+ my_uca_add_contraction_flag(cs, r->curr[0], MY_UCA_CNT_HEAD);
+ my_uca_add_contraction_flag(cs, r->curr[1], MY_UCA_CNT_TAIL);
+ to= my_uca_add_contraction(cs, r->curr, 2)->weight;
+ /* Copy weight from the reset character */
+ to[0]= my_char_weight_addr(cs, r->base)[0];
+ /* Apply primary difference */
+ to[0]+= r->diff[0];
}
}
}
@@ -8701,6 +8882,39 @@ CHARSET_INFO my_charset_ucs2_hungarian_u
};
+CHARSET_INFO my_charset_ucs2_croatian_uca_ci=
+{
+ 149,0,0, /* number */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ "ucs2", /* cs name */
+ "ucs2_croatian_ci", /* name */
+ "", /* comment */
+ croatian, /* tailoring */
+ NULL, /* ctype */
+ NULL, /* to_lower */
+ NULL, /* to_upper */
+ NULL, /* sort_order */
+ NULL, /* contractions */
+ NULL, /* sort_order_big*/
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ my_unicase_default, /* caseinfo */
+ NULL, /* state_map */
+ NULL, /* ident_map */
+ 8, /* strxfrm_multiply */
+ 1, /* caseup_multiply */
+ 1, /* casedn_multiply */
+ 2, /* mbminlen */
+ 2, /* mbmaxlen */
+ 9, /* min_sort_char */
+ 0xFFFF, /* max_sort_char */
+ ' ', /* pad char */
+ 0, /* escape_with_backslash_is_dangerous */
+ &my_charset_ucs2_handler,
+ &my_collation_ucs2_uca_handler
+};
+
+
#endif
@@ -9358,6 +9572,38 @@ CHARSET_INFO my_charset_utf8_hungarian_u
&my_collation_any_uca_handler
};
+CHARSET_INFO my_charset_utf8_croatian_uca_ci=
+{
+ 213,0,0, /* number */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
+ "utf8", /* cs name */
+ "utf8_croatian_ci", /* name */
+ "", /* comment */
+ croatian, /* tailoring */
+ ctype_utf8, /* ctype */
+ NULL, /* to_lower */
+ NULL, /* to_upper */
+ NULL, /* sort_order */
+ NULL, /* contractions */
+ NULL, /* sort_order_big*/
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ my_unicase_default, /* caseinfo */
+ NULL, /* state_map */
+ NULL, /* ident_map */
+ 8, /* strxfrm_multiply */
+ 1, /* caseup_multiply */
+ 1, /* casedn_multiply */
+ 1, /* mbminlen */
+ 3, /* mbmaxlen */
+ 9, /* min_sort_char */
+ 0xFFFF, /* max_sort_char */
+ ' ', /* pad char */
+ 0, /* escape_with_backslash_is_dangerous */
+ &my_charset_utf8_handler,
+ &my_collation_any_uca_handler
+};
+
#endif /* HAVE_CHARSET_utf8 */
#endif /* HAVE_UCA_COLLATIONS */
=== modified file 'strings/ctype-ucs2.c'
--- a/strings/ctype-ucs2.c 2009-10-15 21:38:29 +0000
+++ b/strings/ctype-ucs2.c 2009-11-30 12:42:24 +0000
@@ -1526,8 +1526,7 @@ my_bool my_like_range_ucs2(CHARSET_INFO
char *min_org=min_str;
char *min_end=min_str+res_length;
size_t charlen= res_length / cs->mbmaxlen;
- const char *contraction_flags= cs->contractions ?
- ((const char*) cs->contractions) + 0x40*0x40 : NULL;
+ my_bool have_contractions= my_uca_have_contractions(cs);
for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0
; ptr+=2, charlen--)
@@ -1567,8 +1566,9 @@ fill_max_and_min:
return 0;
}
- if (contraction_flags && ptr + 3 < end &&
- ptr[0] == '\0' && contraction_flags[(uchar) ptr[1]])
+ if (have_contractions && ptr + 3 < end &&
+ ptr[0] == '\0' &&
+ my_uca_can_be_contraction_head(cs, (uchar) ptr[1]))
{
/* Contraction head found */
if (ptr[2] == '\0' && (ptr[3] == w_one || ptr[3] == w_many))
@@ -1581,8 +1581,9 @@ fill_max_and_min:
Check if the second letter can be contraction part,
and if two letters really produce a contraction.
*/
- if (ptr[2] == '\0' && contraction_flags[(uchar) ptr[3]] &&
- cs->contractions[(ptr[1]-0x40)*0x40 + ptr[3] - 0x40])
+ if (ptr[2] == '\0' &&
+ my_uca_can_be_contraction_tail(cs, (uchar) ptr[3]) &&
+ my_uca_contraction2_weight(cs,(uchar) ptr[1], (uchar) ptr[3]))
{
/* Contraction found */
if (charlen == 1 || min_str + 2 >= min_end)
1
0
[Maria-developers] MWL#47: On the question of annotations persisting from one binary log to another
by Sergey Petrunya 30 Nov '09
by Sergey Petrunya 30 Nov '09
30 Nov '09
Hi Alex,
My opinion is as follows:
When log-slave-updates is not set, the slave is not binlogging the updates
it is applying, so the comments do not go to the binary log either.
When log-slave-updates is set, the action should depend on the
binlog-annotate-row-events setting, like it's done on the master. That is,
if binlog-annotate-row-events is on, annotate events should be passed to
slave's binary log, otherwise they should be discarded.
There is one hole left: if one does
mysqlbinlog /path/to/binlog | mysql --host=slave-which-has-log-slave-updates
then the annotations will not make it to slave's binary log. I think that
should be ok, but we better get a confirmation of this to be sure.
One should also take care that the slave do not write annotations for SQL
statements in form of
BINLOG 'xaqw324435324hnjsfp'
as they are not useful (or at least don't copy the entire 'xaqe23....' part).
BR
Sergey
--
Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog
1
0