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
6504ac9b
Commit
6504ac9b
authored
Oct 18, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make lower/upper/title work for non-BMP characters.
parent
cd046945
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
24 deletions
+15
-24
Objects/unicodectype.c
Objects/unicodectype.c
+15
-24
No files found.
Objects/unicodectype.c
View file @
6504ac9b
...
@@ -62,18 +62,17 @@ int _PyUnicode_IsLinebreak(Py_UNICODE ch)
...
@@ -62,18 +62,17 @@ int _PyUnicode_IsLinebreak(Py_UNICODE ch)
Py_UNICODE
_PyUnicode_ToTitlecase
(
register
Py_UNICODE
ch
)
Py_UNICODE
_PyUnicode_ToTitlecase
(
register
Py_UNICODE
ch
)
{
{
const
_PyUnicode_TypeRecord
*
ctype
=
gettyperecord
(
ch
);
const
_PyUnicode_TypeRecord
*
ctype
=
gettyperecord
(
ch
);
int
delta
;
if
(
ctype
->
title
)
if
(
ctype
->
title
)
ch
+
=
ctype
->
title
;
delta
=
ctype
->
title
;
else
else
ch
+
=
ctype
->
upper
;
delta
=
ctype
->
upper
;
#ifdef Py_UNICODE_WIDE
if
(
delta
>=
32768
)
/* The database assumes that the values wrap around at 0x10000. */
delta
-=
65536
;
if
(
ch
>
0x10000
)
ch
-=
0x10000
;
return
ch
+
delta
;
#endif
return
ch
;
}
}
/* Returns 1 for Unicode characters having the category 'Lt', 0
/* Returns 1 for Unicode characters having the category 'Lt', 0
...
@@ -358,14 +357,10 @@ int _PyUnicode_IsUppercase(Py_UNICODE ch)
...
@@ -358,14 +357,10 @@ int _PyUnicode_IsUppercase(Py_UNICODE ch)
Py_UNICODE
_PyUnicode_ToUppercase
(
Py_UNICODE
ch
)
Py_UNICODE
_PyUnicode_ToUppercase
(
Py_UNICODE
ch
)
{
{
const
_PyUnicode_TypeRecord
*
ctype
=
gettyperecord
(
ch
);
const
_PyUnicode_TypeRecord
*
ctype
=
gettyperecord
(
ch
);
int
delta
=
ctype
->
upper
;
ch
+=
ctype
->
upper
;
if
(
delta
>=
32768
)
#ifdef Py_UNICODE_WIDE
delta
-=
65536
;
/* The database assumes that the values wrap around at 0x10000. */
return
ch
+
delta
;
if
(
ch
>
0x10000
)
ch
-=
0x10000
;
#endif
return
ch
;
}
}
/* Returns the lowercase Unicode characters corresponding to ch or just
/* Returns the lowercase Unicode characters corresponding to ch or just
...
@@ -374,14 +369,10 @@ Py_UNICODE _PyUnicode_ToUppercase(Py_UNICODE ch)
...
@@ -374,14 +369,10 @@ Py_UNICODE _PyUnicode_ToUppercase(Py_UNICODE ch)
Py_UNICODE
_PyUnicode_ToLowercase
(
Py_UNICODE
ch
)
Py_UNICODE
_PyUnicode_ToLowercase
(
Py_UNICODE
ch
)
{
{
const
_PyUnicode_TypeRecord
*
ctype
=
gettyperecord
(
ch
);
const
_PyUnicode_TypeRecord
*
ctype
=
gettyperecord
(
ch
);
int
delta
=
ctype
->
lower
;
ch
+=
ctype
->
lower
;
if
(
delta
>=
32768
)
#ifdef Py_UNICODE_WIDE
delta
-=
65536
;
/* The database assumes that the values wrap around at 0x10000. */
return
ch
+
delta
;
if
(
ch
>
0x10000
)
ch
-=
0x10000
;
#endif
return
ch
;
}
}
/* Returns 1 for Unicode characters having the category 'Ll', 'Lu', 'Lt',
/* Returns 1 for Unicode characters having the category 'Ll', 'Lu', 'Lt',
...
...
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