summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-11-03 19:17:05 +0100
committerSergei Golubchik <sergii@pisem.net>2011-11-03 19:17:05 +0100
commit0e007344eae972b9be7d88ca43373cb33662ac1c (patch)
tree7b3561cb3ea2ad24d013e847680ec165f406387e /strings
parent3794110f0215f0631107c2694dc0f1675a4bb520 (diff)
parent681476255147dacac7e3674b6cd2ae770fee2208 (diff)
downloadmariadb-git-0e007344eae972b9be7d88ca43373cb33662ac1c.tar.gz
mysql-5.5.18 merge
Diffstat (limited to 'strings')
-rw-r--r--strings/conf_to_src.c5
-rw-r--r--strings/ctype-big5.c4
-rw-r--r--strings/ctype-cp932.c4
-rw-r--r--strings/ctype-czech.c4
-rw-r--r--strings/ctype-euc_kr.c4
-rw-r--r--strings/ctype-eucjpms.c5
-rw-r--r--strings/ctype-extra.c3
-rw-r--r--strings/ctype-gb2312.c4
-rw-r--r--strings/ctype-gbk.c4
-rw-r--r--strings/ctype-latin1.c5
-rw-r--r--strings/ctype-mb.c4
-rw-r--r--strings/ctype-simple.c4
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-tis620.c8
-rw-r--r--strings/ctype-uca.c84
-rw-r--r--strings/ctype-ucs2.c8
-rw-r--r--strings/ctype-ujis.c2
-rw-r--r--strings/ctype-utf8.c6
-rw-r--r--strings/ctype-win1250ch.c4
-rw-r--r--strings/ctype.c5
-rw-r--r--strings/decimal.c15
-rw-r--r--strings/do_ctype.c4
-rw-r--r--strings/dtoa.c25
-rw-r--r--strings/dump_map.c3
-rw-r--r--strings/my_strchr.c4
-rw-r--r--strings/my_vsnprintf.c4
-rw-r--r--strings/str_alloc.c5
-rw-r--r--strings/strmake.c5
-rw-r--r--strings/uca-dump.c3
-rw-r--r--strings/uctypedump.c3
-rw-r--r--strings/utr11-dump.c3
-rw-r--r--strings/xml.c2
32 files changed, 141 insertions, 106 deletions
diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c
index f8b560422d7..aebeafcda98 100644
--- a/strings/conf_to_src.c
+++ b/strings/conf_to_src.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000-2003, 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
+ Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "strings_def.h"
#include <m_ctype.h>
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index e636c6e0263..1b8e2fb5f3a 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
* This file is basicly usa7 character sets with some extra functions
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 037d9da7926..68a13dbedbd 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2005, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* This file is for cp932 charaset (Windows Japanese),
and created based on ctype-sjis.c file */
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index 21af116edf6..08c8412e8ae 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* File strings/ctype-czech.c for MySQL.
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index 9321a0ac2c8..77296f34f6a 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
* This file is for Korean EUC charset, and created by powerm90@tinc.co.kr.
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 5d09c1c9d8d..b2af2cb5608 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -1,7 +1,6 @@
-/* Copyright tommy@valley.ne.jp.
- Copyright (c) 2002, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2005, 2011, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c
index e0499c6f2e3..b52cc603e4d 100644
--- a/strings/ctype-extra.c
+++ b/strings/ctype-extra.c
@@ -6,8 +6,7 @@
./conf_to_src ../sql/share/charsets/ > FILE
*/
-/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2003, 2010, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index af0526790c5..af6c6f9f8c2 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* This file is for Chinese EUC character sets (GB2312), and created by Miles Tsai (net-bull@126.com).
*/
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index f021c268d0a..a33d0d82f56 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* This file is for Chinese character sets GBK, created by Wei He
(hewei@mail.ied.ac.cn)
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index 63858b56c9e..f5456c1a943 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2003-2007 MySQL AB, 2009 Sun Microsystems, Inc.
+ Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "strings_def.h"
#include <m_ctype.h>
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index d220a80d120..33e0c58cbbf 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "strings_def.h"
#include <m_ctype.h>
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 4f2a42f5905..eb8c44805da 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2002, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "strings_def.h"
#include <m_ctype.h>
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index b782c892fd9..042ceab4f35 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* This file is for Shift JIS charset, and created by tommy@valley.ne.jp.
*/
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 9bf7a73a6d1..f6fe4c0f914 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -1,4 +1,6 @@
-/*
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2009-2011, Monty Program Ab
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
@@ -10,11 +12,9 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009-2011, Monty Program Ab
Copyright (C) 2003 by Sathit Jittanupat
<jsat66@hotmail.com,jsat66@yahoo.com>
* solving bug crash with long text field string
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 683fb8f6654..b5f151c4d10 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2004, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This library is free software; you can redistribute it and/or
@@ -13,8 +13,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301, USA */
/*
UCA (Unicode Collation Algorithm) support.
@@ -46,6 +46,7 @@
#define MY_UCA_NCHARS 256
#define MY_UCA_CMASK 255
#define MY_UCA_PSHIFT 8
+#define MAX_UCA_CHAR_WITH_EXPLICIT_WEIGHT 0xFFFF
static const uint16 page000data[]= { /* 0000 (4 weights per char) */
0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,
@@ -7077,7 +7078,7 @@ static int my_uca_scanner_next_any(my_uca_scanner *scanner)
return -1;
scanner->sbeg+= mb_len;
- if (wc > 0xFFFF)
+ if (wc > MAX_UCA_CHAR_WITH_EXPLICIT_WEIGHT)
{
/* Return 0xFFFD as weight for all characters outside BMP */
scanner->wbeg= nochar;
@@ -7142,30 +7143,6 @@ static my_uca_scanner_handler my_any_uca_scanner_handler=
};
-/**
- 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 const 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] :
- 0);
-}
-
-
/*
Compares two strings according to the collation
@@ -7439,6 +7416,33 @@ static size_t my_strnxfrm_uca(CHARSET_INFO *cs,
+/**
+ Helper function:
+ Find address of weights of the given character.
+
+ @param weights UCA weight array
+ @param lengths UCA length array
+ @param 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 const uint16 *
+my_char_weight_addr(CHARSET_INFO *cs, uint wc)
+{
+ uint page, ofst;
+ const uchar *ucal= cs->sort_order;
+ const uint16 * const *ucaw= cs->sort_order_big;
+
+ return wc > MAX_UCA_CHAR_WITH_EXPLICIT_WEIGHT ? NULL :
+ (ucaw[page= (wc >> 8)] ?
+ ucaw[page] + (ofst= (wc & 0xFF)) * ucal[page] :
+ NULL);
+}
+
+
/*
This function compares if two characters are the same.
The sign +1 or -1 does not matter. The only
@@ -7449,17 +7453,20 @@ static size_t my_strnxfrm_uca(CHARSET_INFO *cs,
static int my_uca_charcmp(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
{
- size_t page1= wc1 >> MY_UCA_PSHIFT;
- size_t page2= wc2 >> MY_UCA_PSHIFT;
- const uchar *ucal= cs->sort_order;
- const uint16 *const *ucaw= cs->sort_order_big;
- size_t length1= ucal[page1];
- size_t length2= ucal[page2];
- const uint16 *weight1= ucaw[page1] + (wc1 & MY_UCA_CMASK) * ucal[page1];
- const uint16 *weight2= ucaw[page2] + (wc2 & MY_UCA_CMASK) * ucal[page2];
+ size_t length1, length2;
+ const uint16 *weight1= my_char_weight_addr(cs, wc1);
+ const uint16 *weight2= my_char_weight_addr(cs, wc2);
if (!weight1 || !weight2)
return wc1 != wc2;
+
+ /* Quickly compare first weights */
+ if (weight1[0] != weight2[0])
+ return 1;
+
+ /* Thoroughly compare all weights */
+ length1= cs->sort_order[wc1 >> MY_UCA_PSHIFT];
+ length2= cs->sort_order[wc2 >> MY_UCA_PSHIFT];
if (length1 > length2)
return memcmp((const void*)weight1, (const void*)weight2, length2*2) ?
@@ -8044,6 +8051,11 @@ static my_bool create_tailoring(struct charset_info_st *cs,
*/
for (i=0; i < rc; i++)
{
+ /* check if the shift or the reset characters are out of range */
+ if (rule[i].curr[0] > MAX_UCA_CHAR_WITH_EXPLICIT_WEIGHT ||
+ rule[i].base > MAX_UCA_CHAR_WITH_EXPLICIT_WEIGHT)
+ return 1;
+
if (!rule[i].curr[1]) /* If not a contraction */
{
uint pageb= (rule[i].base >> 8) & 0xFF;
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 4f676c8effe..b22ca43a062 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1,6 +1,6 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
@@ -13,8 +13,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301, USA */
/* UCS2 support. Written by Alexander Barkov <bar@mysql.com> */
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index ecb0992c70d..32d65a07f23 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -1,5 +1,5 @@
/* Copyright tommy@valley.ne.jp.
- Copyright (c) 2002, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This library is free software; you can redistribute it and/or
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 74dcbcf4fc2..daca63437ca 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This library is free software; you can redistribute it and/or
@@ -13,8 +13,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA */
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301, USA */
/* UTF8 according RFC 2279 */
/* Written by Alexander Barkov <bar@udm.net> */
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 19896de5e66..a22fe7b696f 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2001 Jan Pazdziora.
- Copyright (c) 2003, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2002, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
Shared, independent copyright: (C) 2001 Jan Pazdziora.
diff --git a/strings/ctype.c b/strings/ctype.c
index 429f4a0b366..296960b55b5 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000-2007 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
+ Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "strings_def.h"
#include <m_ctype.h>
diff --git a/strings/decimal.c b/strings/decimal.c
index dc8a8a70809..8ac3d61612d 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -1403,11 +1403,18 @@ int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale)
buf++;
}
my_afree(d_copy);
+
+ /*
+ No digits? We have read the number zero, of unspecified precision.
+ Make it a proper zero, with non-zero precision.
+ */
+ if (to->intg == 0 && to->frac == 0)
+ decimal_make_zero(to);
return error;
err:
my_afree(d_copy);
- decimal_make_zero(((decimal_t*) to));
+ decimal_make_zero(to);
return(E_DEC_BAD_NUM);
}
@@ -2183,7 +2190,6 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2,
}
buf0=to->buf;
stop0=buf0+intg0+frac0;
- DBUG_ASSERT(stop0 <= &to->buf[to->len]);
if (likely(div_mod))
while (dintg++ < 0 && buf0 < &to->buf[to->len])
{
@@ -2278,7 +2284,10 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2,
}
}
if (likely(div_mod))
+ {
+ DBUG_ASSERT(buf0 < to->buf + to->len);
*buf0=(dec1)guess;
+ }
dcarry= *start1;
start1++;
}
diff --git a/strings/do_ctype.c b/strings/do_ctype.c
index c0e4aaf9be6..addb3a3d7f6 100644
--- a/strings/do_ctype.c
+++ b/strings/do_ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* Prints case-convert and sort-convert tabell on stdout. This is used to
make _ctype.c easyer */
diff --git a/strings/dtoa.c b/strings/dtoa.c
index 3aeeed9e148..e6339bab1d9 100644
--- a/strings/dtoa.c
+++ b/strings/dtoa.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/****************************************************************
@@ -45,7 +45,7 @@
see if it is possible to get rid of malloc().
this constant is sufficient to avoid malloc() on all inputs I have tried.
*/
-#define DTOA_BUFF_SIZE (420 * sizeof(void *))
+#define DTOA_BUFF_SIZE (460 * sizeof(void *))
/* Magic value returned by dtoa() to indicate overflow */
#define DTOA_OVERFLOW 9999
@@ -658,6 +658,7 @@ typedef struct Stack_alloc
static Bigint *Balloc(int k, Stack_alloc *alloc)
{
Bigint *rv;
+ DBUG_ASSERT(k <= Kmax);
if (k <= Kmax && alloc->freelist[k])
{
rv= alloc->freelist[k];
@@ -1004,9 +1005,10 @@ static Bigint p5_a[]=
static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc)
{
- Bigint *b1, *p5, *p51;
+ Bigint *b1, *p5, *p51=NULL;
int i;
static int p05[3]= { 5, 25, 125 };
+ my_bool overflow= FALSE;
if ((i= k & 3))
b= multadd(b, p05[i-1], 0, alloc);
@@ -1025,17 +1027,22 @@ static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc)
if (!(k>>= 1))
break;
/* Calculate next power of 5 */
- if (p5 < p5_a + P5A_MAX)
- ++p5;
- else if (p5 == p5_a + P5A_MAX)
- p5= mult(p5, p5, alloc);
- else
+ if (overflow)
{
p51= mult(p5, p5, alloc);
Bfree(p5, alloc);
p5= p51;
}
+ else if (p5 < p5_a + P5A_MAX)
+ ++p5;
+ else if (p5 == p5_a + P5A_MAX)
+ {
+ p5= mult(p5, p5, alloc);
+ overflow= TRUE;
+ }
}
+ if (p51)
+ Bfree(p51, alloc);
return b;
}
diff --git a/strings/dump_map.c b/strings/dump_map.c
index 61e6cbb6e02..83d35f259a1 100644
--- a/strings/dump_map.c
+++ b/strings/dump_map.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2003, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2003, 2004, 2006 MySQL AB
+ Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
diff --git a/strings/my_strchr.c b/strings/my_strchr.c
index baf832c9a0a..9bb1f0954ed 100644
--- a/strings/my_strchr.c
+++ b/strings/my_strchr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2005, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "strings_def.h"
#include <m_ctype.h>
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 72fd35e4e0f..dde6b0255ed 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "strings_def.h"
#include <m_ctype.h>
diff --git a/strings/str_alloc.c b/strings/str_alloc.c
index 5233a804153..3e218ff1fbd 100644
--- a/strings/str_alloc.c
+++ b/strings/str_alloc.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2005, 2006 MySQL AB
+ Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "strings_def.h"
diff --git a/strings/strmake.c b/strings/strmake.c
index 5c26538c9bd..b6f37dd3d88 100644
--- a/strings/strmake.c
+++ b/strings/strmake.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2001, 2003, 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc.
+ Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -12,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* File : strmake.c
Author : Michael Widenius
diff --git a/strings/uca-dump.c b/strings/uca-dump.c
index d281783aa2b..ab3437d17df 100644
--- a/strings/uca-dump.c
+++ b/strings/uca-dump.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2004, 2006 MySQL AB
+ Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
diff --git a/strings/uctypedump.c b/strings/uctypedump.c
index 117db2ba30a..ed3c64969d5 100644
--- a/strings/uctypedump.c
+++ b/strings/uctypedump.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2006, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2006 MySQL AB
+ Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/strings/utr11-dump.c b/strings/utr11-dump.c
index 41cc387b2e0..8bd5e9ee58b 100644
--- a/strings/utr11-dump.c
+++ b/strings/utr11-dump.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2004, 2006 MySQL AB
+ Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
diff --git a/strings/xml.c b/strings/xml.c
index 7834f971269..54ff7a26c16 100644
--- a/strings/xml.c
+++ b/strings/xml.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2003, 2011, Oracle and/or its affiliates.
Copyright (c) 2011 Monty Program Ab
This program is free software; you can redistribute it and/or modify