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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fbe69e6e
Commit
fbe69e6e
authored
Nov 29, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UCS2 fixes
parent
a640fc95
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
237 additions
and
240 deletions
+237
-240
strings/ctype-utf8.c
strings/ctype-utf8.c
+237
-240
No files found.
strings/ctype-utf8.c
View file @
fbe69e6e
...
@@ -2555,202 +2555,205 @@ long my_strntol_ucs2(CHARSET_INFO *cs,
...
@@ -2555,202 +2555,205 @@ long my_strntol_ucs2(CHARSET_INFO *cs,
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
,
char
**
endptr
,
int
base
)
{
{
int
negative
;
int
negative
=
0
;
register
ulong
cutoff
;
register
unsigned
int
cutlim
;
register
ulong
i
;
register
const
char
*
s
;
register
unsigned
char
c
;
const
char
*
save
,
*
e
;
int
overflow
;
int
overflow
;
int
cnv
;
my_wc_t
wc
;
register
unsigned
int
cutlim
;
register
ulong
cutoff
;
register
ulong
res
;
register
const
char
*
s
=
nptr
;
register
const
char
*
e
=
nptr
+
l
;
const
char
*
save
;
if
(
base
<
0
||
base
==
1
||
base
>
36
)
do
{
base
=
10
;
if
((
cnv
=
cs
->
mb_wc
(
cs
,
&
wc
,
s
,
e
))
>
0
)
s
=
nptr
;
e
=
nptr
+
l
;
for
(
;
s
<
e
&&
my_isspace
(
cs
,
*
s
);
s
++
);
if
(
s
==
e
)
{
{
goto
noconv
;
switch
(
wc
)
}
if
(
*
s
==
'-'
)
{
{
negative
=
1
;
case
' '
:
break
;
++
s
;
case
'\t'
:
break
;
case
'-'
:
negative
=
!
negative
;
break
;
case
'+'
:
break
;
default
:
goto
bs
;
}
}
}
else
if
(
*
s
==
'+'
)
else
/* No more characters or bad multibyte sequence */
{
{
negative
=
0
;
if
(
endptr
!=
NULL
)
++
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
return
0
;
}
}
else
s
+=
cnv
;
negative
=
0
;
}
while
(
1
)
;
if
(
base
==
16
&&
s
[
0
]
==
'0'
&&
my_toupper
(
cs
,
s
[
1
])
==
'X'
)
bs:
s
+=
2
;
if
(
base
==
0
)
if
(
base
<=
0
||
base
==
1
||
base
>
36
)
{
if
(
*
s
==
'0'
)
{
if
(
my_toupper
(
cs
,
s
[
1
])
==
'X'
)
{
s
+=
2
;
base
=
16
;
}
else
base
=
8
;
}
else
base
=
10
;
base
=
10
;
}
overflow
=
0
;
res
=
0
;
save
=
s
;
save
=
s
;
cutoff
=
((
ulong
)
~
0L
)
/
(
unsigned
long
int
)
base
;
cutoff
=
((
ulong
)
~
0L
)
/
(
unsigned
long
int
)
base
;
cutlim
=
(
uint
)
(((
ulong
)
~
0L
)
%
(
unsigned
long
int
)
base
);
cutlim
=
(
uint
)
(((
ulong
)
~
0L
)
%
(
unsigned
long
int
)
base
);
overflow
=
0
;
i
=
0
;
for
(
c
=
*
s
;
s
!=
e
;
c
=
*++
s
)
do
{
if
((
cnv
=
cs
->
mb_wc
(
cs
,
&
wc
,
s
,
e
))
>
0
)
{
{
if
(
my_isdigit
(
cs
,
c
))
s
+=
cnv
;
c
-=
'0'
;
if
(
wc
>=
'0'
&&
wc
<=
'9'
)
else
if
(
my_isalpha
(
cs
,
c
))
wc
-=
'0'
;
c
=
my_toupper
(
cs
,
c
)
-
'A'
+
10
;
else
if
(
wc
>=
'A'
&&
wc
<=
'Z'
)
wc
=
wc
-
'A'
+
10
;
else
if
(
wc
>=
'a'
&&
wc
<=
'z'
)
wc
=
wc
-
'a'
+
10
;
else
else
break
;
break
;
if
(
c
>=
base
)
if
((
int
)
w
c
>=
base
)
break
;
break
;
if
(
i
>
cutoff
||
(
i
==
cutoff
&&
c
>
cutlim
))
if
(
res
>
cutoff
||
(
res
==
cutoff
&&
w
c
>
cutlim
))
overflow
=
1
;
overflow
=
1
;
else
else
{
{
i
*=
(
ulong
)
base
;
res
*=
(
ulong
)
base
;
i
+=
c
;
res
+=
w
c
;
}
}
}
}
else
if
(
cnv
==
MY_CS_ILSEQ
)
if
(
s
==
save
)
{
goto
noconv
;
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
my_errno
=
EILSEQ
;
return
0
;
}
else
{
/* No more characters */
break
;
}
}
while
(
1
);
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
if
(
s
==
save
)
{
my_errno
=
EDOM
;
return
0L
;
}
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
);
my_errno
=
(
ERANGE
);
return
((
ulong
)
~
0L
);
return
((
ulong
)
~
0L
);
}
}
return
(
negative
?
-
((
long
)
i
)
:
(
long
)
i
);
return
(
negative
?
-
((
long
)
res
)
:
(
long
)
res
);
noconv:
my_errno
=
(
EDOM
);
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
}
}
longlong
my_strntoll_ucs2
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
longlong
my_strntoll_ucs2
(
CHARSET_INFO
*
cs
,
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
const
char
*
nptr
,
uint
l
,
char
**
endptr
,
int
base
)
{
{
int
negative
;
int
negative
=
0
;
int
overflow
;
int
cnv
;
my_wc_t
wc
;
register
ulonglong
cutoff
;
register
ulonglong
cutoff
;
register
unsigned
int
cutlim
;
register
unsigned
int
cutlim
;
register
ulonglong
i
;
register
ulonglong
res
;
register
const
char
*
s
,
*
e
;
register
const
char
*
s
=
nptr
;
register
unsigned
char
c
;
register
const
char
*
e
=
nptr
+
l
;
const
char
*
save
;
const
char
*
save
;
int
overflow
;
if
(
base
<
0
||
base
==
1
||
base
>
36
)
base
=
10
;
s
=
nptr
;
e
=
nptr
+
l
;
for
(;
s
<
e
&&
my_isspace
(
cs
,
*
s
);
s
++
);
do
{
if
((
cnv
=
cs
->
mb_wc
(
cs
,
&
wc
,
s
,
e
))
>
0
)
if
(
s
==
e
)
{
{
goto
noconv
;
switch
(
wc
)
}
if
(
*
s
==
'-'
)
{
{
negative
=
1
;
case
' '
:
break
;
++
s
;
case
'\t'
:
break
;
case
'-'
:
negative
=
!
negative
;
break
;
case
'+'
:
break
;
default
:
goto
bs
;
}
}
}
else
if
(
*
s
==
'+'
)
else
/* No more characters or bad multibyte sequence */
{
{
negative
=
0
;
if
(
endptr
!=
NULL
)
++
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
return
0
;
}
}
else
s
+=
cnv
;
negative
=
0
;
}
while
(
1
)
;
if
(
base
==
16
&&
s
[
0
]
==
'0'
&&
my_toupper
(
cs
,
s
[
1
])
==
'X'
)
bs:
s
+=
2
;
if
(
base
==
0
)
if
(
base
<=
0
||
base
==
1
||
base
>
36
)
{
if
(
*
s
==
'0'
)
{
if
(
my_toupper
(
cs
,
s
[
1
])
==
'X'
)
{
s
+=
2
;
base
=
16
;
}
else
base
=
8
;
}
else
base
=
10
;
base
=
10
;
}
overflow
=
0
;
res
=
0
;
save
=
s
;
save
=
s
;
cutoff
=
(
~
(
ulonglong
)
0
)
/
(
unsigned
long
int
)
base
;
cutoff
=
(
~
(
ulonglong
)
0
)
/
(
unsigned
long
int
)
base
;
cutlim
=
(
uint
)
((
~
(
ulonglong
)
0
)
%
(
unsigned
long
int
)
base
);
cutlim
=
(
uint
)
((
~
(
ulonglong
)
0
)
%
(
unsigned
long
int
)
base
);
overflow
=
0
;
do
{
i
=
0
;
if
((
cnv
=
cs
->
mb_wc
(
cs
,
&
wc
,
s
,
e
))
>
0
)
for
(
c
=
*
s
;
s
!=
e
;
c
=
*++
s
)
{
{
if
(
my_isdigit
(
cs
,
c
))
s
+=
cnv
;
c
-=
'0'
;
if
(
wc
>=
'0'
&&
wc
<=
'9'
)
else
if
(
my_isalpha
(
cs
,
c
))
wc
-=
'0'
;
c
=
my_toupper
(
cs
,
c
)
-
'A'
+
10
;
else
if
(
wc
>=
'A'
&&
wc
<=
'Z'
)
wc
=
wc
-
'A'
+
10
;
else
if
(
wc
>=
'a'
&&
wc
<=
'z'
)
wc
=
wc
-
'a'
+
10
;
else
else
break
;
break
;
if
(
c
>=
base
)
if
((
int
)
w
c
>=
base
)
break
;
break
;
if
(
i
>
cutoff
||
(
i
==
cutoff
&&
c
>
cutlim
))
if
(
res
>
cutoff
||
(
res
==
cutoff
&&
w
c
>
cutlim
))
overflow
=
1
;
overflow
=
1
;
else
else
{
{
i
*=
(
ulonglong
)
base
;
res
*=
(
ulonglong
)
base
;
i
+=
c
;
res
+=
w
c
;
}
}
}
}
else
if
(
cnv
==
MY_CS_ILSEQ
)
if
(
s
==
save
)
{
goto
noconv
;
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
my_errno
=
EILSEQ
;
return
0
;
}
else
{
/* No more characters */
break
;
}
}
while
(
1
);
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
if
(
s
==
save
)
{
my_errno
=
EDOM
;
return
0L
;
}
if
(
negative
)
if
(
negative
)
{
{
if
(
i
>
(
ulonglong
)
LONGLONG_MIN
)
if
(
res
>
(
ulonglong
)
LONGLONG_MIN
)
overflow
=
1
;
overflow
=
1
;
}
}
else
if
(
i
>
(
ulonglong
)
LONGLONG_MAX
)
else
if
(
res
>
(
ulonglong
)
LONGLONG_MAX
)
overflow
=
1
;
overflow
=
1
;
if
(
overflow
)
if
(
overflow
)
...
@@ -2759,120 +2762,114 @@ longlong my_strntoll_ucs2(CHARSET_INFO *cs __attribute__((unused)),
...
@@ -2759,120 +2762,114 @@ longlong my_strntoll_ucs2(CHARSET_INFO *cs __attribute__((unused)),
return
negative
?
LONGLONG_MIN
:
LONGLONG_MAX
;
return
negative
?
LONGLONG_MIN
:
LONGLONG_MAX
;
}
}
return
(
negative
?
-
((
longlong
)
i
)
:
(
longlong
)
i
);
return
(
negative
?
-
((
longlong
)
res
)
:
(
longlong
)
res
);
noconv:
my_errno
=
(
EDOM
);
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
}
}
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
,
char
**
endptr
,
int
base
)
{
{
int
negative
;
int
negative
=
0
;
int
overflow
;
int
cnv
;
my_wc_t
wc
;
register
ulonglong
cutoff
;
register
ulonglong
cutoff
;
register
unsigned
int
cutlim
;
register
unsigned
int
cutlim
;
register
ulonglong
i
;
register
ulonglong
res
;
register
const
char
*
s
,
*
e
;
register
const
char
*
s
=
nptr
;
register
unsigned
char
c
;
register
const
char
*
e
=
nptr
+
l
;
const
char
*
save
;
const
char
*
save
;
int
overflow
;
if
(
base
<
0
||
base
==
1
||
base
>
36
)
base
=
10
;
s
=
nptr
;
e
=
nptr
+
l
;
for
(;
s
<
e
&&
my_isspace
(
cs
,
*
s
);
s
++
);
do
{
if
((
cnv
=
cs
->
mb_wc
(
cs
,
&
wc
,
s
,
e
))
>
0
)
if
(
s
==
e
)
{
{
goto
noconv
;
switch
(
wc
)
}
if
(
*
s
==
'-'
)
{
{
negative
=
1
;
case
' '
:
break
;
++
s
;
case
'\t'
:
break
;
case
'-'
:
negative
=
!
negative
;
break
;
case
'+'
:
break
;
default
:
goto
bs
;
}
}
else
if
(
*
s
==
'+'
)
}
else
/* No more characters or bad multibyte sequence */
{
{
negative
=
0
;
if
(
endptr
!=
NULL
)
++
s
;
*
endptr
=
(
char
*
)
s
;
my_errno
=
(
cnv
==
MY_CS_ILSEQ
)
?
EILSEQ
:
EDOM
;
return
0
;
}
}
else
s
+=
cnv
;
negative
=
0
;
}
while
(
1
)
;
if
(
base
==
16
&&
s
[
0
]
==
'0'
&&
my_toupper
(
cs
,
s
[
1
])
==
'X'
)
bs:
s
+=
2
;
if
(
base
==
0
)
if
(
base
<=
0
||
base
==
1
||
base
>
36
)
{
if
(
*
s
==
'0'
)
{
if
(
my_toupper
(
cs
,
s
[
1
])
==
'X'
)
{
s
+=
2
;
base
=
16
;
}
else
base
=
8
;
}
else
base
=
10
;
base
=
10
;
}
overflow
=
0
;
res
=
0
;
save
=
s
;
save
=
s
;
cutoff
=
(
~
(
ulonglong
)
0
)
/
(
unsigned
long
int
)
base
;
cutoff
=
(
~
(
ulonglong
)
0
)
/
(
unsigned
long
int
)
base
;
cutlim
=
(
uint
)
((
~
(
ulonglong
)
0
)
%
(
unsigned
long
int
)
base
);
cutlim
=
(
uint
)
((
~
(
ulonglong
)
0
)
%
(
unsigned
long
int
)
base
);
overflow
=
0
;
do
{
i
=
0
;
if
((
cnv
=
cs
->
mb_wc
(
cs
,
&
wc
,
s
,
e
))
>
0
)
for
(
c
=
*
s
;
s
!=
e
;
c
=
*++
s
)
{
{
if
(
my_isdigit
(
cs
,
c
))
s
+=
cnv
;
c
-=
'0'
;
if
(
wc
>=
'0'
&&
wc
<=
'9'
)
else
if
(
my_isalpha
(
cs
,
c
))
wc
-=
'0'
;
c
=
my_toupper
(
cs
,
c
)
-
'A'
+
10
;
else
if
(
wc
>=
'A'
&&
wc
<=
'Z'
)
wc
=
wc
-
'A'
+
10
;
else
if
(
wc
>=
'a'
&&
wc
<=
'z'
)
wc
=
wc
-
'a'
+
10
;
else
else
break
;
break
;
if
(
c
>=
base
)
if
((
int
)
w
c
>=
base
)
break
;
break
;
if
(
i
>
cutoff
||
(
i
==
cutoff
&&
c
>
cutlim
))
if
(
res
>
cutoff
||
(
res
==
cutoff
&&
w
c
>
cutlim
))
overflow
=
1
;
overflow
=
1
;
else
else
{
{
i
*=
(
ulonglong
)
base
;
res
*=
(
ulonglong
)
base
;
i
+=
c
;
res
+=
w
c
;
}
}
}
}
else
if
(
cnv
==
MY_CS_ILSEQ
)
if
(
s
==
save
)
{
goto
noconv
;
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
my_errno
=
EILSEQ
;
return
0
;
}
else
{
/* No more characters */
break
;
}
}
while
(
1
);
if
(
endptr
!=
NULL
)
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
s
;
*
endptr
=
(
char
*
)
s
;
if
(
s
==
save
)
{
my_errno
=
EDOM
;
return
0L
;
}
if
(
overflow
)
if
(
overflow
)
{
{
my_errno
=
(
ERANGE
);
my_errno
=
(
ERANGE
);
return
(
~
(
ulonglong
)
0
);
return
(
~
(
ulonglong
)
0
);
}
}
return
(
negative
?
-
((
longlong
)
i
)
:
(
longlong
)
i
);
return
(
negative
?
-
((
longlong
)
res
)
:
(
longlong
)
res
);
noconv:
my_errno
=
(
EDOM
);
if
(
endptr
!=
NULL
)
*
endptr
=
(
char
*
)
nptr
;
return
0L
;
}
}
double
my_strntod_ucs2
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
double
my_strntod_ucs2
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
const
char
*
nptr
,
uint
l
,
char
**
endptr
)
const
char
*
nptr
,
uint
l
,
char
**
endptr
)
{
{
...
...
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