summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
Diffstat (limited to 'strings')
-rwxr-xr-xstrings/CMakeLists.txt12
-rw-r--r--strings/Makefile.am2
-rw-r--r--strings/ctype-win1250ch.c4
-rw-r--r--strings/decimal.c13
-rw-r--r--strings/strtod.c3
5 files changed, 26 insertions, 8 deletions
diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt
new file mode 100755
index 00000000000..0c65ce390b2
--- /dev/null
+++ b/strings/CMakeLists.txt
@@ -0,0 +1,12 @@
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+ADD_LIBRARY(strings bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
+ ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c
+ ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c
+ ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c int2str.c
+ is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c r_strinstr.c
+ str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c
+ strtod.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c
+ strcont.c strinstr.c)
diff --git a/strings/Makefile.am b/strings/Makefile.am
index 7ee115c09e5..255bc4e1518 100644
--- a/strings/Makefile.am
+++ b/strings/Makefile.am
@@ -53,7 +53,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc
bmove_upp-sparc.s strappend-sparc.s strend-sparc.s \
strinstr-sparc.s strmake-sparc.s strmov-sparc.s \
strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \
- t_ctype.h
+ t_ctype.h CMakeLists.txt
libmystrings_a_LIBADD=
conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 0bc465f16ea..39948964a42 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -636,11 +636,11 @@ my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
ptr++; /* Skip escape */
else if (*ptr == w_one || *ptr == w_many) /* '_' or '%' in SQL */
break;
- *min_str = like_range_prefix_min_win1250ch[(uint)(*ptr)];
+ *min_str= like_range_prefix_min_win1250ch[(uint) (uchar) (*ptr)];
if (*min_str != min_sort_char)
only_min_found= 0;
min_str++;
- *max_str++= like_range_prefix_max_win1250ch[(uint)(*ptr)];
+ *max_str++= like_range_prefix_max_win1250ch[(uint) (uchar) (*ptr)];
}
if (cs->state & MY_CS_BINSORT)
diff --git a/strings/decimal.c b/strings/decimal.c
index 8786a513945..5a0bc0968b6 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -171,6 +171,7 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
do \
{ \
dec1 a=(from1)+(from2)+(carry); \
+ DBUG_ASSERT((carry) <= 1); \
if (((carry)= a >= DIG_BASE)) /* no division here! */ \
a-=DIG_BASE; \
(to)=a; \
@@ -179,7 +180,7 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
#define ADD2(to, from1, from2, carry) \
do \
{ \
- dec1 a=(from1)+(from2)+(carry); \
+ dec2 a=((dec2)(from1))+(from2)+(carry); \
if (((carry)= a >= DIG_BASE)) \
a-=DIG_BASE; \
if (unlikely(a >= DIG_BASE)) \
@@ -187,7 +188,7 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
a-=DIG_BASE; \
carry++; \
} \
- (to)=a; \
+ (to)=(dec1) a; \
} while(0)
#define SUB(to, from1, from2, carry) /* to=from1-from2 */ \
@@ -1998,7 +1999,13 @@ int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to)
ADD2(*buf0, *buf0, lo, carry);
carry+=hi;
}
- for (; carry; buf0--)
+ if (carry)
+ {
+ if (buf0 < to->buf)
+ return E_DEC_OVERFLOW;
+ ADD2(*buf0, *buf0, 0, carry);
+ }
+ for (buf0--; carry; buf0--)
{
if (buf0 < to->buf)
return E_DEC_OVERFLOW;
diff --git a/strings/strtod.c b/strings/strtod.c
index e0910205d2f..7171a6e0801 100644
--- a/strings/strtod.c
+++ b/strings/strtod.c
@@ -26,8 +26,7 @@
*/
-#include "my_base.h" /* Defines EOVERFLOW on Windows */
-#include "my_global.h" /* Includes errno.h */
+#include "my_base.h" /* Includes errno.h + EOVERFLOW */
#include "m_ctype.h"
#define MAX_DBL_EXP 308