Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4bd6c356
Commit
4bd6c356
authored
Jan 16, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strnto family functions now return error in a new argument
parent
df1a1075
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
166 additions
and
125 deletions
+166
-125
include/m_ctype.h
include/m_ctype.h
+15
-15
libmysql/libmysql.c
libmysql/libmysql.c
+7
-6
sql/field.cc
sql/field.cc
+48
-43
sql/item.cc
sql/item.cc
+10
-4
sql/item.h
sql/item.h
+10
-4
sql/item_func.h
sql/item_func.h
+4
-2
sql/item_strfunc.cc
sql/item_strfunc.cc
+7
-4
sql/item_sum.cc
sql/item_sum.cc
+2
-1
sql/item_sum.h
sql/item_sum.h
+4
-2
sql/mysqld.cc
sql/mysqld.cc
+2
-1
sql/procedure.h
sql/procedure.h
+6
-4
strings/ctype-simple.c
strings/ctype-simple.c
+18
-14
strings/ctype-utf8.c
strings/ctype-utf8.c
+26
-22
strings/ctype.c
strings/ctype.c
+7
-3
No files found.
include/m_ctype.h
View file @
4bd6c356
...
@@ -138,11 +138,11 @@ typedef struct charset_info_st
...
@@ -138,11 +138,11 @@ typedef struct charset_info_st
int
(
*
longlong10_to_str
)(
struct
charset_info_st
*
,
char
*
to
,
uint
n
,
int
radix
,
longlong
val
);
int
(
*
longlong10_to_str
)(
struct
charset_info_st
*
,
char
*
to
,
uint
n
,
int
radix
,
longlong
val
);
/* String-to-number convertion routines */
/* String-to-number convertion routines */
long
(
*
strntol
)(
struct
charset_info_st
*
,
const
char
*
s
,
uint
l
,
char
**
e
,
int
base
);
long
(
*
strntol
)(
struct
charset_info_st
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
ulong
(
*
strntoul
)(
struct
charset_info_st
*
,
const
char
*
s
,
uint
l
,
char
**
e
,
int
base
);
ulong
(
*
strntoul
)(
struct
charset_info_st
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
longlong
(
*
strntoll
)(
struct
charset_info_st
*
,
const
char
*
s
,
uint
l
,
char
**
e
,
int
base
);
longlong
(
*
strntoll
)(
struct
charset_info_st
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
ulonglong
(
*
strntoull
)(
struct
charset_info_st
*
,
const
char
*
s
,
uint
l
,
char
**
e
,
int
base
);
ulonglong
(
*
strntoull
)(
struct
charset_info_st
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
double
(
*
strntod
)(
struct
charset_info_st
*
,
char
*
s
,
uint
l
,
char
**
e
);
double
(
*
strntod
)(
struct
charset_info_st
*
,
char
*
s
,
uint
l
,
char
**
e
,
int
*
err
);
}
CHARSET_INFO
;
}
CHARSET_INFO
;
...
@@ -183,11 +183,11 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
...
@@ -183,11 +183,11 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
int
my_snprintf_8bit
(
struct
charset_info_st
*
,
char
*
to
,
uint
n
,
const
char
*
fmt
,
...);
int
my_snprintf_8bit
(
struct
charset_info_st
*
,
char
*
to
,
uint
n
,
const
char
*
fmt
,
...);
long
my_strntol_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
char
**
e
,
int
base
);
long
my_strntol_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
ulong
my_strntoul_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
char
**
e
,
int
base
);
ulong
my_strntoul_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
longlong
my_strntoll_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
char
**
e
,
int
base
);
longlong
my_strntoll_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
ulonglong
my_strntoull_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
char
**
e
,
int
base
);
ulonglong
my_strntoull_8bit
(
CHARSET_INFO
*
,
const
char
*
s
,
uint
l
,
int
base
,
char
**
e
,
int
*
err
);
double
my_strntod_8bit
(
CHARSET_INFO
*
,
char
*
s
,
uint
l
,
char
**
e
);
double
my_strntod_8bit
(
CHARSET_INFO
*
,
char
*
s
,
uint
l
,
char
**
e
,
int
*
err
);
int
my_long10_to_str_8bit
(
CHARSET_INFO
*
,
char
*
to
,
uint
l
,
int
radix
,
long
int
val
);
int
my_long10_to_str_8bit
(
CHARSET_INFO
*
,
char
*
to
,
uint
l
,
int
radix
,
long
int
val
);
int
my_longlong10_to_str_8bit
(
CHARSET_INFO
*
,
char
*
to
,
uint
l
,
int
radix
,
longlong
val
);
int
my_longlong10_to_str_8bit
(
CHARSET_INFO
*
,
char
*
to
,
uint
l
,
int
radix
,
longlong
val
);
...
@@ -274,11 +274,11 @@ int my_wildcmp_mb(CHARSET_INFO *,
...
@@ -274,11 +274,11 @@ int my_wildcmp_mb(CHARSET_INFO *,
#define my_strcasecmp(s, a, b) ((s)->strcasecmp((s), (a), (b)))
#define my_strcasecmp(s, a, b) ((s)->strcasecmp((s), (a), (b)))
#define my_strncasecmp(s, a, b, l) ((s)->strncasecmp((s), (a), (b), (l)))
#define my_strncasecmp(s, a, b, l) ((s)->strncasecmp((s), (a), (b), (l)))
#define my_strntol(s, a, b, c, d
) ((s)->strntol((s),(a),(b),(c),(d
)))
#define my_strntol(s, a, b, c, d
, e) ((s)->strntol((s),(a),(b),(c),(d),(e
)))
#define my_strntoul(s, a, b, c, d
) ((s)->strntoul((s),(a),(b),(c),(d
)))
#define my_strntoul(s, a, b, c, d
, e) ((s)->strntoul((s),(a),(b),(c),(d),(e
)))
#define my_strntoll(s, a, b, c, d
) ((s)->strntoll((s),(a),(b),(c),(d
)))
#define my_strntoll(s, a, b, c, d
, e) ((s)->strntoll((s),(a),(b),(c),(d),(e
)))
#define my_strntoull(s, a, b, c,d
) ((s)->strntoull((s),(a),(b),(c),(d
)))
#define my_strntoull(s, a, b, c,d
, e) ((s)->strntoull((s),(a),(b),(c),(d),(e
)))
#define my_strntod(s, a, b, c
) ((s)->strntod((s),(a),(b),(c
)))
#define my_strntod(s, a, b, c
, d) ((s)->strntod((s),(a),(b),(c),(d
)))
/* XXX: still need to take care of this one */
/* XXX: still need to take care of this one */
...
...
libmysql/libmysql.c
View file @
4bd6c356
...
@@ -4522,41 +4522,42 @@ static void send_data_double(MYSQL_BIND *param, double value)
...
@@ -4522,41 +4522,42 @@ static void send_data_double(MYSQL_BIND *param, double value)
static
void
send_data_str
(
MYSQL_BIND
*
param
,
char
*
value
,
uint
length
)
static
void
send_data_str
(
MYSQL_BIND
*
param
,
char
*
value
,
uint
length
)
{
{
char
*
buffer
=
param
->
buffer
;
char
*
buffer
=
param
->
buffer
;
int
err
=
0
;
switch
(
param
->
buffer_type
)
{
switch
(
param
->
buffer_type
)
{
case
MYSQL_TYPE_TINY
:
case
MYSQL_TYPE_TINY
:
{
{
uchar
data
=
(
uchar
)
my_strntol
(
system_charset_info
,
value
,
length
,
NULL
,
10
);
uchar
data
=
(
uchar
)
my_strntol
(
system_charset_info
,
value
,
length
,
10
,
NULL
,
&
err
);
*
buffer
=
data
;
*
buffer
=
data
;
break
;
break
;
}
}
case
MYSQL_TYPE_SHORT
:
case
MYSQL_TYPE_SHORT
:
{
{
short
data
=
(
short
)
my_strntol
(
system_charset_info
,
value
,
length
,
NULL
,
10
);
short
data
=
(
short
)
my_strntol
(
system_charset_info
,
value
,
length
,
10
,
NULL
,
&
err
);
int2store
(
buffer
,
data
);
int2store
(
buffer
,
data
);
break
;
break
;
}
}
case
MYSQL_TYPE_LONG
:
case
MYSQL_TYPE_LONG
:
{
{
int32
data
=
(
int32
)
my_strntol
(
system_charset_info
,
value
,
length
,
NULL
,
10
);
int32
data
=
(
int32
)
my_strntol
(
system_charset_info
,
value
,
length
,
10
,
NULL
,
&
err
);
int4store
(
buffer
,
data
);
int4store
(
buffer
,
data
);
break
;
break
;
}
}
case
MYSQL_TYPE_LONGLONG
:
case
MYSQL_TYPE_LONGLONG
:
{
{
longlong
data
=
my_strntoll
(
system_charset_info
,
value
,
length
,
NULL
,
10
);
longlong
data
=
my_strntoll
(
system_charset_info
,
value
,
length
,
10
,
NULL
,
&
err
);
int8store
(
buffer
,
data
);
int8store
(
buffer
,
data
);
break
;
break
;
}
}
case
MYSQL_TYPE_FLOAT
:
case
MYSQL_TYPE_FLOAT
:
{
{
float
data
=
(
float
)
my_strntod
(
system_charset_info
,
value
,
length
,
NULL
);
float
data
=
(
float
)
my_strntod
(
system_charset_info
,
value
,
length
,
NULL
,
&
err
);
float4store
(
buffer
,
data
);
float4store
(
buffer
,
data
);
break
;
break
;
}
}
case
MYSQL_TYPE_DOUBLE
:
case
MYSQL_TYPE_DOUBLE
:
{
{
double
data
=
my_strntod
(
system_charset_info
,
value
,
length
,
NULL
);
double
data
=
my_strntod
(
system_charset_info
,
value
,
length
,
NULL
,
&
err
);
float8store
(
buffer
,
data
);
float8store
(
buffer
,
data
);
break
;
break
;
}
}
...
...
sql/field.cc
View file @
4bd6c356
...
@@ -840,15 +840,17 @@ int Field_decimal::store(longlong nr)
...
@@ -840,15 +840,17 @@ int Field_decimal::store(longlong nr)
double
Field_decimal
::
val_real
(
void
)
double
Field_decimal
::
val_real
(
void
)
{
{
return
my_strntod
(
my_charset_bin
,
ptr
,
field_length
,
NULL
);
int
err
;
return
my_strntod
(
my_charset_bin
,
ptr
,
field_length
,
NULL
,
&
err
);
}
}
longlong
Field_decimal
::
val_int
(
void
)
longlong
Field_decimal
::
val_int
(
void
)
{
{
int
err
;
if
(
unsigned_flag
)
if
(
unsigned_flag
)
return
my_strntoull
(
my_charset_bin
,
ptr
,
field_length
,
NULL
,
10
);
return
my_strntoull
(
my_charset_bin
,
ptr
,
field_length
,
10
,
NULL
,
&
err
);
else
else
return
my_strntoll
(
my_charset_bin
,
ptr
,
field_length
,
NULL
,
10
);
return
my_strntoll
(
my_charset_bin
,
ptr
,
field_length
,
10
,
NULL
,
&
err
);
}
}
...
@@ -950,8 +952,9 @@ void Field_decimal::sql_type(String &res) const
...
@@ -950,8 +952,9 @@ void Field_decimal::sql_type(String &res) const
int
Field_tiny
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_tiny
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
int
err
;
char
*
end
;
char
*
end
;
long
tmp
=
my_strntol
(
cs
,
from
,
len
,
&
end
,
10
);
long
tmp
=
my_strntol
(
cs
,
from
,
len
,
10
,
&
end
,
&
err
);
int
error
=
0
;
int
error
=
0
;
if
(
unsigned_flag
)
if
(
unsigned_flag
)
...
@@ -1151,8 +1154,9 @@ void Field_tiny::sql_type(String &res) const
...
@@ -1151,8 +1154,9 @@ void Field_tiny::sql_type(String &res) const
int
Field_short
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_short
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
int
err
;
char
*
end
;
char
*
end
;
long
tmp
=
my_strntol
(
cs
,
from
,
len
,
&
end
,
10
);
long
tmp
=
my_strntol
(
cs
,
from
,
len
,
10
,
&
end
,
&
err
);
int
error
=
0
;
int
error
=
0
;
if
(
unsigned_flag
)
if
(
unsigned_flag
)
{
{
...
@@ -1423,8 +1427,9 @@ void Field_short::sql_type(String &res) const
...
@@ -1423,8 +1427,9 @@ void Field_short::sql_type(String &res) const
int
Field_medium
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_medium
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
int
err
;
char
*
end
;
char
*
end
;
long
tmp
=
my_strntol
(
cs
,
from
,
len
,
&
end
,
10
);
long
tmp
=
my_strntol
(
cs
,
from
,
len
,
10
,
&
end
,
&
err
);
int
error
=
0
;
int
error
=
0
;
if
(
unsigned_flag
)
if
(
unsigned_flag
)
...
@@ -1659,16 +1664,15 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
...
@@ -1659,16 +1664,15 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
error
=
1
;
error
=
1
;
}
}
else
else
tmp
=
(
long
)
my_strntoul
(
cs
,
from
,
len
,
&
end
,
10
);
tmp
=
(
long
)
my_strntoul
(
cs
,
from
,
len
,
10
,
&
end
,
&
error
);
}
}
else
else
tmp
=
my_strntol
(
cs
,
from
,
len
,
&
end
,
10
);
tmp
=
my_strntol
(
cs
,
from
,
len
,
10
,
&
end
,
&
error
);
if
(
my_errno
||
if
(
error
||
(
from
+
len
!=
end
&&
current_thd
->
count_cuted_fields
&&
(
from
+
len
!=
end
&&
current_thd
->
count_cuted_fields
&&
!
test_if_int
(
from
,
len
,
end
,
cs
)))
!
test_if_int
(
from
,
len
,
end
,
cs
)))
{
{
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
error
=
1
;
}
}
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
if
(
table
->
db_low_byte_first
)
...
@@ -1918,11 +1922,11 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
...
@@ -1918,11 +1922,11 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
error
=
1
;
error
=
1
;
}
}
else
else
tmp
=
(
longlong
)
my_strntoull
(
cs
,
from
,
len
,
&
end
,
10
);
tmp
=
(
longlong
)
my_strntoull
(
cs
,
from
,
len
,
10
,
&
end
,
&
error
);
}
}
else
else
tmp
=
my_strntoll
(
cs
,
from
,
len
,
&
end
,
10
);
tmp
=
my_strntoll
(
cs
,
from
,
len
,
10
,
&
end
,
&
error
);
if
(
my_errno
||
if
(
error
||
(
from
+
len
!=
end
&&
current_thd
->
count_cuted_fields
&&
(
from
+
len
!=
end
&&
current_thd
->
count_cuted_fields
&&
!
test_if_int
(
from
,
len
,
end
,
cs
)))
!
test_if_int
(
from
,
len
,
end
,
cs
)))
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
...
@@ -2130,14 +2134,14 @@ void Field_longlong::sql_type(String &res) const
...
@@ -2130,14 +2134,14 @@ void Field_longlong::sql_type(String &res) const
int
Field_float
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_float
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
errno
=
0
;
// my_strntod() changes errno
int
err
=
0
;
Field_float
::
store
(
my_strntod
(
cs
,(
char
*
)
from
,
len
,(
char
**
)
NULL
));
Field_float
::
store
(
my_strntod
(
cs
,(
char
*
)
from
,
len
,(
char
**
)
NULL
,
&
err
));
if
(
err
no
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
,
cs
))
if
(
err
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
,
cs
))
{
{
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
return
1
;
return
1
;
}
}
return
(
err
no
)
?
1
:
0
;
return
(
err
)
?
1
:
0
;
}
}
...
@@ -2403,19 +2407,17 @@ void Field_float::sql_type(String &res) const
...
@@ -2403,19 +2407,17 @@ void Field_float::sql_type(String &res) const
int
Field_double
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_double
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
errno
=
0
;
// my_strntod() changes errno
int
err
=
0
;
int
error
=
0
;
double
j
=
my_strntod
(
cs
,(
char
*
)
from
,
len
,(
char
**
)
0
,
&
err
);
double
j
=
my_strntod
(
cs
,(
char
*
)
from
,
len
,(
char
**
)
0
);
if
(
err
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
,
cs
))
if
(
errno
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
,
cs
))
{
{
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
error
=
1
;
}
}
if
(
unsigned_flag
&&
j
<
0
)
if
(
unsigned_flag
&&
j
<
0
)
{
{
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
j
=
0
;
j
=
0
;
err
or
=
1
;
err
=
1
;
}
}
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
if
(
table
->
db_low_byte_first
)
...
@@ -2425,7 +2427,7 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
...
@@ -2425,7 +2427,7 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
else
else
#endif
#endif
doublestore
(
ptr
,
j
);
doublestore
(
ptr
,
j
);
return
err
or
;
return
err
;
}
}
...
@@ -3191,8 +3193,9 @@ void Field_time::sql_type(String &res) const
...
@@ -3191,8 +3193,9 @@ void Field_time::sql_type(String &res) const
int
Field_year
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_year
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
int
err
;
char
*
end
;
char
*
end
;
long
nr
=
my_strntol
(
cs
,
from
,
len
,
&
end
,
10
);
long
nr
=
my_strntol
(
cs
,
from
,
len
,
10
,
&
end
,
&
err
);
if
(
nr
<
0
||
nr
>=
100
&&
nr
<=
1900
||
nr
>
2155
)
if
(
nr
<
0
||
nr
>=
100
&&
nr
<=
1900
||
nr
>
2155
)
{
{
...
@@ -3929,15 +3932,17 @@ int Field_string::store(longlong nr)
...
@@ -3929,15 +3932,17 @@ int Field_string::store(longlong nr)
double
Field_string
::
val_real
(
void
)
double
Field_string
::
val_real
(
void
)
{
{
int
err
;
CHARSET_INFO
*
cs
=
charset
();
CHARSET_INFO
*
cs
=
charset
();
return
my_strntod
(
cs
,
ptr
,
field_length
,(
char
**
)
0
);
return
my_strntod
(
cs
,
ptr
,
field_length
,(
char
**
)
0
,
&
err
);
}
}
longlong
Field_string
::
val_int
(
void
)
longlong
Field_string
::
val_int
(
void
)
{
{
int
err
;
CHARSET_INFO
*
cs
=
charset
();
CHARSET_INFO
*
cs
=
charset
();
return
my_strntoll
(
cs
,
ptr
,
field_length
,
NULL
,
10
);
return
my_strntoll
(
cs
,
ptr
,
field_length
,
10
,
NULL
,
&
err
);
}
}
...
@@ -4096,17 +4101,19 @@ int Field_varstring::store(longlong nr)
...
@@ -4096,17 +4101,19 @@ int Field_varstring::store(longlong nr)
double
Field_varstring
::
val_real
(
void
)
double
Field_varstring
::
val_real
(
void
)
{
{
int
err
;
uint
length
=
uint2korr
(
ptr
)
+
2
;
uint
length
=
uint2korr
(
ptr
)
+
2
;
CHARSET_INFO
*
cs
=
charset
();
CHARSET_INFO
*
cs
=
charset
();
return
my_strntod
(
cs
,
ptr
+
2
,
length
,(
char
**
)
0
);
return
my_strntod
(
cs
,
ptr
+
2
,
length
,(
char
**
)
0
,
&
err
);
}
}
longlong
Field_varstring
::
val_int
(
void
)
longlong
Field_varstring
::
val_int
(
void
)
{
{
int
err
;
uint
length
=
uint2korr
(
ptr
)
+
2
;
uint
length
=
uint2korr
(
ptr
)
+
2
;
CHARSET_INFO
*
cs
=
charset
();
CHARSET_INFO
*
cs
=
charset
();
return
my_strntoll
(
cs
,
ptr
+
2
,
length
,
NULL
,
10
);
return
my_strntoll
(
cs
,
ptr
+
2
,
length
,
10
,
NULL
,
&
err
);
}
}
...
@@ -4414,24 +4421,26 @@ int Field_blob::store(longlong nr)
...
@@ -4414,24 +4421,26 @@ int Field_blob::store(longlong nr)
double
Field_blob
::
val_real
(
void
)
double
Field_blob
::
val_real
(
void
)
{
{
int
err
;
char
*
blob
;
char
*
blob
;
memcpy_fixed
(
&
blob
,
ptr
+
packlength
,
sizeof
(
char
*
));
memcpy_fixed
(
&
blob
,
ptr
+
packlength
,
sizeof
(
char
*
));
if
(
!
blob
)
if
(
!
blob
)
return
0.0
;
return
0.0
;
uint32
length
=
get_length
(
ptr
);
uint32
length
=
get_length
(
ptr
);
CHARSET_INFO
*
cs
=
charset
();
CHARSET_INFO
*
cs
=
charset
();
return
my_strntod
(
cs
,
blob
,
length
,(
char
**
)
0
);
return
my_strntod
(
cs
,
blob
,
length
,(
char
**
)
0
,
&
err
);
}
}
longlong
Field_blob
::
val_int
(
void
)
longlong
Field_blob
::
val_int
(
void
)
{
{
int
err
;
char
*
blob
;
char
*
blob
;
memcpy_fixed
(
&
blob
,
ptr
+
packlength
,
sizeof
(
char
*
));
memcpy_fixed
(
&
blob
,
ptr
+
packlength
,
sizeof
(
char
*
));
if
(
!
blob
)
if
(
!
blob
)
return
0
;
return
0
;
uint32
length
=
get_length
(
ptr
);
uint32
length
=
get_length
(
ptr
);
return
my_strntoll
(
charset
(),
blob
,
length
,
NULL
,
10
);
return
my_strntoll
(
charset
(),
blob
,
length
,
10
,
NULL
,
&
err
);
}
}
...
@@ -4846,7 +4855,7 @@ uint find_enum(TYPELIB *lib,const char *x, uint length)
...
@@ -4846,7 +4855,7 @@ uint find_enum(TYPELIB *lib,const char *x, uint length)
int
Field_enum
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
int
Field_enum
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
{
{
int
err
or
=
0
;
int
err
=
0
;
uint
tmp
=
find_enum
(
typelib
,
from
,
length
);
uint
tmp
=
find_enum
(
typelib
,
from
,
length
);
if
(
!
tmp
)
if
(
!
tmp
)
{
{
...
@@ -4854,20 +4863,18 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
...
@@ -4854,20 +4863,18 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
{
{
/* This is for reading numbers with LOAD DATA INFILE */
/* This is for reading numbers with LOAD DATA INFILE */
char
*
end
;
char
*
end
;
my_errno
=
0
;
tmp
=
(
uint
)
my_strntoul
(
cs
,
from
,
length
,
10
,
&
end
,
&
err
);
tmp
=
(
uint
)
my_strntoul
(
cs
,
from
,
length
,
&
end
,
10
);
if
(
err
||
end
!=
from
+
length
||
tmp
>
typelib
->
count
)
if
(
my_errno
||
end
!=
from
+
length
||
tmp
>
typelib
->
count
)
{
{
tmp
=
0
;
tmp
=
0
;
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
error
=
1
;
}
}
}
}
else
else
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
}
}
store_type
((
ulonglong
)
tmp
);
store_type
((
ulonglong
)
tmp
);
return
err
or
;
return
err
;
}
}
...
@@ -5052,7 +5059,7 @@ ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
...
@@ -5052,7 +5059,7 @@ ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
int
Field_set
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
int
Field_set
::
store
(
const
char
*
from
,
uint
length
,
CHARSET_INFO
*
cs
)
{
{
int
err
or
=
0
;
int
err
=
0
;
char
*
not_used
;
char
*
not_used
;
uint
not_used2
;
uint
not_used2
;
...
@@ -5061,19 +5068,17 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
...
@@ -5061,19 +5068,17 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
{
{
/* This is for reading numbers with LOAD DATA INFILE */
/* This is for reading numbers with LOAD DATA INFILE */
char
*
end
;
char
*
end
;
my_errno
=
0
;
tmp
=
my_strntoull
(
cs
,
from
,
length
,
10
,
&
end
,
&
err
);
tmp
=
my_strntoull
(
cs
,
from
,
length
,
&
end
,
10
);
if
(
err
||
end
!=
from
+
length
||
if
(
my_errno
||
end
!=
from
+
length
||
tmp
>
(
ulonglong
)
(((
longlong
)
1
<<
typelib
->
count
)
-
(
longlong
)
1
))
tmp
>
(
ulonglong
)
(((
longlong
)
1
<<
typelib
->
count
)
-
(
longlong
)
1
))
{
{
tmp
=
0
;
tmp
=
0
;
error
=
1
;
}
}
else
else
current_thd
->
cuted_fields
--
;
// Remove warning from find_set
current_thd
->
cuted_fields
--
;
// Remove warning from find_set
}
}
store_type
(
tmp
);
store_type
(
tmp
);
return
err
or
;
return
err
;
}
}
...
...
sql/item.cc
View file @
4bd6c356
...
@@ -378,10 +378,11 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
...
@@ -378,10 +378,11 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
double
Item_param
::
val
()
double
Item_param
::
val
()
{
{
int
err
;
switch
(
item_result_type
)
{
switch
(
item_result_type
)
{
case
STRING_RESULT
:
case
STRING_RESULT
:
return
(
double
)
my_strntod
(
str_value
.
charset
(),
(
char
*
)
str_value
.
ptr
(),
return
(
double
)
my_strntod
(
str_value
.
charset
(),
(
char
*
)
str_value
.
ptr
(),
str_value
.
length
(),
(
char
**
)
0
);
str_value
.
length
(),
(
char
**
)
0
,
&
err
);
case
INT_RESULT
:
case
INT_RESULT
:
return
(
double
)
int_value
;
return
(
double
)
int_value
;
default:
default:
...
@@ -392,9 +393,12 @@ double Item_param::val()
...
@@ -392,9 +393,12 @@ double Item_param::val()
longlong
Item_param
::
val_int
()
longlong
Item_param
::
val_int
()
{
{
int
err
;
switch
(
item_result_type
)
{
switch
(
item_result_type
)
{
case
STRING_RESULT
:
case
STRING_RESULT
:
return
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),(
char
**
)
0
,
10
);
return
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),
10
,
(
char
**
)
0
,
&
err
);
case
REAL_RESULT
:
case
REAL_RESULT
:
return
(
longlong
)
(
real_value
+
(
real_value
>
0
?
0.5
:
-
0.5
));
return
(
longlong
)
(
real_value
+
(
real_value
>
0
?
0.5
:
-
0.5
));
default:
default:
...
@@ -1263,17 +1267,19 @@ void Item_cache_str::store(Item *item)
...
@@ -1263,17 +1267,19 @@ void Item_cache_str::store(Item *item)
}
}
double
Item_cache_str
::
val
()
double
Item_cache_str
::
val
()
{
{
int
err
;
if
(
value
)
if
(
value
)
return
my_strntod
(
value
->
charset
(),
(
char
*
)
value
->
ptr
(),
return
my_strntod
(
value
->
charset
(),
(
char
*
)
value
->
ptr
(),
value
->
length
(),
(
char
**
)
0
);
value
->
length
(),
(
char
**
)
0
,
&
err
);
else
else
return
(
double
)
0
;
return
(
double
)
0
;
}
}
longlong
Item_cache_str
::
val_int
()
longlong
Item_cache_str
::
val_int
()
{
{
int
err
;
if
(
value
)
if
(
value
)
return
my_strntoll
(
value
->
charset
(),
value
->
ptr
(),
return
my_strntoll
(
value
->
charset
(),
value
->
ptr
(),
value
->
length
(),
(
char
**
)
0
,
10
);
value
->
length
(),
10
,
(
char
**
)
0
,
&
err
);
else
else
return
(
longlong
)
0
;
return
(
longlong
)
0
;
}
}
...
...
sql/item.h
View file @
4bd6c356
...
@@ -344,13 +344,15 @@ public:
...
@@ -344,13 +344,15 @@ public:
enum
Type
type
()
const
{
return
STRING_ITEM
;
}
enum
Type
type
()
const
{
return
STRING_ITEM
;
}
double
val
()
double
val
()
{
{
int
err
;
return
my_strntod
(
str_value
.
charset
(),
(
char
*
)
str_value
.
ptr
(),
return
my_strntod
(
str_value
.
charset
(),
(
char
*
)
str_value
.
ptr
(),
str_value
.
length
(),
(
char
**
)
0
);
str_value
.
length
(),
(
char
**
)
0
,
&
err
);
}
}
longlong
val_int
()
longlong
val_int
()
{
{
int
err
;
return
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
return
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),
(
char
**
)
0
,
10
);
str_value
.
length
(),
10
,
(
char
**
)
0
,
&
err
);
}
}
String
*
val_str
(
String
*
)
{
return
(
String
*
)
&
str_value
;
}
String
*
val_str
(
String
*
)
{
return
(
String
*
)
&
str_value
;
}
int
save_in_field
(
Field
*
field
,
bool
no_conversions
);
int
save_in_field
(
Field
*
field
,
bool
no_conversions
);
...
@@ -599,12 +601,16 @@ public:
...
@@ -599,12 +601,16 @@ public:
enum_field_types
field_type
()
const
{
return
cached_field_type
;
}
enum_field_types
field_type
()
const
{
return
cached_field_type
;
}
double
val
()
double
val
()
{
{
int
err
;
return
(
null_value
?
0.0
:
return
(
null_value
?
0.0
:
my_strntod
(
str_value
.
charset
(),
(
char
*
)
str_value
.
ptr
(),
my_strntod
(
str_value
.
charset
(),
(
char
*
)
str_value
.
ptr
(),
str_value
.
length
(),
NULL
));
str_value
.
length
(),
NULL
,
&
err
));
}
}
longlong
val_int
()
longlong
val_int
()
{
return
null_value
?
LL
(
0
)
:
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),(
char
**
)
0
,
10
);
}
{
int
err
;
return
null_value
?
LL
(
0
)
:
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),
10
,
(
char
**
)
0
,
&
err
);
}
String
*
val_str
(
String
*
);
String
*
val_str
(
String
*
);
void
make_field
(
Send_field
*
field
)
{
item
->
make_field
(
field
);
}
void
make_field
(
Send_field
*
field
)
{
item
->
make_field
(
field
);
}
void
copy
();
void
copy
();
...
...
sql/item_func.h
View file @
4bd6c356
...
@@ -812,13 +812,15 @@ public:
...
@@ -812,13 +812,15 @@ public:
String
*
val_str
(
String
*
);
String
*
val_str
(
String
*
);
double
val
()
double
val
()
{
{
int
err
;
String
*
res
;
res
=
val_str
(
&
str_value
);
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
my_strntod
(
res
->
charset
(),(
char
*
)
res
->
ptr
(),
res
->
length
(),
0
)
:
0.0
;
return
res
?
my_strntod
(
res
->
charset
(),(
char
*
)
res
->
ptr
(),
res
->
length
(),
0
,
&
err
)
:
0.0
;
}
}
longlong
val_int
()
longlong
val_int
()
{
{
int
err
;
String
*
res
;
res
=
val_str
(
&
str_value
);
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
(
char
**
)
0
,
10
)
:
(
longlong
)
0
;
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
10
,(
char
**
)
0
,
&
err
)
:
(
longlong
)
0
;
}
}
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
fix_length_and_dec
();
void
fix_length_and_dec
();
...
...
sql/item_strfunc.cc
View file @
4bd6c356
...
@@ -52,17 +52,19 @@ uint nr_of_decimals(const char *str)
...
@@ -52,17 +52,19 @@ uint nr_of_decimals(const char *str)
double
Item_str_func
::
val
()
double
Item_str_func
::
val
()
{
{
int
err
;
String
*
res
;
String
*
res
;
res
=
val_str
(
&
str_value
);
res
=
val_str
(
&
str_value
);
return
res
?
my_strntod
(
res
->
charset
(),
(
char
*
)
res
->
ptr
(),
res
->
length
(),
return
res
?
my_strntod
(
res
->
charset
(),
(
char
*
)
res
->
ptr
(),
res
->
length
(),
NULL
)
:
0.0
;
NULL
,
&
err
)
:
0.0
;
}
}
longlong
Item_str_func
::
val_int
()
longlong
Item_str_func
::
val_int
()
{
{
int
err
;
String
*
res
;
String
*
res
;
res
=
val_str
(
&
str_value
);
res
=
val_str
(
&
str_value
);
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
NULL
,
10
)
:
(
longlong
)
0
;
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
10
,
NULL
,
&
err
)
:
(
longlong
)
0
;
}
}
...
@@ -1956,6 +1958,7 @@ String *Item_func_conv::val_str(String *str)
...
@@ -1956,6 +1958,7 @@ String *Item_func_conv::val_str(String *str)
longlong
dec
;
longlong
dec
;
int
from_base
=
(
int
)
args
[
1
]
->
val_int
();
int
from_base
=
(
int
)
args
[
1
]
->
val_int
();
int
to_base
=
(
int
)
args
[
2
]
->
val_int
();
int
to_base
=
(
int
)
args
[
2
]
->
val_int
();
int
err
;
if
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
||
args
[
2
]
->
null_value
||
if
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
||
args
[
2
]
->
null_value
||
abs
(
to_base
)
>
36
||
abs
(
to_base
)
<
2
||
abs
(
to_base
)
>
36
||
abs
(
to_base
)
<
2
||
...
@@ -1966,9 +1969,9 @@ String *Item_func_conv::val_str(String *str)
...
@@ -1966,9 +1969,9 @@ String *Item_func_conv::val_str(String *str)
}
}
null_value
=
0
;
null_value
=
0
;
if
(
from_base
<
0
)
if
(
from_base
<
0
)
dec
=
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
&
endptr
,
-
from_base
);
dec
=
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
-
from_base
,
&
endptr
,
&
err
);
else
else
dec
=
(
longlong
)
my_strntoull
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
&
endptr
,
from_base
);
dec
=
(
longlong
)
my_strntoull
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
from_base
,
&
endptr
,
&
err
);
ptr
=
longlong2str
(
dec
,
ans
,
to_base
);
ptr
=
longlong2str
(
dec
,
ans
,
to_base
);
if
(
str
->
copy
(
ans
,(
uint32
)
(
ptr
-
ans
),
thd_charset
()))
if
(
str
->
copy
(
ans
,(
uint32
)
(
ptr
-
ans
),
thd_charset
()))
return
&
empty_string
;
return
&
empty_string
;
...
...
sql/item_sum.cc
View file @
4bd6c356
...
@@ -336,13 +336,14 @@ void Item_sum_variance::update_field(int offset)
...
@@ -336,13 +336,14 @@ void Item_sum_variance::update_field(int offset)
double
Item_sum_hybrid
::
val
()
double
Item_sum_hybrid
::
val
()
{
{
int
err
;
if
(
null_value
)
if
(
null_value
)
return
0.0
;
return
0.0
;
switch
(
hybrid_type
)
{
switch
(
hybrid_type
)
{
case
STRING_RESULT
:
case
STRING_RESULT
:
String
*
res
;
res
=
val_str
(
&
str_value
);
String
*
res
;
res
=
val_str
(
&
str_value
);
return
(
res
?
my_strntod
(
res
->
charset
(),
(
char
*
)
res
->
ptr
(),
res
->
length
(),
return
(
res
?
my_strntod
(
res
->
charset
(),
(
char
*
)
res
->
ptr
(),
res
->
length
(),
(
char
**
)
0
)
:
0.0
);
(
char
**
)
0
,
&
err
)
:
0.0
);
case
INT_RESULT
:
case
INT_RESULT
:
if
(
unsigned_flag
)
if
(
unsigned_flag
)
return
ulonglong2double
(
sum_int
);
return
ulonglong2double
(
sum_int
);
...
...
sql/item_sum.h
View file @
4bd6c356
...
@@ -483,14 +483,16 @@ public:
...
@@ -483,14 +483,16 @@ public:
String
*
val_str
(
String
*
);
String
*
val_str
(
String
*
);
double
val
()
double
val
()
{
{
int
err
;
String
*
res
;
res
=
val_str
(
&
str_value
);
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
my_strntod
(
res
->
charset
(),(
char
*
)
res
->
ptr
(),
res
->
length
(),
return
res
?
my_strntod
(
res
->
charset
(),(
char
*
)
res
->
ptr
(),
res
->
length
(),
(
char
**
)
0
)
:
0.0
;
(
char
**
)
0
,
&
err
)
:
0.0
;
}
}
longlong
val_int
()
longlong
val_int
()
{
{
int
err
;
String
*
res
;
res
=
val_str
(
&
str_value
);
String
*
res
;
res
=
val_str
(
&
str_value
);
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
(
char
**
)
0
,
10
)
:
(
longlong
)
0
;
return
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
10
,
(
char
**
)
0
,
&
err
)
:
(
longlong
)
0
;
}
}
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
fix_length_and_dec
();
void
fix_length_and_dec
();
...
...
sql/mysqld.cc
View file @
4bd6c356
...
@@ -4666,9 +4666,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
...
@@ -4666,9 +4666,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
berkeley_lock_type
=
berkeley_lock_types
[
type
-
1
];
berkeley_lock_type
=
berkeley_lock_types
[
type
-
1
];
else
else
{
{
int
err
;
char
*
end
;
char
*
end
;
uint
length
=
strlen
(
argument
);
uint
length
=
strlen
(
argument
);
long
value
=
my_strntol
(
my_charset_latin1
,
argument
,
length
,
&
end
,
10
);
long
value
=
my_strntol
(
my_charset_latin1
,
argument
,
length
,
10
,
&
end
,
&
err
);
if
(
test_if_int
(
argument
,(
uint
)
length
,
end
,
my_charset_latin1
))
if
(
test_if_int
(
argument
,(
uint
)
length
,
end
,
my_charset_latin1
))
berkeley_lock_scan_time
=
value
;
berkeley_lock_scan_time
=
value
;
else
else
...
...
sql/procedure.h
View file @
4bd6c356
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
void
set
(
double
nr
)
{
value
=
nr
;
}
void
set
(
double
nr
)
{
value
=
nr
;
}
void
set
(
longlong
nr
)
{
value
=
(
double
)
nr
;
}
void
set
(
longlong
nr
)
{
value
=
(
double
)
nr
;
}
void
set
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
void
set
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
{
value
=
my_strntod
(
cs
,(
char
*
)
str
,
length
,(
char
**
)
0
);
}
{
int
err
;
value
=
my_strntod
(
cs
,(
char
*
)
str
,
length
,(
char
**
)
0
,
&
err
);
}
double
val
()
{
return
value
;
}
double
val
()
{
return
value
;
}
longlong
val_int
()
{
return
(
longlong
)
value
;
}
longlong
val_int
()
{
return
(
longlong
)
value
;
}
String
*
val_str
(
String
*
s
)
{
s
->
set
(
value
,
decimals
,
thd_charset
());
return
s
;
}
String
*
val_str
(
String
*
s
)
{
s
->
set
(
value
,
decimals
,
thd_charset
());
return
s
;
}
...
@@ -77,7 +77,7 @@ public:
...
@@ -77,7 +77,7 @@ public:
void
set
(
double
nr
)
{
value
=
(
longlong
)
nr
;
}
void
set
(
double
nr
)
{
value
=
(
longlong
)
nr
;
}
void
set
(
longlong
nr
)
{
value
=
nr
;
}
void
set
(
longlong
nr
)
{
value
=
nr
;
}
void
set
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
void
set
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
{
value
=
my_strntoll
(
cs
,
str
,
length
,
NULL
,
10
);
}
{
int
err
;
value
=
my_strntoll
(
cs
,
str
,
length
,
10
,
NULL
,
&
err
);
}
double
val
()
{
return
(
double
)
value
;
}
double
val
()
{
return
(
double
)
value
;
}
longlong
val_int
()
{
return
value
;
}
longlong
val_int
()
{
return
value
;
}
String
*
val_str
(
String
*
s
)
{
s
->
set
(
value
,
thd_charset
());
return
s
;
}
String
*
val_str
(
String
*
s
)
{
s
->
set
(
value
,
thd_charset
());
return
s
;
}
...
@@ -98,14 +98,16 @@ public:
...
@@ -98,14 +98,16 @@ public:
{
str_value
.
copy
(
str
,
length
,
cs
);
}
{
str_value
.
copy
(
str
,
length
,
cs
);
}
double
val
()
double
val
()
{
{
int
err
;
CHARSET_INFO
*
cs
=
str_value
.
charset
();
CHARSET_INFO
*
cs
=
str_value
.
charset
();
return
my_strntod
(
cs
,
(
char
*
)
str_value
.
ptr
(),
str_value
.
length
(),
return
my_strntod
(
cs
,
(
char
*
)
str_value
.
ptr
(),
str_value
.
length
(),
(
char
**
)
0
);
(
char
**
)
0
,
&
err
);
}
}
longlong
val_int
()
longlong
val_int
()
{
{
int
err
;
CHARSET_INFO
*
cs
=
str_value
.
charset
();
CHARSET_INFO
*
cs
=
str_value
.
charset
();
return
my_strntoll
(
cs
,
str_value
.
ptr
(),
str_value
.
length
(),
NULL
,
10
);
return
my_strntoll
(
cs
,
str_value
.
ptr
(),
str_value
.
length
(),
10
,
NULL
,
&
err
);
}
}
String
*
val_str
(
String
*
)
String
*
val_str
(
String
*
)
{
{
...
...
strings/ctype-simple.c
View file @
4bd6c356
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
#include <my_global.h>
#include <my_global.h>
#include "m_string.h"
#include "m_string.h"
#include "m_ctype.h"
#include "m_ctype.h"
#include "my_sys.h"
/* defines errno */
#include <errno.h>
#include <errno.h>
#include "stdarg.h"
#include "stdarg.h"
...
@@ -203,7 +202,8 @@ void my_hash_sort_simple(CHARSET_INFO *cs,
...
@@ -203,7 +202,8 @@ void my_hash_sort_simple(CHARSET_INFO *cs,
long
my_strntol_8bit
(
CHARSET_INFO
*
cs
,
long
my_strntol_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
int
base
,
char
**
endptr
,
int
*
err
)
{
{
int
negative
;
int
negative
;
register
ulong
cutoff
;
register
ulong
cutoff
;
...
@@ -303,14 +303,14 @@ long my_strntol_8bit(CHARSET_INFO *cs,
...
@@ -303,14 +303,14 @@ long my_strntol_8bit(CHARSET_INFO *cs,
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
)
;
err
[
0
]
=
ERANGE
;
return
negative
?
LONG_MIN
:
LONG_MAX
;
return
negative
?
LONG_MIN
:
LONG_MAX
;
}
}
return
(
negative
?
-
((
long
)
i
)
:
(
long
)
i
);
return
(
negative
?
-
((
long
)
i
)
:
(
long
)
i
);
noconv:
noconv:
my_errno
=
(
EDOM
)
;
err
[
0
]
=
EDOM
;
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
return
0L
;
...
@@ -318,7 +318,8 @@ noconv:
...
@@ -318,7 +318,8 @@ noconv:
ulong
my_strntoul_8bit
(
CHARSET_INFO
*
cs
,
ulong
my_strntoul_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
int
base
,
char
**
endptr
,
int
*
err
)
{
{
int
negative
;
int
negative
;
register
ulong
cutoff
;
register
ulong
cutoff
;
...
@@ -409,14 +410,14 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
...
@@ -409,14 +410,14 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
)
;
err
[
0
]
=
ERANGE
;
return
((
ulong
)
~
0L
);
return
((
ulong
)
~
0L
);
}
}
return
(
negative
?
-
((
long
)
i
)
:
(
long
)
i
);
return
(
negative
?
-
((
long
)
i
)
:
(
long
)
i
);
noconv:
noconv:
my_errno
=
(
EDOM
)
;
err
[
0
]
=
EDOM
;
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
return
0L
;
...
@@ -424,7 +425,8 @@ noconv:
...
@@ -424,7 +425,8 @@ noconv:
longlong
my_strntoll_8bit
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
longlong
my_strntoll_8bit
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
int
base
,
char
**
endptr
,
int
*
err
)
{
{
int
negative
;
int
negative
;
register
ulonglong
cutoff
;
register
ulonglong
cutoff
;
...
@@ -524,14 +526,14 @@ longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)),
...
@@ -524,14 +526,14 @@ longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)),
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
)
;
err
[
0
]
=
ERANGE
;
return
negative
?
LONGLONG_MIN
:
LONGLONG_MAX
;
return
negative
?
LONGLONG_MIN
:
LONGLONG_MAX
;
}
}
return
(
negative
?
-
((
longlong
)
i
)
:
(
longlong
)
i
);
return
(
negative
?
-
((
longlong
)
i
)
:
(
longlong
)
i
);
noconv:
noconv:
my_errno
=
(
EDOM
)
;
err
[
0
]
=
EDOM
;
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
return
0L
;
...
@@ -539,7 +541,8 @@ noconv:
...
@@ -539,7 +541,8 @@ noconv:
ulonglong
my_strntoull_8bit
(
CHARSET_INFO
*
cs
,
ulonglong
my_strntoull_8bit
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
int
base
,
char
**
endptr
,
int
*
err
)
{
{
int
negative
;
int
negative
;
register
ulonglong
cutoff
;
register
ulonglong
cutoff
;
...
@@ -631,14 +634,14 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs,
...
@@ -631,14 +634,14 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs,
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
)
;
err
[
0
]
=
ERANGE
;
return
(
~
(
ulonglong
)
0
);
return
(
~
(
ulonglong
)
0
);
}
}
return
(
negative
?
-
((
longlong
)
i
)
:
(
longlong
)
i
);
return
(
negative
?
-
((
longlong
)
i
)
:
(
longlong
)
i
);
noconv:
noconv:
my_errno
=
(
EDOM
)
;
err
[
0
]
=
EDOM
;
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
return
0L
;
...
@@ -667,7 +670,8 @@ noconv:
...
@@ -667,7 +670,8 @@ noconv:
double
my_strntod_8bit
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
double
my_strntod_8bit
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
char
*
str
,
uint
length
,
char
**
end
)
char
*
str
,
uint
length
,
char
**
end
,
int
*
err
__attribute__
((
unused
)))
{
{
char
end_char
;
char
end_char
;
double
result
;
double
result
;
...
...
strings/ctype-utf8.c
View file @
4bd6c356
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
#include <my_global.h>
#include <my_global.h>
#include "m_string.h"
#include "m_string.h"
#include "m_ctype.h"
#include "m_ctype.h"
#include "my_sys.h"
/* defines errno */
#include <errno.h>
#include <errno.h>
#ifdef HAVE_CHARSET_utf8
#ifdef HAVE_CHARSET_utf8
...
@@ -2446,7 +2445,8 @@ static int my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused))
...
@@ -2446,7 +2445,8 @@ static int my_snprintf_ucs2(CHARSET_INFO *cs __attribute__((unused))
long
my_strntol_ucs2
(
CHARSET_INFO
*
cs
,
long
my_strntol_ucs2
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
int
base
,
char
**
endptr
,
int
*
err
)
{
{
int
negative
=
0
;
int
negative
=
0
;
int
overflow
;
int
overflow
;
...
@@ -2475,7 +2475,7 @@ long my_strntol_ucs2(CHARSET_INFO *cs,
...
@@ -2475,7 +2475,7 @@ long my_strntol_ucs2(CHARSET_INFO *cs,
{
{
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
err
[
0
]
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
return
0
;
return
0
;
}
}
s
+=
cnv
;
s
+=
cnv
;
...
@@ -2518,7 +2518,7 @@ bs:
...
@@ -2518,7 +2518,7 @@ bs:
{
{
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
EILSEQ
;
err
[
0
]
=
EILSEQ
;
return
0
;
return
0
;
}
}
else
else
...
@@ -2533,7 +2533,7 @@ bs:
...
@@ -2533,7 +2533,7 @@ bs:
if
(
s
==
save
)
if
(
s
==
save
)
{
{
my_errno
=
EDOM
;
err
[
0
]
=
EDOM
;
return
0L
;
return
0L
;
}
}
...
@@ -2547,7 +2547,7 @@ bs:
...
@@ -2547,7 +2547,7 @@ bs:
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
)
;
err
[
0
]
=
ERANGE
;
return
negative
?
LONG_MIN
:
LONG_MAX
;
return
negative
?
LONG_MIN
:
LONG_MAX
;
}
}
...
@@ -2556,7 +2556,8 @@ bs:
...
@@ -2556,7 +2556,8 @@ bs:
ulong
my_strntoul_ucs2
(
CHARSET_INFO
*
cs
,
ulong
my_strntoul_ucs2
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
int
base
,
char
**
endptr
,
int
*
err
)
{
{
int
negative
=
0
;
int
negative
=
0
;
int
overflow
;
int
overflow
;
...
@@ -2585,7 +2586,7 @@ ulong my_strntoul_ucs2(CHARSET_INFO *cs,
...
@@ -2585,7 +2586,7 @@ ulong my_strntoul_ucs2(CHARSET_INFO *cs,
{
{
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
err
[
0
]
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
return
0
;
return
0
;
}
}
s
+=
cnv
;
s
+=
cnv
;
...
@@ -2628,7 +2629,7 @@ bs:
...
@@ -2628,7 +2629,7 @@ bs:
{
{
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
EILSEQ
;
err
[
0
]
=
EILSEQ
;
return
0
;
return
0
;
}
}
else
else
...
@@ -2643,13 +2644,13 @@ bs:
...
@@ -2643,13 +2644,13 @@ bs:
if
(
s
==
save
)
if
(
s
==
save
)
{
{
my_errno
=
EDOM
;
err
[
0
]
=
EDOM
;
return
0L
;
return
0L
;
}
}
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
);
err
[
0
]
=
(
ERANGE
);
return
((
ulong
)
~
0L
);
return
((
ulong
)
~
0L
);
}
}
...
@@ -2660,7 +2661,8 @@ bs:
...
@@ -2660,7 +2661,8 @@ bs:
longlong
my_strntoll_ucs2
(
CHARSET_INFO
*
cs
,
longlong
my_strntoll_ucs2
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
int
base
,
char
**
endptr
,
int
*
err
)
{
{
int
negative
=
0
;
int
negative
=
0
;
int
overflow
;
int
overflow
;
...
@@ -2689,7 +2691,7 @@ longlong my_strntoll_ucs2(CHARSET_INFO *cs,
...
@@ -2689,7 +2691,7 @@ longlong my_strntoll_ucs2(CHARSET_INFO *cs,
{
{
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
err
[
0
]
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
return
0
;
return
0
;
}
}
s
+=
cnv
;
s
+=
cnv
;
...
@@ -2732,7 +2734,7 @@ bs:
...
@@ -2732,7 +2734,7 @@ bs:
{
{
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
EILSEQ
;
err
[
0
]
=
EILSEQ
;
return
0
;
return
0
;
}
}
else
else
...
@@ -2747,7 +2749,7 @@ bs:
...
@@ -2747,7 +2749,7 @@ bs:
if
(
s
==
save
)
if
(
s
==
save
)
{
{
my_errno
=
EDOM
;
err
[
0
]
=
EDOM
;
return
0L
;
return
0L
;
}
}
...
@@ -2761,7 +2763,7 @@ bs:
...
@@ -2761,7 +2763,7 @@ bs:
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
)
;
err
[
0
]
=
ERANGE
;
return
negative
?
LONGLONG_MIN
:
LONGLONG_MAX
;
return
negative
?
LONGLONG_MIN
:
LONGLONG_MAX
;
}
}
...
@@ -2772,7 +2774,8 @@ bs:
...
@@ -2772,7 +2774,8 @@ bs:
ulonglong
my_strntoull_ucs2
(
CHARSET_INFO
*
cs
,
ulonglong
my_strntoull_ucs2
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
int
base
,
char
**
endptr
,
int
*
err
)
{
{
int
negative
=
0
;
int
negative
=
0
;
int
overflow
;
int
overflow
;
...
@@ -2801,7 +2804,7 @@ ulonglong my_strntoull_ucs2(CHARSET_INFO *cs,
...
@@ -2801,7 +2804,7 @@ ulonglong my_strntoull_ucs2(CHARSET_INFO *cs,
{
{
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
err
[
0
]
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
return
0
;
return
0
;
}
}
s
+=
cnv
;
s
+=
cnv
;
...
@@ -2844,7 +2847,7 @@ bs:
...
@@ -2844,7 +2847,7 @@ bs:
{
{
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
EILSEQ
;
err
[
0
]
=
EILSEQ
;
return
0
;
return
0
;
}
}
else
else
...
@@ -2859,13 +2862,13 @@ bs:
...
@@ -2859,13 +2862,13 @@ bs:
if
(
s
==
save
)
if
(
s
==
save
)
{
{
my_errno
=
EDOM
;
err
[
0
]
=
EDOM
;
return
0L
;
return
0L
;
}
}
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
)
;
err
[
0
]
=
ERANGE
;
return
(
~
(
ulonglong
)
0
);
return
(
~
(
ulonglong
)
0
);
}
}
...
@@ -2874,7 +2877,8 @@ bs:
...
@@ -2874,7 +2877,8 @@ bs:
double
my_strntod_ucs2
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
double
my_strntod_ucs2
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
char
*
nptr
,
uint
length
,
char
**
endptr
)
char
*
nptr
,
uint
length
,
char
**
endptr
,
int
*
err
__attribute__
((
unused
)))
{
{
char
buf
[
256
];
char
buf
[
256
];
double
res
;
double
res
;
...
...
strings/ctype.c
View file @
4bd6c356
...
@@ -3983,6 +3983,7 @@ typedef struct my_cs_file_info
...
@@ -3983,6 +3983,7 @@ typedef struct my_cs_file_info
static
int
fill_uchar
(
uchar
*
a
,
uint
size
,
const
char
*
str
,
uint
len
)
static
int
fill_uchar
(
uchar
*
a
,
uint
size
,
const
char
*
str
,
uint
len
)
{
{
int
err
=
0
;
uint
i
=
0
;
uint
i
=
0
;
const
char
*
s
,
*
b
,
*
e
=
str
+
len
;
const
char
*
s
,
*
b
,
*
e
=
str
+
len
;
...
@@ -3993,7 +3994,7 @@ static int fill_uchar(uchar *a,uint size,const char *str, uint len)
...
@@ -3993,7 +3994,7 @@ static int fill_uchar(uchar *a,uint size,const char *str, uint len)
for
(
;
(
s
<
e
)
&&
!
strchr
(
"
\t\r\n
"
,
s
[
0
]);
s
++
)
;
for
(
;
(
s
<
e
)
&&
!
strchr
(
"
\t\r\n
"
,
s
[
0
]);
s
++
)
;
if
(
s
==
b
||
i
>
size
)
if
(
s
==
b
||
i
>
size
)
break
;
break
;
a
[
i
]
=
my_strntoul
(
my_charset_latin1
,
b
,
s
-
b
,
NULL
,
16
);
a
[
i
]
=
my_strntoul
(
my_charset_latin1
,
b
,
s
-
b
,
16
,
NULL
,
&
err
);
}
}
return
0
;
return
0
;
}
}
...
@@ -4001,6 +4002,8 @@ static int fill_uchar(uchar *a,uint size,const char *str, uint len)
...
@@ -4001,6 +4002,8 @@ static int fill_uchar(uchar *a,uint size,const char *str, uint len)
static
int
fill_uint16
(
uint16
*
a
,
uint
size
,
const
char
*
str
,
uint
len
)
static
int
fill_uint16
(
uint16
*
a
,
uint
size
,
const
char
*
str
,
uint
len
)
{
{
uint
i
=
0
;
uint
i
=
0
;
int
err
;
const
char
*
s
,
*
b
,
*
e
=
str
+
len
;
const
char
*
s
,
*
b
,
*
e
=
str
+
len
;
for
(
s
=
str
;
s
<
e
;
i
++
)
for
(
s
=
str
;
s
<
e
;
i
++
)
{
{
...
@@ -4009,7 +4012,7 @@ static int fill_uint16(uint16 *a,uint size,const char *str, uint len)
...
@@ -4009,7 +4012,7 @@ static int fill_uint16(uint16 *a,uint size,const char *str, uint len)
for
(
;
(
s
<
e
)
&&
!
strchr
(
"
\t\r\n
"
,
s
[
0
]);
s
++
)
;
for
(
;
(
s
<
e
)
&&
!
strchr
(
"
\t\r\n
"
,
s
[
0
]);
s
++
)
;
if
(
s
==
b
||
i
>
size
)
if
(
s
==
b
||
i
>
size
)
break
;
break
;
a
[
i
]
=
my_strntol
(
my_charset_latin1
,
b
,
s
-
b
,
NULL
,
16
);
a
[
i
]
=
my_strntol
(
my_charset_latin1
,
b
,
s
-
b
,
16
,
NULL
,
&
err
);
}
}
return
0
;
return
0
;
}
}
...
@@ -4051,6 +4054,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
...
@@ -4051,6 +4054,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
struct
my_cs_file_info
*
i
=
(
struct
my_cs_file_info
*
)
st
->
user_data
;
struct
my_cs_file_info
*
i
=
(
struct
my_cs_file_info
*
)
st
->
user_data
;
struct
my_cs_file_section_st
*
s
;
struct
my_cs_file_section_st
*
s
;
int
state
=
(
s
=
cs_file_sec
(
st
->
attr
,
strlen
(
st
->
attr
)))
?
s
->
state
:
0
;
int
state
=
(
s
=
cs_file_sec
(
st
->
attr
,
strlen
(
st
->
attr
)))
?
s
->
state
:
0
;
int
err
;
#ifndef DBUG_OFF
#ifndef DBUG_OFF
if
(
0
){
if
(
0
){
...
@@ -4062,7 +4066,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
...
@@ -4062,7 +4066,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
switch
(
state
)
{
switch
(
state
)
{
case
_CS_ID
:
case
_CS_ID
:
i
->
cs
.
number
=
my_strntoul
(
my_charset_latin1
,
attr
,
len
,
(
char
**
)
NULL
,
0
);
i
->
cs
.
number
=
my_strntoul
(
my_charset_latin1
,
attr
,
len
,
0
,(
char
**
)
NULL
,
&
err
);
break
;
break
;
case
_CS_COLNAME
:
case
_CS_COLNAME
:
i
->
cs
.
name
=
mstr
(
i
->
name
,
attr
,
len
,
MY_CS_NAME_SIZE
-
1
);
i
->
cs
.
name
=
mstr
(
i
->
name
,
attr
,
len
,
MY_CS_NAME_SIZE
-
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment