summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <lenz@mysql.com>2005-02-02 21:36:40 +0100
committerunknown <lenz@mysql.com>2005-02-02 21:36:40 +0100
commit355f7128c4e8815a5dc13377b1689746bd690d0d (patch)
tree97b2a393cc92322522d56ed12c7bdbd6b4754c03
parent7d3553590ff97fd74610198dfcc7c9f511256023 (diff)
parentad21db5e0727704ee0527c08410bafff4d3150f4 (diff)
downloadmariadb-git-355f7128c4e8815a5dc13377b1689746bd690d0d.tar.gz
Merge mysql.com:/data0/mysqldev/my/mysql-4.1
into mysql.com:/data0/mysqldev/my/mysql-4.1-build configure.in: Auto merged
-rw-r--r--client/mysqldump.c36
-rw-r--r--configure.in4
-rw-r--r--extra/perror.c14
-rw-r--r--innobase/include/univ.i4
-rw-r--r--mysql-test/r/compare.result3
-rw-r--r--mysql-test/t/compare.test2
-rw-r--r--mysys/my_handler.c6
-rw-r--r--sql/sql_table.cc9
-rw-r--r--sql/sql_update.cc3
-rw-r--r--strings/ctype-big5.c4
-rw-r--r--strings/ctype-bin.c4
-rw-r--r--strings/ctype-gbk.c4
-rw-r--r--strings/ctype-latin1.c4
-rw-r--r--strings/ctype-mb.c4
-rw-r--r--strings/ctype-simple.c6
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-tis620.c4
-rw-r--r--strings/ctype-ucs2.c4
-rw-r--r--strings/ctype-utf8.c4
19 files changed, 67 insertions, 56 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index afaa2dc5a6d..52255ccb896 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2091,27 +2091,27 @@ static int dump_all_tables_in_db(char *database)
RETURN
void
*/
-static void get_actual_table_name( const char *old_table_name,
- char *new_table_name,
- int buf_size )
-{
- MYSQL_RES *tableRes;
- MYSQL_ROW row;
- char query[ NAME_LEN + 50 ];
- DBUG_ENTER("get_actual_table_name");
+static void get_actual_table_name(const char *old_table_name,
+ char *new_table_name,
+ int buf_size)
+{
+ MYSQL_RES *tableRes;
+ MYSQL_ROW row;
+ char query[ NAME_LEN + 50 ];
+ DBUG_ENTER("get_actual_table_name");
- sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name );
- if (mysql_query_with_error_report(sock, 0, query))
- {
- safe_exit(EX_MYSQLERR);
- }
+ sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name);
+ if (mysql_query_with_error_report(sock, 0, query))
+ {
+ safe_exit(EX_MYSQLERR);
+ }
- tableRes = mysql_store_result( sock );
- row = mysql_fetch_row( tableRes );
- strncpy( new_table_name, row[0], buf_size );
- mysql_free_result(tableRes);
-} /* get_actual_table_name */
+ tableRes= mysql_store_result( sock );
+ row= mysql_fetch_row( tableRes );
+ strmake(new_table_name, row[0], buf_size-1);
+ mysql_free_result(tableRes);
+}
static int dump_selected_tables(char *db, char **table_names, int tables)
diff --git a/configure.in b/configure.in
index 2ad8cb2ac68..caa42004736 100644
--- a/configure.in
+++ b/configure.in
@@ -1677,8 +1677,8 @@ then
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
- CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
+ CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC -DUNIV_DEBUG $CFLAGS"
+ CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC -DUNIV_DEBUG $CXXFLAGS"
else
# Optimized version. No debug
CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
diff --git a/extra/perror.c b/extra/perror.c
index fc10d8eaecc..27027520cbe 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -213,12 +213,14 @@ int main(int argc,char *argv[])
string 'Unknown Error'. To avoid printing it we try to find the
error string by asking for an impossible big error message.
*/
- msg = strerror(10000);
+ msg= strerror(10000);
- /* allocate a buffer for unknown_error since strerror always returns the same pointer
- on some platforms such as Windows */
- unknown_error = malloc( strlen(msg)+1 );
- strcpy( unknown_error, msg );
+ /*
+ Allocate a buffer for unknown_error since strerror always returns
+ the same pointer on some platforms such as Windows
+ */
+ unknown_error= malloc(strlen(msg)+1);
+ strmov(unknown_error, msg);
for ( ; argc-- > 0 ; argv++)
{
@@ -271,7 +273,7 @@ int main(int argc,char *argv[])
/* if we allocated a buffer for unknown_error, free it now */
if (unknown_error)
- free(unknown_error);
+ free(unknown_error);
exit(error);
return error;
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index 6ae4fe1c2ce..625978ffc38 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -80,10 +80,6 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
-#ifdef DBUG_ON
-#define UNIV_DEBUG
-#endif /* DBUG_ON */
-
/*
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index 49ec2dd85cc..6f667aabac0 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -39,3 +39,6 @@ DROP TABLE t1;
SELECT CHAR(31) = '', '' = CHAR(31);
CHAR(31) = '' '' = CHAR(31)
0 0
+SELECT CHAR(30) = '', '' = CHAR(30);
+CHAR(30) = '' '' = CHAR(30)
+0 0
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
index e3c042e608a..bc20786227b 100644
--- a/mysql-test/t/compare.test
+++ b/mysql-test/t/compare.test
@@ -33,3 +33,5 @@ DROP TABLE t1;
# Bug #8134: Comparison against CHAR(31) at end of string
SELECT CHAR(31) = '', '' = CHAR(31);
+# Extra test
+SELECT CHAR(30) = '', '' = CHAR(30);
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index df1e9e55e0a..5ee181ca78e 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -43,7 +43,7 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
return 0;
if (skip_end_space && a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
/*
We are using space compression. We have to check if longer key
has next character < ' ', in which case it's less than the shorter
@@ -57,12 +57,12 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
/* put shorter key in a */
a_length= b_length;
a= b;
- swap= -1 ^ 1; /* swap sign of result */
+ swap= -1; /* swap sign of result */
}
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
return 0;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f3c107c2696..5f3875ba934 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2272,7 +2272,10 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
strxmov(src_path, (*tmp_table)->path, reg_ext, NullS);
else
{
- fn_format( src_path, src_table, src_db, reg_ext, MYF(MY_UNPACK_FILENAME));
+ strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table,
+ reg_ext, NullS);
+ /* Resolve symlinks (for windows) */
+ fn_format(src_path, src_path, "", "", MYF(MY_UNPACK_FILENAME));
if (access(src_path, F_OK))
{
my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table);
@@ -2299,7 +2302,9 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
}
else
{
- fn_format( dst_path, table_name, db, reg_ext, MYF(MY_UNPACK_FILENAME));
+ strxmov(dst_path, mysql_data_home, "/", db, "/", table_name,
+ reg_ext, NullS);
+ fn_format(dst_path, dst_path, "", "", MYF(MY_UNPACK_FILENAME));
if (!access(dst_path, F_OK))
goto table_exists;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 0ec71bdfba3..663f2d2be34 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -167,7 +167,10 @@ int mysql_update(THD *thd,
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
used_key_is_modified=check_if_key_used(table, used_index, fields);
else
+ {
used_key_is_modified=0;
+ used_index= MAX_KEY;
+ }
if (used_key_is_modified || order)
{
/*
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 997b8ce93d6..270b02212af 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -271,7 +271,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
if (!res && a_length != b_length)
{
const uchar *end;
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -286,7 +286,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 95c52512243..618879607ec 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -157,7 +157,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
}
if (a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -172,7 +172,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return 0;
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 731ad58a2fb..9daa9f90f3c 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -2632,7 +2632,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
if (!res && a_length != b_length)
{
const uchar *end;
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -2647,7 +2647,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index 32d9a227c2f..4ab101add5b 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -611,7 +611,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
if (a != a_end || b != b_end)
{
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -626,7 +626,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
for ( ; a < a_end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return 0;
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 731fc460cef..6cf48291c91 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -389,7 +389,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
}
if (a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -404,7 +404,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return 0;
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 4dc6a1be27b..1a09b16a264 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -143,7 +143,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
}
if (a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -153,12 +153,12 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
/* put shorter key in s */
a_length= b_length;
a= b;
- swap= -1^1; /* swap sign of result */
+ swap= -1; /* swap sign of result */
}
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return 0;
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index c0b33a13cdd..0cb30a9b6ee 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -251,7 +251,7 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length);
if (!res && (a != a_end || b != b_end))
{
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -266,7 +266,7 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
for (; a < a_end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 3a43c556ac8..6a6c55d214e 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -589,7 +589,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
}
if (a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -605,7 +605,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
{
if (*a != ' ')
{
- res= ((int) *a - (int) ' ') ^ swap;
+ res= (*a < ' ') ? -swap : swap;
goto ret;
}
}
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 936e2b6fdce..ea11f8816a5 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -275,7 +275,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
if (slen != tlen)
{
- int swap= 0;
+ int swap= 1;
if (slen < tlen)
{
s= t;
@@ -286,7 +286,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
for ( ; s < se ; s+= 2)
{
if (s[0] || s[1] != ' ')
- return (((int)s[0] << 8) + (int) s[1] - (int) ' ') ^ swap;
+ return (s[0] == 0 && s[1] < ' ') ? -swap : swap;
}
}
return 0;
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 502d0ec285e..486d428bf1d 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2077,7 +2077,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
if (slen != tlen)
{
- int swap= 0;
+ int swap= 1;
if (slen < tlen)
{
slen= tlen;
@@ -2098,7 +2098,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
for ( ; s < se; s++)
{
if (*s != ' ')
- return ((int)*s - (int) ' ') ^ swap;
+ return (*s < ' ') ? -swap : swap;
}
}
return 0;