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
4f62ac93
Commit
4f62ac93
authored
Jan 31, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More use of new CHARSET_INFO functions and two bug fixes
parent
24be8669
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
42 deletions
+7
-42
sql/sql_string.cc
sql/sql_string.cc
+3
-36
strings/ctype-mb.c
strings/ctype-mb.c
+3
-5
strings/ctype-utf8.c
strings/ctype-utf8.c
+1
-1
No files found.
sql/sql_string.cc
View file @
4f62ac93
...
...
@@ -363,46 +363,13 @@ bool String::append(IO_CACHE* file, uint32 arg_length)
uint32
String
::
numchars
()
{
#ifdef USE_MB
register
uint32
n
=
0
,
mblen
;
register
const
char
*
mbstr
=
Ptr
;
register
const
char
*
end
=
mbstr
+
str_length
;
if
(
use_mb
(
str_charset
))
{
while
(
mbstr
<
end
)
{
if
((
mblen
=
my_ismbchar
(
str_charset
,
mbstr
,
end
)))
mbstr
+=
mblen
;
else
++
mbstr
;
++
n
;
}
return
n
;
}
else
#endif
return
str_length
;
return
str_charset
->
numchars
(
str_charset
,
Ptr
,
Ptr
+
str_length
);
}
int
String
::
charpos
(
int
i
,
uint32
offset
)
{
#ifdef USE_MB
register
uint32
mblen
;
register
const
char
*
mbstr
=
Ptr
+
offset
;
register
const
char
*
end
=
Ptr
+
str_length
;
if
(
use_mb
(
str_charset
))
{
if
(
i
<=
0
)
return
i
;
while
(
i
&&
mbstr
<
end
)
{
if
((
mblen
=
my_ismbchar
(
str_charset
,
mbstr
,
end
)))
mbstr
+=
mblen
;
else
++
mbstr
;
--
i
;
}
if
(
INT_MAX32
-
i
<=
(
int
)
(
mbstr
-
Ptr
-
offset
))
return
INT_MAX32
;
else
return
(
int
)
((
mbstr
-
Ptr
-
offset
)
+
i
);
}
else
#endif
return
i
;
if
(
i
<
0
)
return
i
;
return
str_charset
->
charpos
(
str_charset
,
Ptr
+
offset
,
Ptr
+
str_length
,
i
);
}
int
String
::
strstr
(
const
String
&
s
,
uint32
offset
)
...
...
strings/ctype-mb.c
View file @
4f62ac93
...
...
@@ -289,12 +289,10 @@ uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)),
}
uint
my_charpos_mb
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
const
char
*
b
__attribute__
((
unused
)),
const
char
*
e
__attribute__
((
unused
)),
uint
pos
)
const
char
*
b
,
const
char
*
e
,
uint
pos
)
{
uint
res
=
0
,
mblen
;
const
char
*
b0
;
uint
mblen
;
const
char
*
b0
=
b
;
while
(
pos
&&
b
<
e
)
{
...
...
strings/ctype-utf8.c
View file @
4f62ac93
...
...
@@ -3079,7 +3079,7 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const
char
*
e
__attribute__
((
unused
)),
uint
pos
)
{
return
pos
/
2
;
return
pos
*
2
;
}
CHARSET_INFO
my_charset_ucs2
=
...
...
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