Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a3d874fe
Commit
a3d874fe
authored
Nov 23, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Verify that the code in CJK UNIFIED IDEOGRAPH- actually denotes an ideograph.
parent
f504c248
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
Modules/unicodedata.c
Modules/unicodedata.c
+12
-3
No files found.
Modules/unicodedata.c
View file @
a3d874fe
...
...
@@ -580,6 +580,15 @@ static char *hangul_syllables[][3] = {
{
0
,
0
,
"H"
}
};
static
int
is_unified_ideograph
(
Py_UCS4
code
)
{
return
(
(
0x3400
<=
code
&&
code
<=
0x4DB5
)
||
/* CJK Ideograph Extension A */
(
0x4E00
<=
code
&&
code
<=
0x9FA5
)
||
/* CJK Ideograph */
(
0x20000
<=
code
&&
code
<=
0x2A6D6
));
/* CJK Ideograph Extension B */
}
static
int
_getucname
(
Py_UCS4
code
,
char
*
buffer
,
int
buflen
)
{
...
...
@@ -610,9 +619,7 @@ _getucname(Py_UCS4 code, char* buffer, int buflen)
return
1
;
}
if
((
0x3400
<=
code
&&
code
<=
0x4DB5
)
||
/* CJK Ideograph Extension A */
(
0x4E00
<=
code
&&
code
<=
0x9FA5
)
||
/* CJK Ideograph */
(
0x20000
<=
code
&&
code
<=
0x2A6D6
))
{
/* CJK Ideograph Extension B */
if
(
is_unified_ideograph
(
code
))
{
if
(
buflen
<
28
)
/* Worst case: CJK UNIFIED IDEOGRAPH-20000 */
return
0
;
...
...
@@ -743,6 +750,8 @@ _getcode(const char* name, int namelen, Py_UCS4* code)
return
0
;
name
++
;
}
if
(
!
is_unified_ideograph
(
v
))
return
0
;
*
code
=
v
;
return
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